google_redis1/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 CloudRedis 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_redis1 as redis1;
49/// use redis1::api::Cluster;
50/// use redis1::{Result, Error};
51/// # async fn dox() {
52/// use redis1::{CloudRedis, 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 = CloudRedis::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 = Cluster::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_clusters_create(req, "parent")
99/// .request_id("sed")
100/// .cluster_id("amet.")
101/// .doit().await;
102///
103/// match result {
104/// Err(e) => match e {
105/// // The Error enum provides details about what exactly happened.
106/// // You can also just use its `Debug`, `Display` or `Error` traits
107/// Error::HttpError(_)
108/// |Error::Io(_)
109/// |Error::MissingAPIKey
110/// |Error::MissingToken(_)
111/// |Error::Cancelled
112/// |Error::UploadSizeLimitExceeded(_, _)
113/// |Error::Failure(_)
114/// |Error::BadRequest(_)
115/// |Error::FieldClash(_)
116/// |Error::JsonDecodeError(_, _) => println!("{}", e),
117/// },
118/// Ok(res) => println!("Success: {:?}", res),
119/// }
120/// # }
121/// ```
122#[derive(Clone)]
123pub struct CloudRedis<C> {
124 pub client: common::Client<C>,
125 pub auth: Box<dyn common::GetToken>,
126 _user_agent: String,
127 _base_url: String,
128 _root_url: String,
129}
130
131impl<C> common::Hub for CloudRedis<C> {}
132
133impl<'a, C> CloudRedis<C> {
134 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> CloudRedis<C> {
135 CloudRedis {
136 client,
137 auth: Box::new(auth),
138 _user_agent: "google-api-rust-client/7.0.0".to_string(),
139 _base_url: "https://redis.googleapis.com/".to_string(),
140 _root_url: "https://redis.googleapis.com/".to_string(),
141 }
142 }
143
144 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
145 ProjectMethods { hub: self }
146 }
147
148 /// Set the user-agent header field to use in all requests to the server.
149 /// It defaults to `google-api-rust-client/7.0.0`.
150 ///
151 /// Returns the previously set user-agent.
152 pub fn user_agent(&mut self, agent_name: String) -> String {
153 std::mem::replace(&mut self._user_agent, agent_name)
154 }
155
156 /// Set the base url to use in all requests to the server.
157 /// It defaults to `https://redis.googleapis.com/`.
158 ///
159 /// Returns the previously set base url.
160 pub fn base_url(&mut self, new_base_url: String) -> String {
161 std::mem::replace(&mut self._base_url, new_base_url)
162 }
163
164 /// Set the root url to use in all requests to the server.
165 /// It defaults to `https://redis.googleapis.com/`.
166 ///
167 /// Returns the previously set root url.
168 pub fn root_url(&mut self, new_root_url: String) -> String {
169 std::mem::replace(&mut self._root_url, new_root_url)
170 }
171}
172
173// ############
174// SCHEMAS ###
175// ##########
176/// Configuration of the AOF based persistence.
177///
178/// This type is not used in any activity, and only used as *part* of another schema.
179///
180#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
181#[serde_with::serde_as]
182#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
183pub struct AOFConfig {
184 /// Optional. fsync configuration.
185 #[serde(rename = "appendFsync")]
186 pub append_fsync: Option<String>,
187}
188
189impl common::Part for AOFConfig {}
190
191/// The automated backup config for a cluster.
192///
193/// This type is not used in any activity, and only used as *part* of another schema.
194///
195#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
196#[serde_with::serde_as]
197#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
198pub struct AutomatedBackupConfig {
199 /// Optional. The automated backup mode. If the mode is disabled, the other fields will be ignored.
200 #[serde(rename = "automatedBackupMode")]
201 pub automated_backup_mode: Option<String>,
202 /// Optional. Trigger automated backups at a fixed frequency.
203 #[serde(rename = "fixedFrequencySchedule")]
204 pub fixed_frequency_schedule: Option<FixedFrequencySchedule>,
205 /// Optional. How long to keep automated backups before the backups are deleted. The value should be between 1 day and 365 days. If not specified, the default value is 35 days.
206 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
207 pub retention: Option<chrono::Duration>,
208}
209
210impl common::Part for AutomatedBackupConfig {}
211
212/// Backup of a cluster.
213///
214/// # Activities
215///
216/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
217/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
218///
219/// * [locations backup collections backups get projects](ProjectLocationBackupCollectionBackupGetCall) (response)
220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
221#[serde_with::serde_as]
222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
223pub struct Backup {
224 /// Output only. List of backup files of the backup.
225 #[serde(rename = "backupFiles")]
226 pub backup_files: Option<Vec<BackupFile>>,
227 /// Output only. Type of the backup.
228 #[serde(rename = "backupType")]
229 pub backup_type: Option<String>,
230 /// Output only. Cluster resource path of this backup.
231 pub cluster: Option<String>,
232 /// Output only. Cluster uid of this backup.
233 #[serde(rename = "clusterUid")]
234 pub cluster_uid: Option<String>,
235 /// Output only. The time when the backup was created.
236 #[serde(rename = "createTime")]
237 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
238 /// Output only. Encryption information of the backup.
239 #[serde(rename = "encryptionInfo")]
240 pub encryption_info: Option<EncryptionInfo>,
241 /// Output only. redis-7.2, valkey-7.5
242 #[serde(rename = "engineVersion")]
243 pub engine_version: Option<String>,
244 /// Output only. The time when the backup will expire.
245 #[serde(rename = "expireTime")]
246 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
247 /// Identifier. Full resource path of the backup. the last part of the name is the backup id with the following format: [YYYYMMDDHHMMSS]_[Shorted Cluster UID] OR customer specified while backup cluster. Example: 20240515123000_1234
248 pub name: Option<String>,
249 /// Output only. Node type of the cluster.
250 #[serde(rename = "nodeType")]
251 pub node_type: Option<String>,
252 /// Output only. Number of replicas for the cluster.
253 #[serde(rename = "replicaCount")]
254 pub replica_count: Option<i32>,
255 /// Output only. Number of shards for the cluster.
256 #[serde(rename = "shardCount")]
257 pub shard_count: Option<i32>,
258 /// Output only. State of the backup.
259 pub state: Option<String>,
260 /// Output only. Total size of the backup in bytes.
261 #[serde(rename = "totalSizeBytes")]
262 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
263 pub total_size_bytes: Option<i64>,
264 /// Output only. System assigned unique identifier of the backup.
265 pub uid: Option<String>,
266}
267
268impl common::ResponseResult for Backup {}
269
270/// Request for \[BackupCluster\].
271///
272/// # Activities
273///
274/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
275/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
276///
277/// * [locations clusters backup projects](ProjectLocationClusterBackupCall) (request)
278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
279#[serde_with::serde_as]
280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
281pub struct BackupClusterRequest {
282 /// Optional. The id of the backup to be created. If not specified, the default value ([YYYYMMDDHHMMSS]_[Shortened Cluster UID] is used.
283 #[serde(rename = "backupId")]
284 pub backup_id: Option<String>,
285 /// Optional. TTL for the backup to expire. Value range is 1 day to 100 years. If not specified, the default value is 100 years.
286 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
287 pub ttl: Option<chrono::Duration>,
288}
289
290impl common::RequestValue for BackupClusterRequest {}
291
292/// BackupCollection of a cluster.
293///
294/// # Activities
295///
296/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
297/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
298///
299/// * [locations backup collections get projects](ProjectLocationBackupCollectionGetCall) (response)
300#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
301#[serde_with::serde_as]
302#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
303pub struct BackupCollection {
304 /// Output only. The full resource path of the cluster the backup collection belongs to. Example: projects/{project}/locations/{location}/clusters/{cluster}
305 pub cluster: Option<String>,
306 /// Output only. The cluster uid of the backup collection.
307 #[serde(rename = "clusterUid")]
308 pub cluster_uid: Option<String>,
309 /// Output only. The time when the backup collection was created.
310 #[serde(rename = "createTime")]
311 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
312 /// Output only. The KMS key used to encrypt the backups under this backup collection.
313 #[serde(rename = "kmsKey")]
314 pub kms_key: Option<String>,
315 /// Output only. The last time a backup was created in the backup collection.
316 #[serde(rename = "lastBackupTime")]
317 pub last_backup_time: Option<chrono::DateTime<chrono::offset::Utc>>,
318 /// Identifier. Full resource path of the backup collection.
319 pub name: Option<String>,
320 /// Output only. Total number of backups in the backup collection.
321 #[serde(rename = "totalBackupCount")]
322 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
323 pub total_backup_count: Option<i64>,
324 /// Output only. Total size of all backups in the backup collection.
325 #[serde(rename = "totalBackupSizeBytes")]
326 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
327 pub total_backup_size_bytes: Option<i64>,
328 /// Output only. System assigned unique identifier of the backup collection.
329 pub uid: Option<String>,
330}
331
332impl common::ResponseResult for BackupCollection {}
333
334/// Backup is consisted of multiple backup files.
335///
336/// This type is not used in any activity, and only used as *part* of another schema.
337///
338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
339#[serde_with::serde_as]
340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
341pub struct BackupFile {
342 /// Output only. The time when the backup file was created.
343 #[serde(rename = "createTime")]
344 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
345 /// Output only. e.g: .rdb
346 #[serde(rename = "fileName")]
347 pub file_name: Option<String>,
348 /// Output only. Size of the backup file in bytes.
349 #[serde(rename = "sizeBytes")]
350 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
351 pub size_bytes: Option<i64>,
352}
353
354impl common::Part for BackupFile {}
355
356/// There is no detailed description.
357///
358/// This type is not used in any activity, and only used as *part* of another schema.
359///
360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
361#[serde_with::serde_as]
362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
363pub struct CertChain {
364 /// The certificates that form the CA chain, from leaf to root order.
365 pub certificates: Option<Vec<String>>,
366}
367
368impl common::Part for CertChain {}
369
370/// Redis cluster certificate authority
371///
372/// # Activities
373///
374/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
375/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
376///
377/// * [locations clusters get certificate authority projects](ProjectLocationClusterGetCertificateAuthorityCall) (response)
378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
379#[serde_with::serde_as]
380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
381pub struct CertificateAuthority {
382 /// no description provided
383 #[serde(rename = "managedServerCa")]
384 pub managed_server_ca: Option<ManagedCertificateAuthority>,
385 /// Identifier. Unique name of the resource in this scope including project, location and cluster using the form: `projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority`
386 pub name: Option<String>,
387}
388
389impl common::ResponseResult for CertificateAuthority {}
390
391/// A cluster instance.
392///
393/// # Activities
394///
395/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
396/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
397///
398/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (request)
399/// * [locations clusters get projects](ProjectLocationClusterGetCall) (response)
400/// * [locations clusters patch projects](ProjectLocationClusterPatchCall) (request)
401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
402#[serde_with::serde_as]
403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
404pub struct Cluster {
405 /// Optional. Immutable. Deprecated, do not use.
406 #[serde(rename = "allowFewerZonesDeployment")]
407 pub allow_fewer_zones_deployment: Option<bool>,
408 /// Optional. If true, cluster endpoints that are created and registered by customers can be deleted asynchronously. That is, such a cluster endpoint can be de-registered before the forwarding rules in the cluster endpoint are deleted.
409 #[serde(rename = "asyncClusterEndpointsDeletionEnabled")]
410 pub async_cluster_endpoints_deletion_enabled: Option<bool>,
411 /// Optional. The authorization mode of the Redis cluster. If not provided, auth feature is disabled for the cluster.
412 #[serde(rename = "authorizationMode")]
413 pub authorization_mode: Option<String>,
414 /// Optional. The automated backup config for the cluster.
415 #[serde(rename = "automatedBackupConfig")]
416 pub automated_backup_config: Option<AutomatedBackupConfig>,
417 /// Output only. This field is used to determine the available maintenance versions for the self service update.
418 #[serde(rename = "availableMaintenanceVersions")]
419 pub available_maintenance_versions: Option<Vec<String>>,
420 /// Optional. Output only. The backup collection full resource name. Example: projects/{project}/locations/{location}/backupCollections/{collection}
421 #[serde(rename = "backupCollection")]
422 pub backup_collection: Option<String>,
423 /// Optional. A list of cluster endpoints.
424 #[serde(rename = "clusterEndpoints")]
425 pub cluster_endpoints: Option<Vec<ClusterEndpoint>>,
426 /// Output only. The timestamp associated with the cluster creation request.
427 #[serde(rename = "createTime")]
428 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
429 /// Optional. Cross cluster replication config.
430 #[serde(rename = "crossClusterReplicationConfig")]
431 pub cross_cluster_replication_config: Option<CrossClusterReplicationConfig>,
432 /// Optional. The delete operation will fail when the value is set to true.
433 #[serde(rename = "deletionProtectionEnabled")]
434 pub deletion_protection_enabled: Option<bool>,
435 /// Output only. Endpoints created on each given network, for Redis clients to connect to the cluster. Currently only one discovery endpoint is supported.
436 #[serde(rename = "discoveryEndpoints")]
437 pub discovery_endpoints: Option<Vec<DiscoveryEndpoint>>,
438 /// Output only. This field represents the actual maintenance version of the cluster.
439 #[serde(rename = "effectiveMaintenanceVersion")]
440 pub effective_maintenance_version: Option<String>,
441 /// Output only. Encryption information of the data at rest of the cluster.
442 #[serde(rename = "encryptionInfo")]
443 pub encryption_info: Option<EncryptionInfo>,
444 /// Optional. Backups stored in Cloud Storage buckets. The Cloud Storage buckets need to be the same region as the clusters. Read permission is required to import from the provided Cloud Storage objects.
445 #[serde(rename = "gcsSource")]
446 pub gcs_source: Option<GcsBackupSource>,
447 /// Optional. The KMS key used to encrypt the at-rest data of the cluster.
448 #[serde(rename = "kmsKey")]
449 pub kms_key: Option<String>,
450 /// Optional. Labels to represent user-provided metadata.
451 pub labels: Option<HashMap<String, String>>,
452 /// Optional. ClusterMaintenancePolicy determines when to allow or deny updates.
453 #[serde(rename = "maintenancePolicy")]
454 pub maintenance_policy: Option<ClusterMaintenancePolicy>,
455 /// Output only. ClusterMaintenanceSchedule Output only Published maintenance schedule.
456 #[serde(rename = "maintenanceSchedule")]
457 pub maintenance_schedule: Option<ClusterMaintenanceSchedule>,
458 /// Optional. This field can be used to trigger self service update to indicate the desired maintenance version. The input to this field can be determined by the available_maintenance_versions field.
459 #[serde(rename = "maintenanceVersion")]
460 pub maintenance_version: Option<String>,
461 /// Optional. Backups generated and managed by memorystore service.
462 #[serde(rename = "managedBackupSource")]
463 pub managed_backup_source: Option<ManagedBackupSource>,
464 /// Required. Identifier. Unique name of the resource in this scope including project and location using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
465 pub name: Option<String>,
466 /// Optional. The type of a redis node in the cluster. NodeType determines the underlying machine-type of a redis node.
467 #[serde(rename = "nodeType")]
468 pub node_type: Option<String>,
469 /// Optional. Input only. Ondemand maintenance for the cluster. This field can be used to trigger ondemand critical update on the cluster.
470 #[serde(rename = "ondemandMaintenance")]
471 pub ondemand_maintenance: Option<bool>,
472 /// Optional. Persistence config (RDB, AOF) for the cluster.
473 #[serde(rename = "persistenceConfig")]
474 pub persistence_config: Option<ClusterPersistenceConfig>,
475 /// Output only. Precise value of redis memory size in GB for the entire cluster.
476 #[serde(rename = "preciseSizeGb")]
477 pub precise_size_gb: Option<f64>,
478 /// Optional. Each PscConfig configures the consumer network where IPs will be designated to the cluster for client access through Private Service Connect Automation. Currently, only one PscConfig is supported.
479 #[serde(rename = "pscConfigs")]
480 pub psc_configs: Option<Vec<PscConfig>>,
481 /// Output only. The list of PSC connections that are auto-created through service connectivity automation.
482 #[serde(rename = "pscConnections")]
483 pub psc_connections: Option<Vec<PscConnection>>,
484 /// Output only. Service attachment details to configure Psc connections
485 #[serde(rename = "pscServiceAttachments")]
486 pub psc_service_attachments: Option<Vec<PscServiceAttachment>>,
487 /// Optional. Key/Value pairs of customer overrides for mutable Redis Configs
488 #[serde(rename = "redisConfigs")]
489 pub redis_configs: Option<HashMap<String, String>>,
490 /// Optional. The number of replica nodes per shard.
491 #[serde(rename = "replicaCount")]
492 pub replica_count: Option<i32>,
493 /// Optional. Output only. Reserved for future use.
494 #[serde(rename = "satisfiesPzi")]
495 pub satisfies_pzi: Option<bool>,
496 /// Optional. Output only. Reserved for future use.
497 #[serde(rename = "satisfiesPzs")]
498 pub satisfies_pzs: Option<bool>,
499 /// Optional. Number of shards for the Redis cluster.
500 #[serde(rename = "shardCount")]
501 pub shard_count: Option<i32>,
502 /// Optional. Input only. Simulate a maintenance event.
503 #[serde(rename = "simulateMaintenanceEvent")]
504 pub simulate_maintenance_event: Option<bool>,
505 /// Output only. Redis memory size in GB for the entire cluster rounded up to the next integer.
506 #[serde(rename = "sizeGb")]
507 pub size_gb: Option<i32>,
508 /// Output only. The current state of this cluster. Can be CREATING, READY, UPDATING, DELETING and SUSPENDED
509 pub state: Option<String>,
510 /// Output only. Additional information about the current state of the cluster.
511 #[serde(rename = "stateInfo")]
512 pub state_info: Option<StateInfo>,
513 /// Optional. The in-transit encryption for the Redis cluster. If not provided, encryption is disabled for the cluster.
514 #[serde(rename = "transitEncryptionMode")]
515 pub transit_encryption_mode: Option<String>,
516 /// Output only. System assigned, unique identifier for the cluster.
517 pub uid: Option<String>,
518 /// Optional. This config will be used to determine how the customer wants us to distribute cluster resources within the region.
519 #[serde(rename = "zoneDistributionConfig")]
520 pub zone_distribution_config: Option<ZoneDistributionConfig>,
521}
522
523impl common::RequestValue for Cluster {}
524impl common::ResponseResult for Cluster {}
525
526/// ClusterEndpoint consists of PSC connections that are created as a group in each VPC network for accessing the cluster. In each group, there shall be one connection for each service attachment in the cluster.
527///
528/// This type is not used in any activity, and only used as *part* of another schema.
529///
530#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
531#[serde_with::serde_as]
532#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
533pub struct ClusterEndpoint {
534 /// Required. A group of PSC connections. They are created in the same VPC network, one for each service attachment in the cluster.
535 pub connections: Option<Vec<ConnectionDetail>>,
536}
537
538impl common::Part for ClusterEndpoint {}
539
540/// Maintenance policy per cluster.
541///
542/// This type is not used in any activity, and only used as *part* of another schema.
543///
544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
545#[serde_with::serde_as]
546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
547pub struct ClusterMaintenancePolicy {
548 /// Output only. The time when the policy was created i.e. Maintenance Window or Deny Period was assigned.
549 #[serde(rename = "createTime")]
550 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
551 /// Output only. The time when the policy was updated i.e. Maintenance Window or Deny Period was updated.
552 #[serde(rename = "updateTime")]
553 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
554 /// Optional. Maintenance window that is applied to resources covered by this policy. Minimum 1. For the current version, the maximum number of weekly_maintenance_window is expected to be one.
555 #[serde(rename = "weeklyMaintenanceWindow")]
556 pub weekly_maintenance_window: Option<Vec<ClusterWeeklyMaintenanceWindow>>,
557}
558
559impl common::Part for ClusterMaintenancePolicy {}
560
561/// Upcoming maintenance schedule.
562///
563/// This type is not used in any activity, and only used as *part* of another schema.
564///
565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
566#[serde_with::serde_as]
567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
568pub struct ClusterMaintenanceSchedule {
569 /// Output only. The end time of any upcoming scheduled maintenance for this instance.
570 #[serde(rename = "endTime")]
571 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
572 /// Output only. The start time of any upcoming scheduled maintenance for this instance.
573 #[serde(rename = "startTime")]
574 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
575}
576
577impl common::Part for ClusterMaintenanceSchedule {}
578
579/// Configuration of the persistence functionality.
580///
581/// This type is not used in any activity, and only used as *part* of another schema.
582///
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct ClusterPersistenceConfig {
587 /// Optional. AOF configuration. This field will be ignored if mode is not AOF.
588 #[serde(rename = "aofConfig")]
589 pub aof_config: Option<AOFConfig>,
590 /// Optional. The mode of persistence.
591 pub mode: Option<String>,
592 /// Optional. RDB configuration. This field will be ignored if mode is not RDB.
593 #[serde(rename = "rdbConfig")]
594 pub rdb_config: Option<RDBConfig>,
595}
596
597impl common::Part for ClusterPersistenceConfig {}
598
599/// Time window specified for weekly operations.
600///
601/// This type is not used in any activity, and only used as *part* of another schema.
602///
603#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
604#[serde_with::serde_as]
605#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
606pub struct ClusterWeeklyMaintenanceWindow {
607 /// Optional. Allows to define schedule that runs specified day of the week.
608 pub day: Option<String>,
609 /// Optional. Start time of the window in UTC.
610 #[serde(rename = "startTime")]
611 pub start_time: Option<TimeOfDay>,
612}
613
614impl common::Part for ClusterWeeklyMaintenanceWindow {}
615
616/// Detailed information of each PSC connection.
617///
618/// This type is not used in any activity, and only used as *part* of another schema.
619///
620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
621#[serde_with::serde_as]
622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
623pub struct ConnectionDetail {
624 /// Detailed information of a PSC connection that is created through service connectivity automation.
625 #[serde(rename = "pscAutoConnection")]
626 pub psc_auto_connection: Option<PscAutoConnection>,
627 /// Detailed information of a PSC connection that is created by the customer who owns the cluster.
628 #[serde(rename = "pscConnection")]
629 pub psc_connection: Option<PscConnection>,
630}
631
632impl common::Part for ConnectionDetail {}
633
634/// Cross cluster replication config.
635///
636/// This type is not used in any activity, and only used as *part* of another schema.
637///
638#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
639#[serde_with::serde_as]
640#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
641pub struct CrossClusterReplicationConfig {
642 /// Output only. The role of the cluster in cross cluster replication.
643 #[serde(rename = "clusterRole")]
644 pub cluster_role: Option<String>,
645 /// Output only. An output only view of all the member clusters participating in the cross cluster replication. This view will be provided by every member cluster irrespective of its cluster role(primary or secondary). A primary cluster can provide information about all the secondary clusters replicating from it. However, a secondary cluster only knows about the primary cluster from which it is replicating. However, for scenarios, where the primary cluster is unavailable(e.g. regional outage), a GetCluster request can be sent to any other member cluster and this field will list all the member clusters participating in cross cluster replication.
646 pub membership: Option<Membership>,
647 /// Details of the primary cluster that is used as the replication source for this secondary cluster. This field is only set for a secondary cluster.
648 #[serde(rename = "primaryCluster")]
649 pub primary_cluster: Option<RemoteCluster>,
650 /// List of secondary clusters that are replicating from this primary cluster. This field is only set for a primary cluster.
651 #[serde(rename = "secondaryClusters")]
652 pub secondary_clusters: Option<Vec<RemoteCluster>>,
653 /// Output only. The last time cross cluster replication config was updated.
654 #[serde(rename = "updateTime")]
655 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
656}
657
658impl common::Part for CrossClusterReplicationConfig {}
659
660/// Endpoints on each network, for Redis clients to connect to the cluster.
661///
662/// This type is not used in any activity, and only used as *part* of another schema.
663///
664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
665#[serde_with::serde_as]
666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
667pub struct DiscoveryEndpoint {
668 /// Output only. Address of the exposed Redis endpoint used by clients to connect to the service. The address could be either IP or hostname.
669 pub address: Option<String>,
670 /// Output only. The port number of the exposed Redis endpoint.
671 pub port: Option<i32>,
672 /// Output only. Customer configuration for where the endpoint is created and accessed from.
673 #[serde(rename = "pscConfig")]
674 pub psc_config: Option<PscConfig>,
675}
676
677impl common::Part for DiscoveryEndpoint {}
678
679/// 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); }
680///
681/// # Activities
682///
683/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
684/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
685///
686/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
687/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
688#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
689#[serde_with::serde_as]
690#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
691pub struct Empty {
692 _never_set: Option<bool>,
693}
694
695impl common::ResponseResult for Empty {}
696
697/// EncryptionInfo describes the encryption information of a cluster or a backup.
698///
699/// This type is not used in any activity, and only used as *part* of another schema.
700///
701#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
702#[serde_with::serde_as]
703#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
704pub struct EncryptionInfo {
705 /// Output only. Type of encryption.
706 #[serde(rename = "encryptionType")]
707 pub encryption_type: Option<String>,
708 /// Output only. The state of the primary version of the KMS key perceived by the system. This field is not populated in backups.
709 #[serde(rename = "kmsKeyPrimaryState")]
710 pub kms_key_primary_state: Option<String>,
711 /// Output only. KMS key versions that are being used to protect the data at-rest.
712 #[serde(rename = "kmsKeyVersions")]
713 pub kms_key_versions: Option<Vec<String>>,
714 /// Output only. The most recent time when the encryption info was updated.
715 #[serde(rename = "lastUpdateTime")]
716 pub last_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
717}
718
719impl common::Part for EncryptionInfo {}
720
721/// Request for \[ExportBackup\].
722///
723/// # Activities
724///
725/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
726/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
727///
728/// * [locations backup collections backups export projects](ProjectLocationBackupCollectionBackupExportCall) (request)
729#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
730#[serde_with::serde_as]
731#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
732pub struct ExportBackupRequest {
733 /// Google Cloud Storage bucket, like "my-bucket".
734 #[serde(rename = "gcsBucket")]
735 pub gcs_bucket: Option<String>,
736}
737
738impl common::RequestValue for ExportBackupRequest {}
739
740/// Request for Export.
741///
742/// # Activities
743///
744/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
745/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
746///
747/// * [locations instances export projects](ProjectLocationInstanceExportCall) (request)
748#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
749#[serde_with::serde_as]
750#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
751pub struct ExportInstanceRequest {
752 /// Required. Specify data to be exported.
753 #[serde(rename = "outputConfig")]
754 pub output_config: Option<OutputConfig>,
755}
756
757impl common::RequestValue for ExportInstanceRequest {}
758
759/// Request for Failover.
760///
761/// # Activities
762///
763/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
764/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
765///
766/// * [locations instances failover projects](ProjectLocationInstanceFailoverCall) (request)
767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
768#[serde_with::serde_as]
769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
770pub struct FailoverInstanceRequest {
771 /// Optional. Available data protection modes that the user can choose. If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
772 #[serde(rename = "dataProtectionMode")]
773 pub data_protection_mode: Option<String>,
774}
775
776impl common::RequestValue for FailoverInstanceRequest {}
777
778/// This schedule allows the backup to be triggered at a fixed frequency (currently only daily is supported).
779///
780/// This type is not used in any activity, and only used as *part* of another schema.
781///
782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
783#[serde_with::serde_as]
784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
785pub struct FixedFrequencySchedule {
786 /// Required. The start time of every automated backup in UTC. It must be set to the start of an hour. This field is required.
787 #[serde(rename = "startTime")]
788 pub start_time: Option<TimeOfDay>,
789}
790
791impl common::Part for FixedFrequencySchedule {}
792
793/// Backups stored in Cloud Storage buckets. The Cloud Storage buckets need to be the same region as the clusters.
794///
795/// This type is not used in any activity, and only used as *part* of another schema.
796///
797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
798#[serde_with::serde_as]
799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
800pub struct GcsBackupSource {
801 /// Optional. URIs of the Cloud Storage objects to import. Example: gs://bucket1/object1, gs://bucket2/folder2/object2
802 pub uris: Option<Vec<String>>,
803}
804
805impl common::Part for GcsBackupSource {}
806
807/// The Cloud Storage location for the output content
808///
809/// This type is not used in any activity, and only used as *part* of another schema.
810///
811#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
812#[serde_with::serde_as]
813#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
814pub struct GcsDestination {
815 /// Required. Data destination URI (e.g. 'gs://my_bucket/my_object'). Existing files will be overwritten.
816 pub uri: Option<String>,
817}
818
819impl common::Part for GcsDestination {}
820
821/// The Cloud Storage location for the input content
822///
823/// This type is not used in any activity, and only used as *part* of another schema.
824///
825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
826#[serde_with::serde_as]
827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
828pub struct GcsSource {
829 /// Required. Source data URI. (e.g. 'gs://my_bucket/my_object').
830 pub uri: Option<String>,
831}
832
833impl common::Part for GcsSource {}
834
835/// Request for Import.
836///
837/// # Activities
838///
839/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
840/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
841///
842/// * [locations instances import projects](ProjectLocationInstanceImportCall) (request)
843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
844#[serde_with::serde_as]
845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
846pub struct ImportInstanceRequest {
847 /// Required. Specify data to be imported.
848 #[serde(rename = "inputConfig")]
849 pub input_config: Option<InputConfig>,
850}
851
852impl common::RequestValue for ImportInstanceRequest {}
853
854/// The input content
855///
856/// This type is not used in any activity, and only used as *part* of another schema.
857///
858#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
859#[serde_with::serde_as]
860#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
861pub struct InputConfig {
862 /// Google Cloud Storage location where input content is located.
863 #[serde(rename = "gcsSource")]
864 pub gcs_source: Option<GcsSource>,
865}
866
867impl common::Part for InputConfig {}
868
869/// A Memorystore for Redis instance.
870///
871/// # Activities
872///
873/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
874/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
875///
876/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request)
877/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
878/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (request)
879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
880#[serde_with::serde_as]
881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
882pub struct Instance {
883 /// Optional. If specified, at least one node will be provisioned in this zone in addition to the zone specified in location_id. Only applicable to standard tier. If provided, it must be a different zone from the one provided in [location_id]. Additional nodes beyond the first 2 will be placed in zones selected by the service.
884 #[serde(rename = "alternativeLocationId")]
885 pub alternative_location_id: Option<String>,
886 /// Optional. Indicates whether OSS Redis AUTH is enabled for the instance. If set to "true" AUTH is enabled on the instance. Default value is "false" meaning AUTH is disabled.
887 #[serde(rename = "authEnabled")]
888 pub auth_enabled: Option<bool>,
889 /// Optional. The full name of the Google Compute Engine [network](https://cloud.google.com/vpc/docs/vpc) to which the instance is connected. If left unspecified, the `default` network will be used.
890 #[serde(rename = "authorizedNetwork")]
891 pub authorized_network: Option<String>,
892 /// Optional. The available maintenance versions that an instance could update to.
893 #[serde(rename = "availableMaintenanceVersions")]
894 pub available_maintenance_versions: Option<Vec<String>>,
895 /// Optional. The network connect mode of the Redis instance. If not provided, the connect mode defaults to DIRECT_PEERING.
896 #[serde(rename = "connectMode")]
897 pub connect_mode: Option<String>,
898 /// Output only. The time the instance was created.
899 #[serde(rename = "createTime")]
900 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
901 /// Output only. The current zone where the Redis primary node is located. In basic tier, this will always be the same as [location_id]. In standard tier, this can be the zone of any node in the instance.
902 #[serde(rename = "currentLocationId")]
903 pub current_location_id: Option<String>,
904 /// Optional. The KMS key reference that the customer provides when trying to create the instance.
905 #[serde(rename = "customerManagedKey")]
906 pub customer_managed_key: Option<String>,
907 /// An arbitrary and optional user-provided name for the instance.
908 #[serde(rename = "displayName")]
909 pub display_name: Option<String>,
910 /// Output only. Hostname or IP address of the exposed Redis endpoint used by clients to connect to the service.
911 pub host: Option<String>,
912 /// Resource labels to represent user provided metadata
913 pub labels: Option<HashMap<String, String>>,
914 /// Optional. The zone where the instance will be provisioned. If not provided, the service will choose a zone from the specified region for the instance. For standard tier, additional nodes will be added across multiple zones for protection against zonal failures. If specified, at least one node will be provisioned in this zone.
915 #[serde(rename = "locationId")]
916 pub location_id: Option<String>,
917 /// Optional. The maintenance policy for the instance. If not provided, maintenance events can be performed at any time.
918 #[serde(rename = "maintenancePolicy")]
919 pub maintenance_policy: Option<MaintenancePolicy>,
920 /// Output only. Date and time of upcoming maintenance events which have been scheduled.
921 #[serde(rename = "maintenanceSchedule")]
922 pub maintenance_schedule: Option<MaintenanceSchedule>,
923 /// Optional. The self service update maintenance version. The version is date based such as "20210712_00_00".
924 #[serde(rename = "maintenanceVersion")]
925 pub maintenance_version: Option<String>,
926 /// Required. Redis memory size in GiB.
927 #[serde(rename = "memorySizeGb")]
928 pub memory_size_gb: Option<i32>,
929 /// Required. Unique name of the resource in this scope including project and location using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: Redis instances are managed and addressed at regional level so location_id here refers to a GCP region; however, users may choose which specific zone (or collection of zones for cross-zone instances) an instance should be provisioned in. Refer to location_id and alternative_location_id fields for more details.
930 pub name: Option<String>,
931 /// Output only. Info per node.
932 pub nodes: Option<Vec<NodeInfo>>,
933 /// Optional. Persistence configuration parameters
934 #[serde(rename = "persistenceConfig")]
935 pub persistence_config: Option<PersistenceConfig>,
936 /// Output only. Cloud IAM identity used by import / export operations to transfer data to/from Cloud Storage. Format is "serviceAccount:". The value may change over time for a given instance so should be checked before each import/export operation.
937 #[serde(rename = "persistenceIamIdentity")]
938 pub persistence_iam_identity: Option<String>,
939 /// Output only. The port number of the exposed Redis endpoint.
940 pub port: Option<i32>,
941 /// Output only. Hostname or IP address of the exposed readonly Redis endpoint. Standard tier only. Targets all healthy replica nodes in instance. Replication is asynchronous and replica nodes will exhibit some lag behind the primary. Write requests must target 'host'.
942 #[serde(rename = "readEndpoint")]
943 pub read_endpoint: Option<String>,
944 /// Output only. The port number of the exposed readonly redis endpoint. Standard tier only. Write requests should target 'port'.
945 #[serde(rename = "readEndpointPort")]
946 pub read_endpoint_port: Option<i32>,
947 /// Optional. Read replicas mode for the instance. Defaults to READ_REPLICAS_DISABLED.
948 #[serde(rename = "readReplicasMode")]
949 pub read_replicas_mode: Option<String>,
950 /// Optional. Redis configuration parameters, according to http://redis.io/topics/config. Currently, the only supported parameters are: Redis version 3.2 and newer: * maxmemory-policy * notify-keyspace-events Redis version 4.0 and newer: * activedefrag * lfu-decay-time * lfu-log-factor * maxmemory-gb Redis version 5.0 and newer: * stream-node-max-bytes * stream-node-max-entries
951 #[serde(rename = "redisConfigs")]
952 pub redis_configs: Option<HashMap<String, String>>,
953 /// Optional. The version of Redis software. If not provided, the default version will be used. Currently, the supported values are: * `REDIS_3_2` for Redis 3.2 compatibility * `REDIS_4_0` for Redis 4.0 compatibility * `REDIS_5_0` for Redis 5.0 compatibility * `REDIS_6_X` for Redis 6.x compatibility * `REDIS_7_0` for Redis 7.0 compatibility (default) * `REDIS_7_2` for Redis 7.2 compatibility
954 #[serde(rename = "redisVersion")]
955 pub redis_version: Option<String>,
956 /// Optional. The number of replica nodes. The valid range for the Standard Tier with read replicas enabled is [1-5] and defaults to 2. If read replicas are not enabled for a Standard Tier instance, the only valid value is 1 and the default is 1. The valid value for basic tier is 0 and the default is also 0.
957 #[serde(rename = "replicaCount")]
958 pub replica_count: Option<i32>,
959 /// Optional. For DIRECT_PEERING mode, the CIDR range of internal addresses that are reserved for this instance. Range must be unique and non-overlapping with existing subnets in an authorized network. For PRIVATE_SERVICE_ACCESS mode, the name of one allocated IP address ranges associated with this private service access connection. If not provided, the service will choose an unused /29 block, for example, 10.0.0.0/29 or 192.168.0.0/29. For READ_REPLICAS_ENABLED the default block size is /28.
960 #[serde(rename = "reservedIpRange")]
961 pub reserved_ip_range: Option<String>,
962 /// Optional. Output only. Reserved for future use.
963 #[serde(rename = "satisfiesPzi")]
964 pub satisfies_pzi: Option<bool>,
965 /// Optional. Output only. Reserved for future use.
966 #[serde(rename = "satisfiesPzs")]
967 pub satisfies_pzs: Option<bool>,
968 /// Optional. Additional IP range for node placement. Required when enabling read replicas on an existing instance. For DIRECT_PEERING mode value must be a CIDR range of size /28, or "auto". For PRIVATE_SERVICE_ACCESS mode value must be the name of an allocated address range associated with the private service access connection, or "auto".
969 #[serde(rename = "secondaryIpRange")]
970 pub secondary_ip_range: Option<String>,
971 /// Output only. List of server CA certificates for the instance.
972 #[serde(rename = "serverCaCerts")]
973 pub server_ca_certs: Option<Vec<TlsCertificate>>,
974 /// Output only. The current state of this instance.
975 pub state: Option<String>,
976 /// Output only. Additional information about the current status of this instance, if available.
977 #[serde(rename = "statusMessage")]
978 pub status_message: Option<String>,
979 /// Optional. reasons that causes instance in "SUSPENDED" state.
980 #[serde(rename = "suspensionReasons")]
981 pub suspension_reasons: Option<Vec<String>>,
982 /// Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
983 pub tags: Option<HashMap<String, String>>,
984 /// Required. The service tier of the instance.
985 pub tier: Option<String>,
986 /// Optional. The TLS mode of the Redis instance. If not provided, TLS is disabled for the instance.
987 #[serde(rename = "transitEncryptionMode")]
988 pub transit_encryption_mode: Option<String>,
989}
990
991impl common::RequestValue for Instance {}
992impl common::ResponseResult for Instance {}
993
994/// Instance AUTH string details.
995///
996/// # Activities
997///
998/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
999/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1000///
1001/// * [locations instances get auth string projects](ProjectLocationInstanceGetAuthStringCall) (response)
1002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1003#[serde_with::serde_as]
1004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1005pub struct InstanceAuthString {
1006 /// AUTH string set on the instance.
1007 #[serde(rename = "authString")]
1008 pub auth_string: Option<String>,
1009}
1010
1011impl common::ResponseResult for InstanceAuthString {}
1012
1013/// Response for \[ListBackupCollections\].
1014///
1015/// # Activities
1016///
1017/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1018/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1019///
1020/// * [locations backup collections list projects](ProjectLocationBackupCollectionListCall) (response)
1021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1022#[serde_with::serde_as]
1023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1024pub struct ListBackupCollectionsResponse {
1025 /// A list of backupCollections in the project. If the `location_id` in the parent field of the request is "-", all regions available to the project are queried, and the results aggregated. If in such an aggregated query a location is unavailable, a placeholder backupCollection entry is included in the response with the `name` field set to a value of the form `projects/{project_id}/locations/{location_id}/backupCollections/`- and the `status` field set to ERROR and `status_message` field set to "location not available for ListBackupCollections".
1026 #[serde(rename = "backupCollections")]
1027 pub backup_collections: Option<Vec<BackupCollection>>,
1028 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
1029 #[serde(rename = "nextPageToken")]
1030 pub next_page_token: Option<String>,
1031 /// Locations that could not be reached.
1032 pub unreachable: Option<Vec<String>>,
1033}
1034
1035impl common::ResponseResult for ListBackupCollectionsResponse {}
1036
1037/// Response for \[ListBackups\].
1038///
1039/// # Activities
1040///
1041/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1042/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1043///
1044/// * [locations backup collections backups list projects](ProjectLocationBackupCollectionBackupListCall) (response)
1045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1046#[serde_with::serde_as]
1047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1048pub struct ListBackupsResponse {
1049 /// A list of backups in the project.
1050 pub backups: Option<Vec<Backup>>,
1051 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
1052 #[serde(rename = "nextPageToken")]
1053 pub next_page_token: Option<String>,
1054 /// Backups that could not be reached.
1055 pub unreachable: Option<Vec<String>>,
1056}
1057
1058impl common::ResponseResult for ListBackupsResponse {}
1059
1060/// Response for ListClusters.
1061///
1062/// # Activities
1063///
1064/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1065/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1066///
1067/// * [locations clusters list projects](ProjectLocationClusterListCall) (response)
1068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1069#[serde_with::serde_as]
1070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1071pub struct ListClustersResponse {
1072 /// A list of Redis clusters in the project in the specified location, or across all locations. If the `location_id` in the parent field of the request is "-", all regions available to the project are queried, and the results aggregated. If in such an aggregated query a location is unavailable, a placeholder Redis entry is included in the response with the `name` field set to a value of the form `projects/{project_id}/locations/{location_id}/clusters/`- and the `status` field set to ERROR and `status_message` field set to "location not available for ListClusters".
1073 pub clusters: Option<Vec<Cluster>>,
1074 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
1075 #[serde(rename = "nextPageToken")]
1076 pub next_page_token: Option<String>,
1077 /// Locations that could not be reached.
1078 pub unreachable: Option<Vec<String>>,
1079}
1080
1081impl common::ResponseResult for ListClustersResponse {}
1082
1083/// Response for ListInstances.
1084///
1085/// # Activities
1086///
1087/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1088/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1089///
1090/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
1091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1092#[serde_with::serde_as]
1093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1094pub struct ListInstancesResponse {
1095 /// A list of Redis instances in the project in the specified location, or across all locations. If the `location_id` in the parent field of the request is "-", all regions available to the project are queried, and the results aggregated. If in such an aggregated query a location is unavailable, a placeholder Redis entry is included in the response with the `name` field set to a value of the form `projects/{project_id}/locations/{location_id}/instances/`- and the `status` field set to ERROR and `status_message` field set to "location not available for ListInstances".
1096 pub instances: Option<Vec<Instance>>,
1097 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
1098 #[serde(rename = "nextPageToken")]
1099 pub next_page_token: Option<String>,
1100 /// Locations that could not be reached.
1101 pub unreachable: Option<Vec<String>>,
1102}
1103
1104impl common::ResponseResult for ListInstancesResponse {}
1105
1106/// The response message for Locations.ListLocations.
1107///
1108/// # Activities
1109///
1110/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1111/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1112///
1113/// * [locations list projects](ProjectLocationListCall) (response)
1114#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1115#[serde_with::serde_as]
1116#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1117pub struct ListLocationsResponse {
1118 /// A list of locations that matches the specified filter in the request.
1119 pub locations: Option<Vec<Location>>,
1120 /// The standard List next-page token.
1121 #[serde(rename = "nextPageToken")]
1122 pub next_page_token: Option<String>,
1123}
1124
1125impl common::ResponseResult for ListLocationsResponse {}
1126
1127/// The response message for Operations.ListOperations.
1128///
1129/// # Activities
1130///
1131/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1132/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1133///
1134/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1136#[serde_with::serde_as]
1137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1138pub struct ListOperationsResponse {
1139 /// The standard List next-page token.
1140 #[serde(rename = "nextPageToken")]
1141 pub next_page_token: Option<String>,
1142 /// A list of operations that matches the specified filter in the request.
1143 pub operations: Option<Vec<Operation>>,
1144 /// 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.
1145 pub unreachable: Option<Vec<String>>,
1146}
1147
1148impl common::ResponseResult for ListOperationsResponse {}
1149
1150/// A resource that represents a Google Cloud location.
1151///
1152/// # Activities
1153///
1154/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1155/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1156///
1157/// * [locations get projects](ProjectLocationGetCall) (response)
1158#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1159#[serde_with::serde_as]
1160#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1161pub struct Location {
1162 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1163 #[serde(rename = "displayName")]
1164 pub display_name: Option<String>,
1165 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1166 pub labels: Option<HashMap<String, String>>,
1167 /// Resource ID for the region. For example: "us-east1".
1168 #[serde(rename = "locationId")]
1169 pub location_id: Option<String>,
1170 /// Output only. The set of available zones in the location. The map is keyed by the lowercase ID of each zone, as defined by Compute Engine. These keys can be specified in `location_id` or `alternative_location_id` fields when creating a Redis instance.
1171 pub metadata: Option<HashMap<String, serde_json::Value>>,
1172 /// Full resource name for the region. For example: "projects/example-project/locations/us-east1".
1173 pub name: Option<String>,
1174}
1175
1176impl common::ResponseResult for Location {}
1177
1178/// Maintenance policy for an instance.
1179///
1180/// This type is not used in any activity, and only used as *part* of another schema.
1181///
1182#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1183#[serde_with::serde_as]
1184#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1185pub struct MaintenancePolicy {
1186 /// Output only. The time when the policy was created.
1187 #[serde(rename = "createTime")]
1188 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1189 /// Optional. Description of what this policy is for. Create/Update methods return INVALID_ARGUMENT if the length is greater than 512.
1190 pub description: Option<String>,
1191 /// Output only. The time when the policy was last updated.
1192 #[serde(rename = "updateTime")]
1193 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1194 /// Optional. Maintenance window that is applied to resources covered by this policy. Minimum 1. For the current version, the maximum number of weekly_window is expected to be one.
1195 #[serde(rename = "weeklyMaintenanceWindow")]
1196 pub weekly_maintenance_window: Option<Vec<WeeklyMaintenanceWindow>>,
1197}
1198
1199impl common::Part for MaintenancePolicy {}
1200
1201/// Upcoming maintenance schedule. If no maintenance is scheduled, fields are not populated.
1202///
1203/// This type is not used in any activity, and only used as *part* of another schema.
1204///
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct MaintenanceSchedule {
1209 /// If the scheduled maintenance can be rescheduled, default is true.
1210 #[serde(rename = "canReschedule")]
1211 pub can_reschedule: Option<bool>,
1212 /// Output only. The end time of any upcoming scheduled maintenance for this instance.
1213 #[serde(rename = "endTime")]
1214 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1215 /// Output only. The deadline that the maintenance schedule start time can not go beyond, including reschedule.
1216 #[serde(rename = "scheduleDeadlineTime")]
1217 pub schedule_deadline_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1218 /// Output only. The start time of any upcoming scheduled maintenance for this instance.
1219 #[serde(rename = "startTime")]
1220 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1221}
1222
1223impl common::Part for MaintenanceSchedule {}
1224
1225/// Backups that generated and managed by memorystore.
1226///
1227/// This type is not used in any activity, and only used as *part* of another schema.
1228///
1229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1230#[serde_with::serde_as]
1231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1232pub struct ManagedBackupSource {
1233 /// Optional. Example: //redis.googleapis.com/projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup} A shorter version (without the prefix) of the backup name is also supported, like projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup_id} In this case, it assumes the backup is under redis.googleapis.com.
1234 pub backup: Option<String>,
1235}
1236
1237impl common::Part for ManagedBackupSource {}
1238
1239/// There is no detailed description.
1240///
1241/// This type is not used in any activity, and only used as *part* of another schema.
1242///
1243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1244#[serde_with::serde_as]
1245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1246pub struct ManagedCertificateAuthority {
1247 /// The PEM encoded CA certificate chains for redis managed server authentication
1248 #[serde(rename = "caCerts")]
1249 pub ca_certs: Option<Vec<CertChain>>,
1250}
1251
1252impl common::Part for ManagedCertificateAuthority {}
1253
1254/// An output only view of all the member clusters participating in the cross cluster replication.
1255///
1256/// This type is not used in any activity, and only used as *part* of another schema.
1257///
1258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1259#[serde_with::serde_as]
1260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1261pub struct Membership {
1262 /// Output only. The primary cluster that acts as the source of replication for the secondary clusters.
1263 #[serde(rename = "primaryCluster")]
1264 pub primary_cluster: Option<RemoteCluster>,
1265 /// Output only. The list of secondary clusters replicating from the primary cluster.
1266 #[serde(rename = "secondaryClusters")]
1267 pub secondary_clusters: Option<Vec<RemoteCluster>>,
1268}
1269
1270impl common::Part for Membership {}
1271
1272/// Node specific properties.
1273///
1274/// This type is not used in any activity, and only used as *part* of another schema.
1275///
1276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1277#[serde_with::serde_as]
1278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1279pub struct NodeInfo {
1280 /// Output only. Node identifying string. e.g. 'node-0', 'node-1'
1281 pub id: Option<String>,
1282 /// Output only. Location of the node.
1283 pub zone: Option<String>,
1284}
1285
1286impl common::Part for NodeInfo {}
1287
1288/// This resource represents a long-running operation that is the result of a network API call.
1289///
1290/// # Activities
1291///
1292/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1293/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1294///
1295/// * [locations backup collections backups delete projects](ProjectLocationBackupCollectionBackupDeleteCall) (response)
1296/// * [locations backup collections backups export projects](ProjectLocationBackupCollectionBackupExportCall) (response)
1297/// * [locations clusters backup projects](ProjectLocationClusterBackupCall) (response)
1298/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (response)
1299/// * [locations clusters delete projects](ProjectLocationClusterDeleteCall) (response)
1300/// * [locations clusters patch projects](ProjectLocationClusterPatchCall) (response)
1301/// * [locations clusters reschedule cluster maintenance projects](ProjectLocationClusterRescheduleClusterMaintenanceCall) (response)
1302/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (response)
1303/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
1304/// * [locations instances export projects](ProjectLocationInstanceExportCall) (response)
1305/// * [locations instances failover projects](ProjectLocationInstanceFailoverCall) (response)
1306/// * [locations instances import projects](ProjectLocationInstanceImportCall) (response)
1307/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (response)
1308/// * [locations instances reschedule maintenance projects](ProjectLocationInstanceRescheduleMaintenanceCall) (response)
1309/// * [locations instances upgrade projects](ProjectLocationInstanceUpgradeCall) (response)
1310/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1311#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1312#[serde_with::serde_as]
1313#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1314pub struct Operation {
1315 /// 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.
1316 pub done: Option<bool>,
1317 /// The error result of the operation in case of failure or cancellation.
1318 pub error: Option<Status>,
1319 /// { `createTime`: The time the operation was created. `endTime`: The time the operation finished running. `target`: Server-defined resource path for the target of the operation. `verb`: Name of the verb executed by the operation. `statusDetail`: Human-readable status of the operation, if any. `cancelRequested`: Identifies whether the user has requested cancellation of the operation. Operations that have successfully been cancelled have Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`. `apiVersion`: API version used to start the operation. }
1320 pub metadata: Option<HashMap<String, serde_json::Value>>,
1321 /// 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}`.
1322 pub name: Option<String>,
1323 /// 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`.
1324 pub response: Option<HashMap<String, serde_json::Value>>,
1325}
1326
1327impl common::ResponseResult for Operation {}
1328
1329/// The output content
1330///
1331/// This type is not used in any activity, and only used as *part* of another schema.
1332///
1333#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1334#[serde_with::serde_as]
1335#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1336pub struct OutputConfig {
1337 /// Google Cloud Storage destination for output content.
1338 #[serde(rename = "gcsDestination")]
1339 pub gcs_destination: Option<GcsDestination>,
1340}
1341
1342impl common::Part for OutputConfig {}
1343
1344/// Configuration of the persistence functionality.
1345///
1346/// This type is not used in any activity, and only used as *part* of another schema.
1347///
1348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1349#[serde_with::serde_as]
1350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1351pub struct PersistenceConfig {
1352 /// Optional. Controls whether Persistence features are enabled. If not provided, the existing value will be used.
1353 #[serde(rename = "persistenceMode")]
1354 pub persistence_mode: Option<String>,
1355 /// Output only. The next time that a snapshot attempt is scheduled to occur.
1356 #[serde(rename = "rdbNextSnapshotTime")]
1357 pub rdb_next_snapshot_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1358 /// Optional. Period between RDB snapshots. Snapshots will be attempted every period starting from the provided snapshot start time. For example, a start time of 01/01/2033 06:45 and SIX_HOURS snapshot period will do nothing until 01/01/2033, and then trigger snapshots every day at 06:45, 12:45, 18:45, and 00:45 the next day, and so on. If not provided, TWENTY_FOUR_HOURS will be used as default.
1359 #[serde(rename = "rdbSnapshotPeriod")]
1360 pub rdb_snapshot_period: Option<String>,
1361 /// Optional. Date and time that the first snapshot was/will be attempted, and to which future snapshots will be aligned. If not provided, the current time will be used.
1362 #[serde(rename = "rdbSnapshotStartTime")]
1363 pub rdb_snapshot_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1364}
1365
1366impl common::Part for PersistenceConfig {}
1367
1368/// Details of consumer resources in a PSC connection that is created through Service Connectivity Automation.
1369///
1370/// This type is not used in any activity, and only used as *part* of another schema.
1371///
1372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1373#[serde_with::serde_as]
1374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1375pub struct PscAutoConnection {
1376 /// Output only. The IP allocated on the consumer network for the PSC forwarding rule.
1377 pub address: Option<String>,
1378 /// Output only. Type of the PSC connection.
1379 #[serde(rename = "connectionType")]
1380 pub connection_type: Option<String>,
1381 /// Output only. The URI of the consumer side forwarding rule. Example: projects/{projectNumOrId}/regions/us-east1/forwardingRules/{resourceId}.
1382 #[serde(rename = "forwardingRule")]
1383 pub forwarding_rule: Option<String>,
1384 /// Required. The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
1385 pub network: Option<String>,
1386 /// Required. The consumer project_id where the forwarding rule is created from.
1387 #[serde(rename = "projectId")]
1388 pub project_id: Option<String>,
1389 /// Output only. The PSC connection id of the forwarding rule connected to the service attachment.
1390 #[serde(rename = "pscConnectionId")]
1391 pub psc_connection_id: Option<String>,
1392 /// Output only. The status of the PSC connection. Please note that this value is updated periodically. Please use Private Service Connect APIs for the latest status.
1393 #[serde(rename = "pscConnectionStatus")]
1394 pub psc_connection_status: Option<String>,
1395 /// Output only. The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
1396 #[serde(rename = "serviceAttachment")]
1397 pub service_attachment: Option<String>,
1398}
1399
1400impl common::Part for PscAutoConnection {}
1401
1402/// There is no detailed description.
1403///
1404/// This type is not used in any activity, and only used as *part* of another schema.
1405///
1406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1407#[serde_with::serde_as]
1408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1409pub struct PscConfig {
1410 /// Required. The network where the IP address of the discovery endpoint will be reserved, in the form of projects/{network_project}/global/networks/{network_id}.
1411 pub network: Option<String>,
1412}
1413
1414impl common::Part for PscConfig {}
1415
1416/// Details of consumer resources in a PSC connection.
1417///
1418/// This type is not used in any activity, and only used as *part* of another schema.
1419///
1420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1421#[serde_with::serde_as]
1422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1423pub struct PscConnection {
1424 /// Required. The IP allocated on the consumer network for the PSC forwarding rule.
1425 pub address: Option<String>,
1426 /// Output only. Type of the PSC connection.
1427 #[serde(rename = "connectionType")]
1428 pub connection_type: Option<String>,
1429 /// Required. The URI of the consumer side forwarding rule. Example: projects/{projectNumOrId}/regions/us-east1/forwardingRules/{resourceId}.
1430 #[serde(rename = "forwardingRule")]
1431 pub forwarding_rule: Option<String>,
1432 /// Required. The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
1433 pub network: Option<String>,
1434 /// Output only. port will only be set for Primary/Reader or Discovery endpoint.
1435 pub port: Option<i32>,
1436 /// Optional. Project ID of the consumer project where the forwarding rule is created in.
1437 #[serde(rename = "projectId")]
1438 pub project_id: Option<String>,
1439 /// Required. The PSC connection id of the forwarding rule connected to the service attachment.
1440 #[serde(rename = "pscConnectionId")]
1441 pub psc_connection_id: Option<String>,
1442 /// Output only. The status of the PSC connection. Please note that this value is updated periodically. To get the latest status of a PSC connection, follow https://cloud.google.com/vpc/docs/configure-private-service-connect-services#endpoint-details.
1443 #[serde(rename = "pscConnectionStatus")]
1444 pub psc_connection_status: Option<String>,
1445 /// Required. The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
1446 #[serde(rename = "serviceAttachment")]
1447 pub service_attachment: Option<String>,
1448}
1449
1450impl common::Part for PscConnection {}
1451
1452/// Configuration of a service attachment of the cluster, for creating PSC connections.
1453///
1454/// This type is not used in any activity, and only used as *part* of another schema.
1455///
1456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1457#[serde_with::serde_as]
1458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1459pub struct PscServiceAttachment {
1460 /// Output only. Type of a PSC connection targeting this service attachment.
1461 #[serde(rename = "connectionType")]
1462 pub connection_type: Option<String>,
1463 /// Output only. Service attachment URI which your self-created PscConnection should use as target
1464 #[serde(rename = "serviceAttachment")]
1465 pub service_attachment: Option<String>,
1466}
1467
1468impl common::Part for PscServiceAttachment {}
1469
1470/// Configuration of the RDB based persistence.
1471///
1472/// This type is not used in any activity, and only used as *part* of another schema.
1473///
1474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1475#[serde_with::serde_as]
1476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1477pub struct RDBConfig {
1478 /// Optional. Period between RDB snapshots.
1479 #[serde(rename = "rdbSnapshotPeriod")]
1480 pub rdb_snapshot_period: Option<String>,
1481 /// Optional. The time that the first snapshot was/will be attempted, and to which future snapshots will be aligned. If not provided, the current time will be used.
1482 #[serde(rename = "rdbSnapshotStartTime")]
1483 pub rdb_snapshot_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1484}
1485
1486impl common::Part for RDBConfig {}
1487
1488/// Details of the remote cluster associated with this cluster in a cross cluster replication setup.
1489///
1490/// This type is not used in any activity, and only used as *part* of another schema.
1491///
1492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1493#[serde_with::serde_as]
1494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1495pub struct RemoteCluster {
1496 /// Output only. The full resource path of the remote cluster in the format: projects//locations//clusters/
1497 pub cluster: Option<String>,
1498 /// Output only. The unique identifier of the remote cluster.
1499 pub uid: Option<String>,
1500}
1501
1502impl common::Part for RemoteCluster {}
1503
1504/// Request for rescheduling a cluster maintenance.
1505///
1506/// # Activities
1507///
1508/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1509/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1510///
1511/// * [locations clusters reschedule cluster maintenance projects](ProjectLocationClusterRescheduleClusterMaintenanceCall) (request)
1512#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1513#[serde_with::serde_as]
1514#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1515pub struct RescheduleClusterMaintenanceRequest {
1516 /// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
1517 #[serde(rename = "rescheduleType")]
1518 pub reschedule_type: Option<String>,
1519 /// Optional. Timestamp when the maintenance shall be rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example `2012-11-15T16:19:00.094Z`.
1520 #[serde(rename = "scheduleTime")]
1521 pub schedule_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1522}
1523
1524impl common::RequestValue for RescheduleClusterMaintenanceRequest {}
1525
1526/// Request for RescheduleMaintenance.
1527///
1528/// # Activities
1529///
1530/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1531/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1532///
1533/// * [locations instances reschedule maintenance projects](ProjectLocationInstanceRescheduleMaintenanceCall) (request)
1534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1535#[serde_with::serde_as]
1536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1537pub struct RescheduleMaintenanceRequest {
1538 /// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
1539 #[serde(rename = "rescheduleType")]
1540 pub reschedule_type: Option<String>,
1541 /// Optional. Timestamp when the maintenance shall be rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example `2012-11-15T16:19:00.094Z`.
1542 #[serde(rename = "scheduleTime")]
1543 pub schedule_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1544}
1545
1546impl common::RequestValue for RescheduleMaintenanceRequest {}
1547
1548/// Represents additional information about the state of the cluster.
1549///
1550/// This type is not used in any activity, and only used as *part* of another schema.
1551///
1552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1553#[serde_with::serde_as]
1554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1555pub struct StateInfo {
1556 /// Describes ongoing update on the cluster when cluster state is UPDATING.
1557 #[serde(rename = "updateInfo")]
1558 pub update_info: Option<UpdateInfo>,
1559}
1560
1561impl common::Part for StateInfo {}
1562
1563/// 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).
1564///
1565/// This type is not used in any activity, and only used as *part* of another schema.
1566///
1567#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1568#[serde_with::serde_as]
1569#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1570pub struct Status {
1571 /// The status code, which should be an enum value of google.rpc.Code.
1572 pub code: Option<i32>,
1573 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1574 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1575 /// 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.
1576 pub message: Option<String>,
1577}
1578
1579impl common::Part for Status {}
1580
1581/// Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
1582///
1583/// This type is not used in any activity, and only used as *part* of another schema.
1584///
1585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1586#[serde_with::serde_as]
1587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1588pub struct TimeOfDay {
1589 /// Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
1590 pub hours: Option<i32>,
1591 /// Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
1592 pub minutes: Option<i32>,
1593 /// Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
1594 pub nanos: Option<i32>,
1595 /// Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.
1596 pub seconds: Option<i32>,
1597}
1598
1599impl common::Part for TimeOfDay {}
1600
1601/// TlsCertificate Resource
1602///
1603/// This type is not used in any activity, and only used as *part* of another schema.
1604///
1605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1606#[serde_with::serde_as]
1607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1608pub struct TlsCertificate {
1609 /// PEM representation.
1610 pub cert: Option<String>,
1611 /// Output only. The time when the certificate was created in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2020-05-18T00:00:00.094Z`.
1612 #[serde(rename = "createTime")]
1613 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1614 /// Output only. The time when the certificate expires in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2020-05-18T00:00:00.094Z`.
1615 #[serde(rename = "expireTime")]
1616 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1617 /// Serial number, as extracted from the certificate.
1618 #[serde(rename = "serialNumber")]
1619 pub serial_number: Option<String>,
1620 /// Sha1 Fingerprint of the certificate.
1621 #[serde(rename = "sha1Fingerprint")]
1622 pub sha1_fingerprint: Option<String>,
1623}
1624
1625impl common::Part for TlsCertificate {}
1626
1627/// Represents information about an updating cluster.
1628///
1629/// This type is not used in any activity, and only used as *part* of another schema.
1630///
1631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1632#[serde_with::serde_as]
1633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1634pub struct UpdateInfo {
1635 /// Target node type for redis cluster.
1636 #[serde(rename = "targetNodeType")]
1637 pub target_node_type: Option<String>,
1638 /// Target number of replica nodes per shard.
1639 #[serde(rename = "targetReplicaCount")]
1640 pub target_replica_count: Option<i32>,
1641 /// Target number of shards for redis cluster
1642 #[serde(rename = "targetShardCount")]
1643 pub target_shard_count: Option<i32>,
1644}
1645
1646impl common::Part for UpdateInfo {}
1647
1648/// Request for UpgradeInstance.
1649///
1650/// # Activities
1651///
1652/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1653/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1654///
1655/// * [locations instances upgrade projects](ProjectLocationInstanceUpgradeCall) (request)
1656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1657#[serde_with::serde_as]
1658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1659pub struct UpgradeInstanceRequest {
1660 /// Required. Specifies the target version of Redis software to upgrade to.
1661 #[serde(rename = "redisVersion")]
1662 pub redis_version: Option<String>,
1663}
1664
1665impl common::RequestValue for UpgradeInstanceRequest {}
1666
1667/// Time window in which disruptive maintenance updates occur. Non-disruptive updates can occur inside or outside this window.
1668///
1669/// This type is not used in any activity, and only used as *part* of another schema.
1670///
1671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1672#[serde_with::serde_as]
1673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1674pub struct WeeklyMaintenanceWindow {
1675 /// Required. The day of week that maintenance updates occur.
1676 pub day: Option<String>,
1677 /// Output only. Duration of the maintenance window. The current window is fixed at 1 hour.
1678 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1679 pub duration: Option<chrono::Duration>,
1680 /// Required. Start time of the window in UTC time.
1681 #[serde(rename = "startTime")]
1682 pub start_time: Option<TimeOfDay>,
1683}
1684
1685impl common::Part for WeeklyMaintenanceWindow {}
1686
1687/// Zone distribution config for allocation of cluster resources.
1688///
1689/// This type is not used in any activity, and only used as *part* of another schema.
1690///
1691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1692#[serde_with::serde_as]
1693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1694pub struct ZoneDistributionConfig {
1695 /// Optional. The mode of zone distribution. Defaults to MULTI_ZONE, when not specified.
1696 pub mode: Option<String>,
1697 /// Optional. When SINGLE ZONE distribution is selected, zone field would be used to allocate all resources in that zone. This is not applicable to MULTI_ZONE, and would be ignored for MULTI_ZONE clusters.
1698 pub zone: Option<String>,
1699}
1700
1701impl common::Part for ZoneDistributionConfig {}
1702
1703// ###################
1704// MethodBuilders ###
1705// #################
1706
1707/// A builder providing access to all methods supported on *project* resources.
1708/// It is not used directly, but through the [`CloudRedis`] hub.
1709///
1710/// # Example
1711///
1712/// Instantiate a resource builder
1713///
1714/// ```test_harness,no_run
1715/// extern crate hyper;
1716/// extern crate hyper_rustls;
1717/// extern crate google_redis1 as redis1;
1718///
1719/// # async fn dox() {
1720/// use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1721///
1722/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1723/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1724/// .with_native_roots()
1725/// .unwrap()
1726/// .https_only()
1727/// .enable_http2()
1728/// .build();
1729///
1730/// let executor = hyper_util::rt::TokioExecutor::new();
1731/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1732/// secret,
1733/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1734/// yup_oauth2::client::CustomHyperClientBuilder::from(
1735/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1736/// ),
1737/// ).build().await.unwrap();
1738///
1739/// let client = hyper_util::client::legacy::Client::builder(
1740/// hyper_util::rt::TokioExecutor::new()
1741/// )
1742/// .build(
1743/// hyper_rustls::HttpsConnectorBuilder::new()
1744/// .with_native_roots()
1745/// .unwrap()
1746/// .https_or_http()
1747/// .enable_http2()
1748/// .build()
1749/// );
1750/// let mut hub = CloudRedis::new(client, auth);
1751/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1752/// // like `locations_backup_collections_backups_delete(...)`, `locations_backup_collections_backups_export(...)`, `locations_backup_collections_backups_get(...)`, `locations_backup_collections_backups_list(...)`, `locations_backup_collections_get(...)`, `locations_backup_collections_list(...)`, `locations_clusters_backup(...)`, `locations_clusters_create(...)`, `locations_clusters_delete(...)`, `locations_clusters_get(...)`, `locations_clusters_get_certificate_authority(...)`, `locations_clusters_list(...)`, `locations_clusters_patch(...)`, `locations_clusters_reschedule_cluster_maintenance(...)`, `locations_get(...)`, `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_export(...)`, `locations_instances_failover(...)`, `locations_instances_get(...)`, `locations_instances_get_auth_string(...)`, `locations_instances_import(...)`, `locations_instances_list(...)`, `locations_instances_patch(...)`, `locations_instances_reschedule_maintenance(...)`, `locations_instances_upgrade(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)`
1753/// // to build up your call.
1754/// let rb = hub.projects();
1755/// # }
1756/// ```
1757pub struct ProjectMethods<'a, C>
1758where
1759 C: 'a,
1760{
1761 hub: &'a CloudRedis<C>,
1762}
1763
1764impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1765
1766impl<'a, C> ProjectMethods<'a, C> {
1767 /// Create a builder to help you perform the following task:
1768 ///
1769 /// Deletes a specific backup.
1770 ///
1771 /// # Arguments
1772 ///
1773 /// * `name` - Required. Redis backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1774 pub fn locations_backup_collections_backups_delete(
1775 &self,
1776 name: &str,
1777 ) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C> {
1778 ProjectLocationBackupCollectionBackupDeleteCall {
1779 hub: self.hub,
1780 _name: name.to_string(),
1781 _request_id: Default::default(),
1782 _delegate: Default::default(),
1783 _additional_params: Default::default(),
1784 _scopes: Default::default(),
1785 }
1786 }
1787
1788 /// Create a builder to help you perform the following task:
1789 ///
1790 /// Exports a specific backup to a customer target Cloud Storage URI.
1791 ///
1792 /// # Arguments
1793 ///
1794 /// * `request` - No description provided.
1795 /// * `name` - Required. Redis backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1796 pub fn locations_backup_collections_backups_export(
1797 &self,
1798 request: ExportBackupRequest,
1799 name: &str,
1800 ) -> ProjectLocationBackupCollectionBackupExportCall<'a, C> {
1801 ProjectLocationBackupCollectionBackupExportCall {
1802 hub: self.hub,
1803 _request: request,
1804 _name: name.to_string(),
1805 _delegate: Default::default(),
1806 _additional_params: Default::default(),
1807 _scopes: Default::default(),
1808 }
1809 }
1810
1811 /// Create a builder to help you perform the following task:
1812 ///
1813 /// Gets the details of a specific backup.
1814 ///
1815 /// # Arguments
1816 ///
1817 /// * `name` - Required. Redis backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1818 pub fn locations_backup_collections_backups_get(
1819 &self,
1820 name: &str,
1821 ) -> ProjectLocationBackupCollectionBackupGetCall<'a, C> {
1822 ProjectLocationBackupCollectionBackupGetCall {
1823 hub: self.hub,
1824 _name: name.to_string(),
1825 _delegate: Default::default(),
1826 _additional_params: Default::default(),
1827 _scopes: Default::default(),
1828 }
1829 }
1830
1831 /// Create a builder to help you perform the following task:
1832 ///
1833 /// Lists all backups owned by a backup collection.
1834 ///
1835 /// # Arguments
1836 ///
1837 /// * `parent` - Required. The resource name of the backupCollection using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
1838 pub fn locations_backup_collections_backups_list(
1839 &self,
1840 parent: &str,
1841 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C> {
1842 ProjectLocationBackupCollectionBackupListCall {
1843 hub: self.hub,
1844 _parent: parent.to_string(),
1845 _page_token: Default::default(),
1846 _page_size: Default::default(),
1847 _delegate: Default::default(),
1848 _additional_params: Default::default(),
1849 _scopes: Default::default(),
1850 }
1851 }
1852
1853 /// Create a builder to help you perform the following task:
1854 ///
1855 /// Get a backup collection.
1856 ///
1857 /// # Arguments
1858 ///
1859 /// * `name` - Required. Redis backupCollection resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` where `location_id` refers to a Google Cloud region.
1860 pub fn locations_backup_collections_get(
1861 &self,
1862 name: &str,
1863 ) -> ProjectLocationBackupCollectionGetCall<'a, C> {
1864 ProjectLocationBackupCollectionGetCall {
1865 hub: self.hub,
1866 _name: name.to_string(),
1867 _delegate: Default::default(),
1868 _additional_params: Default::default(),
1869 _scopes: Default::default(),
1870 }
1871 }
1872
1873 /// Create a builder to help you perform the following task:
1874 ///
1875 /// Lists all backup collections owned by a consumer project in either the specified location (region) or all locations. If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
1876 ///
1877 /// # Arguments
1878 ///
1879 /// * `parent` - Required. The resource name of the backupCollection location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.
1880 pub fn locations_backup_collections_list(
1881 &self,
1882 parent: &str,
1883 ) -> ProjectLocationBackupCollectionListCall<'a, C> {
1884 ProjectLocationBackupCollectionListCall {
1885 hub: self.hub,
1886 _parent: parent.to_string(),
1887 _page_token: Default::default(),
1888 _page_size: Default::default(),
1889 _delegate: Default::default(),
1890 _additional_params: Default::default(),
1891 _scopes: Default::default(),
1892 }
1893 }
1894
1895 /// Create a builder to help you perform the following task:
1896 ///
1897 /// Backup Redis Cluster. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the cluster's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for backup.
1898 ///
1899 /// # Arguments
1900 ///
1901 /// * `request` - No description provided.
1902 /// * `name` - Required. Redis cluster resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
1903 pub fn locations_clusters_backup(
1904 &self,
1905 request: BackupClusterRequest,
1906 name: &str,
1907 ) -> ProjectLocationClusterBackupCall<'a, C> {
1908 ProjectLocationClusterBackupCall {
1909 hub: self.hub,
1910 _request: request,
1911 _name: name.to_string(),
1912 _delegate: Default::default(),
1913 _additional_params: Default::default(),
1914 _scopes: Default::default(),
1915 }
1916 }
1917
1918 /// Create a builder to help you perform the following task:
1919 ///
1920 /// Creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
1921 ///
1922 /// # Arguments
1923 ///
1924 /// * `request` - No description provided.
1925 /// * `parent` - Required. The resource name of the cluster location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.
1926 pub fn locations_clusters_create(
1927 &self,
1928 request: Cluster,
1929 parent: &str,
1930 ) -> ProjectLocationClusterCreateCall<'a, C> {
1931 ProjectLocationClusterCreateCall {
1932 hub: self.hub,
1933 _request: request,
1934 _parent: parent.to_string(),
1935 _request_id: Default::default(),
1936 _cluster_id: Default::default(),
1937 _delegate: Default::default(),
1938 _additional_params: Default::default(),
1939 _scopes: Default::default(),
1940 }
1941 }
1942
1943 /// Create a builder to help you perform the following task:
1944 ///
1945 /// Deletes a specific Redis cluster. Cluster stops serving and data is deleted.
1946 ///
1947 /// # Arguments
1948 ///
1949 /// * `name` - Required. Redis cluster resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
1950 pub fn locations_clusters_delete(&self, name: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
1951 ProjectLocationClusterDeleteCall {
1952 hub: self.hub,
1953 _name: name.to_string(),
1954 _request_id: Default::default(),
1955 _delegate: Default::default(),
1956 _additional_params: Default::default(),
1957 _scopes: Default::default(),
1958 }
1959 }
1960
1961 /// Create a builder to help you perform the following task:
1962 ///
1963 /// Gets the details of a specific Redis cluster.
1964 ///
1965 /// # Arguments
1966 ///
1967 /// * `name` - Required. Redis cluster resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
1968 pub fn locations_clusters_get(&self, name: &str) -> ProjectLocationClusterGetCall<'a, C> {
1969 ProjectLocationClusterGetCall {
1970 hub: self.hub,
1971 _name: name.to_string(),
1972 _delegate: Default::default(),
1973 _additional_params: Default::default(),
1974 _scopes: Default::default(),
1975 }
1976 }
1977
1978 /// Create a builder to help you perform the following task:
1979 ///
1980 /// Gets the details of certificate authority information for Redis cluster.
1981 ///
1982 /// # Arguments
1983 ///
1984 /// * `name` - Required. Redis cluster certificate authority resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority` where `location_id` refers to a Google Cloud region.
1985 pub fn locations_clusters_get_certificate_authority(
1986 &self,
1987 name: &str,
1988 ) -> ProjectLocationClusterGetCertificateAuthorityCall<'a, C> {
1989 ProjectLocationClusterGetCertificateAuthorityCall {
1990 hub: self.hub,
1991 _name: name.to_string(),
1992 _delegate: Default::default(),
1993 _additional_params: Default::default(),
1994 _scopes: Default::default(),
1995 }
1996 }
1997
1998 /// Create a builder to help you perform the following task:
1999 ///
2000 /// Lists all Redis clusters owned by a project in either the specified location (region) or all locations. The location should have the following format: * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
2001 ///
2002 /// # Arguments
2003 ///
2004 /// * `parent` - Required. The resource name of the cluster location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.
2005 pub fn locations_clusters_list(&self, parent: &str) -> ProjectLocationClusterListCall<'a, C> {
2006 ProjectLocationClusterListCall {
2007 hub: self.hub,
2008 _parent: parent.to_string(),
2009 _page_token: Default::default(),
2010 _page_size: Default::default(),
2011 _delegate: Default::default(),
2012 _additional_params: Default::default(),
2013 _scopes: Default::default(),
2014 }
2015 }
2016
2017 /// Create a builder to help you perform the following task:
2018 ///
2019 /// Updates the metadata and configuration of a specific Redis cluster. Completed longrunning.Operation will contain the new cluster object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
2020 ///
2021 /// # Arguments
2022 ///
2023 /// * `request` - No description provided.
2024 /// * `name` - Required. Identifier. Unique name of the resource in this scope including project and location using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
2025 pub fn locations_clusters_patch(
2026 &self,
2027 request: Cluster,
2028 name: &str,
2029 ) -> ProjectLocationClusterPatchCall<'a, C> {
2030 ProjectLocationClusterPatchCall {
2031 hub: self.hub,
2032 _request: request,
2033 _name: name.to_string(),
2034 _update_mask: Default::default(),
2035 _request_id: Default::default(),
2036 _delegate: Default::default(),
2037 _additional_params: Default::default(),
2038 _scopes: Default::default(),
2039 }
2040 }
2041
2042 /// Create a builder to help you perform the following task:
2043 ///
2044 /// Reschedules upcoming maintenance event.
2045 ///
2046 /// # Arguments
2047 ///
2048 /// * `request` - No description provided.
2049 /// * `name` - Required. Redis Cluster instance resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
2050 pub fn locations_clusters_reschedule_cluster_maintenance(
2051 &self,
2052 request: RescheduleClusterMaintenanceRequest,
2053 name: &str,
2054 ) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C> {
2055 ProjectLocationClusterRescheduleClusterMaintenanceCall {
2056 hub: self.hub,
2057 _request: request,
2058 _name: name.to_string(),
2059 _delegate: Default::default(),
2060 _additional_params: Default::default(),
2061 _scopes: Default::default(),
2062 }
2063 }
2064
2065 /// Create a builder to help you perform the following task:
2066 ///
2067 /// Creates a Redis instance based on the specified tier and memory size. By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc). The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
2068 ///
2069 /// # Arguments
2070 ///
2071 /// * `request` - No description provided.
2072 /// * `parent` - Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
2073 pub fn locations_instances_create(
2074 &self,
2075 request: Instance,
2076 parent: &str,
2077 ) -> ProjectLocationInstanceCreateCall<'a, C> {
2078 ProjectLocationInstanceCreateCall {
2079 hub: self.hub,
2080 _request: request,
2081 _parent: parent.to_string(),
2082 _instance_id: Default::default(),
2083 _delegate: Default::default(),
2084 _additional_params: Default::default(),
2085 _scopes: Default::default(),
2086 }
2087 }
2088
2089 /// Create a builder to help you perform the following task:
2090 ///
2091 /// Deletes a specific Redis instance. Instance stops serving and data is deleted.
2092 ///
2093 /// # Arguments
2094 ///
2095 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2096 pub fn locations_instances_delete(
2097 &self,
2098 name: &str,
2099 ) -> ProjectLocationInstanceDeleteCall<'a, C> {
2100 ProjectLocationInstanceDeleteCall {
2101 hub: self.hub,
2102 _name: name.to_string(),
2103 _delegate: Default::default(),
2104 _additional_params: Default::default(),
2105 _scopes: Default::default(),
2106 }
2107 }
2108
2109 /// Create a builder to help you perform the following task:
2110 ///
2111 /// Export Redis instance data into a Redis RDB format file in Cloud Storage. Redis will continue serving during this operation. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
2112 ///
2113 /// # Arguments
2114 ///
2115 /// * `request` - No description provided.
2116 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2117 pub fn locations_instances_export(
2118 &self,
2119 request: ExportInstanceRequest,
2120 name: &str,
2121 ) -> ProjectLocationInstanceExportCall<'a, C> {
2122 ProjectLocationInstanceExportCall {
2123 hub: self.hub,
2124 _request: request,
2125 _name: name.to_string(),
2126 _delegate: Default::default(),
2127 _additional_params: Default::default(),
2128 _scopes: Default::default(),
2129 }
2130 }
2131
2132 /// Create a builder to help you perform the following task:
2133 ///
2134 /// Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
2135 ///
2136 /// # Arguments
2137 ///
2138 /// * `request` - No description provided.
2139 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2140 pub fn locations_instances_failover(
2141 &self,
2142 request: FailoverInstanceRequest,
2143 name: &str,
2144 ) -> ProjectLocationInstanceFailoverCall<'a, C> {
2145 ProjectLocationInstanceFailoverCall {
2146 hub: self.hub,
2147 _request: request,
2148 _name: name.to_string(),
2149 _delegate: Default::default(),
2150 _additional_params: Default::default(),
2151 _scopes: Default::default(),
2152 }
2153 }
2154
2155 /// Create a builder to help you perform the following task:
2156 ///
2157 /// Gets the details of a specific Redis instance.
2158 ///
2159 /// # Arguments
2160 ///
2161 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2162 pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, C> {
2163 ProjectLocationInstanceGetCall {
2164 hub: self.hub,
2165 _name: name.to_string(),
2166 _delegate: Default::default(),
2167 _additional_params: Default::default(),
2168 _scopes: Default::default(),
2169 }
2170 }
2171
2172 /// Create a builder to help you perform the following task:
2173 ///
2174 /// Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response will be empty. This information is not included in the details returned to GetInstance.
2175 ///
2176 /// # Arguments
2177 ///
2178 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2179 pub fn locations_instances_get_auth_string(
2180 &self,
2181 name: &str,
2182 ) -> ProjectLocationInstanceGetAuthStringCall<'a, C> {
2183 ProjectLocationInstanceGetAuthStringCall {
2184 hub: self.hub,
2185 _name: name.to_string(),
2186 _delegate: Default::default(),
2187 _additional_params: Default::default(),
2188 _scopes: Default::default(),
2189 }
2190 }
2191
2192 /// Create a builder to help you perform the following task:
2193 ///
2194 /// Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
2195 ///
2196 /// # Arguments
2197 ///
2198 /// * `request` - No description provided.
2199 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2200 pub fn locations_instances_import(
2201 &self,
2202 request: ImportInstanceRequest,
2203 name: &str,
2204 ) -> ProjectLocationInstanceImportCall<'a, C> {
2205 ProjectLocationInstanceImportCall {
2206 hub: self.hub,
2207 _request: request,
2208 _name: name.to_string(),
2209 _delegate: Default::default(),
2210 _additional_params: Default::default(),
2211 _scopes: Default::default(),
2212 }
2213 }
2214
2215 /// Create a builder to help you perform the following task:
2216 ///
2217 /// Lists all Redis instances owned by a project in either the specified location (region) or all locations. The location should have the following format: * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
2218 ///
2219 /// # Arguments
2220 ///
2221 /// * `parent` - Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
2222 pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, C> {
2223 ProjectLocationInstanceListCall {
2224 hub: self.hub,
2225 _parent: parent.to_string(),
2226 _page_token: Default::default(),
2227 _page_size: Default::default(),
2228 _delegate: Default::default(),
2229 _additional_params: Default::default(),
2230 _scopes: Default::default(),
2231 }
2232 }
2233
2234 /// Create a builder to help you perform the following task:
2235 ///
2236 /// Updates the metadata and configuration of a specific Redis instance. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
2237 ///
2238 /// # Arguments
2239 ///
2240 /// * `request` - No description provided.
2241 /// * `name` - Required. Unique name of the resource in this scope including project and location using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: Redis instances are managed and addressed at regional level so location_id here refers to a GCP region; however, users may choose which specific zone (or collection of zones for cross-zone instances) an instance should be provisioned in. Refer to location_id and alternative_location_id fields for more details.
2242 pub fn locations_instances_patch(
2243 &self,
2244 request: Instance,
2245 name: &str,
2246 ) -> ProjectLocationInstancePatchCall<'a, C> {
2247 ProjectLocationInstancePatchCall {
2248 hub: self.hub,
2249 _request: request,
2250 _name: name.to_string(),
2251 _update_mask: Default::default(),
2252 _delegate: Default::default(),
2253 _additional_params: Default::default(),
2254 _scopes: Default::default(),
2255 }
2256 }
2257
2258 /// Create a builder to help you perform the following task:
2259 ///
2260 /// Reschedule maintenance for a given instance in a given project and location.
2261 ///
2262 /// # Arguments
2263 ///
2264 /// * `request` - No description provided.
2265 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2266 pub fn locations_instances_reschedule_maintenance(
2267 &self,
2268 request: RescheduleMaintenanceRequest,
2269 name: &str,
2270 ) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C> {
2271 ProjectLocationInstanceRescheduleMaintenanceCall {
2272 hub: self.hub,
2273 _request: request,
2274 _name: name.to_string(),
2275 _delegate: Default::default(),
2276 _additional_params: Default::default(),
2277 _scopes: Default::default(),
2278 }
2279 }
2280
2281 /// Create a builder to help you perform the following task:
2282 ///
2283 /// Upgrades Redis instance to the newer Redis version specified in the request.
2284 ///
2285 /// # Arguments
2286 ///
2287 /// * `request` - No description provided.
2288 /// * `name` - Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
2289 pub fn locations_instances_upgrade(
2290 &self,
2291 request: UpgradeInstanceRequest,
2292 name: &str,
2293 ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
2294 ProjectLocationInstanceUpgradeCall {
2295 hub: self.hub,
2296 _request: request,
2297 _name: name.to_string(),
2298 _delegate: Default::default(),
2299 _additional_params: Default::default(),
2300 _scopes: Default::default(),
2301 }
2302 }
2303
2304 /// Create a builder to help you perform the following task:
2305 ///
2306 /// 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`.
2307 ///
2308 /// # Arguments
2309 ///
2310 /// * `name` - The name of the operation resource to be cancelled.
2311 pub fn locations_operations_cancel(
2312 &self,
2313 name: &str,
2314 ) -> ProjectLocationOperationCancelCall<'a, C> {
2315 ProjectLocationOperationCancelCall {
2316 hub: self.hub,
2317 _name: name.to_string(),
2318 _delegate: Default::default(),
2319 _additional_params: Default::default(),
2320 _scopes: Default::default(),
2321 }
2322 }
2323
2324 /// Create a builder to help you perform the following task:
2325 ///
2326 /// 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`.
2327 ///
2328 /// # Arguments
2329 ///
2330 /// * `name` - The name of the operation resource to be deleted.
2331 pub fn locations_operations_delete(
2332 &self,
2333 name: &str,
2334 ) -> ProjectLocationOperationDeleteCall<'a, C> {
2335 ProjectLocationOperationDeleteCall {
2336 hub: self.hub,
2337 _name: name.to_string(),
2338 _delegate: Default::default(),
2339 _additional_params: Default::default(),
2340 _scopes: Default::default(),
2341 }
2342 }
2343
2344 /// Create a builder to help you perform the following task:
2345 ///
2346 /// 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.
2347 ///
2348 /// # Arguments
2349 ///
2350 /// * `name` - The name of the operation resource.
2351 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2352 ProjectLocationOperationGetCall {
2353 hub: self.hub,
2354 _name: name.to_string(),
2355 _delegate: Default::default(),
2356 _additional_params: Default::default(),
2357 _scopes: Default::default(),
2358 }
2359 }
2360
2361 /// Create a builder to help you perform the following task:
2362 ///
2363 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2364 ///
2365 /// # Arguments
2366 ///
2367 /// * `name` - The name of the operation's parent resource.
2368 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2369 ProjectLocationOperationListCall {
2370 hub: self.hub,
2371 _name: name.to_string(),
2372 _return_partial_success: Default::default(),
2373 _page_token: Default::default(),
2374 _page_size: Default::default(),
2375 _filter: Default::default(),
2376 _delegate: Default::default(),
2377 _additional_params: Default::default(),
2378 _scopes: Default::default(),
2379 }
2380 }
2381
2382 /// Create a builder to help you perform the following task:
2383 ///
2384 /// Gets information about a location.
2385 ///
2386 /// # Arguments
2387 ///
2388 /// * `name` - Resource name for the location.
2389 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
2390 ProjectLocationGetCall {
2391 hub: self.hub,
2392 _name: name.to_string(),
2393 _delegate: Default::default(),
2394 _additional_params: Default::default(),
2395 _scopes: Default::default(),
2396 }
2397 }
2398
2399 /// Create a builder to help you perform the following task:
2400 ///
2401 /// Lists information about the supported locations for this service.
2402 ///
2403 /// # Arguments
2404 ///
2405 /// * `name` - The resource that owns the locations collection, if applicable.
2406 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
2407 ProjectLocationListCall {
2408 hub: self.hub,
2409 _name: name.to_string(),
2410 _page_token: Default::default(),
2411 _page_size: Default::default(),
2412 _filter: Default::default(),
2413 _extra_location_types: Default::default(),
2414 _delegate: Default::default(),
2415 _additional_params: Default::default(),
2416 _scopes: Default::default(),
2417 }
2418 }
2419}
2420
2421// ###################
2422// CallBuilders ###
2423// #################
2424
2425/// Deletes a specific backup.
2426///
2427/// A builder for the *locations.backupCollections.backups.delete* method supported by a *project* resource.
2428/// It is not used directly, but through a [`ProjectMethods`] instance.
2429///
2430/// # Example
2431///
2432/// Instantiate a resource method builder
2433///
2434/// ```test_harness,no_run
2435/// # extern crate hyper;
2436/// # extern crate hyper_rustls;
2437/// # extern crate google_redis1 as redis1;
2438/// # async fn dox() {
2439/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2440///
2441/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2442/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2443/// # .with_native_roots()
2444/// # .unwrap()
2445/// # .https_only()
2446/// # .enable_http2()
2447/// # .build();
2448///
2449/// # let executor = hyper_util::rt::TokioExecutor::new();
2450/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2451/// # secret,
2452/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2453/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2454/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2455/// # ),
2456/// # ).build().await.unwrap();
2457///
2458/// # let client = hyper_util::client::legacy::Client::builder(
2459/// # hyper_util::rt::TokioExecutor::new()
2460/// # )
2461/// # .build(
2462/// # hyper_rustls::HttpsConnectorBuilder::new()
2463/// # .with_native_roots()
2464/// # .unwrap()
2465/// # .https_or_http()
2466/// # .enable_http2()
2467/// # .build()
2468/// # );
2469/// # let mut hub = CloudRedis::new(client, auth);
2470/// // You can configure optional parameters by calling the respective setters at will, and
2471/// // execute the final call using `doit()`.
2472/// // Values shown here are possibly random and not representative !
2473/// let result = hub.projects().locations_backup_collections_backups_delete("name")
2474/// .request_id("amet.")
2475/// .doit().await;
2476/// # }
2477/// ```
2478pub struct ProjectLocationBackupCollectionBackupDeleteCall<'a, C>
2479where
2480 C: 'a,
2481{
2482 hub: &'a CloudRedis<C>,
2483 _name: String,
2484 _request_id: Option<String>,
2485 _delegate: Option<&'a mut dyn common::Delegate>,
2486 _additional_params: HashMap<String, String>,
2487 _scopes: BTreeSet<String>,
2488}
2489
2490impl<'a, C> common::CallBuilder for ProjectLocationBackupCollectionBackupDeleteCall<'a, C> {}
2491
2492impl<'a, C> ProjectLocationBackupCollectionBackupDeleteCall<'a, C>
2493where
2494 C: common::Connector,
2495{
2496 /// Perform the operation you have build so far.
2497 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2498 use std::borrow::Cow;
2499 use std::io::{Read, Seek};
2500
2501 use common::{url::Params, ToParts};
2502 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2503
2504 let mut dd = common::DefaultDelegate;
2505 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2506 dlg.begin(common::MethodInfo {
2507 id: "redis.projects.locations.backupCollections.backups.delete",
2508 http_method: hyper::Method::DELETE,
2509 });
2510
2511 for &field in ["alt", "name", "requestId"].iter() {
2512 if self._additional_params.contains_key(field) {
2513 dlg.finished(false);
2514 return Err(common::Error::FieldClash(field));
2515 }
2516 }
2517
2518 let mut params = Params::with_capacity(4 + self._additional_params.len());
2519 params.push("name", self._name);
2520 if let Some(value) = self._request_id.as_ref() {
2521 params.push("requestId", value);
2522 }
2523
2524 params.extend(self._additional_params.iter());
2525
2526 params.push("alt", "json");
2527 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2528 if self._scopes.is_empty() {
2529 self._scopes
2530 .insert(Scope::CloudPlatform.as_ref().to_string());
2531 }
2532
2533 #[allow(clippy::single_element_loop)]
2534 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2535 url = params.uri_replacement(url, param_name, find_this, true);
2536 }
2537 {
2538 let to_remove = ["name"];
2539 params.remove_params(&to_remove);
2540 }
2541
2542 let url = params.parse_with_url(&url);
2543
2544 loop {
2545 let token = match self
2546 .hub
2547 .auth
2548 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2549 .await
2550 {
2551 Ok(token) => token,
2552 Err(e) => match dlg.token(e) {
2553 Ok(token) => token,
2554 Err(e) => {
2555 dlg.finished(false);
2556 return Err(common::Error::MissingToken(e));
2557 }
2558 },
2559 };
2560 let mut req_result = {
2561 let client = &self.hub.client;
2562 dlg.pre_request();
2563 let mut req_builder = hyper::Request::builder()
2564 .method(hyper::Method::DELETE)
2565 .uri(url.as_str())
2566 .header(USER_AGENT, self.hub._user_agent.clone());
2567
2568 if let Some(token) = token.as_ref() {
2569 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2570 }
2571
2572 let request = req_builder
2573 .header(CONTENT_LENGTH, 0_u64)
2574 .body(common::to_body::<String>(None));
2575
2576 client.request(request.unwrap()).await
2577 };
2578
2579 match req_result {
2580 Err(err) => {
2581 if let common::Retry::After(d) = dlg.http_error(&err) {
2582 sleep(d).await;
2583 continue;
2584 }
2585 dlg.finished(false);
2586 return Err(common::Error::HttpError(err));
2587 }
2588 Ok(res) => {
2589 let (mut parts, body) = res.into_parts();
2590 let mut body = common::Body::new(body);
2591 if !parts.status.is_success() {
2592 let bytes = common::to_bytes(body).await.unwrap_or_default();
2593 let error = serde_json::from_str(&common::to_string(&bytes));
2594 let response = common::to_response(parts, bytes.into());
2595
2596 if let common::Retry::After(d) =
2597 dlg.http_failure(&response, error.as_ref().ok())
2598 {
2599 sleep(d).await;
2600 continue;
2601 }
2602
2603 dlg.finished(false);
2604
2605 return Err(match error {
2606 Ok(value) => common::Error::BadRequest(value),
2607 _ => common::Error::Failure(response),
2608 });
2609 }
2610 let response = {
2611 let bytes = common::to_bytes(body).await.unwrap_or_default();
2612 let encoded = common::to_string(&bytes);
2613 match serde_json::from_str(&encoded) {
2614 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2615 Err(error) => {
2616 dlg.response_json_decode_error(&encoded, &error);
2617 return Err(common::Error::JsonDecodeError(
2618 encoded.to_string(),
2619 error,
2620 ));
2621 }
2622 }
2623 };
2624
2625 dlg.finished(true);
2626 return Ok(response);
2627 }
2628 }
2629 }
2630 }
2631
2632 /// Required. Redis backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
2633 ///
2634 /// Sets the *name* path property to the given value.
2635 ///
2636 /// Even though the property as already been set when instantiating this call,
2637 /// we provide this method for API completeness.
2638 pub fn name(
2639 mut self,
2640 new_value: &str,
2641 ) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C> {
2642 self._name = new_value.to_string();
2643 self
2644 }
2645 /// Optional. Idempotent request UUID.
2646 ///
2647 /// Sets the *request id* query property to the given value.
2648 pub fn request_id(
2649 mut self,
2650 new_value: &str,
2651 ) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C> {
2652 self._request_id = Some(new_value.to_string());
2653 self
2654 }
2655 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2656 /// while executing the actual API request.
2657 ///
2658 /// ````text
2659 /// It should be used to handle progress information, and to implement a certain level of resilience.
2660 /// ````
2661 ///
2662 /// Sets the *delegate* property to the given value.
2663 pub fn delegate(
2664 mut self,
2665 new_value: &'a mut dyn common::Delegate,
2666 ) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C> {
2667 self._delegate = Some(new_value);
2668 self
2669 }
2670
2671 /// Set any additional parameter of the query string used in the request.
2672 /// It should be used to set parameters which are not yet available through their own
2673 /// setters.
2674 ///
2675 /// Please note that this method must not be used to set any of the known parameters
2676 /// which have their own setter method. If done anyway, the request will fail.
2677 ///
2678 /// # Additional Parameters
2679 ///
2680 /// * *$.xgafv* (query-string) - V1 error format.
2681 /// * *access_token* (query-string) - OAuth access token.
2682 /// * *alt* (query-string) - Data format for response.
2683 /// * *callback* (query-string) - JSONP
2684 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2685 /// * *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.
2686 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2687 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2688 /// * *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.
2689 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2690 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2691 pub fn param<T>(
2692 mut self,
2693 name: T,
2694 value: T,
2695 ) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C>
2696 where
2697 T: AsRef<str>,
2698 {
2699 self._additional_params
2700 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2701 self
2702 }
2703
2704 /// Identifies the authorization scope for the method you are building.
2705 ///
2706 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2707 /// [`Scope::CloudPlatform`].
2708 ///
2709 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2710 /// tokens for more than one scope.
2711 ///
2712 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2713 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2714 /// sufficient, a read-write scope will do as well.
2715 pub fn add_scope<St>(
2716 mut self,
2717 scope: St,
2718 ) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C>
2719 where
2720 St: AsRef<str>,
2721 {
2722 self._scopes.insert(String::from(scope.as_ref()));
2723 self
2724 }
2725 /// Identifies the authorization scope(s) for the method you are building.
2726 ///
2727 /// See [`Self::add_scope()`] for details.
2728 pub fn add_scopes<I, St>(
2729 mut self,
2730 scopes: I,
2731 ) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C>
2732 where
2733 I: IntoIterator<Item = St>,
2734 St: AsRef<str>,
2735 {
2736 self._scopes
2737 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2738 self
2739 }
2740
2741 /// Removes all scopes, and no default scope will be used either.
2742 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2743 /// for details).
2744 pub fn clear_scopes(mut self) -> ProjectLocationBackupCollectionBackupDeleteCall<'a, C> {
2745 self._scopes.clear();
2746 self
2747 }
2748}
2749
2750/// Exports a specific backup to a customer target Cloud Storage URI.
2751///
2752/// A builder for the *locations.backupCollections.backups.export* method supported by a *project* resource.
2753/// It is not used directly, but through a [`ProjectMethods`] instance.
2754///
2755/// # Example
2756///
2757/// Instantiate a resource method builder
2758///
2759/// ```test_harness,no_run
2760/// # extern crate hyper;
2761/// # extern crate hyper_rustls;
2762/// # extern crate google_redis1 as redis1;
2763/// use redis1::api::ExportBackupRequest;
2764/// # async fn dox() {
2765/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2766///
2767/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2768/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2769/// # .with_native_roots()
2770/// # .unwrap()
2771/// # .https_only()
2772/// # .enable_http2()
2773/// # .build();
2774///
2775/// # let executor = hyper_util::rt::TokioExecutor::new();
2776/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2777/// # secret,
2778/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2779/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2780/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2781/// # ),
2782/// # ).build().await.unwrap();
2783///
2784/// # let client = hyper_util::client::legacy::Client::builder(
2785/// # hyper_util::rt::TokioExecutor::new()
2786/// # )
2787/// # .build(
2788/// # hyper_rustls::HttpsConnectorBuilder::new()
2789/// # .with_native_roots()
2790/// # .unwrap()
2791/// # .https_or_http()
2792/// # .enable_http2()
2793/// # .build()
2794/// # );
2795/// # let mut hub = CloudRedis::new(client, auth);
2796/// // As the method needs a request, you would usually fill it with the desired information
2797/// // into the respective structure. Some of the parts shown here might not be applicable !
2798/// // Values shown here are possibly random and not representative !
2799/// let mut req = ExportBackupRequest::default();
2800///
2801/// // You can configure optional parameters by calling the respective setters at will, and
2802/// // execute the final call using `doit()`.
2803/// // Values shown here are possibly random and not representative !
2804/// let result = hub.projects().locations_backup_collections_backups_export(req, "name")
2805/// .doit().await;
2806/// # }
2807/// ```
2808pub struct ProjectLocationBackupCollectionBackupExportCall<'a, C>
2809where
2810 C: 'a,
2811{
2812 hub: &'a CloudRedis<C>,
2813 _request: ExportBackupRequest,
2814 _name: String,
2815 _delegate: Option<&'a mut dyn common::Delegate>,
2816 _additional_params: HashMap<String, String>,
2817 _scopes: BTreeSet<String>,
2818}
2819
2820impl<'a, C> common::CallBuilder for ProjectLocationBackupCollectionBackupExportCall<'a, C> {}
2821
2822impl<'a, C> ProjectLocationBackupCollectionBackupExportCall<'a, C>
2823where
2824 C: common::Connector,
2825{
2826 /// Perform the operation you have build so far.
2827 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2828 use std::borrow::Cow;
2829 use std::io::{Read, Seek};
2830
2831 use common::{url::Params, ToParts};
2832 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2833
2834 let mut dd = common::DefaultDelegate;
2835 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2836 dlg.begin(common::MethodInfo {
2837 id: "redis.projects.locations.backupCollections.backups.export",
2838 http_method: hyper::Method::POST,
2839 });
2840
2841 for &field in ["alt", "name"].iter() {
2842 if self._additional_params.contains_key(field) {
2843 dlg.finished(false);
2844 return Err(common::Error::FieldClash(field));
2845 }
2846 }
2847
2848 let mut params = Params::with_capacity(4 + self._additional_params.len());
2849 params.push("name", self._name);
2850
2851 params.extend(self._additional_params.iter());
2852
2853 params.push("alt", "json");
2854 let mut url = self.hub._base_url.clone() + "v1/{+name}:export";
2855 if self._scopes.is_empty() {
2856 self._scopes
2857 .insert(Scope::CloudPlatform.as_ref().to_string());
2858 }
2859
2860 #[allow(clippy::single_element_loop)]
2861 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2862 url = params.uri_replacement(url, param_name, find_this, true);
2863 }
2864 {
2865 let to_remove = ["name"];
2866 params.remove_params(&to_remove);
2867 }
2868
2869 let url = params.parse_with_url(&url);
2870
2871 let mut json_mime_type = mime::APPLICATION_JSON;
2872 let mut request_value_reader = {
2873 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2874 common::remove_json_null_values(&mut value);
2875 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2876 serde_json::to_writer(&mut dst, &value).unwrap();
2877 dst
2878 };
2879 let request_size = request_value_reader
2880 .seek(std::io::SeekFrom::End(0))
2881 .unwrap();
2882 request_value_reader
2883 .seek(std::io::SeekFrom::Start(0))
2884 .unwrap();
2885
2886 loop {
2887 let token = match self
2888 .hub
2889 .auth
2890 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2891 .await
2892 {
2893 Ok(token) => token,
2894 Err(e) => match dlg.token(e) {
2895 Ok(token) => token,
2896 Err(e) => {
2897 dlg.finished(false);
2898 return Err(common::Error::MissingToken(e));
2899 }
2900 },
2901 };
2902 request_value_reader
2903 .seek(std::io::SeekFrom::Start(0))
2904 .unwrap();
2905 let mut req_result = {
2906 let client = &self.hub.client;
2907 dlg.pre_request();
2908 let mut req_builder = hyper::Request::builder()
2909 .method(hyper::Method::POST)
2910 .uri(url.as_str())
2911 .header(USER_AGENT, self.hub._user_agent.clone());
2912
2913 if let Some(token) = token.as_ref() {
2914 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2915 }
2916
2917 let request = req_builder
2918 .header(CONTENT_TYPE, json_mime_type.to_string())
2919 .header(CONTENT_LENGTH, request_size as u64)
2920 .body(common::to_body(
2921 request_value_reader.get_ref().clone().into(),
2922 ));
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 ///
2981 /// Sets the *request* property to the given value.
2982 ///
2983 /// Even though the property as already been set when instantiating this call,
2984 /// we provide this method for API completeness.
2985 pub fn request(
2986 mut self,
2987 new_value: ExportBackupRequest,
2988 ) -> ProjectLocationBackupCollectionBackupExportCall<'a, C> {
2989 self._request = new_value;
2990 self
2991 }
2992 /// Required. Redis backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
2993 ///
2994 /// Sets the *name* path property to the given value.
2995 ///
2996 /// Even though the property as already been set when instantiating this call,
2997 /// we provide this method for API completeness.
2998 pub fn name(
2999 mut self,
3000 new_value: &str,
3001 ) -> ProjectLocationBackupCollectionBackupExportCall<'a, C> {
3002 self._name = new_value.to_string();
3003 self
3004 }
3005 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3006 /// while executing the actual API request.
3007 ///
3008 /// ````text
3009 /// It should be used to handle progress information, and to implement a certain level of resilience.
3010 /// ````
3011 ///
3012 /// Sets the *delegate* property to the given value.
3013 pub fn delegate(
3014 mut self,
3015 new_value: &'a mut dyn common::Delegate,
3016 ) -> ProjectLocationBackupCollectionBackupExportCall<'a, C> {
3017 self._delegate = Some(new_value);
3018 self
3019 }
3020
3021 /// Set any additional parameter of the query string used in the request.
3022 /// It should be used to set parameters which are not yet available through their own
3023 /// setters.
3024 ///
3025 /// Please note that this method must not be used to set any of the known parameters
3026 /// which have their own setter method. If done anyway, the request will fail.
3027 ///
3028 /// # Additional Parameters
3029 ///
3030 /// * *$.xgafv* (query-string) - V1 error format.
3031 /// * *access_token* (query-string) - OAuth access token.
3032 /// * *alt* (query-string) - Data format for response.
3033 /// * *callback* (query-string) - JSONP
3034 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3035 /// * *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.
3036 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3037 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3038 /// * *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.
3039 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3040 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3041 pub fn param<T>(
3042 mut self,
3043 name: T,
3044 value: T,
3045 ) -> ProjectLocationBackupCollectionBackupExportCall<'a, C>
3046 where
3047 T: AsRef<str>,
3048 {
3049 self._additional_params
3050 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3051 self
3052 }
3053
3054 /// Identifies the authorization scope for the method you are building.
3055 ///
3056 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3057 /// [`Scope::CloudPlatform`].
3058 ///
3059 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3060 /// tokens for more than one scope.
3061 ///
3062 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3063 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3064 /// sufficient, a read-write scope will do as well.
3065 pub fn add_scope<St>(
3066 mut self,
3067 scope: St,
3068 ) -> ProjectLocationBackupCollectionBackupExportCall<'a, C>
3069 where
3070 St: AsRef<str>,
3071 {
3072 self._scopes.insert(String::from(scope.as_ref()));
3073 self
3074 }
3075 /// Identifies the authorization scope(s) for the method you are building.
3076 ///
3077 /// See [`Self::add_scope()`] for details.
3078 pub fn add_scopes<I, St>(
3079 mut self,
3080 scopes: I,
3081 ) -> ProjectLocationBackupCollectionBackupExportCall<'a, C>
3082 where
3083 I: IntoIterator<Item = St>,
3084 St: AsRef<str>,
3085 {
3086 self._scopes
3087 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3088 self
3089 }
3090
3091 /// Removes all scopes, and no default scope will be used either.
3092 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3093 /// for details).
3094 pub fn clear_scopes(mut self) -> ProjectLocationBackupCollectionBackupExportCall<'a, C> {
3095 self._scopes.clear();
3096 self
3097 }
3098}
3099
3100/// Gets the details of a specific backup.
3101///
3102/// A builder for the *locations.backupCollections.backups.get* method supported by a *project* resource.
3103/// It is not used directly, but through a [`ProjectMethods`] instance.
3104///
3105/// # Example
3106///
3107/// Instantiate a resource method builder
3108///
3109/// ```test_harness,no_run
3110/// # extern crate hyper;
3111/// # extern crate hyper_rustls;
3112/// # extern crate google_redis1 as redis1;
3113/// # async fn dox() {
3114/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3115///
3116/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3117/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3118/// # .with_native_roots()
3119/// # .unwrap()
3120/// # .https_only()
3121/// # .enable_http2()
3122/// # .build();
3123///
3124/// # let executor = hyper_util::rt::TokioExecutor::new();
3125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3126/// # secret,
3127/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3128/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3129/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3130/// # ),
3131/// # ).build().await.unwrap();
3132///
3133/// # let client = hyper_util::client::legacy::Client::builder(
3134/// # hyper_util::rt::TokioExecutor::new()
3135/// # )
3136/// # .build(
3137/// # hyper_rustls::HttpsConnectorBuilder::new()
3138/// # .with_native_roots()
3139/// # .unwrap()
3140/// # .https_or_http()
3141/// # .enable_http2()
3142/// # .build()
3143/// # );
3144/// # let mut hub = CloudRedis::new(client, auth);
3145/// // You can configure optional parameters by calling the respective setters at will, and
3146/// // execute the final call using `doit()`.
3147/// // Values shown here are possibly random and not representative !
3148/// let result = hub.projects().locations_backup_collections_backups_get("name")
3149/// .doit().await;
3150/// # }
3151/// ```
3152pub struct ProjectLocationBackupCollectionBackupGetCall<'a, C>
3153where
3154 C: 'a,
3155{
3156 hub: &'a CloudRedis<C>,
3157 _name: String,
3158 _delegate: Option<&'a mut dyn common::Delegate>,
3159 _additional_params: HashMap<String, String>,
3160 _scopes: BTreeSet<String>,
3161}
3162
3163impl<'a, C> common::CallBuilder for ProjectLocationBackupCollectionBackupGetCall<'a, C> {}
3164
3165impl<'a, C> ProjectLocationBackupCollectionBackupGetCall<'a, C>
3166where
3167 C: common::Connector,
3168{
3169 /// Perform the operation you have build so far.
3170 pub async fn doit(mut self) -> common::Result<(common::Response, Backup)> {
3171 use std::borrow::Cow;
3172 use std::io::{Read, Seek};
3173
3174 use common::{url::Params, ToParts};
3175 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3176
3177 let mut dd = common::DefaultDelegate;
3178 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3179 dlg.begin(common::MethodInfo {
3180 id: "redis.projects.locations.backupCollections.backups.get",
3181 http_method: hyper::Method::GET,
3182 });
3183
3184 for &field in ["alt", "name"].iter() {
3185 if self._additional_params.contains_key(field) {
3186 dlg.finished(false);
3187 return Err(common::Error::FieldClash(field));
3188 }
3189 }
3190
3191 let mut params = Params::with_capacity(3 + self._additional_params.len());
3192 params.push("name", self._name);
3193
3194 params.extend(self._additional_params.iter());
3195
3196 params.push("alt", "json");
3197 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3198 if self._scopes.is_empty() {
3199 self._scopes
3200 .insert(Scope::CloudPlatform.as_ref().to_string());
3201 }
3202
3203 #[allow(clippy::single_element_loop)]
3204 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3205 url = params.uri_replacement(url, param_name, find_this, true);
3206 }
3207 {
3208 let to_remove = ["name"];
3209 params.remove_params(&to_remove);
3210 }
3211
3212 let url = params.parse_with_url(&url);
3213
3214 loop {
3215 let token = match self
3216 .hub
3217 .auth
3218 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3219 .await
3220 {
3221 Ok(token) => token,
3222 Err(e) => match dlg.token(e) {
3223 Ok(token) => token,
3224 Err(e) => {
3225 dlg.finished(false);
3226 return Err(common::Error::MissingToken(e));
3227 }
3228 },
3229 };
3230 let mut req_result = {
3231 let client = &self.hub.client;
3232 dlg.pre_request();
3233 let mut req_builder = hyper::Request::builder()
3234 .method(hyper::Method::GET)
3235 .uri(url.as_str())
3236 .header(USER_AGENT, self.hub._user_agent.clone());
3237
3238 if let Some(token) = token.as_ref() {
3239 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3240 }
3241
3242 let request = req_builder
3243 .header(CONTENT_LENGTH, 0_u64)
3244 .body(common::to_body::<String>(None));
3245
3246 client.request(request.unwrap()).await
3247 };
3248
3249 match req_result {
3250 Err(err) => {
3251 if let common::Retry::After(d) = dlg.http_error(&err) {
3252 sleep(d).await;
3253 continue;
3254 }
3255 dlg.finished(false);
3256 return Err(common::Error::HttpError(err));
3257 }
3258 Ok(res) => {
3259 let (mut parts, body) = res.into_parts();
3260 let mut body = common::Body::new(body);
3261 if !parts.status.is_success() {
3262 let bytes = common::to_bytes(body).await.unwrap_or_default();
3263 let error = serde_json::from_str(&common::to_string(&bytes));
3264 let response = common::to_response(parts, bytes.into());
3265
3266 if let common::Retry::After(d) =
3267 dlg.http_failure(&response, error.as_ref().ok())
3268 {
3269 sleep(d).await;
3270 continue;
3271 }
3272
3273 dlg.finished(false);
3274
3275 return Err(match error {
3276 Ok(value) => common::Error::BadRequest(value),
3277 _ => common::Error::Failure(response),
3278 });
3279 }
3280 let response = {
3281 let bytes = common::to_bytes(body).await.unwrap_or_default();
3282 let encoded = common::to_string(&bytes);
3283 match serde_json::from_str(&encoded) {
3284 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3285 Err(error) => {
3286 dlg.response_json_decode_error(&encoded, &error);
3287 return Err(common::Error::JsonDecodeError(
3288 encoded.to_string(),
3289 error,
3290 ));
3291 }
3292 }
3293 };
3294
3295 dlg.finished(true);
3296 return Ok(response);
3297 }
3298 }
3299 }
3300 }
3301
3302 /// Required. Redis backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
3303 ///
3304 /// Sets the *name* path property to the given value.
3305 ///
3306 /// Even though the property as already been set when instantiating this call,
3307 /// we provide this method for API completeness.
3308 pub fn name(mut self, new_value: &str) -> ProjectLocationBackupCollectionBackupGetCall<'a, C> {
3309 self._name = new_value.to_string();
3310 self
3311 }
3312 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3313 /// while executing the actual API request.
3314 ///
3315 /// ````text
3316 /// It should be used to handle progress information, and to implement a certain level of resilience.
3317 /// ````
3318 ///
3319 /// Sets the *delegate* property to the given value.
3320 pub fn delegate(
3321 mut self,
3322 new_value: &'a mut dyn common::Delegate,
3323 ) -> ProjectLocationBackupCollectionBackupGetCall<'a, C> {
3324 self._delegate = Some(new_value);
3325 self
3326 }
3327
3328 /// Set any additional parameter of the query string used in the request.
3329 /// It should be used to set parameters which are not yet available through their own
3330 /// setters.
3331 ///
3332 /// Please note that this method must not be used to set any of the known parameters
3333 /// which have their own setter method. If done anyway, the request will fail.
3334 ///
3335 /// # Additional Parameters
3336 ///
3337 /// * *$.xgafv* (query-string) - V1 error format.
3338 /// * *access_token* (query-string) - OAuth access token.
3339 /// * *alt* (query-string) - Data format for response.
3340 /// * *callback* (query-string) - JSONP
3341 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3342 /// * *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.
3343 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3344 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3345 /// * *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.
3346 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3347 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3348 pub fn param<T>(
3349 mut self,
3350 name: T,
3351 value: T,
3352 ) -> ProjectLocationBackupCollectionBackupGetCall<'a, C>
3353 where
3354 T: AsRef<str>,
3355 {
3356 self._additional_params
3357 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3358 self
3359 }
3360
3361 /// Identifies the authorization scope for the method you are building.
3362 ///
3363 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3364 /// [`Scope::CloudPlatform`].
3365 ///
3366 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3367 /// tokens for more than one scope.
3368 ///
3369 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3370 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3371 /// sufficient, a read-write scope will do as well.
3372 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupCollectionBackupGetCall<'a, C>
3373 where
3374 St: AsRef<str>,
3375 {
3376 self._scopes.insert(String::from(scope.as_ref()));
3377 self
3378 }
3379 /// Identifies the authorization scope(s) for the method you are building.
3380 ///
3381 /// See [`Self::add_scope()`] for details.
3382 pub fn add_scopes<I, St>(
3383 mut self,
3384 scopes: I,
3385 ) -> ProjectLocationBackupCollectionBackupGetCall<'a, C>
3386 where
3387 I: IntoIterator<Item = St>,
3388 St: AsRef<str>,
3389 {
3390 self._scopes
3391 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3392 self
3393 }
3394
3395 /// Removes all scopes, and no default scope will be used either.
3396 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3397 /// for details).
3398 pub fn clear_scopes(mut self) -> ProjectLocationBackupCollectionBackupGetCall<'a, C> {
3399 self._scopes.clear();
3400 self
3401 }
3402}
3403
3404/// Lists all backups owned by a backup collection.
3405///
3406/// A builder for the *locations.backupCollections.backups.list* method supported by a *project* resource.
3407/// It is not used directly, but through a [`ProjectMethods`] instance.
3408///
3409/// # Example
3410///
3411/// Instantiate a resource method builder
3412///
3413/// ```test_harness,no_run
3414/// # extern crate hyper;
3415/// # extern crate hyper_rustls;
3416/// # extern crate google_redis1 as redis1;
3417/// # async fn dox() {
3418/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3419///
3420/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3421/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3422/// # .with_native_roots()
3423/// # .unwrap()
3424/// # .https_only()
3425/// # .enable_http2()
3426/// # .build();
3427///
3428/// # let executor = hyper_util::rt::TokioExecutor::new();
3429/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3430/// # secret,
3431/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3432/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3433/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3434/// # ),
3435/// # ).build().await.unwrap();
3436///
3437/// # let client = hyper_util::client::legacy::Client::builder(
3438/// # hyper_util::rt::TokioExecutor::new()
3439/// # )
3440/// # .build(
3441/// # hyper_rustls::HttpsConnectorBuilder::new()
3442/// # .with_native_roots()
3443/// # .unwrap()
3444/// # .https_or_http()
3445/// # .enable_http2()
3446/// # .build()
3447/// # );
3448/// # let mut hub = CloudRedis::new(client, auth);
3449/// // You can configure optional parameters by calling the respective setters at will, and
3450/// // execute the final call using `doit()`.
3451/// // Values shown here are possibly random and not representative !
3452/// let result = hub.projects().locations_backup_collections_backups_list("parent")
3453/// .page_token("Lorem")
3454/// .page_size(-12)
3455/// .doit().await;
3456/// # }
3457/// ```
3458pub struct ProjectLocationBackupCollectionBackupListCall<'a, C>
3459where
3460 C: 'a,
3461{
3462 hub: &'a CloudRedis<C>,
3463 _parent: String,
3464 _page_token: Option<String>,
3465 _page_size: Option<i32>,
3466 _delegate: Option<&'a mut dyn common::Delegate>,
3467 _additional_params: HashMap<String, String>,
3468 _scopes: BTreeSet<String>,
3469}
3470
3471impl<'a, C> common::CallBuilder for ProjectLocationBackupCollectionBackupListCall<'a, C> {}
3472
3473impl<'a, C> ProjectLocationBackupCollectionBackupListCall<'a, C>
3474where
3475 C: common::Connector,
3476{
3477 /// Perform the operation you have build so far.
3478 pub async fn doit(mut self) -> common::Result<(common::Response, ListBackupsResponse)> {
3479 use std::borrow::Cow;
3480 use std::io::{Read, Seek};
3481
3482 use common::{url::Params, ToParts};
3483 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3484
3485 let mut dd = common::DefaultDelegate;
3486 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3487 dlg.begin(common::MethodInfo {
3488 id: "redis.projects.locations.backupCollections.backups.list",
3489 http_method: hyper::Method::GET,
3490 });
3491
3492 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3493 if self._additional_params.contains_key(field) {
3494 dlg.finished(false);
3495 return Err(common::Error::FieldClash(field));
3496 }
3497 }
3498
3499 let mut params = Params::with_capacity(5 + self._additional_params.len());
3500 params.push("parent", self._parent);
3501 if let Some(value) = self._page_token.as_ref() {
3502 params.push("pageToken", value);
3503 }
3504 if let Some(value) = self._page_size.as_ref() {
3505 params.push("pageSize", value.to_string());
3506 }
3507
3508 params.extend(self._additional_params.iter());
3509
3510 params.push("alt", "json");
3511 let mut url = self.hub._base_url.clone() + "v1/{+parent}/backups";
3512 if self._scopes.is_empty() {
3513 self._scopes
3514 .insert(Scope::CloudPlatform.as_ref().to_string());
3515 }
3516
3517 #[allow(clippy::single_element_loop)]
3518 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3519 url = params.uri_replacement(url, param_name, find_this, true);
3520 }
3521 {
3522 let to_remove = ["parent"];
3523 params.remove_params(&to_remove);
3524 }
3525
3526 let url = params.parse_with_url(&url);
3527
3528 loop {
3529 let token = match self
3530 .hub
3531 .auth
3532 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3533 .await
3534 {
3535 Ok(token) => token,
3536 Err(e) => match dlg.token(e) {
3537 Ok(token) => token,
3538 Err(e) => {
3539 dlg.finished(false);
3540 return Err(common::Error::MissingToken(e));
3541 }
3542 },
3543 };
3544 let mut req_result = {
3545 let client = &self.hub.client;
3546 dlg.pre_request();
3547 let mut req_builder = hyper::Request::builder()
3548 .method(hyper::Method::GET)
3549 .uri(url.as_str())
3550 .header(USER_AGENT, self.hub._user_agent.clone());
3551
3552 if let Some(token) = token.as_ref() {
3553 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3554 }
3555
3556 let request = req_builder
3557 .header(CONTENT_LENGTH, 0_u64)
3558 .body(common::to_body::<String>(None));
3559
3560 client.request(request.unwrap()).await
3561 };
3562
3563 match req_result {
3564 Err(err) => {
3565 if let common::Retry::After(d) = dlg.http_error(&err) {
3566 sleep(d).await;
3567 continue;
3568 }
3569 dlg.finished(false);
3570 return Err(common::Error::HttpError(err));
3571 }
3572 Ok(res) => {
3573 let (mut parts, body) = res.into_parts();
3574 let mut body = common::Body::new(body);
3575 if !parts.status.is_success() {
3576 let bytes = common::to_bytes(body).await.unwrap_or_default();
3577 let error = serde_json::from_str(&common::to_string(&bytes));
3578 let response = common::to_response(parts, bytes.into());
3579
3580 if let common::Retry::After(d) =
3581 dlg.http_failure(&response, error.as_ref().ok())
3582 {
3583 sleep(d).await;
3584 continue;
3585 }
3586
3587 dlg.finished(false);
3588
3589 return Err(match error {
3590 Ok(value) => common::Error::BadRequest(value),
3591 _ => common::Error::Failure(response),
3592 });
3593 }
3594 let response = {
3595 let bytes = common::to_bytes(body).await.unwrap_or_default();
3596 let encoded = common::to_string(&bytes);
3597 match serde_json::from_str(&encoded) {
3598 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3599 Err(error) => {
3600 dlg.response_json_decode_error(&encoded, &error);
3601 return Err(common::Error::JsonDecodeError(
3602 encoded.to_string(),
3603 error,
3604 ));
3605 }
3606 }
3607 };
3608
3609 dlg.finished(true);
3610 return Ok(response);
3611 }
3612 }
3613 }
3614 }
3615
3616 /// Required. The resource name of the backupCollection using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
3617 ///
3618 /// Sets the *parent* path property to the given value.
3619 ///
3620 /// Even though the property as already been set when instantiating this call,
3621 /// we provide this method for API completeness.
3622 pub fn parent(
3623 mut self,
3624 new_value: &str,
3625 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C> {
3626 self._parent = new_value.to_string();
3627 self
3628 }
3629 /// Optional. The `next_page_token` value returned from a previous [ListBackupCollections] request, if any.
3630 ///
3631 /// Sets the *page token* query property to the given value.
3632 pub fn page_token(
3633 mut self,
3634 new_value: &str,
3635 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C> {
3636 self._page_token = Some(new_value.to_string());
3637 self
3638 }
3639 /// Optional. The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's `next_page_token` to determine if there are more clusters left to be queried.
3640 ///
3641 /// Sets the *page size* query property to the given value.
3642 pub fn page_size(
3643 mut self,
3644 new_value: i32,
3645 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C> {
3646 self._page_size = Some(new_value);
3647 self
3648 }
3649 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3650 /// while executing the actual API request.
3651 ///
3652 /// ````text
3653 /// It should be used to handle progress information, and to implement a certain level of resilience.
3654 /// ````
3655 ///
3656 /// Sets the *delegate* property to the given value.
3657 pub fn delegate(
3658 mut self,
3659 new_value: &'a mut dyn common::Delegate,
3660 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C> {
3661 self._delegate = Some(new_value);
3662 self
3663 }
3664
3665 /// Set any additional parameter of the query string used in the request.
3666 /// It should be used to set parameters which are not yet available through their own
3667 /// setters.
3668 ///
3669 /// Please note that this method must not be used to set any of the known parameters
3670 /// which have their own setter method. If done anyway, the request will fail.
3671 ///
3672 /// # Additional Parameters
3673 ///
3674 /// * *$.xgafv* (query-string) - V1 error format.
3675 /// * *access_token* (query-string) - OAuth access token.
3676 /// * *alt* (query-string) - Data format for response.
3677 /// * *callback* (query-string) - JSONP
3678 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3679 /// * *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.
3680 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3681 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3682 /// * *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.
3683 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3684 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3685 pub fn param<T>(
3686 mut self,
3687 name: T,
3688 value: T,
3689 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C>
3690 where
3691 T: AsRef<str>,
3692 {
3693 self._additional_params
3694 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3695 self
3696 }
3697
3698 /// Identifies the authorization scope for the method you are building.
3699 ///
3700 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3701 /// [`Scope::CloudPlatform`].
3702 ///
3703 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3704 /// tokens for more than one scope.
3705 ///
3706 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3707 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3708 /// sufficient, a read-write scope will do as well.
3709 pub fn add_scope<St>(
3710 mut self,
3711 scope: St,
3712 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C>
3713 where
3714 St: AsRef<str>,
3715 {
3716 self._scopes.insert(String::from(scope.as_ref()));
3717 self
3718 }
3719 /// Identifies the authorization scope(s) for the method you are building.
3720 ///
3721 /// See [`Self::add_scope()`] for details.
3722 pub fn add_scopes<I, St>(
3723 mut self,
3724 scopes: I,
3725 ) -> ProjectLocationBackupCollectionBackupListCall<'a, C>
3726 where
3727 I: IntoIterator<Item = St>,
3728 St: AsRef<str>,
3729 {
3730 self._scopes
3731 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3732 self
3733 }
3734
3735 /// Removes all scopes, and no default scope will be used either.
3736 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3737 /// for details).
3738 pub fn clear_scopes(mut self) -> ProjectLocationBackupCollectionBackupListCall<'a, C> {
3739 self._scopes.clear();
3740 self
3741 }
3742}
3743
3744/// Get a backup collection.
3745///
3746/// A builder for the *locations.backupCollections.get* method supported by a *project* resource.
3747/// It is not used directly, but through a [`ProjectMethods`] instance.
3748///
3749/// # Example
3750///
3751/// Instantiate a resource method builder
3752///
3753/// ```test_harness,no_run
3754/// # extern crate hyper;
3755/// # extern crate hyper_rustls;
3756/// # extern crate google_redis1 as redis1;
3757/// # async fn dox() {
3758/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3759///
3760/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3761/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3762/// # .with_native_roots()
3763/// # .unwrap()
3764/// # .https_only()
3765/// # .enable_http2()
3766/// # .build();
3767///
3768/// # let executor = hyper_util::rt::TokioExecutor::new();
3769/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3770/// # secret,
3771/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3772/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3773/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3774/// # ),
3775/// # ).build().await.unwrap();
3776///
3777/// # let client = hyper_util::client::legacy::Client::builder(
3778/// # hyper_util::rt::TokioExecutor::new()
3779/// # )
3780/// # .build(
3781/// # hyper_rustls::HttpsConnectorBuilder::new()
3782/// # .with_native_roots()
3783/// # .unwrap()
3784/// # .https_or_http()
3785/// # .enable_http2()
3786/// # .build()
3787/// # );
3788/// # let mut hub = CloudRedis::new(client, auth);
3789/// // You can configure optional parameters by calling the respective setters at will, and
3790/// // execute the final call using `doit()`.
3791/// // Values shown here are possibly random and not representative !
3792/// let result = hub.projects().locations_backup_collections_get("name")
3793/// .doit().await;
3794/// # }
3795/// ```
3796pub struct ProjectLocationBackupCollectionGetCall<'a, C>
3797where
3798 C: 'a,
3799{
3800 hub: &'a CloudRedis<C>,
3801 _name: String,
3802 _delegate: Option<&'a mut dyn common::Delegate>,
3803 _additional_params: HashMap<String, String>,
3804 _scopes: BTreeSet<String>,
3805}
3806
3807impl<'a, C> common::CallBuilder for ProjectLocationBackupCollectionGetCall<'a, C> {}
3808
3809impl<'a, C> ProjectLocationBackupCollectionGetCall<'a, C>
3810where
3811 C: common::Connector,
3812{
3813 /// Perform the operation you have build so far.
3814 pub async fn doit(mut self) -> common::Result<(common::Response, BackupCollection)> {
3815 use std::borrow::Cow;
3816 use std::io::{Read, Seek};
3817
3818 use common::{url::Params, ToParts};
3819 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3820
3821 let mut dd = common::DefaultDelegate;
3822 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3823 dlg.begin(common::MethodInfo {
3824 id: "redis.projects.locations.backupCollections.get",
3825 http_method: hyper::Method::GET,
3826 });
3827
3828 for &field in ["alt", "name"].iter() {
3829 if self._additional_params.contains_key(field) {
3830 dlg.finished(false);
3831 return Err(common::Error::FieldClash(field));
3832 }
3833 }
3834
3835 let mut params = Params::with_capacity(3 + self._additional_params.len());
3836 params.push("name", self._name);
3837
3838 params.extend(self._additional_params.iter());
3839
3840 params.push("alt", "json");
3841 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3842 if self._scopes.is_empty() {
3843 self._scopes
3844 .insert(Scope::CloudPlatform.as_ref().to_string());
3845 }
3846
3847 #[allow(clippy::single_element_loop)]
3848 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3849 url = params.uri_replacement(url, param_name, find_this, true);
3850 }
3851 {
3852 let to_remove = ["name"];
3853 params.remove_params(&to_remove);
3854 }
3855
3856 let url = params.parse_with_url(&url);
3857
3858 loop {
3859 let token = match self
3860 .hub
3861 .auth
3862 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3863 .await
3864 {
3865 Ok(token) => token,
3866 Err(e) => match dlg.token(e) {
3867 Ok(token) => token,
3868 Err(e) => {
3869 dlg.finished(false);
3870 return Err(common::Error::MissingToken(e));
3871 }
3872 },
3873 };
3874 let mut req_result = {
3875 let client = &self.hub.client;
3876 dlg.pre_request();
3877 let mut req_builder = hyper::Request::builder()
3878 .method(hyper::Method::GET)
3879 .uri(url.as_str())
3880 .header(USER_AGENT, self.hub._user_agent.clone());
3881
3882 if let Some(token) = token.as_ref() {
3883 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3884 }
3885
3886 let request = req_builder
3887 .header(CONTENT_LENGTH, 0_u64)
3888 .body(common::to_body::<String>(None));
3889
3890 client.request(request.unwrap()).await
3891 };
3892
3893 match req_result {
3894 Err(err) => {
3895 if let common::Retry::After(d) = dlg.http_error(&err) {
3896 sleep(d).await;
3897 continue;
3898 }
3899 dlg.finished(false);
3900 return Err(common::Error::HttpError(err));
3901 }
3902 Ok(res) => {
3903 let (mut parts, body) = res.into_parts();
3904 let mut body = common::Body::new(body);
3905 if !parts.status.is_success() {
3906 let bytes = common::to_bytes(body).await.unwrap_or_default();
3907 let error = serde_json::from_str(&common::to_string(&bytes));
3908 let response = common::to_response(parts, bytes.into());
3909
3910 if let common::Retry::After(d) =
3911 dlg.http_failure(&response, error.as_ref().ok())
3912 {
3913 sleep(d).await;
3914 continue;
3915 }
3916
3917 dlg.finished(false);
3918
3919 return Err(match error {
3920 Ok(value) => common::Error::BadRequest(value),
3921 _ => common::Error::Failure(response),
3922 });
3923 }
3924 let response = {
3925 let bytes = common::to_bytes(body).await.unwrap_or_default();
3926 let encoded = common::to_string(&bytes);
3927 match serde_json::from_str(&encoded) {
3928 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3929 Err(error) => {
3930 dlg.response_json_decode_error(&encoded, &error);
3931 return Err(common::Error::JsonDecodeError(
3932 encoded.to_string(),
3933 error,
3934 ));
3935 }
3936 }
3937 };
3938
3939 dlg.finished(true);
3940 return Ok(response);
3941 }
3942 }
3943 }
3944 }
3945
3946 /// Required. Redis backupCollection resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` where `location_id` refers to a Google Cloud region.
3947 ///
3948 /// Sets the *name* path property to the given value.
3949 ///
3950 /// Even though the property as already been set when instantiating this call,
3951 /// we provide this method for API completeness.
3952 pub fn name(mut self, new_value: &str) -> ProjectLocationBackupCollectionGetCall<'a, C> {
3953 self._name = new_value.to_string();
3954 self
3955 }
3956 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3957 /// while executing the actual API request.
3958 ///
3959 /// ````text
3960 /// It should be used to handle progress information, and to implement a certain level of resilience.
3961 /// ````
3962 ///
3963 /// Sets the *delegate* property to the given value.
3964 pub fn delegate(
3965 mut self,
3966 new_value: &'a mut dyn common::Delegate,
3967 ) -> ProjectLocationBackupCollectionGetCall<'a, C> {
3968 self._delegate = Some(new_value);
3969 self
3970 }
3971
3972 /// Set any additional parameter of the query string used in the request.
3973 /// It should be used to set parameters which are not yet available through their own
3974 /// setters.
3975 ///
3976 /// Please note that this method must not be used to set any of the known parameters
3977 /// which have their own setter method. If done anyway, the request will fail.
3978 ///
3979 /// # Additional Parameters
3980 ///
3981 /// * *$.xgafv* (query-string) - V1 error format.
3982 /// * *access_token* (query-string) - OAuth access token.
3983 /// * *alt* (query-string) - Data format for response.
3984 /// * *callback* (query-string) - JSONP
3985 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3986 /// * *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.
3987 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3988 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3989 /// * *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.
3990 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3991 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3992 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupCollectionGetCall<'a, C>
3993 where
3994 T: AsRef<str>,
3995 {
3996 self._additional_params
3997 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3998 self
3999 }
4000
4001 /// Identifies the authorization scope for the method you are building.
4002 ///
4003 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4004 /// [`Scope::CloudPlatform`].
4005 ///
4006 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4007 /// tokens for more than one scope.
4008 ///
4009 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4010 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4011 /// sufficient, a read-write scope will do as well.
4012 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupCollectionGetCall<'a, C>
4013 where
4014 St: AsRef<str>,
4015 {
4016 self._scopes.insert(String::from(scope.as_ref()));
4017 self
4018 }
4019 /// Identifies the authorization scope(s) for the method you are building.
4020 ///
4021 /// See [`Self::add_scope()`] for details.
4022 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupCollectionGetCall<'a, C>
4023 where
4024 I: IntoIterator<Item = St>,
4025 St: AsRef<str>,
4026 {
4027 self._scopes
4028 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4029 self
4030 }
4031
4032 /// Removes all scopes, and no default scope will be used either.
4033 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4034 /// for details).
4035 pub fn clear_scopes(mut self) -> ProjectLocationBackupCollectionGetCall<'a, C> {
4036 self._scopes.clear();
4037 self
4038 }
4039}
4040
4041/// Lists all backup collections owned by a consumer project in either the specified location (region) or all locations. If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
4042///
4043/// A builder for the *locations.backupCollections.list* method supported by a *project* resource.
4044/// It is not used directly, but through a [`ProjectMethods`] instance.
4045///
4046/// # Example
4047///
4048/// Instantiate a resource method builder
4049///
4050/// ```test_harness,no_run
4051/// # extern crate hyper;
4052/// # extern crate hyper_rustls;
4053/// # extern crate google_redis1 as redis1;
4054/// # async fn dox() {
4055/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4056///
4057/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4058/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4059/// # .with_native_roots()
4060/// # .unwrap()
4061/// # .https_only()
4062/// # .enable_http2()
4063/// # .build();
4064///
4065/// # let executor = hyper_util::rt::TokioExecutor::new();
4066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4067/// # secret,
4068/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4069/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4070/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4071/// # ),
4072/// # ).build().await.unwrap();
4073///
4074/// # let client = hyper_util::client::legacy::Client::builder(
4075/// # hyper_util::rt::TokioExecutor::new()
4076/// # )
4077/// # .build(
4078/// # hyper_rustls::HttpsConnectorBuilder::new()
4079/// # .with_native_roots()
4080/// # .unwrap()
4081/// # .https_or_http()
4082/// # .enable_http2()
4083/// # .build()
4084/// # );
4085/// # let mut hub = CloudRedis::new(client, auth);
4086/// // You can configure optional parameters by calling the respective setters at will, and
4087/// // execute the final call using `doit()`.
4088/// // Values shown here are possibly random and not representative !
4089/// let result = hub.projects().locations_backup_collections_list("parent")
4090/// .page_token("ea")
4091/// .page_size(-55)
4092/// .doit().await;
4093/// # }
4094/// ```
4095pub struct ProjectLocationBackupCollectionListCall<'a, C>
4096where
4097 C: 'a,
4098{
4099 hub: &'a CloudRedis<C>,
4100 _parent: String,
4101 _page_token: Option<String>,
4102 _page_size: Option<i32>,
4103 _delegate: Option<&'a mut dyn common::Delegate>,
4104 _additional_params: HashMap<String, String>,
4105 _scopes: BTreeSet<String>,
4106}
4107
4108impl<'a, C> common::CallBuilder for ProjectLocationBackupCollectionListCall<'a, C> {}
4109
4110impl<'a, C> ProjectLocationBackupCollectionListCall<'a, C>
4111where
4112 C: common::Connector,
4113{
4114 /// Perform the operation you have build so far.
4115 pub async fn doit(
4116 mut self,
4117 ) -> common::Result<(common::Response, ListBackupCollectionsResponse)> {
4118 use std::borrow::Cow;
4119 use std::io::{Read, Seek};
4120
4121 use common::{url::Params, ToParts};
4122 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4123
4124 let mut dd = common::DefaultDelegate;
4125 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4126 dlg.begin(common::MethodInfo {
4127 id: "redis.projects.locations.backupCollections.list",
4128 http_method: hyper::Method::GET,
4129 });
4130
4131 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4132 if self._additional_params.contains_key(field) {
4133 dlg.finished(false);
4134 return Err(common::Error::FieldClash(field));
4135 }
4136 }
4137
4138 let mut params = Params::with_capacity(5 + self._additional_params.len());
4139 params.push("parent", self._parent);
4140 if let Some(value) = self._page_token.as_ref() {
4141 params.push("pageToken", value);
4142 }
4143 if let Some(value) = self._page_size.as_ref() {
4144 params.push("pageSize", value.to_string());
4145 }
4146
4147 params.extend(self._additional_params.iter());
4148
4149 params.push("alt", "json");
4150 let mut url = self.hub._base_url.clone() + "v1/{+parent}/backupCollections";
4151 if self._scopes.is_empty() {
4152 self._scopes
4153 .insert(Scope::CloudPlatform.as_ref().to_string());
4154 }
4155
4156 #[allow(clippy::single_element_loop)]
4157 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4158 url = params.uri_replacement(url, param_name, find_this, true);
4159 }
4160 {
4161 let to_remove = ["parent"];
4162 params.remove_params(&to_remove);
4163 }
4164
4165 let url = params.parse_with_url(&url);
4166
4167 loop {
4168 let token = match self
4169 .hub
4170 .auth
4171 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4172 .await
4173 {
4174 Ok(token) => token,
4175 Err(e) => match dlg.token(e) {
4176 Ok(token) => token,
4177 Err(e) => {
4178 dlg.finished(false);
4179 return Err(common::Error::MissingToken(e));
4180 }
4181 },
4182 };
4183 let mut req_result = {
4184 let client = &self.hub.client;
4185 dlg.pre_request();
4186 let mut req_builder = hyper::Request::builder()
4187 .method(hyper::Method::GET)
4188 .uri(url.as_str())
4189 .header(USER_AGENT, self.hub._user_agent.clone());
4190
4191 if let Some(token) = token.as_ref() {
4192 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4193 }
4194
4195 let request = req_builder
4196 .header(CONTENT_LENGTH, 0_u64)
4197 .body(common::to_body::<String>(None));
4198
4199 client.request(request.unwrap()).await
4200 };
4201
4202 match req_result {
4203 Err(err) => {
4204 if let common::Retry::After(d) = dlg.http_error(&err) {
4205 sleep(d).await;
4206 continue;
4207 }
4208 dlg.finished(false);
4209 return Err(common::Error::HttpError(err));
4210 }
4211 Ok(res) => {
4212 let (mut parts, body) = res.into_parts();
4213 let mut body = common::Body::new(body);
4214 if !parts.status.is_success() {
4215 let bytes = common::to_bytes(body).await.unwrap_or_default();
4216 let error = serde_json::from_str(&common::to_string(&bytes));
4217 let response = common::to_response(parts, bytes.into());
4218
4219 if let common::Retry::After(d) =
4220 dlg.http_failure(&response, error.as_ref().ok())
4221 {
4222 sleep(d).await;
4223 continue;
4224 }
4225
4226 dlg.finished(false);
4227
4228 return Err(match error {
4229 Ok(value) => common::Error::BadRequest(value),
4230 _ => common::Error::Failure(response),
4231 });
4232 }
4233 let response = {
4234 let bytes = common::to_bytes(body).await.unwrap_or_default();
4235 let encoded = common::to_string(&bytes);
4236 match serde_json::from_str(&encoded) {
4237 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4238 Err(error) => {
4239 dlg.response_json_decode_error(&encoded, &error);
4240 return Err(common::Error::JsonDecodeError(
4241 encoded.to_string(),
4242 error,
4243 ));
4244 }
4245 }
4246 };
4247
4248 dlg.finished(true);
4249 return Ok(response);
4250 }
4251 }
4252 }
4253 }
4254
4255 /// Required. The resource name of the backupCollection location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.
4256 ///
4257 /// Sets the *parent* path property to the given value.
4258 ///
4259 /// Even though the property as already been set when instantiating this call,
4260 /// we provide this method for API completeness.
4261 pub fn parent(mut self, new_value: &str) -> ProjectLocationBackupCollectionListCall<'a, C> {
4262 self._parent = new_value.to_string();
4263 self
4264 }
4265 /// Optional. The `next_page_token` value returned from a previous [ListBackupCollections] request, if any.
4266 ///
4267 /// Sets the *page token* query property to the given value.
4268 pub fn page_token(mut self, new_value: &str) -> ProjectLocationBackupCollectionListCall<'a, C> {
4269 self._page_token = Some(new_value.to_string());
4270 self
4271 }
4272 /// Optional. The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's `next_page_token` to determine if there are more clusters left to be queried.
4273 ///
4274 /// Sets the *page size* query property to the given value.
4275 pub fn page_size(mut self, new_value: i32) -> ProjectLocationBackupCollectionListCall<'a, C> {
4276 self._page_size = Some(new_value);
4277 self
4278 }
4279 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4280 /// while executing the actual API request.
4281 ///
4282 /// ````text
4283 /// It should be used to handle progress information, and to implement a certain level of resilience.
4284 /// ````
4285 ///
4286 /// Sets the *delegate* property to the given value.
4287 pub fn delegate(
4288 mut self,
4289 new_value: &'a mut dyn common::Delegate,
4290 ) -> ProjectLocationBackupCollectionListCall<'a, C> {
4291 self._delegate = Some(new_value);
4292 self
4293 }
4294
4295 /// Set any additional parameter of the query string used in the request.
4296 /// It should be used to set parameters which are not yet available through their own
4297 /// setters.
4298 ///
4299 /// Please note that this method must not be used to set any of the known parameters
4300 /// which have their own setter method. If done anyway, the request will fail.
4301 ///
4302 /// # Additional Parameters
4303 ///
4304 /// * *$.xgafv* (query-string) - V1 error format.
4305 /// * *access_token* (query-string) - OAuth access token.
4306 /// * *alt* (query-string) - Data format for response.
4307 /// * *callback* (query-string) - JSONP
4308 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4309 /// * *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.
4310 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4311 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4312 /// * *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.
4313 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4314 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4315 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupCollectionListCall<'a, C>
4316 where
4317 T: AsRef<str>,
4318 {
4319 self._additional_params
4320 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4321 self
4322 }
4323
4324 /// Identifies the authorization scope for the method you are building.
4325 ///
4326 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4327 /// [`Scope::CloudPlatform`].
4328 ///
4329 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4330 /// tokens for more than one scope.
4331 ///
4332 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4333 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4334 /// sufficient, a read-write scope will do as well.
4335 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupCollectionListCall<'a, C>
4336 where
4337 St: AsRef<str>,
4338 {
4339 self._scopes.insert(String::from(scope.as_ref()));
4340 self
4341 }
4342 /// Identifies the authorization scope(s) for the method you are building.
4343 ///
4344 /// See [`Self::add_scope()`] for details.
4345 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupCollectionListCall<'a, C>
4346 where
4347 I: IntoIterator<Item = St>,
4348 St: AsRef<str>,
4349 {
4350 self._scopes
4351 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4352 self
4353 }
4354
4355 /// Removes all scopes, and no default scope will be used either.
4356 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4357 /// for details).
4358 pub fn clear_scopes(mut self) -> ProjectLocationBackupCollectionListCall<'a, C> {
4359 self._scopes.clear();
4360 self
4361 }
4362}
4363
4364/// Backup Redis Cluster. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the cluster's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for backup.
4365///
4366/// A builder for the *locations.clusters.backup* method supported by a *project* resource.
4367/// It is not used directly, but through a [`ProjectMethods`] instance.
4368///
4369/// # Example
4370///
4371/// Instantiate a resource method builder
4372///
4373/// ```test_harness,no_run
4374/// # extern crate hyper;
4375/// # extern crate hyper_rustls;
4376/// # extern crate google_redis1 as redis1;
4377/// use redis1::api::BackupClusterRequest;
4378/// # async fn dox() {
4379/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4380///
4381/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4382/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4383/// # .with_native_roots()
4384/// # .unwrap()
4385/// # .https_only()
4386/// # .enable_http2()
4387/// # .build();
4388///
4389/// # let executor = hyper_util::rt::TokioExecutor::new();
4390/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4391/// # secret,
4392/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4393/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4394/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4395/// # ),
4396/// # ).build().await.unwrap();
4397///
4398/// # let client = hyper_util::client::legacy::Client::builder(
4399/// # hyper_util::rt::TokioExecutor::new()
4400/// # )
4401/// # .build(
4402/// # hyper_rustls::HttpsConnectorBuilder::new()
4403/// # .with_native_roots()
4404/// # .unwrap()
4405/// # .https_or_http()
4406/// # .enable_http2()
4407/// # .build()
4408/// # );
4409/// # let mut hub = CloudRedis::new(client, auth);
4410/// // As the method needs a request, you would usually fill it with the desired information
4411/// // into the respective structure. Some of the parts shown here might not be applicable !
4412/// // Values shown here are possibly random and not representative !
4413/// let mut req = BackupClusterRequest::default();
4414///
4415/// // You can configure optional parameters by calling the respective setters at will, and
4416/// // execute the final call using `doit()`.
4417/// // Values shown here are possibly random and not representative !
4418/// let result = hub.projects().locations_clusters_backup(req, "name")
4419/// .doit().await;
4420/// # }
4421/// ```
4422pub struct ProjectLocationClusterBackupCall<'a, C>
4423where
4424 C: 'a,
4425{
4426 hub: &'a CloudRedis<C>,
4427 _request: BackupClusterRequest,
4428 _name: String,
4429 _delegate: Option<&'a mut dyn common::Delegate>,
4430 _additional_params: HashMap<String, String>,
4431 _scopes: BTreeSet<String>,
4432}
4433
4434impl<'a, C> common::CallBuilder for ProjectLocationClusterBackupCall<'a, C> {}
4435
4436impl<'a, C> ProjectLocationClusterBackupCall<'a, C>
4437where
4438 C: common::Connector,
4439{
4440 /// Perform the operation you have build so far.
4441 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4442 use std::borrow::Cow;
4443 use std::io::{Read, Seek};
4444
4445 use common::{url::Params, ToParts};
4446 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4447
4448 let mut dd = common::DefaultDelegate;
4449 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4450 dlg.begin(common::MethodInfo {
4451 id: "redis.projects.locations.clusters.backup",
4452 http_method: hyper::Method::POST,
4453 });
4454
4455 for &field in ["alt", "name"].iter() {
4456 if self._additional_params.contains_key(field) {
4457 dlg.finished(false);
4458 return Err(common::Error::FieldClash(field));
4459 }
4460 }
4461
4462 let mut params = Params::with_capacity(4 + self._additional_params.len());
4463 params.push("name", self._name);
4464
4465 params.extend(self._additional_params.iter());
4466
4467 params.push("alt", "json");
4468 let mut url = self.hub._base_url.clone() + "v1/{+name}:backup";
4469 if self._scopes.is_empty() {
4470 self._scopes
4471 .insert(Scope::CloudPlatform.as_ref().to_string());
4472 }
4473
4474 #[allow(clippy::single_element_loop)]
4475 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4476 url = params.uri_replacement(url, param_name, find_this, true);
4477 }
4478 {
4479 let to_remove = ["name"];
4480 params.remove_params(&to_remove);
4481 }
4482
4483 let url = params.parse_with_url(&url);
4484
4485 let mut json_mime_type = mime::APPLICATION_JSON;
4486 let mut request_value_reader = {
4487 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4488 common::remove_json_null_values(&mut value);
4489 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4490 serde_json::to_writer(&mut dst, &value).unwrap();
4491 dst
4492 };
4493 let request_size = request_value_reader
4494 .seek(std::io::SeekFrom::End(0))
4495 .unwrap();
4496 request_value_reader
4497 .seek(std::io::SeekFrom::Start(0))
4498 .unwrap();
4499
4500 loop {
4501 let token = match self
4502 .hub
4503 .auth
4504 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4505 .await
4506 {
4507 Ok(token) => token,
4508 Err(e) => match dlg.token(e) {
4509 Ok(token) => token,
4510 Err(e) => {
4511 dlg.finished(false);
4512 return Err(common::Error::MissingToken(e));
4513 }
4514 },
4515 };
4516 request_value_reader
4517 .seek(std::io::SeekFrom::Start(0))
4518 .unwrap();
4519 let mut req_result = {
4520 let client = &self.hub.client;
4521 dlg.pre_request();
4522 let mut req_builder = hyper::Request::builder()
4523 .method(hyper::Method::POST)
4524 .uri(url.as_str())
4525 .header(USER_AGENT, self.hub._user_agent.clone());
4526
4527 if let Some(token) = token.as_ref() {
4528 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4529 }
4530
4531 let request = req_builder
4532 .header(CONTENT_TYPE, json_mime_type.to_string())
4533 .header(CONTENT_LENGTH, request_size as u64)
4534 .body(common::to_body(
4535 request_value_reader.get_ref().clone().into(),
4536 ));
4537
4538 client.request(request.unwrap()).await
4539 };
4540
4541 match req_result {
4542 Err(err) => {
4543 if let common::Retry::After(d) = dlg.http_error(&err) {
4544 sleep(d).await;
4545 continue;
4546 }
4547 dlg.finished(false);
4548 return Err(common::Error::HttpError(err));
4549 }
4550 Ok(res) => {
4551 let (mut parts, body) = res.into_parts();
4552 let mut body = common::Body::new(body);
4553 if !parts.status.is_success() {
4554 let bytes = common::to_bytes(body).await.unwrap_or_default();
4555 let error = serde_json::from_str(&common::to_string(&bytes));
4556 let response = common::to_response(parts, bytes.into());
4557
4558 if let common::Retry::After(d) =
4559 dlg.http_failure(&response, error.as_ref().ok())
4560 {
4561 sleep(d).await;
4562 continue;
4563 }
4564
4565 dlg.finished(false);
4566
4567 return Err(match error {
4568 Ok(value) => common::Error::BadRequest(value),
4569 _ => common::Error::Failure(response),
4570 });
4571 }
4572 let response = {
4573 let bytes = common::to_bytes(body).await.unwrap_or_default();
4574 let encoded = common::to_string(&bytes);
4575 match serde_json::from_str(&encoded) {
4576 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4577 Err(error) => {
4578 dlg.response_json_decode_error(&encoded, &error);
4579 return Err(common::Error::JsonDecodeError(
4580 encoded.to_string(),
4581 error,
4582 ));
4583 }
4584 }
4585 };
4586
4587 dlg.finished(true);
4588 return Ok(response);
4589 }
4590 }
4591 }
4592 }
4593
4594 ///
4595 /// Sets the *request* property to the given value.
4596 ///
4597 /// Even though the property as already been set when instantiating this call,
4598 /// we provide this method for API completeness.
4599 pub fn request(
4600 mut self,
4601 new_value: BackupClusterRequest,
4602 ) -> ProjectLocationClusterBackupCall<'a, C> {
4603 self._request = new_value;
4604 self
4605 }
4606 /// Required. Redis cluster resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
4607 ///
4608 /// Sets the *name* path property to the given value.
4609 ///
4610 /// Even though the property as already been set when instantiating this call,
4611 /// we provide this method for API completeness.
4612 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterBackupCall<'a, C> {
4613 self._name = new_value.to_string();
4614 self
4615 }
4616 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4617 /// while executing the actual API request.
4618 ///
4619 /// ````text
4620 /// It should be used to handle progress information, and to implement a certain level of resilience.
4621 /// ````
4622 ///
4623 /// Sets the *delegate* property to the given value.
4624 pub fn delegate(
4625 mut self,
4626 new_value: &'a mut dyn common::Delegate,
4627 ) -> ProjectLocationClusterBackupCall<'a, C> {
4628 self._delegate = Some(new_value);
4629 self
4630 }
4631
4632 /// Set any additional parameter of the query string used in the request.
4633 /// It should be used to set parameters which are not yet available through their own
4634 /// setters.
4635 ///
4636 /// Please note that this method must not be used to set any of the known parameters
4637 /// which have their own setter method. If done anyway, the request will fail.
4638 ///
4639 /// # Additional Parameters
4640 ///
4641 /// * *$.xgafv* (query-string) - V1 error format.
4642 /// * *access_token* (query-string) - OAuth access token.
4643 /// * *alt* (query-string) - Data format for response.
4644 /// * *callback* (query-string) - JSONP
4645 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4646 /// * *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.
4647 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4648 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4649 /// * *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.
4650 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4651 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4652 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterBackupCall<'a, C>
4653 where
4654 T: AsRef<str>,
4655 {
4656 self._additional_params
4657 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4658 self
4659 }
4660
4661 /// Identifies the authorization scope for the method you are building.
4662 ///
4663 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4664 /// [`Scope::CloudPlatform`].
4665 ///
4666 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4667 /// tokens for more than one scope.
4668 ///
4669 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4670 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4671 /// sufficient, a read-write scope will do as well.
4672 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterBackupCall<'a, C>
4673 where
4674 St: AsRef<str>,
4675 {
4676 self._scopes.insert(String::from(scope.as_ref()));
4677 self
4678 }
4679 /// Identifies the authorization scope(s) for the method you are building.
4680 ///
4681 /// See [`Self::add_scope()`] for details.
4682 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterBackupCall<'a, C>
4683 where
4684 I: IntoIterator<Item = St>,
4685 St: AsRef<str>,
4686 {
4687 self._scopes
4688 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4689 self
4690 }
4691
4692 /// Removes all scopes, and no default scope will be used either.
4693 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4694 /// for details).
4695 pub fn clear_scopes(mut self) -> ProjectLocationClusterBackupCall<'a, C> {
4696 self._scopes.clear();
4697 self
4698 }
4699}
4700
4701/// Creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
4702///
4703/// A builder for the *locations.clusters.create* method supported by a *project* resource.
4704/// It is not used directly, but through a [`ProjectMethods`] instance.
4705///
4706/// # Example
4707///
4708/// Instantiate a resource method builder
4709///
4710/// ```test_harness,no_run
4711/// # extern crate hyper;
4712/// # extern crate hyper_rustls;
4713/// # extern crate google_redis1 as redis1;
4714/// use redis1::api::Cluster;
4715/// # async fn dox() {
4716/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4717///
4718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4719/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4720/// # .with_native_roots()
4721/// # .unwrap()
4722/// # .https_only()
4723/// # .enable_http2()
4724/// # .build();
4725///
4726/// # let executor = hyper_util::rt::TokioExecutor::new();
4727/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4728/// # secret,
4729/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4730/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4731/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4732/// # ),
4733/// # ).build().await.unwrap();
4734///
4735/// # let client = hyper_util::client::legacy::Client::builder(
4736/// # hyper_util::rt::TokioExecutor::new()
4737/// # )
4738/// # .build(
4739/// # hyper_rustls::HttpsConnectorBuilder::new()
4740/// # .with_native_roots()
4741/// # .unwrap()
4742/// # .https_or_http()
4743/// # .enable_http2()
4744/// # .build()
4745/// # );
4746/// # let mut hub = CloudRedis::new(client, auth);
4747/// // As the method needs a request, you would usually fill it with the desired information
4748/// // into the respective structure. Some of the parts shown here might not be applicable !
4749/// // Values shown here are possibly random and not representative !
4750/// let mut req = Cluster::default();
4751///
4752/// // You can configure optional parameters by calling the respective setters at will, and
4753/// // execute the final call using `doit()`.
4754/// // Values shown here are possibly random and not representative !
4755/// let result = hub.projects().locations_clusters_create(req, "parent")
4756/// .request_id("duo")
4757/// .cluster_id("ipsum")
4758/// .doit().await;
4759/// # }
4760/// ```
4761pub struct ProjectLocationClusterCreateCall<'a, C>
4762where
4763 C: 'a,
4764{
4765 hub: &'a CloudRedis<C>,
4766 _request: Cluster,
4767 _parent: String,
4768 _request_id: Option<String>,
4769 _cluster_id: Option<String>,
4770 _delegate: Option<&'a mut dyn common::Delegate>,
4771 _additional_params: HashMap<String, String>,
4772 _scopes: BTreeSet<String>,
4773}
4774
4775impl<'a, C> common::CallBuilder for ProjectLocationClusterCreateCall<'a, C> {}
4776
4777impl<'a, C> ProjectLocationClusterCreateCall<'a, C>
4778where
4779 C: common::Connector,
4780{
4781 /// Perform the operation you have build so far.
4782 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4783 use std::borrow::Cow;
4784 use std::io::{Read, Seek};
4785
4786 use common::{url::Params, ToParts};
4787 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4788
4789 let mut dd = common::DefaultDelegate;
4790 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4791 dlg.begin(common::MethodInfo {
4792 id: "redis.projects.locations.clusters.create",
4793 http_method: hyper::Method::POST,
4794 });
4795
4796 for &field in ["alt", "parent", "requestId", "clusterId"].iter() {
4797 if self._additional_params.contains_key(field) {
4798 dlg.finished(false);
4799 return Err(common::Error::FieldClash(field));
4800 }
4801 }
4802
4803 let mut params = Params::with_capacity(6 + self._additional_params.len());
4804 params.push("parent", self._parent);
4805 if let Some(value) = self._request_id.as_ref() {
4806 params.push("requestId", value);
4807 }
4808 if let Some(value) = self._cluster_id.as_ref() {
4809 params.push("clusterId", value);
4810 }
4811
4812 params.extend(self._additional_params.iter());
4813
4814 params.push("alt", "json");
4815 let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
4816 if self._scopes.is_empty() {
4817 self._scopes
4818 .insert(Scope::CloudPlatform.as_ref().to_string());
4819 }
4820
4821 #[allow(clippy::single_element_loop)]
4822 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4823 url = params.uri_replacement(url, param_name, find_this, true);
4824 }
4825 {
4826 let to_remove = ["parent"];
4827 params.remove_params(&to_remove);
4828 }
4829
4830 let url = params.parse_with_url(&url);
4831
4832 let mut json_mime_type = mime::APPLICATION_JSON;
4833 let mut request_value_reader = {
4834 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4835 common::remove_json_null_values(&mut value);
4836 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4837 serde_json::to_writer(&mut dst, &value).unwrap();
4838 dst
4839 };
4840 let request_size = request_value_reader
4841 .seek(std::io::SeekFrom::End(0))
4842 .unwrap();
4843 request_value_reader
4844 .seek(std::io::SeekFrom::Start(0))
4845 .unwrap();
4846
4847 loop {
4848 let token = match self
4849 .hub
4850 .auth
4851 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4852 .await
4853 {
4854 Ok(token) => token,
4855 Err(e) => match dlg.token(e) {
4856 Ok(token) => token,
4857 Err(e) => {
4858 dlg.finished(false);
4859 return Err(common::Error::MissingToken(e));
4860 }
4861 },
4862 };
4863 request_value_reader
4864 .seek(std::io::SeekFrom::Start(0))
4865 .unwrap();
4866 let mut req_result = {
4867 let client = &self.hub.client;
4868 dlg.pre_request();
4869 let mut req_builder = hyper::Request::builder()
4870 .method(hyper::Method::POST)
4871 .uri(url.as_str())
4872 .header(USER_AGENT, self.hub._user_agent.clone());
4873
4874 if let Some(token) = token.as_ref() {
4875 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4876 }
4877
4878 let request = req_builder
4879 .header(CONTENT_TYPE, json_mime_type.to_string())
4880 .header(CONTENT_LENGTH, request_size as u64)
4881 .body(common::to_body(
4882 request_value_reader.get_ref().clone().into(),
4883 ));
4884
4885 client.request(request.unwrap()).await
4886 };
4887
4888 match req_result {
4889 Err(err) => {
4890 if let common::Retry::After(d) = dlg.http_error(&err) {
4891 sleep(d).await;
4892 continue;
4893 }
4894 dlg.finished(false);
4895 return Err(common::Error::HttpError(err));
4896 }
4897 Ok(res) => {
4898 let (mut parts, body) = res.into_parts();
4899 let mut body = common::Body::new(body);
4900 if !parts.status.is_success() {
4901 let bytes = common::to_bytes(body).await.unwrap_or_default();
4902 let error = serde_json::from_str(&common::to_string(&bytes));
4903 let response = common::to_response(parts, bytes.into());
4904
4905 if let common::Retry::After(d) =
4906 dlg.http_failure(&response, error.as_ref().ok())
4907 {
4908 sleep(d).await;
4909 continue;
4910 }
4911
4912 dlg.finished(false);
4913
4914 return Err(match error {
4915 Ok(value) => common::Error::BadRequest(value),
4916 _ => common::Error::Failure(response),
4917 });
4918 }
4919 let response = {
4920 let bytes = common::to_bytes(body).await.unwrap_or_default();
4921 let encoded = common::to_string(&bytes);
4922 match serde_json::from_str(&encoded) {
4923 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4924 Err(error) => {
4925 dlg.response_json_decode_error(&encoded, &error);
4926 return Err(common::Error::JsonDecodeError(
4927 encoded.to_string(),
4928 error,
4929 ));
4930 }
4931 }
4932 };
4933
4934 dlg.finished(true);
4935 return Ok(response);
4936 }
4937 }
4938 }
4939 }
4940
4941 ///
4942 /// Sets the *request* property to the given value.
4943 ///
4944 /// Even though the property as already been set when instantiating this call,
4945 /// we provide this method for API completeness.
4946 pub fn request(mut self, new_value: Cluster) -> ProjectLocationClusterCreateCall<'a, C> {
4947 self._request = new_value;
4948 self
4949 }
4950 /// Required. The resource name of the cluster location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.
4951 ///
4952 /// Sets the *parent* path property to the given value.
4953 ///
4954 /// Even though the property as already been set when instantiating this call,
4955 /// we provide this method for API completeness.
4956 pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterCreateCall<'a, C> {
4957 self._parent = new_value.to_string();
4958 self
4959 }
4960 /// Optional. Idempotent request UUID.
4961 ///
4962 /// Sets the *request id* query property to the given value.
4963 pub fn request_id(mut self, new_value: &str) -> ProjectLocationClusterCreateCall<'a, C> {
4964 self._request_id = Some(new_value.to_string());
4965 self
4966 }
4967 /// Required. The logical name of the Redis cluster in the customer project with the following restrictions: * Must contain only lowercase letters, numbers, and hyphens. * Must start with a letter. * Must be between 1-63 characters. * Must end with a number or a letter. * Must be unique within the customer project / location
4968 ///
4969 /// Sets the *cluster id* query property to the given value.
4970 pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterCreateCall<'a, C> {
4971 self._cluster_id = Some(new_value.to_string());
4972 self
4973 }
4974 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4975 /// while executing the actual API request.
4976 ///
4977 /// ````text
4978 /// It should be used to handle progress information, and to implement a certain level of resilience.
4979 /// ````
4980 ///
4981 /// Sets the *delegate* property to the given value.
4982 pub fn delegate(
4983 mut self,
4984 new_value: &'a mut dyn common::Delegate,
4985 ) -> ProjectLocationClusterCreateCall<'a, C> {
4986 self._delegate = Some(new_value);
4987 self
4988 }
4989
4990 /// Set any additional parameter of the query string used in the request.
4991 /// It should be used to set parameters which are not yet available through their own
4992 /// setters.
4993 ///
4994 /// Please note that this method must not be used to set any of the known parameters
4995 /// which have their own setter method. If done anyway, the request will fail.
4996 ///
4997 /// # Additional Parameters
4998 ///
4999 /// * *$.xgafv* (query-string) - V1 error format.
5000 /// * *access_token* (query-string) - OAuth access token.
5001 /// * *alt* (query-string) - Data format for response.
5002 /// * *callback* (query-string) - JSONP
5003 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5004 /// * *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.
5005 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5006 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5007 /// * *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.
5008 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5009 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5010 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterCreateCall<'a, C>
5011 where
5012 T: AsRef<str>,
5013 {
5014 self._additional_params
5015 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5016 self
5017 }
5018
5019 /// Identifies the authorization scope for the method you are building.
5020 ///
5021 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5022 /// [`Scope::CloudPlatform`].
5023 ///
5024 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5025 /// tokens for more than one scope.
5026 ///
5027 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5028 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5029 /// sufficient, a read-write scope will do as well.
5030 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterCreateCall<'a, C>
5031 where
5032 St: AsRef<str>,
5033 {
5034 self._scopes.insert(String::from(scope.as_ref()));
5035 self
5036 }
5037 /// Identifies the authorization scope(s) for the method you are building.
5038 ///
5039 /// See [`Self::add_scope()`] for details.
5040 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterCreateCall<'a, C>
5041 where
5042 I: IntoIterator<Item = St>,
5043 St: AsRef<str>,
5044 {
5045 self._scopes
5046 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5047 self
5048 }
5049
5050 /// Removes all scopes, and no default scope will be used either.
5051 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5052 /// for details).
5053 pub fn clear_scopes(mut self) -> ProjectLocationClusterCreateCall<'a, C> {
5054 self._scopes.clear();
5055 self
5056 }
5057}
5058
5059/// Deletes a specific Redis cluster. Cluster stops serving and data is deleted.
5060///
5061/// A builder for the *locations.clusters.delete* method supported by a *project* resource.
5062/// It is not used directly, but through a [`ProjectMethods`] instance.
5063///
5064/// # Example
5065///
5066/// Instantiate a resource method builder
5067///
5068/// ```test_harness,no_run
5069/// # extern crate hyper;
5070/// # extern crate hyper_rustls;
5071/// # extern crate google_redis1 as redis1;
5072/// # async fn dox() {
5073/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5074///
5075/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5076/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5077/// # .with_native_roots()
5078/// # .unwrap()
5079/// # .https_only()
5080/// # .enable_http2()
5081/// # .build();
5082///
5083/// # let executor = hyper_util::rt::TokioExecutor::new();
5084/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5085/// # secret,
5086/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5087/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5088/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5089/// # ),
5090/// # ).build().await.unwrap();
5091///
5092/// # let client = hyper_util::client::legacy::Client::builder(
5093/// # hyper_util::rt::TokioExecutor::new()
5094/// # )
5095/// # .build(
5096/// # hyper_rustls::HttpsConnectorBuilder::new()
5097/// # .with_native_roots()
5098/// # .unwrap()
5099/// # .https_or_http()
5100/// # .enable_http2()
5101/// # .build()
5102/// # );
5103/// # let mut hub = CloudRedis::new(client, auth);
5104/// // You can configure optional parameters by calling the respective setters at will, and
5105/// // execute the final call using `doit()`.
5106/// // Values shown here are possibly random and not representative !
5107/// let result = hub.projects().locations_clusters_delete("name")
5108/// .request_id("ut")
5109/// .doit().await;
5110/// # }
5111/// ```
5112pub struct ProjectLocationClusterDeleteCall<'a, C>
5113where
5114 C: 'a,
5115{
5116 hub: &'a CloudRedis<C>,
5117 _name: String,
5118 _request_id: Option<String>,
5119 _delegate: Option<&'a mut dyn common::Delegate>,
5120 _additional_params: HashMap<String, String>,
5121 _scopes: BTreeSet<String>,
5122}
5123
5124impl<'a, C> common::CallBuilder for ProjectLocationClusterDeleteCall<'a, C> {}
5125
5126impl<'a, C> ProjectLocationClusterDeleteCall<'a, C>
5127where
5128 C: common::Connector,
5129{
5130 /// Perform the operation you have build so far.
5131 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5132 use std::borrow::Cow;
5133 use std::io::{Read, Seek};
5134
5135 use common::{url::Params, ToParts};
5136 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5137
5138 let mut dd = common::DefaultDelegate;
5139 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5140 dlg.begin(common::MethodInfo {
5141 id: "redis.projects.locations.clusters.delete",
5142 http_method: hyper::Method::DELETE,
5143 });
5144
5145 for &field in ["alt", "name", "requestId"].iter() {
5146 if self._additional_params.contains_key(field) {
5147 dlg.finished(false);
5148 return Err(common::Error::FieldClash(field));
5149 }
5150 }
5151
5152 let mut params = Params::with_capacity(4 + self._additional_params.len());
5153 params.push("name", self._name);
5154 if let Some(value) = self._request_id.as_ref() {
5155 params.push("requestId", value);
5156 }
5157
5158 params.extend(self._additional_params.iter());
5159
5160 params.push("alt", "json");
5161 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5162 if self._scopes.is_empty() {
5163 self._scopes
5164 .insert(Scope::CloudPlatform.as_ref().to_string());
5165 }
5166
5167 #[allow(clippy::single_element_loop)]
5168 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5169 url = params.uri_replacement(url, param_name, find_this, true);
5170 }
5171 {
5172 let to_remove = ["name"];
5173 params.remove_params(&to_remove);
5174 }
5175
5176 let url = params.parse_with_url(&url);
5177
5178 loop {
5179 let token = match self
5180 .hub
5181 .auth
5182 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5183 .await
5184 {
5185 Ok(token) => token,
5186 Err(e) => match dlg.token(e) {
5187 Ok(token) => token,
5188 Err(e) => {
5189 dlg.finished(false);
5190 return Err(common::Error::MissingToken(e));
5191 }
5192 },
5193 };
5194 let mut req_result = {
5195 let client = &self.hub.client;
5196 dlg.pre_request();
5197 let mut req_builder = hyper::Request::builder()
5198 .method(hyper::Method::DELETE)
5199 .uri(url.as_str())
5200 .header(USER_AGENT, self.hub._user_agent.clone());
5201
5202 if let Some(token) = token.as_ref() {
5203 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5204 }
5205
5206 let request = req_builder
5207 .header(CONTENT_LENGTH, 0_u64)
5208 .body(common::to_body::<String>(None));
5209
5210 client.request(request.unwrap()).await
5211 };
5212
5213 match req_result {
5214 Err(err) => {
5215 if let common::Retry::After(d) = dlg.http_error(&err) {
5216 sleep(d).await;
5217 continue;
5218 }
5219 dlg.finished(false);
5220 return Err(common::Error::HttpError(err));
5221 }
5222 Ok(res) => {
5223 let (mut parts, body) = res.into_parts();
5224 let mut body = common::Body::new(body);
5225 if !parts.status.is_success() {
5226 let bytes = common::to_bytes(body).await.unwrap_or_default();
5227 let error = serde_json::from_str(&common::to_string(&bytes));
5228 let response = common::to_response(parts, bytes.into());
5229
5230 if let common::Retry::After(d) =
5231 dlg.http_failure(&response, error.as_ref().ok())
5232 {
5233 sleep(d).await;
5234 continue;
5235 }
5236
5237 dlg.finished(false);
5238
5239 return Err(match error {
5240 Ok(value) => common::Error::BadRequest(value),
5241 _ => common::Error::Failure(response),
5242 });
5243 }
5244 let response = {
5245 let bytes = common::to_bytes(body).await.unwrap_or_default();
5246 let encoded = common::to_string(&bytes);
5247 match serde_json::from_str(&encoded) {
5248 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5249 Err(error) => {
5250 dlg.response_json_decode_error(&encoded, &error);
5251 return Err(common::Error::JsonDecodeError(
5252 encoded.to_string(),
5253 error,
5254 ));
5255 }
5256 }
5257 };
5258
5259 dlg.finished(true);
5260 return Ok(response);
5261 }
5262 }
5263 }
5264 }
5265
5266 /// Required. Redis cluster resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
5267 ///
5268 /// Sets the *name* path property to the given value.
5269 ///
5270 /// Even though the property as already been set when instantiating this call,
5271 /// we provide this method for API completeness.
5272 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
5273 self._name = new_value.to_string();
5274 self
5275 }
5276 /// Optional. Idempotent request UUID.
5277 ///
5278 /// Sets the *request id* query property to the given value.
5279 pub fn request_id(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
5280 self._request_id = Some(new_value.to_string());
5281 self
5282 }
5283 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5284 /// while executing the actual API request.
5285 ///
5286 /// ````text
5287 /// It should be used to handle progress information, and to implement a certain level of resilience.
5288 /// ````
5289 ///
5290 /// Sets the *delegate* property to the given value.
5291 pub fn delegate(
5292 mut self,
5293 new_value: &'a mut dyn common::Delegate,
5294 ) -> ProjectLocationClusterDeleteCall<'a, C> {
5295 self._delegate = Some(new_value);
5296 self
5297 }
5298
5299 /// Set any additional parameter of the query string used in the request.
5300 /// It should be used to set parameters which are not yet available through their own
5301 /// setters.
5302 ///
5303 /// Please note that this method must not be used to set any of the known parameters
5304 /// which have their own setter method. If done anyway, the request will fail.
5305 ///
5306 /// # Additional Parameters
5307 ///
5308 /// * *$.xgafv* (query-string) - V1 error format.
5309 /// * *access_token* (query-string) - OAuth access token.
5310 /// * *alt* (query-string) - Data format for response.
5311 /// * *callback* (query-string) - JSONP
5312 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5313 /// * *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.
5314 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5315 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5316 /// * *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.
5317 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5318 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5319 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterDeleteCall<'a, C>
5320 where
5321 T: AsRef<str>,
5322 {
5323 self._additional_params
5324 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5325 self
5326 }
5327
5328 /// Identifies the authorization scope for the method you are building.
5329 ///
5330 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5331 /// [`Scope::CloudPlatform`].
5332 ///
5333 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5334 /// tokens for more than one scope.
5335 ///
5336 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5337 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5338 /// sufficient, a read-write scope will do as well.
5339 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterDeleteCall<'a, C>
5340 where
5341 St: AsRef<str>,
5342 {
5343 self._scopes.insert(String::from(scope.as_ref()));
5344 self
5345 }
5346 /// Identifies the authorization scope(s) for the method you are building.
5347 ///
5348 /// See [`Self::add_scope()`] for details.
5349 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterDeleteCall<'a, C>
5350 where
5351 I: IntoIterator<Item = St>,
5352 St: AsRef<str>,
5353 {
5354 self._scopes
5355 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5356 self
5357 }
5358
5359 /// Removes all scopes, and no default scope will be used either.
5360 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5361 /// for details).
5362 pub fn clear_scopes(mut self) -> ProjectLocationClusterDeleteCall<'a, C> {
5363 self._scopes.clear();
5364 self
5365 }
5366}
5367
5368/// Gets the details of a specific Redis cluster.
5369///
5370/// A builder for the *locations.clusters.get* method supported by a *project* resource.
5371/// It is not used directly, but through a [`ProjectMethods`] instance.
5372///
5373/// # Example
5374///
5375/// Instantiate a resource method builder
5376///
5377/// ```test_harness,no_run
5378/// # extern crate hyper;
5379/// # extern crate hyper_rustls;
5380/// # extern crate google_redis1 as redis1;
5381/// # async fn dox() {
5382/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5383///
5384/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5385/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5386/// # .with_native_roots()
5387/// # .unwrap()
5388/// # .https_only()
5389/// # .enable_http2()
5390/// # .build();
5391///
5392/// # let executor = hyper_util::rt::TokioExecutor::new();
5393/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5394/// # secret,
5395/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5396/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5397/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5398/// # ),
5399/// # ).build().await.unwrap();
5400///
5401/// # let client = hyper_util::client::legacy::Client::builder(
5402/// # hyper_util::rt::TokioExecutor::new()
5403/// # )
5404/// # .build(
5405/// # hyper_rustls::HttpsConnectorBuilder::new()
5406/// # .with_native_roots()
5407/// # .unwrap()
5408/// # .https_or_http()
5409/// # .enable_http2()
5410/// # .build()
5411/// # );
5412/// # let mut hub = CloudRedis::new(client, auth);
5413/// // You can configure optional parameters by calling the respective setters at will, and
5414/// // execute the final call using `doit()`.
5415/// // Values shown here are possibly random and not representative !
5416/// let result = hub.projects().locations_clusters_get("name")
5417/// .doit().await;
5418/// # }
5419/// ```
5420pub struct ProjectLocationClusterGetCall<'a, C>
5421where
5422 C: 'a,
5423{
5424 hub: &'a CloudRedis<C>,
5425 _name: String,
5426 _delegate: Option<&'a mut dyn common::Delegate>,
5427 _additional_params: HashMap<String, String>,
5428 _scopes: BTreeSet<String>,
5429}
5430
5431impl<'a, C> common::CallBuilder for ProjectLocationClusterGetCall<'a, C> {}
5432
5433impl<'a, C> ProjectLocationClusterGetCall<'a, C>
5434where
5435 C: common::Connector,
5436{
5437 /// Perform the operation you have build so far.
5438 pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
5439 use std::borrow::Cow;
5440 use std::io::{Read, Seek};
5441
5442 use common::{url::Params, ToParts};
5443 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5444
5445 let mut dd = common::DefaultDelegate;
5446 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5447 dlg.begin(common::MethodInfo {
5448 id: "redis.projects.locations.clusters.get",
5449 http_method: hyper::Method::GET,
5450 });
5451
5452 for &field in ["alt", "name"].iter() {
5453 if self._additional_params.contains_key(field) {
5454 dlg.finished(false);
5455 return Err(common::Error::FieldClash(field));
5456 }
5457 }
5458
5459 let mut params = Params::with_capacity(3 + self._additional_params.len());
5460 params.push("name", self._name);
5461
5462 params.extend(self._additional_params.iter());
5463
5464 params.push("alt", "json");
5465 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5466 if self._scopes.is_empty() {
5467 self._scopes
5468 .insert(Scope::CloudPlatform.as_ref().to_string());
5469 }
5470
5471 #[allow(clippy::single_element_loop)]
5472 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5473 url = params.uri_replacement(url, param_name, find_this, true);
5474 }
5475 {
5476 let to_remove = ["name"];
5477 params.remove_params(&to_remove);
5478 }
5479
5480 let url = params.parse_with_url(&url);
5481
5482 loop {
5483 let token = match self
5484 .hub
5485 .auth
5486 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5487 .await
5488 {
5489 Ok(token) => token,
5490 Err(e) => match dlg.token(e) {
5491 Ok(token) => token,
5492 Err(e) => {
5493 dlg.finished(false);
5494 return Err(common::Error::MissingToken(e));
5495 }
5496 },
5497 };
5498 let mut req_result = {
5499 let client = &self.hub.client;
5500 dlg.pre_request();
5501 let mut req_builder = hyper::Request::builder()
5502 .method(hyper::Method::GET)
5503 .uri(url.as_str())
5504 .header(USER_AGENT, self.hub._user_agent.clone());
5505
5506 if let Some(token) = token.as_ref() {
5507 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5508 }
5509
5510 let request = req_builder
5511 .header(CONTENT_LENGTH, 0_u64)
5512 .body(common::to_body::<String>(None));
5513
5514 client.request(request.unwrap()).await
5515 };
5516
5517 match req_result {
5518 Err(err) => {
5519 if let common::Retry::After(d) = dlg.http_error(&err) {
5520 sleep(d).await;
5521 continue;
5522 }
5523 dlg.finished(false);
5524 return Err(common::Error::HttpError(err));
5525 }
5526 Ok(res) => {
5527 let (mut parts, body) = res.into_parts();
5528 let mut body = common::Body::new(body);
5529 if !parts.status.is_success() {
5530 let bytes = common::to_bytes(body).await.unwrap_or_default();
5531 let error = serde_json::from_str(&common::to_string(&bytes));
5532 let response = common::to_response(parts, bytes.into());
5533
5534 if let common::Retry::After(d) =
5535 dlg.http_failure(&response, error.as_ref().ok())
5536 {
5537 sleep(d).await;
5538 continue;
5539 }
5540
5541 dlg.finished(false);
5542
5543 return Err(match error {
5544 Ok(value) => common::Error::BadRequest(value),
5545 _ => common::Error::Failure(response),
5546 });
5547 }
5548 let response = {
5549 let bytes = common::to_bytes(body).await.unwrap_or_default();
5550 let encoded = common::to_string(&bytes);
5551 match serde_json::from_str(&encoded) {
5552 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5553 Err(error) => {
5554 dlg.response_json_decode_error(&encoded, &error);
5555 return Err(common::Error::JsonDecodeError(
5556 encoded.to_string(),
5557 error,
5558 ));
5559 }
5560 }
5561 };
5562
5563 dlg.finished(true);
5564 return Ok(response);
5565 }
5566 }
5567 }
5568 }
5569
5570 /// Required. Redis cluster resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
5571 ///
5572 /// Sets the *name* path property to the given value.
5573 ///
5574 /// Even though the property as already been set when instantiating this call,
5575 /// we provide this method for API completeness.
5576 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
5577 self._name = new_value.to_string();
5578 self
5579 }
5580 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5581 /// while executing the actual API request.
5582 ///
5583 /// ````text
5584 /// It should be used to handle progress information, and to implement a certain level of resilience.
5585 /// ````
5586 ///
5587 /// Sets the *delegate* property to the given value.
5588 pub fn delegate(
5589 mut self,
5590 new_value: &'a mut dyn common::Delegate,
5591 ) -> ProjectLocationClusterGetCall<'a, C> {
5592 self._delegate = Some(new_value);
5593 self
5594 }
5595
5596 /// Set any additional parameter of the query string used in the request.
5597 /// It should be used to set parameters which are not yet available through their own
5598 /// setters.
5599 ///
5600 /// Please note that this method must not be used to set any of the known parameters
5601 /// which have their own setter method. If done anyway, the request will fail.
5602 ///
5603 /// # Additional Parameters
5604 ///
5605 /// * *$.xgafv* (query-string) - V1 error format.
5606 /// * *access_token* (query-string) - OAuth access token.
5607 /// * *alt* (query-string) - Data format for response.
5608 /// * *callback* (query-string) - JSONP
5609 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5610 /// * *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.
5611 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5612 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5613 /// * *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.
5614 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5615 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5616 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterGetCall<'a, C>
5617 where
5618 T: AsRef<str>,
5619 {
5620 self._additional_params
5621 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5622 self
5623 }
5624
5625 /// Identifies the authorization scope for the method you are building.
5626 ///
5627 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5628 /// [`Scope::CloudPlatform`].
5629 ///
5630 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5631 /// tokens for more than one scope.
5632 ///
5633 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5634 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5635 /// sufficient, a read-write scope will do as well.
5636 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterGetCall<'a, C>
5637 where
5638 St: AsRef<str>,
5639 {
5640 self._scopes.insert(String::from(scope.as_ref()));
5641 self
5642 }
5643 /// Identifies the authorization scope(s) for the method you are building.
5644 ///
5645 /// See [`Self::add_scope()`] for details.
5646 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterGetCall<'a, C>
5647 where
5648 I: IntoIterator<Item = St>,
5649 St: AsRef<str>,
5650 {
5651 self._scopes
5652 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5653 self
5654 }
5655
5656 /// Removes all scopes, and no default scope will be used either.
5657 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5658 /// for details).
5659 pub fn clear_scopes(mut self) -> ProjectLocationClusterGetCall<'a, C> {
5660 self._scopes.clear();
5661 self
5662 }
5663}
5664
5665/// Gets the details of certificate authority information for Redis cluster.
5666///
5667/// A builder for the *locations.clusters.getCertificateAuthority* method supported by a *project* resource.
5668/// It is not used directly, but through a [`ProjectMethods`] instance.
5669///
5670/// # Example
5671///
5672/// Instantiate a resource method builder
5673///
5674/// ```test_harness,no_run
5675/// # extern crate hyper;
5676/// # extern crate hyper_rustls;
5677/// # extern crate google_redis1 as redis1;
5678/// # async fn dox() {
5679/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5680///
5681/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5682/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5683/// # .with_native_roots()
5684/// # .unwrap()
5685/// # .https_only()
5686/// # .enable_http2()
5687/// # .build();
5688///
5689/// # let executor = hyper_util::rt::TokioExecutor::new();
5690/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5691/// # secret,
5692/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5693/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5694/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5695/// # ),
5696/// # ).build().await.unwrap();
5697///
5698/// # let client = hyper_util::client::legacy::Client::builder(
5699/// # hyper_util::rt::TokioExecutor::new()
5700/// # )
5701/// # .build(
5702/// # hyper_rustls::HttpsConnectorBuilder::new()
5703/// # .with_native_roots()
5704/// # .unwrap()
5705/// # .https_or_http()
5706/// # .enable_http2()
5707/// # .build()
5708/// # );
5709/// # let mut hub = CloudRedis::new(client, auth);
5710/// // You can configure optional parameters by calling the respective setters at will, and
5711/// // execute the final call using `doit()`.
5712/// // Values shown here are possibly random and not representative !
5713/// let result = hub.projects().locations_clusters_get_certificate_authority("name")
5714/// .doit().await;
5715/// # }
5716/// ```
5717pub struct ProjectLocationClusterGetCertificateAuthorityCall<'a, C>
5718where
5719 C: 'a,
5720{
5721 hub: &'a CloudRedis<C>,
5722 _name: String,
5723 _delegate: Option<&'a mut dyn common::Delegate>,
5724 _additional_params: HashMap<String, String>,
5725 _scopes: BTreeSet<String>,
5726}
5727
5728impl<'a, C> common::CallBuilder for ProjectLocationClusterGetCertificateAuthorityCall<'a, C> {}
5729
5730impl<'a, C> ProjectLocationClusterGetCertificateAuthorityCall<'a, C>
5731where
5732 C: common::Connector,
5733{
5734 /// Perform the operation you have build so far.
5735 pub async fn doit(mut self) -> common::Result<(common::Response, CertificateAuthority)> {
5736 use std::borrow::Cow;
5737 use std::io::{Read, Seek};
5738
5739 use common::{url::Params, ToParts};
5740 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5741
5742 let mut dd = common::DefaultDelegate;
5743 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5744 dlg.begin(common::MethodInfo {
5745 id: "redis.projects.locations.clusters.getCertificateAuthority",
5746 http_method: hyper::Method::GET,
5747 });
5748
5749 for &field in ["alt", "name"].iter() {
5750 if self._additional_params.contains_key(field) {
5751 dlg.finished(false);
5752 return Err(common::Error::FieldClash(field));
5753 }
5754 }
5755
5756 let mut params = Params::with_capacity(3 + self._additional_params.len());
5757 params.push("name", self._name);
5758
5759 params.extend(self._additional_params.iter());
5760
5761 params.push("alt", "json");
5762 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5763 if self._scopes.is_empty() {
5764 self._scopes
5765 .insert(Scope::CloudPlatform.as_ref().to_string());
5766 }
5767
5768 #[allow(clippy::single_element_loop)]
5769 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5770 url = params.uri_replacement(url, param_name, find_this, true);
5771 }
5772 {
5773 let to_remove = ["name"];
5774 params.remove_params(&to_remove);
5775 }
5776
5777 let url = params.parse_with_url(&url);
5778
5779 loop {
5780 let token = match self
5781 .hub
5782 .auth
5783 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5784 .await
5785 {
5786 Ok(token) => token,
5787 Err(e) => match dlg.token(e) {
5788 Ok(token) => token,
5789 Err(e) => {
5790 dlg.finished(false);
5791 return Err(common::Error::MissingToken(e));
5792 }
5793 },
5794 };
5795 let mut req_result = {
5796 let client = &self.hub.client;
5797 dlg.pre_request();
5798 let mut req_builder = hyper::Request::builder()
5799 .method(hyper::Method::GET)
5800 .uri(url.as_str())
5801 .header(USER_AGENT, self.hub._user_agent.clone());
5802
5803 if let Some(token) = token.as_ref() {
5804 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5805 }
5806
5807 let request = req_builder
5808 .header(CONTENT_LENGTH, 0_u64)
5809 .body(common::to_body::<String>(None));
5810
5811 client.request(request.unwrap()).await
5812 };
5813
5814 match req_result {
5815 Err(err) => {
5816 if let common::Retry::After(d) = dlg.http_error(&err) {
5817 sleep(d).await;
5818 continue;
5819 }
5820 dlg.finished(false);
5821 return Err(common::Error::HttpError(err));
5822 }
5823 Ok(res) => {
5824 let (mut parts, body) = res.into_parts();
5825 let mut body = common::Body::new(body);
5826 if !parts.status.is_success() {
5827 let bytes = common::to_bytes(body).await.unwrap_or_default();
5828 let error = serde_json::from_str(&common::to_string(&bytes));
5829 let response = common::to_response(parts, bytes.into());
5830
5831 if let common::Retry::After(d) =
5832 dlg.http_failure(&response, error.as_ref().ok())
5833 {
5834 sleep(d).await;
5835 continue;
5836 }
5837
5838 dlg.finished(false);
5839
5840 return Err(match error {
5841 Ok(value) => common::Error::BadRequest(value),
5842 _ => common::Error::Failure(response),
5843 });
5844 }
5845 let response = {
5846 let bytes = common::to_bytes(body).await.unwrap_or_default();
5847 let encoded = common::to_string(&bytes);
5848 match serde_json::from_str(&encoded) {
5849 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5850 Err(error) => {
5851 dlg.response_json_decode_error(&encoded, &error);
5852 return Err(common::Error::JsonDecodeError(
5853 encoded.to_string(),
5854 error,
5855 ));
5856 }
5857 }
5858 };
5859
5860 dlg.finished(true);
5861 return Ok(response);
5862 }
5863 }
5864 }
5865 }
5866
5867 /// Required. Redis cluster certificate authority resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority` where `location_id` refers to a Google Cloud region.
5868 ///
5869 /// Sets the *name* path property to the given value.
5870 ///
5871 /// Even though the property as already been set when instantiating this call,
5872 /// we provide this method for API completeness.
5873 pub fn name(
5874 mut self,
5875 new_value: &str,
5876 ) -> ProjectLocationClusterGetCertificateAuthorityCall<'a, C> {
5877 self._name = new_value.to_string();
5878 self
5879 }
5880 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5881 /// while executing the actual API request.
5882 ///
5883 /// ````text
5884 /// It should be used to handle progress information, and to implement a certain level of resilience.
5885 /// ````
5886 ///
5887 /// Sets the *delegate* property to the given value.
5888 pub fn delegate(
5889 mut self,
5890 new_value: &'a mut dyn common::Delegate,
5891 ) -> ProjectLocationClusterGetCertificateAuthorityCall<'a, C> {
5892 self._delegate = Some(new_value);
5893 self
5894 }
5895
5896 /// Set any additional parameter of the query string used in the request.
5897 /// It should be used to set parameters which are not yet available through their own
5898 /// setters.
5899 ///
5900 /// Please note that this method must not be used to set any of the known parameters
5901 /// which have their own setter method. If done anyway, the request will fail.
5902 ///
5903 /// # Additional Parameters
5904 ///
5905 /// * *$.xgafv* (query-string) - V1 error format.
5906 /// * *access_token* (query-string) - OAuth access token.
5907 /// * *alt* (query-string) - Data format for response.
5908 /// * *callback* (query-string) - JSONP
5909 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5910 /// * *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.
5911 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5912 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5913 /// * *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.
5914 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5915 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5916 pub fn param<T>(
5917 mut self,
5918 name: T,
5919 value: T,
5920 ) -> ProjectLocationClusterGetCertificateAuthorityCall<'a, C>
5921 where
5922 T: AsRef<str>,
5923 {
5924 self._additional_params
5925 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5926 self
5927 }
5928
5929 /// Identifies the authorization scope for the method you are building.
5930 ///
5931 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5932 /// [`Scope::CloudPlatform`].
5933 ///
5934 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5935 /// tokens for more than one scope.
5936 ///
5937 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5938 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5939 /// sufficient, a read-write scope will do as well.
5940 pub fn add_scope<St>(
5941 mut self,
5942 scope: St,
5943 ) -> ProjectLocationClusterGetCertificateAuthorityCall<'a, C>
5944 where
5945 St: AsRef<str>,
5946 {
5947 self._scopes.insert(String::from(scope.as_ref()));
5948 self
5949 }
5950 /// Identifies the authorization scope(s) for the method you are building.
5951 ///
5952 /// See [`Self::add_scope()`] for details.
5953 pub fn add_scopes<I, St>(
5954 mut self,
5955 scopes: I,
5956 ) -> ProjectLocationClusterGetCertificateAuthorityCall<'a, C>
5957 where
5958 I: IntoIterator<Item = St>,
5959 St: AsRef<str>,
5960 {
5961 self._scopes
5962 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5963 self
5964 }
5965
5966 /// Removes all scopes, and no default scope will be used either.
5967 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5968 /// for details).
5969 pub fn clear_scopes(mut self) -> ProjectLocationClusterGetCertificateAuthorityCall<'a, C> {
5970 self._scopes.clear();
5971 self
5972 }
5973}
5974
5975/// Lists all Redis clusters owned by a project in either the specified location (region) or all locations. The location should have the following format: * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
5976///
5977/// A builder for the *locations.clusters.list* method supported by a *project* resource.
5978/// It is not used directly, but through a [`ProjectMethods`] instance.
5979///
5980/// # Example
5981///
5982/// Instantiate a resource method builder
5983///
5984/// ```test_harness,no_run
5985/// # extern crate hyper;
5986/// # extern crate hyper_rustls;
5987/// # extern crate google_redis1 as redis1;
5988/// # async fn dox() {
5989/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5990///
5991/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5992/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5993/// # .with_native_roots()
5994/// # .unwrap()
5995/// # .https_only()
5996/// # .enable_http2()
5997/// # .build();
5998///
5999/// # let executor = hyper_util::rt::TokioExecutor::new();
6000/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6001/// # secret,
6002/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6003/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6004/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6005/// # ),
6006/// # ).build().await.unwrap();
6007///
6008/// # let client = hyper_util::client::legacy::Client::builder(
6009/// # hyper_util::rt::TokioExecutor::new()
6010/// # )
6011/// # .build(
6012/// # hyper_rustls::HttpsConnectorBuilder::new()
6013/// # .with_native_roots()
6014/// # .unwrap()
6015/// # .https_or_http()
6016/// # .enable_http2()
6017/// # .build()
6018/// # );
6019/// # let mut hub = CloudRedis::new(client, auth);
6020/// // You can configure optional parameters by calling the respective setters at will, and
6021/// // execute the final call using `doit()`.
6022/// // Values shown here are possibly random and not representative !
6023/// let result = hub.projects().locations_clusters_list("parent")
6024/// .page_token("ipsum")
6025/// .page_size(-50)
6026/// .doit().await;
6027/// # }
6028/// ```
6029pub struct ProjectLocationClusterListCall<'a, C>
6030where
6031 C: 'a,
6032{
6033 hub: &'a CloudRedis<C>,
6034 _parent: String,
6035 _page_token: Option<String>,
6036 _page_size: Option<i32>,
6037 _delegate: Option<&'a mut dyn common::Delegate>,
6038 _additional_params: HashMap<String, String>,
6039 _scopes: BTreeSet<String>,
6040}
6041
6042impl<'a, C> common::CallBuilder for ProjectLocationClusterListCall<'a, C> {}
6043
6044impl<'a, C> ProjectLocationClusterListCall<'a, C>
6045where
6046 C: common::Connector,
6047{
6048 /// Perform the operation you have build so far.
6049 pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
6050 use std::borrow::Cow;
6051 use std::io::{Read, Seek};
6052
6053 use common::{url::Params, ToParts};
6054 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6055
6056 let mut dd = common::DefaultDelegate;
6057 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6058 dlg.begin(common::MethodInfo {
6059 id: "redis.projects.locations.clusters.list",
6060 http_method: hyper::Method::GET,
6061 });
6062
6063 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6064 if self._additional_params.contains_key(field) {
6065 dlg.finished(false);
6066 return Err(common::Error::FieldClash(field));
6067 }
6068 }
6069
6070 let mut params = Params::with_capacity(5 + self._additional_params.len());
6071 params.push("parent", self._parent);
6072 if let Some(value) = self._page_token.as_ref() {
6073 params.push("pageToken", value);
6074 }
6075 if let Some(value) = self._page_size.as_ref() {
6076 params.push("pageSize", value.to_string());
6077 }
6078
6079 params.extend(self._additional_params.iter());
6080
6081 params.push("alt", "json");
6082 let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
6083 if self._scopes.is_empty() {
6084 self._scopes
6085 .insert(Scope::CloudPlatform.as_ref().to_string());
6086 }
6087
6088 #[allow(clippy::single_element_loop)]
6089 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6090 url = params.uri_replacement(url, param_name, find_this, true);
6091 }
6092 {
6093 let to_remove = ["parent"];
6094 params.remove_params(&to_remove);
6095 }
6096
6097 let url = params.parse_with_url(&url);
6098
6099 loop {
6100 let token = match self
6101 .hub
6102 .auth
6103 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6104 .await
6105 {
6106 Ok(token) => token,
6107 Err(e) => match dlg.token(e) {
6108 Ok(token) => token,
6109 Err(e) => {
6110 dlg.finished(false);
6111 return Err(common::Error::MissingToken(e));
6112 }
6113 },
6114 };
6115 let mut req_result = {
6116 let client = &self.hub.client;
6117 dlg.pre_request();
6118 let mut req_builder = hyper::Request::builder()
6119 .method(hyper::Method::GET)
6120 .uri(url.as_str())
6121 .header(USER_AGENT, self.hub._user_agent.clone());
6122
6123 if let Some(token) = token.as_ref() {
6124 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6125 }
6126
6127 let request = req_builder
6128 .header(CONTENT_LENGTH, 0_u64)
6129 .body(common::to_body::<String>(None));
6130
6131 client.request(request.unwrap()).await
6132 };
6133
6134 match req_result {
6135 Err(err) => {
6136 if let common::Retry::After(d) = dlg.http_error(&err) {
6137 sleep(d).await;
6138 continue;
6139 }
6140 dlg.finished(false);
6141 return Err(common::Error::HttpError(err));
6142 }
6143 Ok(res) => {
6144 let (mut parts, body) = res.into_parts();
6145 let mut body = common::Body::new(body);
6146 if !parts.status.is_success() {
6147 let bytes = common::to_bytes(body).await.unwrap_or_default();
6148 let error = serde_json::from_str(&common::to_string(&bytes));
6149 let response = common::to_response(parts, bytes.into());
6150
6151 if let common::Retry::After(d) =
6152 dlg.http_failure(&response, error.as_ref().ok())
6153 {
6154 sleep(d).await;
6155 continue;
6156 }
6157
6158 dlg.finished(false);
6159
6160 return Err(match error {
6161 Ok(value) => common::Error::BadRequest(value),
6162 _ => common::Error::Failure(response),
6163 });
6164 }
6165 let response = {
6166 let bytes = common::to_bytes(body).await.unwrap_or_default();
6167 let encoded = common::to_string(&bytes);
6168 match serde_json::from_str(&encoded) {
6169 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6170 Err(error) => {
6171 dlg.response_json_decode_error(&encoded, &error);
6172 return Err(common::Error::JsonDecodeError(
6173 encoded.to_string(),
6174 error,
6175 ));
6176 }
6177 }
6178 };
6179
6180 dlg.finished(true);
6181 return Ok(response);
6182 }
6183 }
6184 }
6185 }
6186
6187 /// Required. The resource name of the cluster location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.
6188 ///
6189 /// Sets the *parent* path property to the given value.
6190 ///
6191 /// Even though the property as already been set when instantiating this call,
6192 /// we provide this method for API completeness.
6193 pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
6194 self._parent = new_value.to_string();
6195 self
6196 }
6197 /// The `next_page_token` value returned from a previous ListClusters request, if any.
6198 ///
6199 /// Sets the *page token* query property to the given value.
6200 pub fn page_token(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
6201 self._page_token = Some(new_value.to_string());
6202 self
6203 }
6204 /// The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's `next_page_token` to determine if there are more clusters left to be queried.
6205 ///
6206 /// Sets the *page size* query property to the given value.
6207 pub fn page_size(mut self, new_value: i32) -> ProjectLocationClusterListCall<'a, C> {
6208 self._page_size = Some(new_value);
6209 self
6210 }
6211 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6212 /// while executing the actual API request.
6213 ///
6214 /// ````text
6215 /// It should be used to handle progress information, and to implement a certain level of resilience.
6216 /// ````
6217 ///
6218 /// Sets the *delegate* property to the given value.
6219 pub fn delegate(
6220 mut self,
6221 new_value: &'a mut dyn common::Delegate,
6222 ) -> ProjectLocationClusterListCall<'a, C> {
6223 self._delegate = Some(new_value);
6224 self
6225 }
6226
6227 /// Set any additional parameter of the query string used in the request.
6228 /// It should be used to set parameters which are not yet available through their own
6229 /// setters.
6230 ///
6231 /// Please note that this method must not be used to set any of the known parameters
6232 /// which have their own setter method. If done anyway, the request will fail.
6233 ///
6234 /// # Additional Parameters
6235 ///
6236 /// * *$.xgafv* (query-string) - V1 error format.
6237 /// * *access_token* (query-string) - OAuth access token.
6238 /// * *alt* (query-string) - Data format for response.
6239 /// * *callback* (query-string) - JSONP
6240 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6241 /// * *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.
6242 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6243 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6244 /// * *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.
6245 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6246 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6247 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterListCall<'a, C>
6248 where
6249 T: AsRef<str>,
6250 {
6251 self._additional_params
6252 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6253 self
6254 }
6255
6256 /// Identifies the authorization scope for the method you are building.
6257 ///
6258 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6259 /// [`Scope::CloudPlatform`].
6260 ///
6261 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6262 /// tokens for more than one scope.
6263 ///
6264 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6265 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6266 /// sufficient, a read-write scope will do as well.
6267 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterListCall<'a, C>
6268 where
6269 St: AsRef<str>,
6270 {
6271 self._scopes.insert(String::from(scope.as_ref()));
6272 self
6273 }
6274 /// Identifies the authorization scope(s) for the method you are building.
6275 ///
6276 /// See [`Self::add_scope()`] for details.
6277 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterListCall<'a, C>
6278 where
6279 I: IntoIterator<Item = St>,
6280 St: AsRef<str>,
6281 {
6282 self._scopes
6283 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6284 self
6285 }
6286
6287 /// Removes all scopes, and no default scope will be used either.
6288 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6289 /// for details).
6290 pub fn clear_scopes(mut self) -> ProjectLocationClusterListCall<'a, C> {
6291 self._scopes.clear();
6292 self
6293 }
6294}
6295
6296/// Updates the metadata and configuration of a specific Redis cluster. Completed longrunning.Operation will contain the new cluster object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
6297///
6298/// A builder for the *locations.clusters.patch* method supported by a *project* resource.
6299/// It is not used directly, but through a [`ProjectMethods`] instance.
6300///
6301/// # Example
6302///
6303/// Instantiate a resource method builder
6304///
6305/// ```test_harness,no_run
6306/// # extern crate hyper;
6307/// # extern crate hyper_rustls;
6308/// # extern crate google_redis1 as redis1;
6309/// use redis1::api::Cluster;
6310/// # async fn dox() {
6311/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6312///
6313/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6314/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6315/// # .with_native_roots()
6316/// # .unwrap()
6317/// # .https_only()
6318/// # .enable_http2()
6319/// # .build();
6320///
6321/// # let executor = hyper_util::rt::TokioExecutor::new();
6322/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6323/// # secret,
6324/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6325/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6326/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6327/// # ),
6328/// # ).build().await.unwrap();
6329///
6330/// # let client = hyper_util::client::legacy::Client::builder(
6331/// # hyper_util::rt::TokioExecutor::new()
6332/// # )
6333/// # .build(
6334/// # hyper_rustls::HttpsConnectorBuilder::new()
6335/// # .with_native_roots()
6336/// # .unwrap()
6337/// # .https_or_http()
6338/// # .enable_http2()
6339/// # .build()
6340/// # );
6341/// # let mut hub = CloudRedis::new(client, auth);
6342/// // As the method needs a request, you would usually fill it with the desired information
6343/// // into the respective structure. Some of the parts shown here might not be applicable !
6344/// // Values shown here are possibly random and not representative !
6345/// let mut req = Cluster::default();
6346///
6347/// // You can configure optional parameters by calling the respective setters at will, and
6348/// // execute the final call using `doit()`.
6349/// // Values shown here are possibly random and not representative !
6350/// let result = hub.projects().locations_clusters_patch(req, "name")
6351/// .update_mask(FieldMask::new::<&str>(&[]))
6352/// .request_id("gubergren")
6353/// .doit().await;
6354/// # }
6355/// ```
6356pub struct ProjectLocationClusterPatchCall<'a, C>
6357where
6358 C: 'a,
6359{
6360 hub: &'a CloudRedis<C>,
6361 _request: Cluster,
6362 _name: String,
6363 _update_mask: Option<common::FieldMask>,
6364 _request_id: Option<String>,
6365 _delegate: Option<&'a mut dyn common::Delegate>,
6366 _additional_params: HashMap<String, String>,
6367 _scopes: BTreeSet<String>,
6368}
6369
6370impl<'a, C> common::CallBuilder for ProjectLocationClusterPatchCall<'a, C> {}
6371
6372impl<'a, C> ProjectLocationClusterPatchCall<'a, C>
6373where
6374 C: common::Connector,
6375{
6376 /// Perform the operation you have build so far.
6377 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6378 use std::borrow::Cow;
6379 use std::io::{Read, Seek};
6380
6381 use common::{url::Params, ToParts};
6382 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6383
6384 let mut dd = common::DefaultDelegate;
6385 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6386 dlg.begin(common::MethodInfo {
6387 id: "redis.projects.locations.clusters.patch",
6388 http_method: hyper::Method::PATCH,
6389 });
6390
6391 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
6392 if self._additional_params.contains_key(field) {
6393 dlg.finished(false);
6394 return Err(common::Error::FieldClash(field));
6395 }
6396 }
6397
6398 let mut params = Params::with_capacity(6 + self._additional_params.len());
6399 params.push("name", self._name);
6400 if let Some(value) = self._update_mask.as_ref() {
6401 params.push("updateMask", value.to_string());
6402 }
6403 if let Some(value) = self._request_id.as_ref() {
6404 params.push("requestId", value);
6405 }
6406
6407 params.extend(self._additional_params.iter());
6408
6409 params.push("alt", "json");
6410 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6411 if self._scopes.is_empty() {
6412 self._scopes
6413 .insert(Scope::CloudPlatform.as_ref().to_string());
6414 }
6415
6416 #[allow(clippy::single_element_loop)]
6417 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6418 url = params.uri_replacement(url, param_name, find_this, true);
6419 }
6420 {
6421 let to_remove = ["name"];
6422 params.remove_params(&to_remove);
6423 }
6424
6425 let url = params.parse_with_url(&url);
6426
6427 let mut json_mime_type = mime::APPLICATION_JSON;
6428 let mut request_value_reader = {
6429 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6430 common::remove_json_null_values(&mut value);
6431 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6432 serde_json::to_writer(&mut dst, &value).unwrap();
6433 dst
6434 };
6435 let request_size = request_value_reader
6436 .seek(std::io::SeekFrom::End(0))
6437 .unwrap();
6438 request_value_reader
6439 .seek(std::io::SeekFrom::Start(0))
6440 .unwrap();
6441
6442 loop {
6443 let token = match self
6444 .hub
6445 .auth
6446 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6447 .await
6448 {
6449 Ok(token) => token,
6450 Err(e) => match dlg.token(e) {
6451 Ok(token) => token,
6452 Err(e) => {
6453 dlg.finished(false);
6454 return Err(common::Error::MissingToken(e));
6455 }
6456 },
6457 };
6458 request_value_reader
6459 .seek(std::io::SeekFrom::Start(0))
6460 .unwrap();
6461 let mut req_result = {
6462 let client = &self.hub.client;
6463 dlg.pre_request();
6464 let mut req_builder = hyper::Request::builder()
6465 .method(hyper::Method::PATCH)
6466 .uri(url.as_str())
6467 .header(USER_AGENT, self.hub._user_agent.clone());
6468
6469 if let Some(token) = token.as_ref() {
6470 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6471 }
6472
6473 let request = req_builder
6474 .header(CONTENT_TYPE, json_mime_type.to_string())
6475 .header(CONTENT_LENGTH, request_size as u64)
6476 .body(common::to_body(
6477 request_value_reader.get_ref().clone().into(),
6478 ));
6479
6480 client.request(request.unwrap()).await
6481 };
6482
6483 match req_result {
6484 Err(err) => {
6485 if let common::Retry::After(d) = dlg.http_error(&err) {
6486 sleep(d).await;
6487 continue;
6488 }
6489 dlg.finished(false);
6490 return Err(common::Error::HttpError(err));
6491 }
6492 Ok(res) => {
6493 let (mut parts, body) = res.into_parts();
6494 let mut body = common::Body::new(body);
6495 if !parts.status.is_success() {
6496 let bytes = common::to_bytes(body).await.unwrap_or_default();
6497 let error = serde_json::from_str(&common::to_string(&bytes));
6498 let response = common::to_response(parts, bytes.into());
6499
6500 if let common::Retry::After(d) =
6501 dlg.http_failure(&response, error.as_ref().ok())
6502 {
6503 sleep(d).await;
6504 continue;
6505 }
6506
6507 dlg.finished(false);
6508
6509 return Err(match error {
6510 Ok(value) => common::Error::BadRequest(value),
6511 _ => common::Error::Failure(response),
6512 });
6513 }
6514 let response = {
6515 let bytes = common::to_bytes(body).await.unwrap_or_default();
6516 let encoded = common::to_string(&bytes);
6517 match serde_json::from_str(&encoded) {
6518 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6519 Err(error) => {
6520 dlg.response_json_decode_error(&encoded, &error);
6521 return Err(common::Error::JsonDecodeError(
6522 encoded.to_string(),
6523 error,
6524 ));
6525 }
6526 }
6527 };
6528
6529 dlg.finished(true);
6530 return Ok(response);
6531 }
6532 }
6533 }
6534 }
6535
6536 ///
6537 /// Sets the *request* property to the given value.
6538 ///
6539 /// Even though the property as already been set when instantiating this call,
6540 /// we provide this method for API completeness.
6541 pub fn request(mut self, new_value: Cluster) -> ProjectLocationClusterPatchCall<'a, C> {
6542 self._request = new_value;
6543 self
6544 }
6545 /// Required. Identifier. Unique name of the resource in this scope including project and location using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
6546 ///
6547 /// Sets the *name* path property to the given value.
6548 ///
6549 /// Even though the property as already been set when instantiating this call,
6550 /// we provide this method for API completeness.
6551 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterPatchCall<'a, C> {
6552 self._name = new_value.to_string();
6553 self
6554 }
6555 /// Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field may only include these fields from Cluster: * `size_gb` * `replica_count` * `cluster_endpoints`
6556 ///
6557 /// Sets the *update mask* query property to the given value.
6558 pub fn update_mask(
6559 mut self,
6560 new_value: common::FieldMask,
6561 ) -> ProjectLocationClusterPatchCall<'a, C> {
6562 self._update_mask = Some(new_value);
6563 self
6564 }
6565 /// Optional. Idempotent request UUID.
6566 ///
6567 /// Sets the *request id* query property to the given value.
6568 pub fn request_id(mut self, new_value: &str) -> ProjectLocationClusterPatchCall<'a, C> {
6569 self._request_id = Some(new_value.to_string());
6570 self
6571 }
6572 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6573 /// while executing the actual API request.
6574 ///
6575 /// ````text
6576 /// It should be used to handle progress information, and to implement a certain level of resilience.
6577 /// ````
6578 ///
6579 /// Sets the *delegate* property to the given value.
6580 pub fn delegate(
6581 mut self,
6582 new_value: &'a mut dyn common::Delegate,
6583 ) -> ProjectLocationClusterPatchCall<'a, C> {
6584 self._delegate = Some(new_value);
6585 self
6586 }
6587
6588 /// Set any additional parameter of the query string used in the request.
6589 /// It should be used to set parameters which are not yet available through their own
6590 /// setters.
6591 ///
6592 /// Please note that this method must not be used to set any of the known parameters
6593 /// which have their own setter method. If done anyway, the request will fail.
6594 ///
6595 /// # Additional Parameters
6596 ///
6597 /// * *$.xgafv* (query-string) - V1 error format.
6598 /// * *access_token* (query-string) - OAuth access token.
6599 /// * *alt* (query-string) - Data format for response.
6600 /// * *callback* (query-string) - JSONP
6601 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6602 /// * *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.
6603 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6604 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6605 /// * *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.
6606 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6607 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6608 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterPatchCall<'a, C>
6609 where
6610 T: AsRef<str>,
6611 {
6612 self._additional_params
6613 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6614 self
6615 }
6616
6617 /// Identifies the authorization scope for the method you are building.
6618 ///
6619 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6620 /// [`Scope::CloudPlatform`].
6621 ///
6622 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6623 /// tokens for more than one scope.
6624 ///
6625 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6626 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6627 /// sufficient, a read-write scope will do as well.
6628 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterPatchCall<'a, C>
6629 where
6630 St: AsRef<str>,
6631 {
6632 self._scopes.insert(String::from(scope.as_ref()));
6633 self
6634 }
6635 /// Identifies the authorization scope(s) for the method you are building.
6636 ///
6637 /// See [`Self::add_scope()`] for details.
6638 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterPatchCall<'a, C>
6639 where
6640 I: IntoIterator<Item = St>,
6641 St: AsRef<str>,
6642 {
6643 self._scopes
6644 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6645 self
6646 }
6647
6648 /// Removes all scopes, and no default scope will be used either.
6649 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6650 /// for details).
6651 pub fn clear_scopes(mut self) -> ProjectLocationClusterPatchCall<'a, C> {
6652 self._scopes.clear();
6653 self
6654 }
6655}
6656
6657/// Reschedules upcoming maintenance event.
6658///
6659/// A builder for the *locations.clusters.rescheduleClusterMaintenance* method supported by a *project* resource.
6660/// It is not used directly, but through a [`ProjectMethods`] instance.
6661///
6662/// # Example
6663///
6664/// Instantiate a resource method builder
6665///
6666/// ```test_harness,no_run
6667/// # extern crate hyper;
6668/// # extern crate hyper_rustls;
6669/// # extern crate google_redis1 as redis1;
6670/// use redis1::api::RescheduleClusterMaintenanceRequest;
6671/// # async fn dox() {
6672/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6673///
6674/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6675/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6676/// # .with_native_roots()
6677/// # .unwrap()
6678/// # .https_only()
6679/// # .enable_http2()
6680/// # .build();
6681///
6682/// # let executor = hyper_util::rt::TokioExecutor::new();
6683/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6684/// # secret,
6685/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6686/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6687/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6688/// # ),
6689/// # ).build().await.unwrap();
6690///
6691/// # let client = hyper_util::client::legacy::Client::builder(
6692/// # hyper_util::rt::TokioExecutor::new()
6693/// # )
6694/// # .build(
6695/// # hyper_rustls::HttpsConnectorBuilder::new()
6696/// # .with_native_roots()
6697/// # .unwrap()
6698/// # .https_or_http()
6699/// # .enable_http2()
6700/// # .build()
6701/// # );
6702/// # let mut hub = CloudRedis::new(client, auth);
6703/// // As the method needs a request, you would usually fill it with the desired information
6704/// // into the respective structure. Some of the parts shown here might not be applicable !
6705/// // Values shown here are possibly random and not representative !
6706/// let mut req = RescheduleClusterMaintenanceRequest::default();
6707///
6708/// // You can configure optional parameters by calling the respective setters at will, and
6709/// // execute the final call using `doit()`.
6710/// // Values shown here are possibly random and not representative !
6711/// let result = hub.projects().locations_clusters_reschedule_cluster_maintenance(req, "name")
6712/// .doit().await;
6713/// # }
6714/// ```
6715pub struct ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C>
6716where
6717 C: 'a,
6718{
6719 hub: &'a CloudRedis<C>,
6720 _request: RescheduleClusterMaintenanceRequest,
6721 _name: String,
6722 _delegate: Option<&'a mut dyn common::Delegate>,
6723 _additional_params: HashMap<String, String>,
6724 _scopes: BTreeSet<String>,
6725}
6726
6727impl<'a, C> common::CallBuilder for ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C> {}
6728
6729impl<'a, C> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C>
6730where
6731 C: common::Connector,
6732{
6733 /// Perform the operation you have build so far.
6734 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6735 use std::borrow::Cow;
6736 use std::io::{Read, Seek};
6737
6738 use common::{url::Params, ToParts};
6739 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6740
6741 let mut dd = common::DefaultDelegate;
6742 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6743 dlg.begin(common::MethodInfo {
6744 id: "redis.projects.locations.clusters.rescheduleClusterMaintenance",
6745 http_method: hyper::Method::POST,
6746 });
6747
6748 for &field in ["alt", "name"].iter() {
6749 if self._additional_params.contains_key(field) {
6750 dlg.finished(false);
6751 return Err(common::Error::FieldClash(field));
6752 }
6753 }
6754
6755 let mut params = Params::with_capacity(4 + self._additional_params.len());
6756 params.push("name", self._name);
6757
6758 params.extend(self._additional_params.iter());
6759
6760 params.push("alt", "json");
6761 let mut url = self.hub._base_url.clone() + "v1/{+name}:rescheduleClusterMaintenance";
6762 if self._scopes.is_empty() {
6763 self._scopes
6764 .insert(Scope::CloudPlatform.as_ref().to_string());
6765 }
6766
6767 #[allow(clippy::single_element_loop)]
6768 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6769 url = params.uri_replacement(url, param_name, find_this, true);
6770 }
6771 {
6772 let to_remove = ["name"];
6773 params.remove_params(&to_remove);
6774 }
6775
6776 let url = params.parse_with_url(&url);
6777
6778 let mut json_mime_type = mime::APPLICATION_JSON;
6779 let mut request_value_reader = {
6780 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6781 common::remove_json_null_values(&mut value);
6782 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6783 serde_json::to_writer(&mut dst, &value).unwrap();
6784 dst
6785 };
6786 let request_size = request_value_reader
6787 .seek(std::io::SeekFrom::End(0))
6788 .unwrap();
6789 request_value_reader
6790 .seek(std::io::SeekFrom::Start(0))
6791 .unwrap();
6792
6793 loop {
6794 let token = match self
6795 .hub
6796 .auth
6797 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6798 .await
6799 {
6800 Ok(token) => token,
6801 Err(e) => match dlg.token(e) {
6802 Ok(token) => token,
6803 Err(e) => {
6804 dlg.finished(false);
6805 return Err(common::Error::MissingToken(e));
6806 }
6807 },
6808 };
6809 request_value_reader
6810 .seek(std::io::SeekFrom::Start(0))
6811 .unwrap();
6812 let mut req_result = {
6813 let client = &self.hub.client;
6814 dlg.pre_request();
6815 let mut req_builder = hyper::Request::builder()
6816 .method(hyper::Method::POST)
6817 .uri(url.as_str())
6818 .header(USER_AGENT, self.hub._user_agent.clone());
6819
6820 if let Some(token) = token.as_ref() {
6821 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6822 }
6823
6824 let request = req_builder
6825 .header(CONTENT_TYPE, json_mime_type.to_string())
6826 .header(CONTENT_LENGTH, request_size as u64)
6827 .body(common::to_body(
6828 request_value_reader.get_ref().clone().into(),
6829 ));
6830
6831 client.request(request.unwrap()).await
6832 };
6833
6834 match req_result {
6835 Err(err) => {
6836 if let common::Retry::After(d) = dlg.http_error(&err) {
6837 sleep(d).await;
6838 continue;
6839 }
6840 dlg.finished(false);
6841 return Err(common::Error::HttpError(err));
6842 }
6843 Ok(res) => {
6844 let (mut parts, body) = res.into_parts();
6845 let mut body = common::Body::new(body);
6846 if !parts.status.is_success() {
6847 let bytes = common::to_bytes(body).await.unwrap_or_default();
6848 let error = serde_json::from_str(&common::to_string(&bytes));
6849 let response = common::to_response(parts, bytes.into());
6850
6851 if let common::Retry::After(d) =
6852 dlg.http_failure(&response, error.as_ref().ok())
6853 {
6854 sleep(d).await;
6855 continue;
6856 }
6857
6858 dlg.finished(false);
6859
6860 return Err(match error {
6861 Ok(value) => common::Error::BadRequest(value),
6862 _ => common::Error::Failure(response),
6863 });
6864 }
6865 let response = {
6866 let bytes = common::to_bytes(body).await.unwrap_or_default();
6867 let encoded = common::to_string(&bytes);
6868 match serde_json::from_str(&encoded) {
6869 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6870 Err(error) => {
6871 dlg.response_json_decode_error(&encoded, &error);
6872 return Err(common::Error::JsonDecodeError(
6873 encoded.to_string(),
6874 error,
6875 ));
6876 }
6877 }
6878 };
6879
6880 dlg.finished(true);
6881 return Ok(response);
6882 }
6883 }
6884 }
6885 }
6886
6887 ///
6888 /// Sets the *request* property to the given value.
6889 ///
6890 /// Even though the property as already been set when instantiating this call,
6891 /// we provide this method for API completeness.
6892 pub fn request(
6893 mut self,
6894 new_value: RescheduleClusterMaintenanceRequest,
6895 ) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C> {
6896 self._request = new_value;
6897 self
6898 }
6899 /// Required. Redis Cluster instance resource name using the form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where `location_id` refers to a Google Cloud region.
6900 ///
6901 /// Sets the *name* path property to the given value.
6902 ///
6903 /// Even though the property as already been set when instantiating this call,
6904 /// we provide this method for API completeness.
6905 pub fn name(
6906 mut self,
6907 new_value: &str,
6908 ) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C> {
6909 self._name = new_value.to_string();
6910 self
6911 }
6912 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6913 /// while executing the actual API request.
6914 ///
6915 /// ````text
6916 /// It should be used to handle progress information, and to implement a certain level of resilience.
6917 /// ````
6918 ///
6919 /// Sets the *delegate* property to the given value.
6920 pub fn delegate(
6921 mut self,
6922 new_value: &'a mut dyn common::Delegate,
6923 ) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C> {
6924 self._delegate = Some(new_value);
6925 self
6926 }
6927
6928 /// Set any additional parameter of the query string used in the request.
6929 /// It should be used to set parameters which are not yet available through their own
6930 /// setters.
6931 ///
6932 /// Please note that this method must not be used to set any of the known parameters
6933 /// which have their own setter method. If done anyway, the request will fail.
6934 ///
6935 /// # Additional Parameters
6936 ///
6937 /// * *$.xgafv* (query-string) - V1 error format.
6938 /// * *access_token* (query-string) - OAuth access token.
6939 /// * *alt* (query-string) - Data format for response.
6940 /// * *callback* (query-string) - JSONP
6941 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6942 /// * *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.
6943 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6944 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6945 /// * *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.
6946 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6947 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6948 pub fn param<T>(
6949 mut self,
6950 name: T,
6951 value: T,
6952 ) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C>
6953 where
6954 T: AsRef<str>,
6955 {
6956 self._additional_params
6957 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6958 self
6959 }
6960
6961 /// Identifies the authorization scope for the method you are building.
6962 ///
6963 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6964 /// [`Scope::CloudPlatform`].
6965 ///
6966 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6967 /// tokens for more than one scope.
6968 ///
6969 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6970 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6971 /// sufficient, a read-write scope will do as well.
6972 pub fn add_scope<St>(
6973 mut self,
6974 scope: St,
6975 ) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C>
6976 where
6977 St: AsRef<str>,
6978 {
6979 self._scopes.insert(String::from(scope.as_ref()));
6980 self
6981 }
6982 /// Identifies the authorization scope(s) for the method you are building.
6983 ///
6984 /// See [`Self::add_scope()`] for details.
6985 pub fn add_scopes<I, St>(
6986 mut self,
6987 scopes: I,
6988 ) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C>
6989 where
6990 I: IntoIterator<Item = St>,
6991 St: AsRef<str>,
6992 {
6993 self._scopes
6994 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6995 self
6996 }
6997
6998 /// Removes all scopes, and no default scope will be used either.
6999 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7000 /// for details).
7001 pub fn clear_scopes(mut self) -> ProjectLocationClusterRescheduleClusterMaintenanceCall<'a, C> {
7002 self._scopes.clear();
7003 self
7004 }
7005}
7006
7007/// Creates a Redis instance based on the specified tier and memory size. By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc). The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
7008///
7009/// A builder for the *locations.instances.create* method supported by a *project* resource.
7010/// It is not used directly, but through a [`ProjectMethods`] instance.
7011///
7012/// # Example
7013///
7014/// Instantiate a resource method builder
7015///
7016/// ```test_harness,no_run
7017/// # extern crate hyper;
7018/// # extern crate hyper_rustls;
7019/// # extern crate google_redis1 as redis1;
7020/// use redis1::api::Instance;
7021/// # async fn dox() {
7022/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7023///
7024/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7025/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7026/// # .with_native_roots()
7027/// # .unwrap()
7028/// # .https_only()
7029/// # .enable_http2()
7030/// # .build();
7031///
7032/// # let executor = hyper_util::rt::TokioExecutor::new();
7033/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7034/// # secret,
7035/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7036/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7037/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7038/// # ),
7039/// # ).build().await.unwrap();
7040///
7041/// # let client = hyper_util::client::legacy::Client::builder(
7042/// # hyper_util::rt::TokioExecutor::new()
7043/// # )
7044/// # .build(
7045/// # hyper_rustls::HttpsConnectorBuilder::new()
7046/// # .with_native_roots()
7047/// # .unwrap()
7048/// # .https_or_http()
7049/// # .enable_http2()
7050/// # .build()
7051/// # );
7052/// # let mut hub = CloudRedis::new(client, auth);
7053/// // As the method needs a request, you would usually fill it with the desired information
7054/// // into the respective structure. Some of the parts shown here might not be applicable !
7055/// // Values shown here are possibly random and not representative !
7056/// let mut req = Instance::default();
7057///
7058/// // You can configure optional parameters by calling the respective setters at will, and
7059/// // execute the final call using `doit()`.
7060/// // Values shown here are possibly random and not representative !
7061/// let result = hub.projects().locations_instances_create(req, "parent")
7062/// .instance_id("Lorem")
7063/// .doit().await;
7064/// # }
7065/// ```
7066pub struct ProjectLocationInstanceCreateCall<'a, C>
7067where
7068 C: 'a,
7069{
7070 hub: &'a CloudRedis<C>,
7071 _request: Instance,
7072 _parent: String,
7073 _instance_id: Option<String>,
7074 _delegate: Option<&'a mut dyn common::Delegate>,
7075 _additional_params: HashMap<String, String>,
7076 _scopes: BTreeSet<String>,
7077}
7078
7079impl<'a, C> common::CallBuilder for ProjectLocationInstanceCreateCall<'a, C> {}
7080
7081impl<'a, C> ProjectLocationInstanceCreateCall<'a, C>
7082where
7083 C: common::Connector,
7084{
7085 /// Perform the operation you have build so far.
7086 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7087 use std::borrow::Cow;
7088 use std::io::{Read, Seek};
7089
7090 use common::{url::Params, ToParts};
7091 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7092
7093 let mut dd = common::DefaultDelegate;
7094 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7095 dlg.begin(common::MethodInfo {
7096 id: "redis.projects.locations.instances.create",
7097 http_method: hyper::Method::POST,
7098 });
7099
7100 for &field in ["alt", "parent", "instanceId"].iter() {
7101 if self._additional_params.contains_key(field) {
7102 dlg.finished(false);
7103 return Err(common::Error::FieldClash(field));
7104 }
7105 }
7106
7107 let mut params = Params::with_capacity(5 + self._additional_params.len());
7108 params.push("parent", self._parent);
7109 if let Some(value) = self._instance_id.as_ref() {
7110 params.push("instanceId", value);
7111 }
7112
7113 params.extend(self._additional_params.iter());
7114
7115 params.push("alt", "json");
7116 let mut url = self.hub._base_url.clone() + "v1/{+parent}/instances";
7117 if self._scopes.is_empty() {
7118 self._scopes
7119 .insert(Scope::CloudPlatform.as_ref().to_string());
7120 }
7121
7122 #[allow(clippy::single_element_loop)]
7123 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7124 url = params.uri_replacement(url, param_name, find_this, true);
7125 }
7126 {
7127 let to_remove = ["parent"];
7128 params.remove_params(&to_remove);
7129 }
7130
7131 let url = params.parse_with_url(&url);
7132
7133 let mut json_mime_type = mime::APPLICATION_JSON;
7134 let mut request_value_reader = {
7135 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7136 common::remove_json_null_values(&mut value);
7137 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7138 serde_json::to_writer(&mut dst, &value).unwrap();
7139 dst
7140 };
7141 let request_size = request_value_reader
7142 .seek(std::io::SeekFrom::End(0))
7143 .unwrap();
7144 request_value_reader
7145 .seek(std::io::SeekFrom::Start(0))
7146 .unwrap();
7147
7148 loop {
7149 let token = match self
7150 .hub
7151 .auth
7152 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7153 .await
7154 {
7155 Ok(token) => token,
7156 Err(e) => match dlg.token(e) {
7157 Ok(token) => token,
7158 Err(e) => {
7159 dlg.finished(false);
7160 return Err(common::Error::MissingToken(e));
7161 }
7162 },
7163 };
7164 request_value_reader
7165 .seek(std::io::SeekFrom::Start(0))
7166 .unwrap();
7167 let mut req_result = {
7168 let client = &self.hub.client;
7169 dlg.pre_request();
7170 let mut req_builder = hyper::Request::builder()
7171 .method(hyper::Method::POST)
7172 .uri(url.as_str())
7173 .header(USER_AGENT, self.hub._user_agent.clone());
7174
7175 if let Some(token) = token.as_ref() {
7176 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7177 }
7178
7179 let request = req_builder
7180 .header(CONTENT_TYPE, json_mime_type.to_string())
7181 .header(CONTENT_LENGTH, request_size as u64)
7182 .body(common::to_body(
7183 request_value_reader.get_ref().clone().into(),
7184 ));
7185
7186 client.request(request.unwrap()).await
7187 };
7188
7189 match req_result {
7190 Err(err) => {
7191 if let common::Retry::After(d) = dlg.http_error(&err) {
7192 sleep(d).await;
7193 continue;
7194 }
7195 dlg.finished(false);
7196 return Err(common::Error::HttpError(err));
7197 }
7198 Ok(res) => {
7199 let (mut parts, body) = res.into_parts();
7200 let mut body = common::Body::new(body);
7201 if !parts.status.is_success() {
7202 let bytes = common::to_bytes(body).await.unwrap_or_default();
7203 let error = serde_json::from_str(&common::to_string(&bytes));
7204 let response = common::to_response(parts, bytes.into());
7205
7206 if let common::Retry::After(d) =
7207 dlg.http_failure(&response, error.as_ref().ok())
7208 {
7209 sleep(d).await;
7210 continue;
7211 }
7212
7213 dlg.finished(false);
7214
7215 return Err(match error {
7216 Ok(value) => common::Error::BadRequest(value),
7217 _ => common::Error::Failure(response),
7218 });
7219 }
7220 let response = {
7221 let bytes = common::to_bytes(body).await.unwrap_or_default();
7222 let encoded = common::to_string(&bytes);
7223 match serde_json::from_str(&encoded) {
7224 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7225 Err(error) => {
7226 dlg.response_json_decode_error(&encoded, &error);
7227 return Err(common::Error::JsonDecodeError(
7228 encoded.to_string(),
7229 error,
7230 ));
7231 }
7232 }
7233 };
7234
7235 dlg.finished(true);
7236 return Ok(response);
7237 }
7238 }
7239 }
7240 }
7241
7242 ///
7243 /// Sets the *request* property to the given value.
7244 ///
7245 /// Even though the property as already been set when instantiating this call,
7246 /// we provide this method for API completeness.
7247 pub fn request(mut self, new_value: Instance) -> ProjectLocationInstanceCreateCall<'a, C> {
7248 self._request = new_value;
7249 self
7250 }
7251 /// Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
7252 ///
7253 /// Sets the *parent* path property to the given value.
7254 ///
7255 /// Even though the property as already been set when instantiating this call,
7256 /// we provide this method for API completeness.
7257 pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
7258 self._parent = new_value.to_string();
7259 self
7260 }
7261 /// Required. The logical name of the Redis instance in the customer project with the following restrictions: * Must contain only lowercase letters, numbers, and hyphens. * Must start with a letter. * Must be between 1-40 characters. * Must end with a number or a letter. * Must be unique within the customer project / location
7262 ///
7263 /// Sets the *instance id* query property to the given value.
7264 pub fn instance_id(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
7265 self._instance_id = Some(new_value.to_string());
7266 self
7267 }
7268 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7269 /// while executing the actual API request.
7270 ///
7271 /// ````text
7272 /// It should be used to handle progress information, and to implement a certain level of resilience.
7273 /// ````
7274 ///
7275 /// Sets the *delegate* property to the given value.
7276 pub fn delegate(
7277 mut self,
7278 new_value: &'a mut dyn common::Delegate,
7279 ) -> ProjectLocationInstanceCreateCall<'a, C> {
7280 self._delegate = Some(new_value);
7281 self
7282 }
7283
7284 /// Set any additional parameter of the query string used in the request.
7285 /// It should be used to set parameters which are not yet available through their own
7286 /// setters.
7287 ///
7288 /// Please note that this method must not be used to set any of the known parameters
7289 /// which have their own setter method. If done anyway, the request will fail.
7290 ///
7291 /// # Additional Parameters
7292 ///
7293 /// * *$.xgafv* (query-string) - V1 error format.
7294 /// * *access_token* (query-string) - OAuth access token.
7295 /// * *alt* (query-string) - Data format for response.
7296 /// * *callback* (query-string) - JSONP
7297 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7298 /// * *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.
7299 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7300 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7301 /// * *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.
7302 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7303 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7304 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C>
7305 where
7306 T: AsRef<str>,
7307 {
7308 self._additional_params
7309 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7310 self
7311 }
7312
7313 /// Identifies the authorization scope for the method you are building.
7314 ///
7315 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7316 /// [`Scope::CloudPlatform`].
7317 ///
7318 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7319 /// tokens for more than one scope.
7320 ///
7321 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7322 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7323 /// sufficient, a read-write scope will do as well.
7324 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceCreateCall<'a, C>
7325 where
7326 St: AsRef<str>,
7327 {
7328 self._scopes.insert(String::from(scope.as_ref()));
7329 self
7330 }
7331 /// Identifies the authorization scope(s) for the method you are building.
7332 ///
7333 /// See [`Self::add_scope()`] for details.
7334 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceCreateCall<'a, C>
7335 where
7336 I: IntoIterator<Item = St>,
7337 St: AsRef<str>,
7338 {
7339 self._scopes
7340 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7341 self
7342 }
7343
7344 /// Removes all scopes, and no default scope will be used either.
7345 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7346 /// for details).
7347 pub fn clear_scopes(mut self) -> ProjectLocationInstanceCreateCall<'a, C> {
7348 self._scopes.clear();
7349 self
7350 }
7351}
7352
7353/// Deletes a specific Redis instance. Instance stops serving and data is deleted.
7354///
7355/// A builder for the *locations.instances.delete* method supported by a *project* resource.
7356/// It is not used directly, but through a [`ProjectMethods`] instance.
7357///
7358/// # Example
7359///
7360/// Instantiate a resource method builder
7361///
7362/// ```test_harness,no_run
7363/// # extern crate hyper;
7364/// # extern crate hyper_rustls;
7365/// # extern crate google_redis1 as redis1;
7366/// # async fn dox() {
7367/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7368///
7369/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7370/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7371/// # .with_native_roots()
7372/// # .unwrap()
7373/// # .https_only()
7374/// # .enable_http2()
7375/// # .build();
7376///
7377/// # let executor = hyper_util::rt::TokioExecutor::new();
7378/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7379/// # secret,
7380/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7381/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7382/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7383/// # ),
7384/// # ).build().await.unwrap();
7385///
7386/// # let client = hyper_util::client::legacy::Client::builder(
7387/// # hyper_util::rt::TokioExecutor::new()
7388/// # )
7389/// # .build(
7390/// # hyper_rustls::HttpsConnectorBuilder::new()
7391/// # .with_native_roots()
7392/// # .unwrap()
7393/// # .https_or_http()
7394/// # .enable_http2()
7395/// # .build()
7396/// # );
7397/// # let mut hub = CloudRedis::new(client, auth);
7398/// // You can configure optional parameters by calling the respective setters at will, and
7399/// // execute the final call using `doit()`.
7400/// // Values shown here are possibly random and not representative !
7401/// let result = hub.projects().locations_instances_delete("name")
7402/// .doit().await;
7403/// # }
7404/// ```
7405pub struct ProjectLocationInstanceDeleteCall<'a, C>
7406where
7407 C: 'a,
7408{
7409 hub: &'a CloudRedis<C>,
7410 _name: String,
7411 _delegate: Option<&'a mut dyn common::Delegate>,
7412 _additional_params: HashMap<String, String>,
7413 _scopes: BTreeSet<String>,
7414}
7415
7416impl<'a, C> common::CallBuilder for ProjectLocationInstanceDeleteCall<'a, C> {}
7417
7418impl<'a, C> ProjectLocationInstanceDeleteCall<'a, C>
7419where
7420 C: common::Connector,
7421{
7422 /// Perform the operation you have build so far.
7423 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7424 use std::borrow::Cow;
7425 use std::io::{Read, Seek};
7426
7427 use common::{url::Params, ToParts};
7428 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7429
7430 let mut dd = common::DefaultDelegate;
7431 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7432 dlg.begin(common::MethodInfo {
7433 id: "redis.projects.locations.instances.delete",
7434 http_method: hyper::Method::DELETE,
7435 });
7436
7437 for &field in ["alt", "name"].iter() {
7438 if self._additional_params.contains_key(field) {
7439 dlg.finished(false);
7440 return Err(common::Error::FieldClash(field));
7441 }
7442 }
7443
7444 let mut params = Params::with_capacity(3 + self._additional_params.len());
7445 params.push("name", self._name);
7446
7447 params.extend(self._additional_params.iter());
7448
7449 params.push("alt", "json");
7450 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7451 if self._scopes.is_empty() {
7452 self._scopes
7453 .insert(Scope::CloudPlatform.as_ref().to_string());
7454 }
7455
7456 #[allow(clippy::single_element_loop)]
7457 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7458 url = params.uri_replacement(url, param_name, find_this, true);
7459 }
7460 {
7461 let to_remove = ["name"];
7462 params.remove_params(&to_remove);
7463 }
7464
7465 let url = params.parse_with_url(&url);
7466
7467 loop {
7468 let token = match self
7469 .hub
7470 .auth
7471 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7472 .await
7473 {
7474 Ok(token) => token,
7475 Err(e) => match dlg.token(e) {
7476 Ok(token) => token,
7477 Err(e) => {
7478 dlg.finished(false);
7479 return Err(common::Error::MissingToken(e));
7480 }
7481 },
7482 };
7483 let mut req_result = {
7484 let client = &self.hub.client;
7485 dlg.pre_request();
7486 let mut req_builder = hyper::Request::builder()
7487 .method(hyper::Method::DELETE)
7488 .uri(url.as_str())
7489 .header(USER_AGENT, self.hub._user_agent.clone());
7490
7491 if let Some(token) = token.as_ref() {
7492 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7493 }
7494
7495 let request = req_builder
7496 .header(CONTENT_LENGTH, 0_u64)
7497 .body(common::to_body::<String>(None));
7498
7499 client.request(request.unwrap()).await
7500 };
7501
7502 match req_result {
7503 Err(err) => {
7504 if let common::Retry::After(d) = dlg.http_error(&err) {
7505 sleep(d).await;
7506 continue;
7507 }
7508 dlg.finished(false);
7509 return Err(common::Error::HttpError(err));
7510 }
7511 Ok(res) => {
7512 let (mut parts, body) = res.into_parts();
7513 let mut body = common::Body::new(body);
7514 if !parts.status.is_success() {
7515 let bytes = common::to_bytes(body).await.unwrap_or_default();
7516 let error = serde_json::from_str(&common::to_string(&bytes));
7517 let response = common::to_response(parts, bytes.into());
7518
7519 if let common::Retry::After(d) =
7520 dlg.http_failure(&response, error.as_ref().ok())
7521 {
7522 sleep(d).await;
7523 continue;
7524 }
7525
7526 dlg.finished(false);
7527
7528 return Err(match error {
7529 Ok(value) => common::Error::BadRequest(value),
7530 _ => common::Error::Failure(response),
7531 });
7532 }
7533 let response = {
7534 let bytes = common::to_bytes(body).await.unwrap_or_default();
7535 let encoded = common::to_string(&bytes);
7536 match serde_json::from_str(&encoded) {
7537 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7538 Err(error) => {
7539 dlg.response_json_decode_error(&encoded, &error);
7540 return Err(common::Error::JsonDecodeError(
7541 encoded.to_string(),
7542 error,
7543 ));
7544 }
7545 }
7546 };
7547
7548 dlg.finished(true);
7549 return Ok(response);
7550 }
7551 }
7552 }
7553 }
7554
7555 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
7556 ///
7557 /// Sets the *name* path property to the given value.
7558 ///
7559 /// Even though the property as already been set when instantiating this call,
7560 /// we provide this method for API completeness.
7561 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDeleteCall<'a, C> {
7562 self._name = new_value.to_string();
7563 self
7564 }
7565 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7566 /// while executing the actual API request.
7567 ///
7568 /// ````text
7569 /// It should be used to handle progress information, and to implement a certain level of resilience.
7570 /// ````
7571 ///
7572 /// Sets the *delegate* property to the given value.
7573 pub fn delegate(
7574 mut self,
7575 new_value: &'a mut dyn common::Delegate,
7576 ) -> ProjectLocationInstanceDeleteCall<'a, C> {
7577 self._delegate = Some(new_value);
7578 self
7579 }
7580
7581 /// Set any additional parameter of the query string used in the request.
7582 /// It should be used to set parameters which are not yet available through their own
7583 /// setters.
7584 ///
7585 /// Please note that this method must not be used to set any of the known parameters
7586 /// which have their own setter method. If done anyway, the request will fail.
7587 ///
7588 /// # Additional Parameters
7589 ///
7590 /// * *$.xgafv* (query-string) - V1 error format.
7591 /// * *access_token* (query-string) - OAuth access token.
7592 /// * *alt* (query-string) - Data format for response.
7593 /// * *callback* (query-string) - JSONP
7594 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7595 /// * *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.
7596 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7597 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7598 /// * *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.
7599 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7600 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7601 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C>
7602 where
7603 T: AsRef<str>,
7604 {
7605 self._additional_params
7606 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7607 self
7608 }
7609
7610 /// Identifies the authorization scope for the method you are building.
7611 ///
7612 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7613 /// [`Scope::CloudPlatform`].
7614 ///
7615 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7616 /// tokens for more than one scope.
7617 ///
7618 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7619 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7620 /// sufficient, a read-write scope will do as well.
7621 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDeleteCall<'a, C>
7622 where
7623 St: AsRef<str>,
7624 {
7625 self._scopes.insert(String::from(scope.as_ref()));
7626 self
7627 }
7628 /// Identifies the authorization scope(s) for the method you are building.
7629 ///
7630 /// See [`Self::add_scope()`] for details.
7631 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceDeleteCall<'a, C>
7632 where
7633 I: IntoIterator<Item = St>,
7634 St: AsRef<str>,
7635 {
7636 self._scopes
7637 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7638 self
7639 }
7640
7641 /// Removes all scopes, and no default scope will be used either.
7642 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7643 /// for details).
7644 pub fn clear_scopes(mut self) -> ProjectLocationInstanceDeleteCall<'a, C> {
7645 self._scopes.clear();
7646 self
7647 }
7648}
7649
7650/// Export Redis instance data into a Redis RDB format file in Cloud Storage. Redis will continue serving during this operation. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
7651///
7652/// A builder for the *locations.instances.export* method supported by a *project* resource.
7653/// It is not used directly, but through a [`ProjectMethods`] instance.
7654///
7655/// # Example
7656///
7657/// Instantiate a resource method builder
7658///
7659/// ```test_harness,no_run
7660/// # extern crate hyper;
7661/// # extern crate hyper_rustls;
7662/// # extern crate google_redis1 as redis1;
7663/// use redis1::api::ExportInstanceRequest;
7664/// # async fn dox() {
7665/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7666///
7667/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7668/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7669/// # .with_native_roots()
7670/// # .unwrap()
7671/// # .https_only()
7672/// # .enable_http2()
7673/// # .build();
7674///
7675/// # let executor = hyper_util::rt::TokioExecutor::new();
7676/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7677/// # secret,
7678/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7679/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7680/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7681/// # ),
7682/// # ).build().await.unwrap();
7683///
7684/// # let client = hyper_util::client::legacy::Client::builder(
7685/// # hyper_util::rt::TokioExecutor::new()
7686/// # )
7687/// # .build(
7688/// # hyper_rustls::HttpsConnectorBuilder::new()
7689/// # .with_native_roots()
7690/// # .unwrap()
7691/// # .https_or_http()
7692/// # .enable_http2()
7693/// # .build()
7694/// # );
7695/// # let mut hub = CloudRedis::new(client, auth);
7696/// // As the method needs a request, you would usually fill it with the desired information
7697/// // into the respective structure. Some of the parts shown here might not be applicable !
7698/// // Values shown here are possibly random and not representative !
7699/// let mut req = ExportInstanceRequest::default();
7700///
7701/// // You can configure optional parameters by calling the respective setters at will, and
7702/// // execute the final call using `doit()`.
7703/// // Values shown here are possibly random and not representative !
7704/// let result = hub.projects().locations_instances_export(req, "name")
7705/// .doit().await;
7706/// # }
7707/// ```
7708pub struct ProjectLocationInstanceExportCall<'a, C>
7709where
7710 C: 'a,
7711{
7712 hub: &'a CloudRedis<C>,
7713 _request: ExportInstanceRequest,
7714 _name: String,
7715 _delegate: Option<&'a mut dyn common::Delegate>,
7716 _additional_params: HashMap<String, String>,
7717 _scopes: BTreeSet<String>,
7718}
7719
7720impl<'a, C> common::CallBuilder for ProjectLocationInstanceExportCall<'a, C> {}
7721
7722impl<'a, C> ProjectLocationInstanceExportCall<'a, C>
7723where
7724 C: common::Connector,
7725{
7726 /// Perform the operation you have build so far.
7727 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7728 use std::borrow::Cow;
7729 use std::io::{Read, Seek};
7730
7731 use common::{url::Params, ToParts};
7732 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7733
7734 let mut dd = common::DefaultDelegate;
7735 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7736 dlg.begin(common::MethodInfo {
7737 id: "redis.projects.locations.instances.export",
7738 http_method: hyper::Method::POST,
7739 });
7740
7741 for &field in ["alt", "name"].iter() {
7742 if self._additional_params.contains_key(field) {
7743 dlg.finished(false);
7744 return Err(common::Error::FieldClash(field));
7745 }
7746 }
7747
7748 let mut params = Params::with_capacity(4 + self._additional_params.len());
7749 params.push("name", self._name);
7750
7751 params.extend(self._additional_params.iter());
7752
7753 params.push("alt", "json");
7754 let mut url = self.hub._base_url.clone() + "v1/{+name}:export";
7755 if self._scopes.is_empty() {
7756 self._scopes
7757 .insert(Scope::CloudPlatform.as_ref().to_string());
7758 }
7759
7760 #[allow(clippy::single_element_loop)]
7761 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7762 url = params.uri_replacement(url, param_name, find_this, true);
7763 }
7764 {
7765 let to_remove = ["name"];
7766 params.remove_params(&to_remove);
7767 }
7768
7769 let url = params.parse_with_url(&url);
7770
7771 let mut json_mime_type = mime::APPLICATION_JSON;
7772 let mut request_value_reader = {
7773 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7774 common::remove_json_null_values(&mut value);
7775 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7776 serde_json::to_writer(&mut dst, &value).unwrap();
7777 dst
7778 };
7779 let request_size = request_value_reader
7780 .seek(std::io::SeekFrom::End(0))
7781 .unwrap();
7782 request_value_reader
7783 .seek(std::io::SeekFrom::Start(0))
7784 .unwrap();
7785
7786 loop {
7787 let token = match self
7788 .hub
7789 .auth
7790 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7791 .await
7792 {
7793 Ok(token) => token,
7794 Err(e) => match dlg.token(e) {
7795 Ok(token) => token,
7796 Err(e) => {
7797 dlg.finished(false);
7798 return Err(common::Error::MissingToken(e));
7799 }
7800 },
7801 };
7802 request_value_reader
7803 .seek(std::io::SeekFrom::Start(0))
7804 .unwrap();
7805 let mut req_result = {
7806 let client = &self.hub.client;
7807 dlg.pre_request();
7808 let mut req_builder = hyper::Request::builder()
7809 .method(hyper::Method::POST)
7810 .uri(url.as_str())
7811 .header(USER_AGENT, self.hub._user_agent.clone());
7812
7813 if let Some(token) = token.as_ref() {
7814 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7815 }
7816
7817 let request = req_builder
7818 .header(CONTENT_TYPE, json_mime_type.to_string())
7819 .header(CONTENT_LENGTH, request_size as u64)
7820 .body(common::to_body(
7821 request_value_reader.get_ref().clone().into(),
7822 ));
7823
7824 client.request(request.unwrap()).await
7825 };
7826
7827 match req_result {
7828 Err(err) => {
7829 if let common::Retry::After(d) = dlg.http_error(&err) {
7830 sleep(d).await;
7831 continue;
7832 }
7833 dlg.finished(false);
7834 return Err(common::Error::HttpError(err));
7835 }
7836 Ok(res) => {
7837 let (mut parts, body) = res.into_parts();
7838 let mut body = common::Body::new(body);
7839 if !parts.status.is_success() {
7840 let bytes = common::to_bytes(body).await.unwrap_or_default();
7841 let error = serde_json::from_str(&common::to_string(&bytes));
7842 let response = common::to_response(parts, bytes.into());
7843
7844 if let common::Retry::After(d) =
7845 dlg.http_failure(&response, error.as_ref().ok())
7846 {
7847 sleep(d).await;
7848 continue;
7849 }
7850
7851 dlg.finished(false);
7852
7853 return Err(match error {
7854 Ok(value) => common::Error::BadRequest(value),
7855 _ => common::Error::Failure(response),
7856 });
7857 }
7858 let response = {
7859 let bytes = common::to_bytes(body).await.unwrap_or_default();
7860 let encoded = common::to_string(&bytes);
7861 match serde_json::from_str(&encoded) {
7862 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7863 Err(error) => {
7864 dlg.response_json_decode_error(&encoded, &error);
7865 return Err(common::Error::JsonDecodeError(
7866 encoded.to_string(),
7867 error,
7868 ));
7869 }
7870 }
7871 };
7872
7873 dlg.finished(true);
7874 return Ok(response);
7875 }
7876 }
7877 }
7878 }
7879
7880 ///
7881 /// Sets the *request* property to the given value.
7882 ///
7883 /// Even though the property as already been set when instantiating this call,
7884 /// we provide this method for API completeness.
7885 pub fn request(
7886 mut self,
7887 new_value: ExportInstanceRequest,
7888 ) -> ProjectLocationInstanceExportCall<'a, C> {
7889 self._request = new_value;
7890 self
7891 }
7892 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
7893 ///
7894 /// Sets the *name* path property to the given value.
7895 ///
7896 /// Even though the property as already been set when instantiating this call,
7897 /// we provide this method for API completeness.
7898 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceExportCall<'a, C> {
7899 self._name = new_value.to_string();
7900 self
7901 }
7902 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7903 /// while executing the actual API request.
7904 ///
7905 /// ````text
7906 /// It should be used to handle progress information, and to implement a certain level of resilience.
7907 /// ````
7908 ///
7909 /// Sets the *delegate* property to the given value.
7910 pub fn delegate(
7911 mut self,
7912 new_value: &'a mut dyn common::Delegate,
7913 ) -> ProjectLocationInstanceExportCall<'a, C> {
7914 self._delegate = Some(new_value);
7915 self
7916 }
7917
7918 /// Set any additional parameter of the query string used in the request.
7919 /// It should be used to set parameters which are not yet available through their own
7920 /// setters.
7921 ///
7922 /// Please note that this method must not be used to set any of the known parameters
7923 /// which have their own setter method. If done anyway, the request will fail.
7924 ///
7925 /// # Additional Parameters
7926 ///
7927 /// * *$.xgafv* (query-string) - V1 error format.
7928 /// * *access_token* (query-string) - OAuth access token.
7929 /// * *alt* (query-string) - Data format for response.
7930 /// * *callback* (query-string) - JSONP
7931 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7932 /// * *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.
7933 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7934 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7935 /// * *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.
7936 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7937 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7938 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceExportCall<'a, C>
7939 where
7940 T: AsRef<str>,
7941 {
7942 self._additional_params
7943 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7944 self
7945 }
7946
7947 /// Identifies the authorization scope for the method you are building.
7948 ///
7949 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7950 /// [`Scope::CloudPlatform`].
7951 ///
7952 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7953 /// tokens for more than one scope.
7954 ///
7955 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7956 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7957 /// sufficient, a read-write scope will do as well.
7958 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceExportCall<'a, C>
7959 where
7960 St: AsRef<str>,
7961 {
7962 self._scopes.insert(String::from(scope.as_ref()));
7963 self
7964 }
7965 /// Identifies the authorization scope(s) for the method you are building.
7966 ///
7967 /// See [`Self::add_scope()`] for details.
7968 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceExportCall<'a, C>
7969 where
7970 I: IntoIterator<Item = St>,
7971 St: AsRef<str>,
7972 {
7973 self._scopes
7974 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7975 self
7976 }
7977
7978 /// Removes all scopes, and no default scope will be used either.
7979 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7980 /// for details).
7981 pub fn clear_scopes(mut self) -> ProjectLocationInstanceExportCall<'a, C> {
7982 self._scopes.clear();
7983 self
7984 }
7985}
7986
7987/// Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
7988///
7989/// A builder for the *locations.instances.failover* method supported by a *project* resource.
7990/// It is not used directly, but through a [`ProjectMethods`] instance.
7991///
7992/// # Example
7993///
7994/// Instantiate a resource method builder
7995///
7996/// ```test_harness,no_run
7997/// # extern crate hyper;
7998/// # extern crate hyper_rustls;
7999/// # extern crate google_redis1 as redis1;
8000/// use redis1::api::FailoverInstanceRequest;
8001/// # async fn dox() {
8002/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8003///
8004/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8005/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8006/// # .with_native_roots()
8007/// # .unwrap()
8008/// # .https_only()
8009/// # .enable_http2()
8010/// # .build();
8011///
8012/// # let executor = hyper_util::rt::TokioExecutor::new();
8013/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8014/// # secret,
8015/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8016/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8017/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8018/// # ),
8019/// # ).build().await.unwrap();
8020///
8021/// # let client = hyper_util::client::legacy::Client::builder(
8022/// # hyper_util::rt::TokioExecutor::new()
8023/// # )
8024/// # .build(
8025/// # hyper_rustls::HttpsConnectorBuilder::new()
8026/// # .with_native_roots()
8027/// # .unwrap()
8028/// # .https_or_http()
8029/// # .enable_http2()
8030/// # .build()
8031/// # );
8032/// # let mut hub = CloudRedis::new(client, auth);
8033/// // As the method needs a request, you would usually fill it with the desired information
8034/// // into the respective structure. Some of the parts shown here might not be applicable !
8035/// // Values shown here are possibly random and not representative !
8036/// let mut req = FailoverInstanceRequest::default();
8037///
8038/// // You can configure optional parameters by calling the respective setters at will, and
8039/// // execute the final call using `doit()`.
8040/// // Values shown here are possibly random and not representative !
8041/// let result = hub.projects().locations_instances_failover(req, "name")
8042/// .doit().await;
8043/// # }
8044/// ```
8045pub struct ProjectLocationInstanceFailoverCall<'a, C>
8046where
8047 C: 'a,
8048{
8049 hub: &'a CloudRedis<C>,
8050 _request: FailoverInstanceRequest,
8051 _name: String,
8052 _delegate: Option<&'a mut dyn common::Delegate>,
8053 _additional_params: HashMap<String, String>,
8054 _scopes: BTreeSet<String>,
8055}
8056
8057impl<'a, C> common::CallBuilder for ProjectLocationInstanceFailoverCall<'a, C> {}
8058
8059impl<'a, C> ProjectLocationInstanceFailoverCall<'a, C>
8060where
8061 C: common::Connector,
8062{
8063 /// Perform the operation you have build so far.
8064 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8065 use std::borrow::Cow;
8066 use std::io::{Read, Seek};
8067
8068 use common::{url::Params, ToParts};
8069 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8070
8071 let mut dd = common::DefaultDelegate;
8072 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8073 dlg.begin(common::MethodInfo {
8074 id: "redis.projects.locations.instances.failover",
8075 http_method: hyper::Method::POST,
8076 });
8077
8078 for &field in ["alt", "name"].iter() {
8079 if self._additional_params.contains_key(field) {
8080 dlg.finished(false);
8081 return Err(common::Error::FieldClash(field));
8082 }
8083 }
8084
8085 let mut params = Params::with_capacity(4 + self._additional_params.len());
8086 params.push("name", self._name);
8087
8088 params.extend(self._additional_params.iter());
8089
8090 params.push("alt", "json");
8091 let mut url = self.hub._base_url.clone() + "v1/{+name}:failover";
8092 if self._scopes.is_empty() {
8093 self._scopes
8094 .insert(Scope::CloudPlatform.as_ref().to_string());
8095 }
8096
8097 #[allow(clippy::single_element_loop)]
8098 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8099 url = params.uri_replacement(url, param_name, find_this, true);
8100 }
8101 {
8102 let to_remove = ["name"];
8103 params.remove_params(&to_remove);
8104 }
8105
8106 let url = params.parse_with_url(&url);
8107
8108 let mut json_mime_type = mime::APPLICATION_JSON;
8109 let mut request_value_reader = {
8110 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8111 common::remove_json_null_values(&mut value);
8112 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8113 serde_json::to_writer(&mut dst, &value).unwrap();
8114 dst
8115 };
8116 let request_size = request_value_reader
8117 .seek(std::io::SeekFrom::End(0))
8118 .unwrap();
8119 request_value_reader
8120 .seek(std::io::SeekFrom::Start(0))
8121 .unwrap();
8122
8123 loop {
8124 let token = match self
8125 .hub
8126 .auth
8127 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8128 .await
8129 {
8130 Ok(token) => token,
8131 Err(e) => match dlg.token(e) {
8132 Ok(token) => token,
8133 Err(e) => {
8134 dlg.finished(false);
8135 return Err(common::Error::MissingToken(e));
8136 }
8137 },
8138 };
8139 request_value_reader
8140 .seek(std::io::SeekFrom::Start(0))
8141 .unwrap();
8142 let mut req_result = {
8143 let client = &self.hub.client;
8144 dlg.pre_request();
8145 let mut req_builder = hyper::Request::builder()
8146 .method(hyper::Method::POST)
8147 .uri(url.as_str())
8148 .header(USER_AGENT, self.hub._user_agent.clone());
8149
8150 if let Some(token) = token.as_ref() {
8151 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8152 }
8153
8154 let request = req_builder
8155 .header(CONTENT_TYPE, json_mime_type.to_string())
8156 .header(CONTENT_LENGTH, request_size as u64)
8157 .body(common::to_body(
8158 request_value_reader.get_ref().clone().into(),
8159 ));
8160
8161 client.request(request.unwrap()).await
8162 };
8163
8164 match req_result {
8165 Err(err) => {
8166 if let common::Retry::After(d) = dlg.http_error(&err) {
8167 sleep(d).await;
8168 continue;
8169 }
8170 dlg.finished(false);
8171 return Err(common::Error::HttpError(err));
8172 }
8173 Ok(res) => {
8174 let (mut parts, body) = res.into_parts();
8175 let mut body = common::Body::new(body);
8176 if !parts.status.is_success() {
8177 let bytes = common::to_bytes(body).await.unwrap_or_default();
8178 let error = serde_json::from_str(&common::to_string(&bytes));
8179 let response = common::to_response(parts, bytes.into());
8180
8181 if let common::Retry::After(d) =
8182 dlg.http_failure(&response, error.as_ref().ok())
8183 {
8184 sleep(d).await;
8185 continue;
8186 }
8187
8188 dlg.finished(false);
8189
8190 return Err(match error {
8191 Ok(value) => common::Error::BadRequest(value),
8192 _ => common::Error::Failure(response),
8193 });
8194 }
8195 let response = {
8196 let bytes = common::to_bytes(body).await.unwrap_or_default();
8197 let encoded = common::to_string(&bytes);
8198 match serde_json::from_str(&encoded) {
8199 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8200 Err(error) => {
8201 dlg.response_json_decode_error(&encoded, &error);
8202 return Err(common::Error::JsonDecodeError(
8203 encoded.to_string(),
8204 error,
8205 ));
8206 }
8207 }
8208 };
8209
8210 dlg.finished(true);
8211 return Ok(response);
8212 }
8213 }
8214 }
8215 }
8216
8217 ///
8218 /// Sets the *request* property to the given value.
8219 ///
8220 /// Even though the property as already been set when instantiating this call,
8221 /// we provide this method for API completeness.
8222 pub fn request(
8223 mut self,
8224 new_value: FailoverInstanceRequest,
8225 ) -> ProjectLocationInstanceFailoverCall<'a, C> {
8226 self._request = new_value;
8227 self
8228 }
8229 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
8230 ///
8231 /// Sets the *name* path property to the given value.
8232 ///
8233 /// Even though the property as already been set when instantiating this call,
8234 /// we provide this method for API completeness.
8235 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceFailoverCall<'a, C> {
8236 self._name = new_value.to_string();
8237 self
8238 }
8239 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8240 /// while executing the actual API request.
8241 ///
8242 /// ````text
8243 /// It should be used to handle progress information, and to implement a certain level of resilience.
8244 /// ````
8245 ///
8246 /// Sets the *delegate* property to the given value.
8247 pub fn delegate(
8248 mut self,
8249 new_value: &'a mut dyn common::Delegate,
8250 ) -> ProjectLocationInstanceFailoverCall<'a, C> {
8251 self._delegate = Some(new_value);
8252 self
8253 }
8254
8255 /// Set any additional parameter of the query string used in the request.
8256 /// It should be used to set parameters which are not yet available through their own
8257 /// setters.
8258 ///
8259 /// Please note that this method must not be used to set any of the known parameters
8260 /// which have their own setter method. If done anyway, the request will fail.
8261 ///
8262 /// # Additional Parameters
8263 ///
8264 /// * *$.xgafv* (query-string) - V1 error format.
8265 /// * *access_token* (query-string) - OAuth access token.
8266 /// * *alt* (query-string) - Data format for response.
8267 /// * *callback* (query-string) - JSONP
8268 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8269 /// * *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.
8270 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8271 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8272 /// * *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.
8273 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8274 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8275 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceFailoverCall<'a, C>
8276 where
8277 T: AsRef<str>,
8278 {
8279 self._additional_params
8280 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8281 self
8282 }
8283
8284 /// Identifies the authorization scope for the method you are building.
8285 ///
8286 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8287 /// [`Scope::CloudPlatform`].
8288 ///
8289 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8290 /// tokens for more than one scope.
8291 ///
8292 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8293 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8294 /// sufficient, a read-write scope will do as well.
8295 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceFailoverCall<'a, C>
8296 where
8297 St: AsRef<str>,
8298 {
8299 self._scopes.insert(String::from(scope.as_ref()));
8300 self
8301 }
8302 /// Identifies the authorization scope(s) for the method you are building.
8303 ///
8304 /// See [`Self::add_scope()`] for details.
8305 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceFailoverCall<'a, C>
8306 where
8307 I: IntoIterator<Item = St>,
8308 St: AsRef<str>,
8309 {
8310 self._scopes
8311 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8312 self
8313 }
8314
8315 /// Removes all scopes, and no default scope will be used either.
8316 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8317 /// for details).
8318 pub fn clear_scopes(mut self) -> ProjectLocationInstanceFailoverCall<'a, C> {
8319 self._scopes.clear();
8320 self
8321 }
8322}
8323
8324/// Gets the details of a specific Redis instance.
8325///
8326/// A builder for the *locations.instances.get* method supported by a *project* resource.
8327/// It is not used directly, but through a [`ProjectMethods`] instance.
8328///
8329/// # Example
8330///
8331/// Instantiate a resource method builder
8332///
8333/// ```test_harness,no_run
8334/// # extern crate hyper;
8335/// # extern crate hyper_rustls;
8336/// # extern crate google_redis1 as redis1;
8337/// # async fn dox() {
8338/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8339///
8340/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8341/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8342/// # .with_native_roots()
8343/// # .unwrap()
8344/// # .https_only()
8345/// # .enable_http2()
8346/// # .build();
8347///
8348/// # let executor = hyper_util::rt::TokioExecutor::new();
8349/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8350/// # secret,
8351/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8352/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8353/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8354/// # ),
8355/// # ).build().await.unwrap();
8356///
8357/// # let client = hyper_util::client::legacy::Client::builder(
8358/// # hyper_util::rt::TokioExecutor::new()
8359/// # )
8360/// # .build(
8361/// # hyper_rustls::HttpsConnectorBuilder::new()
8362/// # .with_native_roots()
8363/// # .unwrap()
8364/// # .https_or_http()
8365/// # .enable_http2()
8366/// # .build()
8367/// # );
8368/// # let mut hub = CloudRedis::new(client, auth);
8369/// // You can configure optional parameters by calling the respective setters at will, and
8370/// // execute the final call using `doit()`.
8371/// // Values shown here are possibly random and not representative !
8372/// let result = hub.projects().locations_instances_get("name")
8373/// .doit().await;
8374/// # }
8375/// ```
8376pub struct ProjectLocationInstanceGetCall<'a, C>
8377where
8378 C: 'a,
8379{
8380 hub: &'a CloudRedis<C>,
8381 _name: String,
8382 _delegate: Option<&'a mut dyn common::Delegate>,
8383 _additional_params: HashMap<String, String>,
8384 _scopes: BTreeSet<String>,
8385}
8386
8387impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetCall<'a, C> {}
8388
8389impl<'a, C> ProjectLocationInstanceGetCall<'a, C>
8390where
8391 C: common::Connector,
8392{
8393 /// Perform the operation you have build so far.
8394 pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
8395 use std::borrow::Cow;
8396 use std::io::{Read, Seek};
8397
8398 use common::{url::Params, ToParts};
8399 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8400
8401 let mut dd = common::DefaultDelegate;
8402 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8403 dlg.begin(common::MethodInfo {
8404 id: "redis.projects.locations.instances.get",
8405 http_method: hyper::Method::GET,
8406 });
8407
8408 for &field in ["alt", "name"].iter() {
8409 if self._additional_params.contains_key(field) {
8410 dlg.finished(false);
8411 return Err(common::Error::FieldClash(field));
8412 }
8413 }
8414
8415 let mut params = Params::with_capacity(3 + self._additional_params.len());
8416 params.push("name", self._name);
8417
8418 params.extend(self._additional_params.iter());
8419
8420 params.push("alt", "json");
8421 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8422 if self._scopes.is_empty() {
8423 self._scopes
8424 .insert(Scope::CloudPlatform.as_ref().to_string());
8425 }
8426
8427 #[allow(clippy::single_element_loop)]
8428 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8429 url = params.uri_replacement(url, param_name, find_this, true);
8430 }
8431 {
8432 let to_remove = ["name"];
8433 params.remove_params(&to_remove);
8434 }
8435
8436 let url = params.parse_with_url(&url);
8437
8438 loop {
8439 let token = match self
8440 .hub
8441 .auth
8442 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8443 .await
8444 {
8445 Ok(token) => token,
8446 Err(e) => match dlg.token(e) {
8447 Ok(token) => token,
8448 Err(e) => {
8449 dlg.finished(false);
8450 return Err(common::Error::MissingToken(e));
8451 }
8452 },
8453 };
8454 let mut req_result = {
8455 let client = &self.hub.client;
8456 dlg.pre_request();
8457 let mut req_builder = hyper::Request::builder()
8458 .method(hyper::Method::GET)
8459 .uri(url.as_str())
8460 .header(USER_AGENT, self.hub._user_agent.clone());
8461
8462 if let Some(token) = token.as_ref() {
8463 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8464 }
8465
8466 let request = req_builder
8467 .header(CONTENT_LENGTH, 0_u64)
8468 .body(common::to_body::<String>(None));
8469
8470 client.request(request.unwrap()).await
8471 };
8472
8473 match req_result {
8474 Err(err) => {
8475 if let common::Retry::After(d) = dlg.http_error(&err) {
8476 sleep(d).await;
8477 continue;
8478 }
8479 dlg.finished(false);
8480 return Err(common::Error::HttpError(err));
8481 }
8482 Ok(res) => {
8483 let (mut parts, body) = res.into_parts();
8484 let mut body = common::Body::new(body);
8485 if !parts.status.is_success() {
8486 let bytes = common::to_bytes(body).await.unwrap_or_default();
8487 let error = serde_json::from_str(&common::to_string(&bytes));
8488 let response = common::to_response(parts, bytes.into());
8489
8490 if let common::Retry::After(d) =
8491 dlg.http_failure(&response, error.as_ref().ok())
8492 {
8493 sleep(d).await;
8494 continue;
8495 }
8496
8497 dlg.finished(false);
8498
8499 return Err(match error {
8500 Ok(value) => common::Error::BadRequest(value),
8501 _ => common::Error::Failure(response),
8502 });
8503 }
8504 let response = {
8505 let bytes = common::to_bytes(body).await.unwrap_or_default();
8506 let encoded = common::to_string(&bytes);
8507 match serde_json::from_str(&encoded) {
8508 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8509 Err(error) => {
8510 dlg.response_json_decode_error(&encoded, &error);
8511 return Err(common::Error::JsonDecodeError(
8512 encoded.to_string(),
8513 error,
8514 ));
8515 }
8516 }
8517 };
8518
8519 dlg.finished(true);
8520 return Ok(response);
8521 }
8522 }
8523 }
8524 }
8525
8526 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
8527 ///
8528 /// Sets the *name* path property to the given value.
8529 ///
8530 /// Even though the property as already been set when instantiating this call,
8531 /// we provide this method for API completeness.
8532 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetCall<'a, C> {
8533 self._name = new_value.to_string();
8534 self
8535 }
8536 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8537 /// while executing the actual API request.
8538 ///
8539 /// ````text
8540 /// It should be used to handle progress information, and to implement a certain level of resilience.
8541 /// ````
8542 ///
8543 /// Sets the *delegate* property to the given value.
8544 pub fn delegate(
8545 mut self,
8546 new_value: &'a mut dyn common::Delegate,
8547 ) -> ProjectLocationInstanceGetCall<'a, C> {
8548 self._delegate = Some(new_value);
8549 self
8550 }
8551
8552 /// Set any additional parameter of the query string used in the request.
8553 /// It should be used to set parameters which are not yet available through their own
8554 /// setters.
8555 ///
8556 /// Please note that this method must not be used to set any of the known parameters
8557 /// which have their own setter method. If done anyway, the request will fail.
8558 ///
8559 /// # Additional Parameters
8560 ///
8561 /// * *$.xgafv* (query-string) - V1 error format.
8562 /// * *access_token* (query-string) - OAuth access token.
8563 /// * *alt* (query-string) - Data format for response.
8564 /// * *callback* (query-string) - JSONP
8565 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8566 /// * *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.
8567 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8568 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8569 /// * *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.
8570 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8571 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8572 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C>
8573 where
8574 T: AsRef<str>,
8575 {
8576 self._additional_params
8577 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8578 self
8579 }
8580
8581 /// Identifies the authorization scope for the method you are building.
8582 ///
8583 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8584 /// [`Scope::CloudPlatform`].
8585 ///
8586 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8587 /// tokens for more than one scope.
8588 ///
8589 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8590 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8591 /// sufficient, a read-write scope will do as well.
8592 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetCall<'a, C>
8593 where
8594 St: AsRef<str>,
8595 {
8596 self._scopes.insert(String::from(scope.as_ref()));
8597 self
8598 }
8599 /// Identifies the authorization scope(s) for the method you are building.
8600 ///
8601 /// See [`Self::add_scope()`] for details.
8602 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetCall<'a, C>
8603 where
8604 I: IntoIterator<Item = St>,
8605 St: AsRef<str>,
8606 {
8607 self._scopes
8608 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8609 self
8610 }
8611
8612 /// Removes all scopes, and no default scope will be used either.
8613 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8614 /// for details).
8615 pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetCall<'a, C> {
8616 self._scopes.clear();
8617 self
8618 }
8619}
8620
8621/// Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response will be empty. This information is not included in the details returned to GetInstance.
8622///
8623/// A builder for the *locations.instances.getAuthString* method supported by a *project* resource.
8624/// It is not used directly, but through a [`ProjectMethods`] instance.
8625///
8626/// # Example
8627///
8628/// Instantiate a resource method builder
8629///
8630/// ```test_harness,no_run
8631/// # extern crate hyper;
8632/// # extern crate hyper_rustls;
8633/// # extern crate google_redis1 as redis1;
8634/// # async fn dox() {
8635/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8636///
8637/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8638/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8639/// # .with_native_roots()
8640/// # .unwrap()
8641/// # .https_only()
8642/// # .enable_http2()
8643/// # .build();
8644///
8645/// # let executor = hyper_util::rt::TokioExecutor::new();
8646/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8647/// # secret,
8648/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8649/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8650/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8651/// # ),
8652/// # ).build().await.unwrap();
8653///
8654/// # let client = hyper_util::client::legacy::Client::builder(
8655/// # hyper_util::rt::TokioExecutor::new()
8656/// # )
8657/// # .build(
8658/// # hyper_rustls::HttpsConnectorBuilder::new()
8659/// # .with_native_roots()
8660/// # .unwrap()
8661/// # .https_or_http()
8662/// # .enable_http2()
8663/// # .build()
8664/// # );
8665/// # let mut hub = CloudRedis::new(client, auth);
8666/// // You can configure optional parameters by calling the respective setters at will, and
8667/// // execute the final call using `doit()`.
8668/// // Values shown here are possibly random and not representative !
8669/// let result = hub.projects().locations_instances_get_auth_string("name")
8670/// .doit().await;
8671/// # }
8672/// ```
8673pub struct ProjectLocationInstanceGetAuthStringCall<'a, C>
8674where
8675 C: 'a,
8676{
8677 hub: &'a CloudRedis<C>,
8678 _name: String,
8679 _delegate: Option<&'a mut dyn common::Delegate>,
8680 _additional_params: HashMap<String, String>,
8681 _scopes: BTreeSet<String>,
8682}
8683
8684impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetAuthStringCall<'a, C> {}
8685
8686impl<'a, C> ProjectLocationInstanceGetAuthStringCall<'a, C>
8687where
8688 C: common::Connector,
8689{
8690 /// Perform the operation you have build so far.
8691 pub async fn doit(mut self) -> common::Result<(common::Response, InstanceAuthString)> {
8692 use std::borrow::Cow;
8693 use std::io::{Read, Seek};
8694
8695 use common::{url::Params, ToParts};
8696 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8697
8698 let mut dd = common::DefaultDelegate;
8699 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8700 dlg.begin(common::MethodInfo {
8701 id: "redis.projects.locations.instances.getAuthString",
8702 http_method: hyper::Method::GET,
8703 });
8704
8705 for &field in ["alt", "name"].iter() {
8706 if self._additional_params.contains_key(field) {
8707 dlg.finished(false);
8708 return Err(common::Error::FieldClash(field));
8709 }
8710 }
8711
8712 let mut params = Params::with_capacity(3 + self._additional_params.len());
8713 params.push("name", self._name);
8714
8715 params.extend(self._additional_params.iter());
8716
8717 params.push("alt", "json");
8718 let mut url = self.hub._base_url.clone() + "v1/{+name}/authString";
8719 if self._scopes.is_empty() {
8720 self._scopes
8721 .insert(Scope::CloudPlatform.as_ref().to_string());
8722 }
8723
8724 #[allow(clippy::single_element_loop)]
8725 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8726 url = params.uri_replacement(url, param_name, find_this, true);
8727 }
8728 {
8729 let to_remove = ["name"];
8730 params.remove_params(&to_remove);
8731 }
8732
8733 let url = params.parse_with_url(&url);
8734
8735 loop {
8736 let token = match self
8737 .hub
8738 .auth
8739 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8740 .await
8741 {
8742 Ok(token) => token,
8743 Err(e) => match dlg.token(e) {
8744 Ok(token) => token,
8745 Err(e) => {
8746 dlg.finished(false);
8747 return Err(common::Error::MissingToken(e));
8748 }
8749 },
8750 };
8751 let mut req_result = {
8752 let client = &self.hub.client;
8753 dlg.pre_request();
8754 let mut req_builder = hyper::Request::builder()
8755 .method(hyper::Method::GET)
8756 .uri(url.as_str())
8757 .header(USER_AGENT, self.hub._user_agent.clone());
8758
8759 if let Some(token) = token.as_ref() {
8760 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8761 }
8762
8763 let request = req_builder
8764 .header(CONTENT_LENGTH, 0_u64)
8765 .body(common::to_body::<String>(None));
8766
8767 client.request(request.unwrap()).await
8768 };
8769
8770 match req_result {
8771 Err(err) => {
8772 if let common::Retry::After(d) = dlg.http_error(&err) {
8773 sleep(d).await;
8774 continue;
8775 }
8776 dlg.finished(false);
8777 return Err(common::Error::HttpError(err));
8778 }
8779 Ok(res) => {
8780 let (mut parts, body) = res.into_parts();
8781 let mut body = common::Body::new(body);
8782 if !parts.status.is_success() {
8783 let bytes = common::to_bytes(body).await.unwrap_or_default();
8784 let error = serde_json::from_str(&common::to_string(&bytes));
8785 let response = common::to_response(parts, bytes.into());
8786
8787 if let common::Retry::After(d) =
8788 dlg.http_failure(&response, error.as_ref().ok())
8789 {
8790 sleep(d).await;
8791 continue;
8792 }
8793
8794 dlg.finished(false);
8795
8796 return Err(match error {
8797 Ok(value) => common::Error::BadRequest(value),
8798 _ => common::Error::Failure(response),
8799 });
8800 }
8801 let response = {
8802 let bytes = common::to_bytes(body).await.unwrap_or_default();
8803 let encoded = common::to_string(&bytes);
8804 match serde_json::from_str(&encoded) {
8805 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8806 Err(error) => {
8807 dlg.response_json_decode_error(&encoded, &error);
8808 return Err(common::Error::JsonDecodeError(
8809 encoded.to_string(),
8810 error,
8811 ));
8812 }
8813 }
8814 };
8815
8816 dlg.finished(true);
8817 return Ok(response);
8818 }
8819 }
8820 }
8821 }
8822
8823 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
8824 ///
8825 /// Sets the *name* path property to the given value.
8826 ///
8827 /// Even though the property as already been set when instantiating this call,
8828 /// we provide this method for API completeness.
8829 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetAuthStringCall<'a, C> {
8830 self._name = new_value.to_string();
8831 self
8832 }
8833 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8834 /// while executing the actual API request.
8835 ///
8836 /// ````text
8837 /// It should be used to handle progress information, and to implement a certain level of resilience.
8838 /// ````
8839 ///
8840 /// Sets the *delegate* property to the given value.
8841 pub fn delegate(
8842 mut self,
8843 new_value: &'a mut dyn common::Delegate,
8844 ) -> ProjectLocationInstanceGetAuthStringCall<'a, C> {
8845 self._delegate = Some(new_value);
8846 self
8847 }
8848
8849 /// Set any additional parameter of the query string used in the request.
8850 /// It should be used to set parameters which are not yet available through their own
8851 /// setters.
8852 ///
8853 /// Please note that this method must not be used to set any of the known parameters
8854 /// which have their own setter method. If done anyway, the request will fail.
8855 ///
8856 /// # Additional Parameters
8857 ///
8858 /// * *$.xgafv* (query-string) - V1 error format.
8859 /// * *access_token* (query-string) - OAuth access token.
8860 /// * *alt* (query-string) - Data format for response.
8861 /// * *callback* (query-string) - JSONP
8862 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8863 /// * *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.
8864 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8865 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8866 /// * *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.
8867 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8868 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8869 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetAuthStringCall<'a, C>
8870 where
8871 T: AsRef<str>,
8872 {
8873 self._additional_params
8874 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8875 self
8876 }
8877
8878 /// Identifies the authorization scope for the method you are building.
8879 ///
8880 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8881 /// [`Scope::CloudPlatform`].
8882 ///
8883 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8884 /// tokens for more than one scope.
8885 ///
8886 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8887 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8888 /// sufficient, a read-write scope will do as well.
8889 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetAuthStringCall<'a, C>
8890 where
8891 St: AsRef<str>,
8892 {
8893 self._scopes.insert(String::from(scope.as_ref()));
8894 self
8895 }
8896 /// Identifies the authorization scope(s) for the method you are building.
8897 ///
8898 /// See [`Self::add_scope()`] for details.
8899 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetAuthStringCall<'a, C>
8900 where
8901 I: IntoIterator<Item = St>,
8902 St: AsRef<str>,
8903 {
8904 self._scopes
8905 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8906 self
8907 }
8908
8909 /// Removes all scopes, and no default scope will be used either.
8910 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8911 /// for details).
8912 pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetAuthStringCall<'a, C> {
8913 self._scopes.clear();
8914 self
8915 }
8916}
8917
8918/// Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
8919///
8920/// A builder for the *locations.instances.import* method supported by a *project* resource.
8921/// It is not used directly, but through a [`ProjectMethods`] instance.
8922///
8923/// # Example
8924///
8925/// Instantiate a resource method builder
8926///
8927/// ```test_harness,no_run
8928/// # extern crate hyper;
8929/// # extern crate hyper_rustls;
8930/// # extern crate google_redis1 as redis1;
8931/// use redis1::api::ImportInstanceRequest;
8932/// # async fn dox() {
8933/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8934///
8935/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8936/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8937/// # .with_native_roots()
8938/// # .unwrap()
8939/// # .https_only()
8940/// # .enable_http2()
8941/// # .build();
8942///
8943/// # let executor = hyper_util::rt::TokioExecutor::new();
8944/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8945/// # secret,
8946/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8947/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8948/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8949/// # ),
8950/// # ).build().await.unwrap();
8951///
8952/// # let client = hyper_util::client::legacy::Client::builder(
8953/// # hyper_util::rt::TokioExecutor::new()
8954/// # )
8955/// # .build(
8956/// # hyper_rustls::HttpsConnectorBuilder::new()
8957/// # .with_native_roots()
8958/// # .unwrap()
8959/// # .https_or_http()
8960/// # .enable_http2()
8961/// # .build()
8962/// # );
8963/// # let mut hub = CloudRedis::new(client, auth);
8964/// // As the method needs a request, you would usually fill it with the desired information
8965/// // into the respective structure. Some of the parts shown here might not be applicable !
8966/// // Values shown here are possibly random and not representative !
8967/// let mut req = ImportInstanceRequest::default();
8968///
8969/// // You can configure optional parameters by calling the respective setters at will, and
8970/// // execute the final call using `doit()`.
8971/// // Values shown here are possibly random and not representative !
8972/// let result = hub.projects().locations_instances_import(req, "name")
8973/// .doit().await;
8974/// # }
8975/// ```
8976pub struct ProjectLocationInstanceImportCall<'a, C>
8977where
8978 C: 'a,
8979{
8980 hub: &'a CloudRedis<C>,
8981 _request: ImportInstanceRequest,
8982 _name: String,
8983 _delegate: Option<&'a mut dyn common::Delegate>,
8984 _additional_params: HashMap<String, String>,
8985 _scopes: BTreeSet<String>,
8986}
8987
8988impl<'a, C> common::CallBuilder for ProjectLocationInstanceImportCall<'a, C> {}
8989
8990impl<'a, C> ProjectLocationInstanceImportCall<'a, C>
8991where
8992 C: common::Connector,
8993{
8994 /// Perform the operation you have build so far.
8995 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8996 use std::borrow::Cow;
8997 use std::io::{Read, Seek};
8998
8999 use common::{url::Params, ToParts};
9000 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9001
9002 let mut dd = common::DefaultDelegate;
9003 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9004 dlg.begin(common::MethodInfo {
9005 id: "redis.projects.locations.instances.import",
9006 http_method: hyper::Method::POST,
9007 });
9008
9009 for &field in ["alt", "name"].iter() {
9010 if self._additional_params.contains_key(field) {
9011 dlg.finished(false);
9012 return Err(common::Error::FieldClash(field));
9013 }
9014 }
9015
9016 let mut params = Params::with_capacity(4 + self._additional_params.len());
9017 params.push("name", self._name);
9018
9019 params.extend(self._additional_params.iter());
9020
9021 params.push("alt", "json");
9022 let mut url = self.hub._base_url.clone() + "v1/{+name}:import";
9023 if self._scopes.is_empty() {
9024 self._scopes
9025 .insert(Scope::CloudPlatform.as_ref().to_string());
9026 }
9027
9028 #[allow(clippy::single_element_loop)]
9029 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9030 url = params.uri_replacement(url, param_name, find_this, true);
9031 }
9032 {
9033 let to_remove = ["name"];
9034 params.remove_params(&to_remove);
9035 }
9036
9037 let url = params.parse_with_url(&url);
9038
9039 let mut json_mime_type = mime::APPLICATION_JSON;
9040 let mut request_value_reader = {
9041 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9042 common::remove_json_null_values(&mut value);
9043 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9044 serde_json::to_writer(&mut dst, &value).unwrap();
9045 dst
9046 };
9047 let request_size = request_value_reader
9048 .seek(std::io::SeekFrom::End(0))
9049 .unwrap();
9050 request_value_reader
9051 .seek(std::io::SeekFrom::Start(0))
9052 .unwrap();
9053
9054 loop {
9055 let token = match self
9056 .hub
9057 .auth
9058 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9059 .await
9060 {
9061 Ok(token) => token,
9062 Err(e) => match dlg.token(e) {
9063 Ok(token) => token,
9064 Err(e) => {
9065 dlg.finished(false);
9066 return Err(common::Error::MissingToken(e));
9067 }
9068 },
9069 };
9070 request_value_reader
9071 .seek(std::io::SeekFrom::Start(0))
9072 .unwrap();
9073 let mut req_result = {
9074 let client = &self.hub.client;
9075 dlg.pre_request();
9076 let mut req_builder = hyper::Request::builder()
9077 .method(hyper::Method::POST)
9078 .uri(url.as_str())
9079 .header(USER_AGENT, self.hub._user_agent.clone());
9080
9081 if let Some(token) = token.as_ref() {
9082 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9083 }
9084
9085 let request = req_builder
9086 .header(CONTENT_TYPE, json_mime_type.to_string())
9087 .header(CONTENT_LENGTH, request_size as u64)
9088 .body(common::to_body(
9089 request_value_reader.get_ref().clone().into(),
9090 ));
9091
9092 client.request(request.unwrap()).await
9093 };
9094
9095 match req_result {
9096 Err(err) => {
9097 if let common::Retry::After(d) = dlg.http_error(&err) {
9098 sleep(d).await;
9099 continue;
9100 }
9101 dlg.finished(false);
9102 return Err(common::Error::HttpError(err));
9103 }
9104 Ok(res) => {
9105 let (mut parts, body) = res.into_parts();
9106 let mut body = common::Body::new(body);
9107 if !parts.status.is_success() {
9108 let bytes = common::to_bytes(body).await.unwrap_or_default();
9109 let error = serde_json::from_str(&common::to_string(&bytes));
9110 let response = common::to_response(parts, bytes.into());
9111
9112 if let common::Retry::After(d) =
9113 dlg.http_failure(&response, error.as_ref().ok())
9114 {
9115 sleep(d).await;
9116 continue;
9117 }
9118
9119 dlg.finished(false);
9120
9121 return Err(match error {
9122 Ok(value) => common::Error::BadRequest(value),
9123 _ => common::Error::Failure(response),
9124 });
9125 }
9126 let response = {
9127 let bytes = common::to_bytes(body).await.unwrap_or_default();
9128 let encoded = common::to_string(&bytes);
9129 match serde_json::from_str(&encoded) {
9130 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9131 Err(error) => {
9132 dlg.response_json_decode_error(&encoded, &error);
9133 return Err(common::Error::JsonDecodeError(
9134 encoded.to_string(),
9135 error,
9136 ));
9137 }
9138 }
9139 };
9140
9141 dlg.finished(true);
9142 return Ok(response);
9143 }
9144 }
9145 }
9146 }
9147
9148 ///
9149 /// Sets the *request* property to the given value.
9150 ///
9151 /// Even though the property as already been set when instantiating this call,
9152 /// we provide this method for API completeness.
9153 pub fn request(
9154 mut self,
9155 new_value: ImportInstanceRequest,
9156 ) -> ProjectLocationInstanceImportCall<'a, C> {
9157 self._request = new_value;
9158 self
9159 }
9160 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
9161 ///
9162 /// Sets the *name* path property to the given value.
9163 ///
9164 /// Even though the property as already been set when instantiating this call,
9165 /// we provide this method for API completeness.
9166 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceImportCall<'a, C> {
9167 self._name = new_value.to_string();
9168 self
9169 }
9170 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9171 /// while executing the actual API request.
9172 ///
9173 /// ````text
9174 /// It should be used to handle progress information, and to implement a certain level of resilience.
9175 /// ````
9176 ///
9177 /// Sets the *delegate* property to the given value.
9178 pub fn delegate(
9179 mut self,
9180 new_value: &'a mut dyn common::Delegate,
9181 ) -> ProjectLocationInstanceImportCall<'a, C> {
9182 self._delegate = Some(new_value);
9183 self
9184 }
9185
9186 /// Set any additional parameter of the query string used in the request.
9187 /// It should be used to set parameters which are not yet available through their own
9188 /// setters.
9189 ///
9190 /// Please note that this method must not be used to set any of the known parameters
9191 /// which have their own setter method. If done anyway, the request will fail.
9192 ///
9193 /// # Additional Parameters
9194 ///
9195 /// * *$.xgafv* (query-string) - V1 error format.
9196 /// * *access_token* (query-string) - OAuth access token.
9197 /// * *alt* (query-string) - Data format for response.
9198 /// * *callback* (query-string) - JSONP
9199 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9200 /// * *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.
9201 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9202 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9203 /// * *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.
9204 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9205 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9206 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceImportCall<'a, C>
9207 where
9208 T: AsRef<str>,
9209 {
9210 self._additional_params
9211 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9212 self
9213 }
9214
9215 /// Identifies the authorization scope for the method you are building.
9216 ///
9217 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9218 /// [`Scope::CloudPlatform`].
9219 ///
9220 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9221 /// tokens for more than one scope.
9222 ///
9223 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9224 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9225 /// sufficient, a read-write scope will do as well.
9226 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceImportCall<'a, C>
9227 where
9228 St: AsRef<str>,
9229 {
9230 self._scopes.insert(String::from(scope.as_ref()));
9231 self
9232 }
9233 /// Identifies the authorization scope(s) for the method you are building.
9234 ///
9235 /// See [`Self::add_scope()`] for details.
9236 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceImportCall<'a, C>
9237 where
9238 I: IntoIterator<Item = St>,
9239 St: AsRef<str>,
9240 {
9241 self._scopes
9242 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9243 self
9244 }
9245
9246 /// Removes all scopes, and no default scope will be used either.
9247 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9248 /// for details).
9249 pub fn clear_scopes(mut self) -> ProjectLocationInstanceImportCall<'a, C> {
9250 self._scopes.clear();
9251 self
9252 }
9253}
9254
9255/// Lists all Redis instances owned by a project in either the specified location (region) or all locations. The location should have the following format: * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
9256///
9257/// A builder for the *locations.instances.list* method supported by a *project* resource.
9258/// It is not used directly, but through a [`ProjectMethods`] instance.
9259///
9260/// # Example
9261///
9262/// Instantiate a resource method builder
9263///
9264/// ```test_harness,no_run
9265/// # extern crate hyper;
9266/// # extern crate hyper_rustls;
9267/// # extern crate google_redis1 as redis1;
9268/// # async fn dox() {
9269/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9270///
9271/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9272/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9273/// # .with_native_roots()
9274/// # .unwrap()
9275/// # .https_only()
9276/// # .enable_http2()
9277/// # .build();
9278///
9279/// # let executor = hyper_util::rt::TokioExecutor::new();
9280/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9281/// # secret,
9282/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9283/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9284/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9285/// # ),
9286/// # ).build().await.unwrap();
9287///
9288/// # let client = hyper_util::client::legacy::Client::builder(
9289/// # hyper_util::rt::TokioExecutor::new()
9290/// # )
9291/// # .build(
9292/// # hyper_rustls::HttpsConnectorBuilder::new()
9293/// # .with_native_roots()
9294/// # .unwrap()
9295/// # .https_or_http()
9296/// # .enable_http2()
9297/// # .build()
9298/// # );
9299/// # let mut hub = CloudRedis::new(client, auth);
9300/// // You can configure optional parameters by calling the respective setters at will, and
9301/// // execute the final call using `doit()`.
9302/// // Values shown here are possibly random and not representative !
9303/// let result = hub.projects().locations_instances_list("parent")
9304/// .page_token("kasd")
9305/// .page_size(-24)
9306/// .doit().await;
9307/// # }
9308/// ```
9309pub struct ProjectLocationInstanceListCall<'a, C>
9310where
9311 C: 'a,
9312{
9313 hub: &'a CloudRedis<C>,
9314 _parent: String,
9315 _page_token: Option<String>,
9316 _page_size: Option<i32>,
9317 _delegate: Option<&'a mut dyn common::Delegate>,
9318 _additional_params: HashMap<String, String>,
9319 _scopes: BTreeSet<String>,
9320}
9321
9322impl<'a, C> common::CallBuilder for ProjectLocationInstanceListCall<'a, C> {}
9323
9324impl<'a, C> ProjectLocationInstanceListCall<'a, C>
9325where
9326 C: common::Connector,
9327{
9328 /// Perform the operation you have build so far.
9329 pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
9330 use std::borrow::Cow;
9331 use std::io::{Read, Seek};
9332
9333 use common::{url::Params, ToParts};
9334 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9335
9336 let mut dd = common::DefaultDelegate;
9337 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9338 dlg.begin(common::MethodInfo {
9339 id: "redis.projects.locations.instances.list",
9340 http_method: hyper::Method::GET,
9341 });
9342
9343 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
9344 if self._additional_params.contains_key(field) {
9345 dlg.finished(false);
9346 return Err(common::Error::FieldClash(field));
9347 }
9348 }
9349
9350 let mut params = Params::with_capacity(5 + self._additional_params.len());
9351 params.push("parent", self._parent);
9352 if let Some(value) = self._page_token.as_ref() {
9353 params.push("pageToken", value);
9354 }
9355 if let Some(value) = self._page_size.as_ref() {
9356 params.push("pageSize", value.to_string());
9357 }
9358
9359 params.extend(self._additional_params.iter());
9360
9361 params.push("alt", "json");
9362 let mut url = self.hub._base_url.clone() + "v1/{+parent}/instances";
9363 if self._scopes.is_empty() {
9364 self._scopes
9365 .insert(Scope::CloudPlatform.as_ref().to_string());
9366 }
9367
9368 #[allow(clippy::single_element_loop)]
9369 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9370 url = params.uri_replacement(url, param_name, find_this, true);
9371 }
9372 {
9373 let to_remove = ["parent"];
9374 params.remove_params(&to_remove);
9375 }
9376
9377 let url = params.parse_with_url(&url);
9378
9379 loop {
9380 let token = match self
9381 .hub
9382 .auth
9383 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9384 .await
9385 {
9386 Ok(token) => token,
9387 Err(e) => match dlg.token(e) {
9388 Ok(token) => token,
9389 Err(e) => {
9390 dlg.finished(false);
9391 return Err(common::Error::MissingToken(e));
9392 }
9393 },
9394 };
9395 let mut req_result = {
9396 let client = &self.hub.client;
9397 dlg.pre_request();
9398 let mut req_builder = hyper::Request::builder()
9399 .method(hyper::Method::GET)
9400 .uri(url.as_str())
9401 .header(USER_AGENT, self.hub._user_agent.clone());
9402
9403 if let Some(token) = token.as_ref() {
9404 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9405 }
9406
9407 let request = req_builder
9408 .header(CONTENT_LENGTH, 0_u64)
9409 .body(common::to_body::<String>(None));
9410
9411 client.request(request.unwrap()).await
9412 };
9413
9414 match req_result {
9415 Err(err) => {
9416 if let common::Retry::After(d) = dlg.http_error(&err) {
9417 sleep(d).await;
9418 continue;
9419 }
9420 dlg.finished(false);
9421 return Err(common::Error::HttpError(err));
9422 }
9423 Ok(res) => {
9424 let (mut parts, body) = res.into_parts();
9425 let mut body = common::Body::new(body);
9426 if !parts.status.is_success() {
9427 let bytes = common::to_bytes(body).await.unwrap_or_default();
9428 let error = serde_json::from_str(&common::to_string(&bytes));
9429 let response = common::to_response(parts, bytes.into());
9430
9431 if let common::Retry::After(d) =
9432 dlg.http_failure(&response, error.as_ref().ok())
9433 {
9434 sleep(d).await;
9435 continue;
9436 }
9437
9438 dlg.finished(false);
9439
9440 return Err(match error {
9441 Ok(value) => common::Error::BadRequest(value),
9442 _ => common::Error::Failure(response),
9443 });
9444 }
9445 let response = {
9446 let bytes = common::to_bytes(body).await.unwrap_or_default();
9447 let encoded = common::to_string(&bytes);
9448 match serde_json::from_str(&encoded) {
9449 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9450 Err(error) => {
9451 dlg.response_json_decode_error(&encoded, &error);
9452 return Err(common::Error::JsonDecodeError(
9453 encoded.to_string(),
9454 error,
9455 ));
9456 }
9457 }
9458 };
9459
9460 dlg.finished(true);
9461 return Ok(response);
9462 }
9463 }
9464 }
9465 }
9466
9467 /// Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
9468 ///
9469 /// Sets the *parent* path property to the given value.
9470 ///
9471 /// Even though the property as already been set when instantiating this call,
9472 /// we provide this method for API completeness.
9473 pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
9474 self._parent = new_value.to_string();
9475 self
9476 }
9477 /// The `next_page_token` value returned from a previous ListInstances request, if any.
9478 ///
9479 /// Sets the *page token* query property to the given value.
9480 pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
9481 self._page_token = Some(new_value.to_string());
9482 self
9483 }
9484 /// The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's `next_page_token` to determine if there are more instances left to be queried.
9485 ///
9486 /// Sets the *page size* query property to the given value.
9487 pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceListCall<'a, C> {
9488 self._page_size = Some(new_value);
9489 self
9490 }
9491 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9492 /// while executing the actual API request.
9493 ///
9494 /// ````text
9495 /// It should be used to handle progress information, and to implement a certain level of resilience.
9496 /// ````
9497 ///
9498 /// Sets the *delegate* property to the given value.
9499 pub fn delegate(
9500 mut self,
9501 new_value: &'a mut dyn common::Delegate,
9502 ) -> ProjectLocationInstanceListCall<'a, C> {
9503 self._delegate = Some(new_value);
9504 self
9505 }
9506
9507 /// Set any additional parameter of the query string used in the request.
9508 /// It should be used to set parameters which are not yet available through their own
9509 /// setters.
9510 ///
9511 /// Please note that this method must not be used to set any of the known parameters
9512 /// which have their own setter method. If done anyway, the request will fail.
9513 ///
9514 /// # Additional Parameters
9515 ///
9516 /// * *$.xgafv* (query-string) - V1 error format.
9517 /// * *access_token* (query-string) - OAuth access token.
9518 /// * *alt* (query-string) - Data format for response.
9519 /// * *callback* (query-string) - JSONP
9520 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9521 /// * *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.
9522 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9523 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9524 /// * *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.
9525 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9526 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9527 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C>
9528 where
9529 T: AsRef<str>,
9530 {
9531 self._additional_params
9532 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9533 self
9534 }
9535
9536 /// Identifies the authorization scope for the method you are building.
9537 ///
9538 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9539 /// [`Scope::CloudPlatform`].
9540 ///
9541 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9542 /// tokens for more than one scope.
9543 ///
9544 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9545 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9546 /// sufficient, a read-write scope will do as well.
9547 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceListCall<'a, C>
9548 where
9549 St: AsRef<str>,
9550 {
9551 self._scopes.insert(String::from(scope.as_ref()));
9552 self
9553 }
9554 /// Identifies the authorization scope(s) for the method you are building.
9555 ///
9556 /// See [`Self::add_scope()`] for details.
9557 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceListCall<'a, C>
9558 where
9559 I: IntoIterator<Item = St>,
9560 St: AsRef<str>,
9561 {
9562 self._scopes
9563 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9564 self
9565 }
9566
9567 /// Removes all scopes, and no default scope will be used either.
9568 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9569 /// for details).
9570 pub fn clear_scopes(mut self) -> ProjectLocationInstanceListCall<'a, C> {
9571 self._scopes.clear();
9572 self
9573 }
9574}
9575
9576/// Updates the metadata and configuration of a specific Redis instance. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
9577///
9578/// A builder for the *locations.instances.patch* method supported by a *project* resource.
9579/// It is not used directly, but through a [`ProjectMethods`] instance.
9580///
9581/// # Example
9582///
9583/// Instantiate a resource method builder
9584///
9585/// ```test_harness,no_run
9586/// # extern crate hyper;
9587/// # extern crate hyper_rustls;
9588/// # extern crate google_redis1 as redis1;
9589/// use redis1::api::Instance;
9590/// # async fn dox() {
9591/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9592///
9593/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9594/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9595/// # .with_native_roots()
9596/// # .unwrap()
9597/// # .https_only()
9598/// # .enable_http2()
9599/// # .build();
9600///
9601/// # let executor = hyper_util::rt::TokioExecutor::new();
9602/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9603/// # secret,
9604/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9605/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9606/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9607/// # ),
9608/// # ).build().await.unwrap();
9609///
9610/// # let client = hyper_util::client::legacy::Client::builder(
9611/// # hyper_util::rt::TokioExecutor::new()
9612/// # )
9613/// # .build(
9614/// # hyper_rustls::HttpsConnectorBuilder::new()
9615/// # .with_native_roots()
9616/// # .unwrap()
9617/// # .https_or_http()
9618/// # .enable_http2()
9619/// # .build()
9620/// # );
9621/// # let mut hub = CloudRedis::new(client, auth);
9622/// // As the method needs a request, you would usually fill it with the desired information
9623/// // into the respective structure. Some of the parts shown here might not be applicable !
9624/// // Values shown here are possibly random and not representative !
9625/// let mut req = Instance::default();
9626///
9627/// // You can configure optional parameters by calling the respective setters at will, and
9628/// // execute the final call using `doit()`.
9629/// // Values shown here are possibly random and not representative !
9630/// let result = hub.projects().locations_instances_patch(req, "name")
9631/// .update_mask(FieldMask::new::<&str>(&[]))
9632/// .doit().await;
9633/// # }
9634/// ```
9635pub struct ProjectLocationInstancePatchCall<'a, C>
9636where
9637 C: 'a,
9638{
9639 hub: &'a CloudRedis<C>,
9640 _request: Instance,
9641 _name: String,
9642 _update_mask: Option<common::FieldMask>,
9643 _delegate: Option<&'a mut dyn common::Delegate>,
9644 _additional_params: HashMap<String, String>,
9645 _scopes: BTreeSet<String>,
9646}
9647
9648impl<'a, C> common::CallBuilder for ProjectLocationInstancePatchCall<'a, C> {}
9649
9650impl<'a, C> ProjectLocationInstancePatchCall<'a, C>
9651where
9652 C: common::Connector,
9653{
9654 /// Perform the operation you have build so far.
9655 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9656 use std::borrow::Cow;
9657 use std::io::{Read, Seek};
9658
9659 use common::{url::Params, ToParts};
9660 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9661
9662 let mut dd = common::DefaultDelegate;
9663 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9664 dlg.begin(common::MethodInfo {
9665 id: "redis.projects.locations.instances.patch",
9666 http_method: hyper::Method::PATCH,
9667 });
9668
9669 for &field in ["alt", "name", "updateMask"].iter() {
9670 if self._additional_params.contains_key(field) {
9671 dlg.finished(false);
9672 return Err(common::Error::FieldClash(field));
9673 }
9674 }
9675
9676 let mut params = Params::with_capacity(5 + self._additional_params.len());
9677 params.push("name", self._name);
9678 if let Some(value) = self._update_mask.as_ref() {
9679 params.push("updateMask", value.to_string());
9680 }
9681
9682 params.extend(self._additional_params.iter());
9683
9684 params.push("alt", "json");
9685 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9686 if self._scopes.is_empty() {
9687 self._scopes
9688 .insert(Scope::CloudPlatform.as_ref().to_string());
9689 }
9690
9691 #[allow(clippy::single_element_loop)]
9692 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9693 url = params.uri_replacement(url, param_name, find_this, true);
9694 }
9695 {
9696 let to_remove = ["name"];
9697 params.remove_params(&to_remove);
9698 }
9699
9700 let url = params.parse_with_url(&url);
9701
9702 let mut json_mime_type = mime::APPLICATION_JSON;
9703 let mut request_value_reader = {
9704 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9705 common::remove_json_null_values(&mut value);
9706 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9707 serde_json::to_writer(&mut dst, &value).unwrap();
9708 dst
9709 };
9710 let request_size = request_value_reader
9711 .seek(std::io::SeekFrom::End(0))
9712 .unwrap();
9713 request_value_reader
9714 .seek(std::io::SeekFrom::Start(0))
9715 .unwrap();
9716
9717 loop {
9718 let token = match self
9719 .hub
9720 .auth
9721 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9722 .await
9723 {
9724 Ok(token) => token,
9725 Err(e) => match dlg.token(e) {
9726 Ok(token) => token,
9727 Err(e) => {
9728 dlg.finished(false);
9729 return Err(common::Error::MissingToken(e));
9730 }
9731 },
9732 };
9733 request_value_reader
9734 .seek(std::io::SeekFrom::Start(0))
9735 .unwrap();
9736 let mut req_result = {
9737 let client = &self.hub.client;
9738 dlg.pre_request();
9739 let mut req_builder = hyper::Request::builder()
9740 .method(hyper::Method::PATCH)
9741 .uri(url.as_str())
9742 .header(USER_AGENT, self.hub._user_agent.clone());
9743
9744 if let Some(token) = token.as_ref() {
9745 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9746 }
9747
9748 let request = req_builder
9749 .header(CONTENT_TYPE, json_mime_type.to_string())
9750 .header(CONTENT_LENGTH, request_size as u64)
9751 .body(common::to_body(
9752 request_value_reader.get_ref().clone().into(),
9753 ));
9754
9755 client.request(request.unwrap()).await
9756 };
9757
9758 match req_result {
9759 Err(err) => {
9760 if let common::Retry::After(d) = dlg.http_error(&err) {
9761 sleep(d).await;
9762 continue;
9763 }
9764 dlg.finished(false);
9765 return Err(common::Error::HttpError(err));
9766 }
9767 Ok(res) => {
9768 let (mut parts, body) = res.into_parts();
9769 let mut body = common::Body::new(body);
9770 if !parts.status.is_success() {
9771 let bytes = common::to_bytes(body).await.unwrap_or_default();
9772 let error = serde_json::from_str(&common::to_string(&bytes));
9773 let response = common::to_response(parts, bytes.into());
9774
9775 if let common::Retry::After(d) =
9776 dlg.http_failure(&response, error.as_ref().ok())
9777 {
9778 sleep(d).await;
9779 continue;
9780 }
9781
9782 dlg.finished(false);
9783
9784 return Err(match error {
9785 Ok(value) => common::Error::BadRequest(value),
9786 _ => common::Error::Failure(response),
9787 });
9788 }
9789 let response = {
9790 let bytes = common::to_bytes(body).await.unwrap_or_default();
9791 let encoded = common::to_string(&bytes);
9792 match serde_json::from_str(&encoded) {
9793 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9794 Err(error) => {
9795 dlg.response_json_decode_error(&encoded, &error);
9796 return Err(common::Error::JsonDecodeError(
9797 encoded.to_string(),
9798 error,
9799 ));
9800 }
9801 }
9802 };
9803
9804 dlg.finished(true);
9805 return Ok(response);
9806 }
9807 }
9808 }
9809 }
9810
9811 ///
9812 /// Sets the *request* property to the given value.
9813 ///
9814 /// Even though the property as already been set when instantiating this call,
9815 /// we provide this method for API completeness.
9816 pub fn request(mut self, new_value: Instance) -> ProjectLocationInstancePatchCall<'a, C> {
9817 self._request = new_value;
9818 self
9819 }
9820 /// Required. Unique name of the resource in this scope including project and location using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: Redis instances are managed and addressed at regional level so location_id here refers to a GCP region; however, users may choose which specific zone (or collection of zones for cross-zone instances) an instance should be provisioned in. Refer to location_id and alternative_location_id fields for more details.
9821 ///
9822 /// Sets the *name* path property to the given value.
9823 ///
9824 /// Even though the property as already been set when instantiating this call,
9825 /// we provide this method for API completeness.
9826 pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C> {
9827 self._name = new_value.to_string();
9828 self
9829 }
9830 /// Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field may only include these fields from Instance: * `displayName` * `labels` * `memorySizeGb` * `redisConfig` * `replica_count`
9831 ///
9832 /// Sets the *update mask* query property to the given value.
9833 pub fn update_mask(
9834 mut self,
9835 new_value: common::FieldMask,
9836 ) -> ProjectLocationInstancePatchCall<'a, C> {
9837 self._update_mask = Some(new_value);
9838 self
9839 }
9840 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9841 /// while executing the actual API request.
9842 ///
9843 /// ````text
9844 /// It should be used to handle progress information, and to implement a certain level of resilience.
9845 /// ````
9846 ///
9847 /// Sets the *delegate* property to the given value.
9848 pub fn delegate(
9849 mut self,
9850 new_value: &'a mut dyn common::Delegate,
9851 ) -> ProjectLocationInstancePatchCall<'a, C> {
9852 self._delegate = Some(new_value);
9853 self
9854 }
9855
9856 /// Set any additional parameter of the query string used in the request.
9857 /// It should be used to set parameters which are not yet available through their own
9858 /// setters.
9859 ///
9860 /// Please note that this method must not be used to set any of the known parameters
9861 /// which have their own setter method. If done anyway, the request will fail.
9862 ///
9863 /// # Additional Parameters
9864 ///
9865 /// * *$.xgafv* (query-string) - V1 error format.
9866 /// * *access_token* (query-string) - OAuth access token.
9867 /// * *alt* (query-string) - Data format for response.
9868 /// * *callback* (query-string) - JSONP
9869 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9870 /// * *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.
9871 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9872 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9873 /// * *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.
9874 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9875 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9876 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C>
9877 where
9878 T: AsRef<str>,
9879 {
9880 self._additional_params
9881 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9882 self
9883 }
9884
9885 /// Identifies the authorization scope for the method you are building.
9886 ///
9887 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9888 /// [`Scope::CloudPlatform`].
9889 ///
9890 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9891 /// tokens for more than one scope.
9892 ///
9893 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9894 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9895 /// sufficient, a read-write scope will do as well.
9896 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePatchCall<'a, C>
9897 where
9898 St: AsRef<str>,
9899 {
9900 self._scopes.insert(String::from(scope.as_ref()));
9901 self
9902 }
9903 /// Identifies the authorization scope(s) for the method you are building.
9904 ///
9905 /// See [`Self::add_scope()`] for details.
9906 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstancePatchCall<'a, C>
9907 where
9908 I: IntoIterator<Item = St>,
9909 St: AsRef<str>,
9910 {
9911 self._scopes
9912 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9913 self
9914 }
9915
9916 /// Removes all scopes, and no default scope will be used either.
9917 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9918 /// for details).
9919 pub fn clear_scopes(mut self) -> ProjectLocationInstancePatchCall<'a, C> {
9920 self._scopes.clear();
9921 self
9922 }
9923}
9924
9925/// Reschedule maintenance for a given instance in a given project and location.
9926///
9927/// A builder for the *locations.instances.rescheduleMaintenance* method supported by a *project* resource.
9928/// It is not used directly, but through a [`ProjectMethods`] instance.
9929///
9930/// # Example
9931///
9932/// Instantiate a resource method builder
9933///
9934/// ```test_harness,no_run
9935/// # extern crate hyper;
9936/// # extern crate hyper_rustls;
9937/// # extern crate google_redis1 as redis1;
9938/// use redis1::api::RescheduleMaintenanceRequest;
9939/// # async fn dox() {
9940/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9941///
9942/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9943/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9944/// # .with_native_roots()
9945/// # .unwrap()
9946/// # .https_only()
9947/// # .enable_http2()
9948/// # .build();
9949///
9950/// # let executor = hyper_util::rt::TokioExecutor::new();
9951/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9952/// # secret,
9953/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9954/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9955/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9956/// # ),
9957/// # ).build().await.unwrap();
9958///
9959/// # let client = hyper_util::client::legacy::Client::builder(
9960/// # hyper_util::rt::TokioExecutor::new()
9961/// # )
9962/// # .build(
9963/// # hyper_rustls::HttpsConnectorBuilder::new()
9964/// # .with_native_roots()
9965/// # .unwrap()
9966/// # .https_or_http()
9967/// # .enable_http2()
9968/// # .build()
9969/// # );
9970/// # let mut hub = CloudRedis::new(client, auth);
9971/// // As the method needs a request, you would usually fill it with the desired information
9972/// // into the respective structure. Some of the parts shown here might not be applicable !
9973/// // Values shown here are possibly random and not representative !
9974/// let mut req = RescheduleMaintenanceRequest::default();
9975///
9976/// // You can configure optional parameters by calling the respective setters at will, and
9977/// // execute the final call using `doit()`.
9978/// // Values shown here are possibly random and not representative !
9979/// let result = hub.projects().locations_instances_reschedule_maintenance(req, "name")
9980/// .doit().await;
9981/// # }
9982/// ```
9983pub struct ProjectLocationInstanceRescheduleMaintenanceCall<'a, C>
9984where
9985 C: 'a,
9986{
9987 hub: &'a CloudRedis<C>,
9988 _request: RescheduleMaintenanceRequest,
9989 _name: String,
9990 _delegate: Option<&'a mut dyn common::Delegate>,
9991 _additional_params: HashMap<String, String>,
9992 _scopes: BTreeSet<String>,
9993}
9994
9995impl<'a, C> common::CallBuilder for ProjectLocationInstanceRescheduleMaintenanceCall<'a, C> {}
9996
9997impl<'a, C> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C>
9998where
9999 C: common::Connector,
10000{
10001 /// Perform the operation you have build so far.
10002 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10003 use std::borrow::Cow;
10004 use std::io::{Read, Seek};
10005
10006 use common::{url::Params, ToParts};
10007 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10008
10009 let mut dd = common::DefaultDelegate;
10010 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10011 dlg.begin(common::MethodInfo {
10012 id: "redis.projects.locations.instances.rescheduleMaintenance",
10013 http_method: hyper::Method::POST,
10014 });
10015
10016 for &field in ["alt", "name"].iter() {
10017 if self._additional_params.contains_key(field) {
10018 dlg.finished(false);
10019 return Err(common::Error::FieldClash(field));
10020 }
10021 }
10022
10023 let mut params = Params::with_capacity(4 + self._additional_params.len());
10024 params.push("name", self._name);
10025
10026 params.extend(self._additional_params.iter());
10027
10028 params.push("alt", "json");
10029 let mut url = self.hub._base_url.clone() + "v1/{+name}:rescheduleMaintenance";
10030 if self._scopes.is_empty() {
10031 self._scopes
10032 .insert(Scope::CloudPlatform.as_ref().to_string());
10033 }
10034
10035 #[allow(clippy::single_element_loop)]
10036 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10037 url = params.uri_replacement(url, param_name, find_this, true);
10038 }
10039 {
10040 let to_remove = ["name"];
10041 params.remove_params(&to_remove);
10042 }
10043
10044 let url = params.parse_with_url(&url);
10045
10046 let mut json_mime_type = mime::APPLICATION_JSON;
10047 let mut request_value_reader = {
10048 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10049 common::remove_json_null_values(&mut value);
10050 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10051 serde_json::to_writer(&mut dst, &value).unwrap();
10052 dst
10053 };
10054 let request_size = request_value_reader
10055 .seek(std::io::SeekFrom::End(0))
10056 .unwrap();
10057 request_value_reader
10058 .seek(std::io::SeekFrom::Start(0))
10059 .unwrap();
10060
10061 loop {
10062 let token = match self
10063 .hub
10064 .auth
10065 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10066 .await
10067 {
10068 Ok(token) => token,
10069 Err(e) => match dlg.token(e) {
10070 Ok(token) => token,
10071 Err(e) => {
10072 dlg.finished(false);
10073 return Err(common::Error::MissingToken(e));
10074 }
10075 },
10076 };
10077 request_value_reader
10078 .seek(std::io::SeekFrom::Start(0))
10079 .unwrap();
10080 let mut req_result = {
10081 let client = &self.hub.client;
10082 dlg.pre_request();
10083 let mut req_builder = hyper::Request::builder()
10084 .method(hyper::Method::POST)
10085 .uri(url.as_str())
10086 .header(USER_AGENT, self.hub._user_agent.clone());
10087
10088 if let Some(token) = token.as_ref() {
10089 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10090 }
10091
10092 let request = req_builder
10093 .header(CONTENT_TYPE, json_mime_type.to_string())
10094 .header(CONTENT_LENGTH, request_size as u64)
10095 .body(common::to_body(
10096 request_value_reader.get_ref().clone().into(),
10097 ));
10098
10099 client.request(request.unwrap()).await
10100 };
10101
10102 match req_result {
10103 Err(err) => {
10104 if let common::Retry::After(d) = dlg.http_error(&err) {
10105 sleep(d).await;
10106 continue;
10107 }
10108 dlg.finished(false);
10109 return Err(common::Error::HttpError(err));
10110 }
10111 Ok(res) => {
10112 let (mut parts, body) = res.into_parts();
10113 let mut body = common::Body::new(body);
10114 if !parts.status.is_success() {
10115 let bytes = common::to_bytes(body).await.unwrap_or_default();
10116 let error = serde_json::from_str(&common::to_string(&bytes));
10117 let response = common::to_response(parts, bytes.into());
10118
10119 if let common::Retry::After(d) =
10120 dlg.http_failure(&response, error.as_ref().ok())
10121 {
10122 sleep(d).await;
10123 continue;
10124 }
10125
10126 dlg.finished(false);
10127
10128 return Err(match error {
10129 Ok(value) => common::Error::BadRequest(value),
10130 _ => common::Error::Failure(response),
10131 });
10132 }
10133 let response = {
10134 let bytes = common::to_bytes(body).await.unwrap_or_default();
10135 let encoded = common::to_string(&bytes);
10136 match serde_json::from_str(&encoded) {
10137 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10138 Err(error) => {
10139 dlg.response_json_decode_error(&encoded, &error);
10140 return Err(common::Error::JsonDecodeError(
10141 encoded.to_string(),
10142 error,
10143 ));
10144 }
10145 }
10146 };
10147
10148 dlg.finished(true);
10149 return Ok(response);
10150 }
10151 }
10152 }
10153 }
10154
10155 ///
10156 /// Sets the *request* property to the given value.
10157 ///
10158 /// Even though the property as already been set when instantiating this call,
10159 /// we provide this method for API completeness.
10160 pub fn request(
10161 mut self,
10162 new_value: RescheduleMaintenanceRequest,
10163 ) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C> {
10164 self._request = new_value;
10165 self
10166 }
10167 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
10168 ///
10169 /// Sets the *name* path property to the given value.
10170 ///
10171 /// Even though the property as already been set when instantiating this call,
10172 /// we provide this method for API completeness.
10173 pub fn name(
10174 mut self,
10175 new_value: &str,
10176 ) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C> {
10177 self._name = new_value.to_string();
10178 self
10179 }
10180 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10181 /// while executing the actual API request.
10182 ///
10183 /// ````text
10184 /// It should be used to handle progress information, and to implement a certain level of resilience.
10185 /// ````
10186 ///
10187 /// Sets the *delegate* property to the given value.
10188 pub fn delegate(
10189 mut self,
10190 new_value: &'a mut dyn common::Delegate,
10191 ) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C> {
10192 self._delegate = Some(new_value);
10193 self
10194 }
10195
10196 /// Set any additional parameter of the query string used in the request.
10197 /// It should be used to set parameters which are not yet available through their own
10198 /// setters.
10199 ///
10200 /// Please note that this method must not be used to set any of the known parameters
10201 /// which have their own setter method. If done anyway, the request will fail.
10202 ///
10203 /// # Additional Parameters
10204 ///
10205 /// * *$.xgafv* (query-string) - V1 error format.
10206 /// * *access_token* (query-string) - OAuth access token.
10207 /// * *alt* (query-string) - Data format for response.
10208 /// * *callback* (query-string) - JSONP
10209 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10210 /// * *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.
10211 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10212 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10213 /// * *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.
10214 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10215 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10216 pub fn param<T>(
10217 mut self,
10218 name: T,
10219 value: T,
10220 ) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C>
10221 where
10222 T: AsRef<str>,
10223 {
10224 self._additional_params
10225 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10226 self
10227 }
10228
10229 /// Identifies the authorization scope for the method you are building.
10230 ///
10231 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10232 /// [`Scope::CloudPlatform`].
10233 ///
10234 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10235 /// tokens for more than one scope.
10236 ///
10237 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10238 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10239 /// sufficient, a read-write scope will do as well.
10240 pub fn add_scope<St>(
10241 mut self,
10242 scope: St,
10243 ) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C>
10244 where
10245 St: AsRef<str>,
10246 {
10247 self._scopes.insert(String::from(scope.as_ref()));
10248 self
10249 }
10250 /// Identifies the authorization scope(s) for the method you are building.
10251 ///
10252 /// See [`Self::add_scope()`] for details.
10253 pub fn add_scopes<I, St>(
10254 mut self,
10255 scopes: I,
10256 ) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C>
10257 where
10258 I: IntoIterator<Item = St>,
10259 St: AsRef<str>,
10260 {
10261 self._scopes
10262 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10263 self
10264 }
10265
10266 /// Removes all scopes, and no default scope will be used either.
10267 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10268 /// for details).
10269 pub fn clear_scopes(mut self) -> ProjectLocationInstanceRescheduleMaintenanceCall<'a, C> {
10270 self._scopes.clear();
10271 self
10272 }
10273}
10274
10275/// Upgrades Redis instance to the newer Redis version specified in the request.
10276///
10277/// A builder for the *locations.instances.upgrade* method supported by a *project* resource.
10278/// It is not used directly, but through a [`ProjectMethods`] instance.
10279///
10280/// # Example
10281///
10282/// Instantiate a resource method builder
10283///
10284/// ```test_harness,no_run
10285/// # extern crate hyper;
10286/// # extern crate hyper_rustls;
10287/// # extern crate google_redis1 as redis1;
10288/// use redis1::api::UpgradeInstanceRequest;
10289/// # async fn dox() {
10290/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10291///
10292/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10293/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10294/// # .with_native_roots()
10295/// # .unwrap()
10296/// # .https_only()
10297/// # .enable_http2()
10298/// # .build();
10299///
10300/// # let executor = hyper_util::rt::TokioExecutor::new();
10301/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10302/// # secret,
10303/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10304/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10305/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10306/// # ),
10307/// # ).build().await.unwrap();
10308///
10309/// # let client = hyper_util::client::legacy::Client::builder(
10310/// # hyper_util::rt::TokioExecutor::new()
10311/// # )
10312/// # .build(
10313/// # hyper_rustls::HttpsConnectorBuilder::new()
10314/// # .with_native_roots()
10315/// # .unwrap()
10316/// # .https_or_http()
10317/// # .enable_http2()
10318/// # .build()
10319/// # );
10320/// # let mut hub = CloudRedis::new(client, auth);
10321/// // As the method needs a request, you would usually fill it with the desired information
10322/// // into the respective structure. Some of the parts shown here might not be applicable !
10323/// // Values shown here are possibly random and not representative !
10324/// let mut req = UpgradeInstanceRequest::default();
10325///
10326/// // You can configure optional parameters by calling the respective setters at will, and
10327/// // execute the final call using `doit()`.
10328/// // Values shown here are possibly random and not representative !
10329/// let result = hub.projects().locations_instances_upgrade(req, "name")
10330/// .doit().await;
10331/// # }
10332/// ```
10333pub struct ProjectLocationInstanceUpgradeCall<'a, C>
10334where
10335 C: 'a,
10336{
10337 hub: &'a CloudRedis<C>,
10338 _request: UpgradeInstanceRequest,
10339 _name: String,
10340 _delegate: Option<&'a mut dyn common::Delegate>,
10341 _additional_params: HashMap<String, String>,
10342 _scopes: BTreeSet<String>,
10343}
10344
10345impl<'a, C> common::CallBuilder for ProjectLocationInstanceUpgradeCall<'a, C> {}
10346
10347impl<'a, C> ProjectLocationInstanceUpgradeCall<'a, C>
10348where
10349 C: common::Connector,
10350{
10351 /// Perform the operation you have build so far.
10352 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10353 use std::borrow::Cow;
10354 use std::io::{Read, Seek};
10355
10356 use common::{url::Params, ToParts};
10357 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10358
10359 let mut dd = common::DefaultDelegate;
10360 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10361 dlg.begin(common::MethodInfo {
10362 id: "redis.projects.locations.instances.upgrade",
10363 http_method: hyper::Method::POST,
10364 });
10365
10366 for &field in ["alt", "name"].iter() {
10367 if self._additional_params.contains_key(field) {
10368 dlg.finished(false);
10369 return Err(common::Error::FieldClash(field));
10370 }
10371 }
10372
10373 let mut params = Params::with_capacity(4 + self._additional_params.len());
10374 params.push("name", self._name);
10375
10376 params.extend(self._additional_params.iter());
10377
10378 params.push("alt", "json");
10379 let mut url = self.hub._base_url.clone() + "v1/{+name}:upgrade";
10380 if self._scopes.is_empty() {
10381 self._scopes
10382 .insert(Scope::CloudPlatform.as_ref().to_string());
10383 }
10384
10385 #[allow(clippy::single_element_loop)]
10386 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10387 url = params.uri_replacement(url, param_name, find_this, true);
10388 }
10389 {
10390 let to_remove = ["name"];
10391 params.remove_params(&to_remove);
10392 }
10393
10394 let url = params.parse_with_url(&url);
10395
10396 let mut json_mime_type = mime::APPLICATION_JSON;
10397 let mut request_value_reader = {
10398 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10399 common::remove_json_null_values(&mut value);
10400 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10401 serde_json::to_writer(&mut dst, &value).unwrap();
10402 dst
10403 };
10404 let request_size = request_value_reader
10405 .seek(std::io::SeekFrom::End(0))
10406 .unwrap();
10407 request_value_reader
10408 .seek(std::io::SeekFrom::Start(0))
10409 .unwrap();
10410
10411 loop {
10412 let token = match self
10413 .hub
10414 .auth
10415 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10416 .await
10417 {
10418 Ok(token) => token,
10419 Err(e) => match dlg.token(e) {
10420 Ok(token) => token,
10421 Err(e) => {
10422 dlg.finished(false);
10423 return Err(common::Error::MissingToken(e));
10424 }
10425 },
10426 };
10427 request_value_reader
10428 .seek(std::io::SeekFrom::Start(0))
10429 .unwrap();
10430 let mut req_result = {
10431 let client = &self.hub.client;
10432 dlg.pre_request();
10433 let mut req_builder = hyper::Request::builder()
10434 .method(hyper::Method::POST)
10435 .uri(url.as_str())
10436 .header(USER_AGENT, self.hub._user_agent.clone());
10437
10438 if let Some(token) = token.as_ref() {
10439 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10440 }
10441
10442 let request = req_builder
10443 .header(CONTENT_TYPE, json_mime_type.to_string())
10444 .header(CONTENT_LENGTH, request_size as u64)
10445 .body(common::to_body(
10446 request_value_reader.get_ref().clone().into(),
10447 ));
10448
10449 client.request(request.unwrap()).await
10450 };
10451
10452 match req_result {
10453 Err(err) => {
10454 if let common::Retry::After(d) = dlg.http_error(&err) {
10455 sleep(d).await;
10456 continue;
10457 }
10458 dlg.finished(false);
10459 return Err(common::Error::HttpError(err));
10460 }
10461 Ok(res) => {
10462 let (mut parts, body) = res.into_parts();
10463 let mut body = common::Body::new(body);
10464 if !parts.status.is_success() {
10465 let bytes = common::to_bytes(body).await.unwrap_or_default();
10466 let error = serde_json::from_str(&common::to_string(&bytes));
10467 let response = common::to_response(parts, bytes.into());
10468
10469 if let common::Retry::After(d) =
10470 dlg.http_failure(&response, error.as_ref().ok())
10471 {
10472 sleep(d).await;
10473 continue;
10474 }
10475
10476 dlg.finished(false);
10477
10478 return Err(match error {
10479 Ok(value) => common::Error::BadRequest(value),
10480 _ => common::Error::Failure(response),
10481 });
10482 }
10483 let response = {
10484 let bytes = common::to_bytes(body).await.unwrap_or_default();
10485 let encoded = common::to_string(&bytes);
10486 match serde_json::from_str(&encoded) {
10487 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10488 Err(error) => {
10489 dlg.response_json_decode_error(&encoded, &error);
10490 return Err(common::Error::JsonDecodeError(
10491 encoded.to_string(),
10492 error,
10493 ));
10494 }
10495 }
10496 };
10497
10498 dlg.finished(true);
10499 return Ok(response);
10500 }
10501 }
10502 }
10503 }
10504
10505 ///
10506 /// Sets the *request* property to the given value.
10507 ///
10508 /// Even though the property as already been set when instantiating this call,
10509 /// we provide this method for API completeness.
10510 pub fn request(
10511 mut self,
10512 new_value: UpgradeInstanceRequest,
10513 ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
10514 self._request = new_value;
10515 self
10516 }
10517 /// Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.
10518 ///
10519 /// Sets the *name* path property to the given value.
10520 ///
10521 /// Even though the property as already been set when instantiating this call,
10522 /// we provide this method for API completeness.
10523 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceUpgradeCall<'a, C> {
10524 self._name = new_value.to_string();
10525 self
10526 }
10527 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10528 /// while executing the actual API request.
10529 ///
10530 /// ````text
10531 /// It should be used to handle progress information, and to implement a certain level of resilience.
10532 /// ````
10533 ///
10534 /// Sets the *delegate* property to the given value.
10535 pub fn delegate(
10536 mut self,
10537 new_value: &'a mut dyn common::Delegate,
10538 ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
10539 self._delegate = Some(new_value);
10540 self
10541 }
10542
10543 /// Set any additional parameter of the query string used in the request.
10544 /// It should be used to set parameters which are not yet available through their own
10545 /// setters.
10546 ///
10547 /// Please note that this method must not be used to set any of the known parameters
10548 /// which have their own setter method. If done anyway, the request will fail.
10549 ///
10550 /// # Additional Parameters
10551 ///
10552 /// * *$.xgafv* (query-string) - V1 error format.
10553 /// * *access_token* (query-string) - OAuth access token.
10554 /// * *alt* (query-string) - Data format for response.
10555 /// * *callback* (query-string) - JSONP
10556 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10557 /// * *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.
10558 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10559 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10560 /// * *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.
10561 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10562 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10563 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceUpgradeCall<'a, C>
10564 where
10565 T: AsRef<str>,
10566 {
10567 self._additional_params
10568 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10569 self
10570 }
10571
10572 /// Identifies the authorization scope for the method you are building.
10573 ///
10574 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10575 /// [`Scope::CloudPlatform`].
10576 ///
10577 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10578 /// tokens for more than one scope.
10579 ///
10580 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10581 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10582 /// sufficient, a read-write scope will do as well.
10583 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceUpgradeCall<'a, C>
10584 where
10585 St: AsRef<str>,
10586 {
10587 self._scopes.insert(String::from(scope.as_ref()));
10588 self
10589 }
10590 /// Identifies the authorization scope(s) for the method you are building.
10591 ///
10592 /// See [`Self::add_scope()`] for details.
10593 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceUpgradeCall<'a, C>
10594 where
10595 I: IntoIterator<Item = St>,
10596 St: AsRef<str>,
10597 {
10598 self._scopes
10599 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10600 self
10601 }
10602
10603 /// Removes all scopes, and no default scope will be used either.
10604 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10605 /// for details).
10606 pub fn clear_scopes(mut self) -> ProjectLocationInstanceUpgradeCall<'a, C> {
10607 self._scopes.clear();
10608 self
10609 }
10610}
10611
10612/// 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`.
10613///
10614/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
10615/// It is not used directly, but through a [`ProjectMethods`] instance.
10616///
10617/// # Example
10618///
10619/// Instantiate a resource method builder
10620///
10621/// ```test_harness,no_run
10622/// # extern crate hyper;
10623/// # extern crate hyper_rustls;
10624/// # extern crate google_redis1 as redis1;
10625/// # async fn dox() {
10626/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10627///
10628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10629/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10630/// # .with_native_roots()
10631/// # .unwrap()
10632/// # .https_only()
10633/// # .enable_http2()
10634/// # .build();
10635///
10636/// # let executor = hyper_util::rt::TokioExecutor::new();
10637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10638/// # secret,
10639/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10640/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10641/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10642/// # ),
10643/// # ).build().await.unwrap();
10644///
10645/// # let client = hyper_util::client::legacy::Client::builder(
10646/// # hyper_util::rt::TokioExecutor::new()
10647/// # )
10648/// # .build(
10649/// # hyper_rustls::HttpsConnectorBuilder::new()
10650/// # .with_native_roots()
10651/// # .unwrap()
10652/// # .https_or_http()
10653/// # .enable_http2()
10654/// # .build()
10655/// # );
10656/// # let mut hub = CloudRedis::new(client, auth);
10657/// // You can configure optional parameters by calling the respective setters at will, and
10658/// // execute the final call using `doit()`.
10659/// // Values shown here are possibly random and not representative !
10660/// let result = hub.projects().locations_operations_cancel("name")
10661/// .doit().await;
10662/// # }
10663/// ```
10664pub struct ProjectLocationOperationCancelCall<'a, C>
10665where
10666 C: 'a,
10667{
10668 hub: &'a CloudRedis<C>,
10669 _name: String,
10670 _delegate: Option<&'a mut dyn common::Delegate>,
10671 _additional_params: HashMap<String, String>,
10672 _scopes: BTreeSet<String>,
10673}
10674
10675impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
10676
10677impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
10678where
10679 C: common::Connector,
10680{
10681 /// Perform the operation you have build so far.
10682 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10683 use std::borrow::Cow;
10684 use std::io::{Read, Seek};
10685
10686 use common::{url::Params, ToParts};
10687 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10688
10689 let mut dd = common::DefaultDelegate;
10690 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10691 dlg.begin(common::MethodInfo {
10692 id: "redis.projects.locations.operations.cancel",
10693 http_method: hyper::Method::POST,
10694 });
10695
10696 for &field in ["alt", "name"].iter() {
10697 if self._additional_params.contains_key(field) {
10698 dlg.finished(false);
10699 return Err(common::Error::FieldClash(field));
10700 }
10701 }
10702
10703 let mut params = Params::with_capacity(3 + self._additional_params.len());
10704 params.push("name", self._name);
10705
10706 params.extend(self._additional_params.iter());
10707
10708 params.push("alt", "json");
10709 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
10710 if self._scopes.is_empty() {
10711 self._scopes
10712 .insert(Scope::CloudPlatform.as_ref().to_string());
10713 }
10714
10715 #[allow(clippy::single_element_loop)]
10716 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10717 url = params.uri_replacement(url, param_name, find_this, true);
10718 }
10719 {
10720 let to_remove = ["name"];
10721 params.remove_params(&to_remove);
10722 }
10723
10724 let url = params.parse_with_url(&url);
10725
10726 loop {
10727 let token = match self
10728 .hub
10729 .auth
10730 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10731 .await
10732 {
10733 Ok(token) => token,
10734 Err(e) => match dlg.token(e) {
10735 Ok(token) => token,
10736 Err(e) => {
10737 dlg.finished(false);
10738 return Err(common::Error::MissingToken(e));
10739 }
10740 },
10741 };
10742 let mut req_result = {
10743 let client = &self.hub.client;
10744 dlg.pre_request();
10745 let mut req_builder = hyper::Request::builder()
10746 .method(hyper::Method::POST)
10747 .uri(url.as_str())
10748 .header(USER_AGENT, self.hub._user_agent.clone());
10749
10750 if let Some(token) = token.as_ref() {
10751 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10752 }
10753
10754 let request = req_builder
10755 .header(CONTENT_LENGTH, 0_u64)
10756 .body(common::to_body::<String>(None));
10757
10758 client.request(request.unwrap()).await
10759 };
10760
10761 match req_result {
10762 Err(err) => {
10763 if let common::Retry::After(d) = dlg.http_error(&err) {
10764 sleep(d).await;
10765 continue;
10766 }
10767 dlg.finished(false);
10768 return Err(common::Error::HttpError(err));
10769 }
10770 Ok(res) => {
10771 let (mut parts, body) = res.into_parts();
10772 let mut body = common::Body::new(body);
10773 if !parts.status.is_success() {
10774 let bytes = common::to_bytes(body).await.unwrap_or_default();
10775 let error = serde_json::from_str(&common::to_string(&bytes));
10776 let response = common::to_response(parts, bytes.into());
10777
10778 if let common::Retry::After(d) =
10779 dlg.http_failure(&response, error.as_ref().ok())
10780 {
10781 sleep(d).await;
10782 continue;
10783 }
10784
10785 dlg.finished(false);
10786
10787 return Err(match error {
10788 Ok(value) => common::Error::BadRequest(value),
10789 _ => common::Error::Failure(response),
10790 });
10791 }
10792 let response = {
10793 let bytes = common::to_bytes(body).await.unwrap_or_default();
10794 let encoded = common::to_string(&bytes);
10795 match serde_json::from_str(&encoded) {
10796 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10797 Err(error) => {
10798 dlg.response_json_decode_error(&encoded, &error);
10799 return Err(common::Error::JsonDecodeError(
10800 encoded.to_string(),
10801 error,
10802 ));
10803 }
10804 }
10805 };
10806
10807 dlg.finished(true);
10808 return Ok(response);
10809 }
10810 }
10811 }
10812 }
10813
10814 /// The name of the operation resource to be cancelled.
10815 ///
10816 /// Sets the *name* path property to the given value.
10817 ///
10818 /// Even though the property as already been set when instantiating this call,
10819 /// we provide this method for API completeness.
10820 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
10821 self._name = new_value.to_string();
10822 self
10823 }
10824 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10825 /// while executing the actual API request.
10826 ///
10827 /// ````text
10828 /// It should be used to handle progress information, and to implement a certain level of resilience.
10829 /// ````
10830 ///
10831 /// Sets the *delegate* property to the given value.
10832 pub fn delegate(
10833 mut self,
10834 new_value: &'a mut dyn common::Delegate,
10835 ) -> ProjectLocationOperationCancelCall<'a, C> {
10836 self._delegate = Some(new_value);
10837 self
10838 }
10839
10840 /// Set any additional parameter of the query string used in the request.
10841 /// It should be used to set parameters which are not yet available through their own
10842 /// setters.
10843 ///
10844 /// Please note that this method must not be used to set any of the known parameters
10845 /// which have their own setter method. If done anyway, the request will fail.
10846 ///
10847 /// # Additional Parameters
10848 ///
10849 /// * *$.xgafv* (query-string) - V1 error format.
10850 /// * *access_token* (query-string) - OAuth access token.
10851 /// * *alt* (query-string) - Data format for response.
10852 /// * *callback* (query-string) - JSONP
10853 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10854 /// * *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.
10855 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10856 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10857 /// * *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.
10858 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10859 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10860 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
10861 where
10862 T: AsRef<str>,
10863 {
10864 self._additional_params
10865 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10866 self
10867 }
10868
10869 /// Identifies the authorization scope for the method you are building.
10870 ///
10871 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10872 /// [`Scope::CloudPlatform`].
10873 ///
10874 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10875 /// tokens for more than one scope.
10876 ///
10877 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10878 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10879 /// sufficient, a read-write scope will do as well.
10880 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
10881 where
10882 St: AsRef<str>,
10883 {
10884 self._scopes.insert(String::from(scope.as_ref()));
10885 self
10886 }
10887 /// Identifies the authorization scope(s) for the method you are building.
10888 ///
10889 /// See [`Self::add_scope()`] for details.
10890 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
10891 where
10892 I: IntoIterator<Item = St>,
10893 St: AsRef<str>,
10894 {
10895 self._scopes
10896 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10897 self
10898 }
10899
10900 /// Removes all scopes, and no default scope will be used either.
10901 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10902 /// for details).
10903 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
10904 self._scopes.clear();
10905 self
10906 }
10907}
10908
10909/// 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`.
10910///
10911/// A builder for the *locations.operations.delete* method supported by a *project* resource.
10912/// It is not used directly, but through a [`ProjectMethods`] instance.
10913///
10914/// # Example
10915///
10916/// Instantiate a resource method builder
10917///
10918/// ```test_harness,no_run
10919/// # extern crate hyper;
10920/// # extern crate hyper_rustls;
10921/// # extern crate google_redis1 as redis1;
10922/// # async fn dox() {
10923/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10924///
10925/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10926/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10927/// # .with_native_roots()
10928/// # .unwrap()
10929/// # .https_only()
10930/// # .enable_http2()
10931/// # .build();
10932///
10933/// # let executor = hyper_util::rt::TokioExecutor::new();
10934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10935/// # secret,
10936/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10937/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10938/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10939/// # ),
10940/// # ).build().await.unwrap();
10941///
10942/// # let client = hyper_util::client::legacy::Client::builder(
10943/// # hyper_util::rt::TokioExecutor::new()
10944/// # )
10945/// # .build(
10946/// # hyper_rustls::HttpsConnectorBuilder::new()
10947/// # .with_native_roots()
10948/// # .unwrap()
10949/// # .https_or_http()
10950/// # .enable_http2()
10951/// # .build()
10952/// # );
10953/// # let mut hub = CloudRedis::new(client, auth);
10954/// // You can configure optional parameters by calling the respective setters at will, and
10955/// // execute the final call using `doit()`.
10956/// // Values shown here are possibly random and not representative !
10957/// let result = hub.projects().locations_operations_delete("name")
10958/// .doit().await;
10959/// # }
10960/// ```
10961pub struct ProjectLocationOperationDeleteCall<'a, C>
10962where
10963 C: 'a,
10964{
10965 hub: &'a CloudRedis<C>,
10966 _name: String,
10967 _delegate: Option<&'a mut dyn common::Delegate>,
10968 _additional_params: HashMap<String, String>,
10969 _scopes: BTreeSet<String>,
10970}
10971
10972impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
10973
10974impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
10975where
10976 C: common::Connector,
10977{
10978 /// Perform the operation you have build so far.
10979 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10980 use std::borrow::Cow;
10981 use std::io::{Read, Seek};
10982
10983 use common::{url::Params, ToParts};
10984 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10985
10986 let mut dd = common::DefaultDelegate;
10987 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10988 dlg.begin(common::MethodInfo {
10989 id: "redis.projects.locations.operations.delete",
10990 http_method: hyper::Method::DELETE,
10991 });
10992
10993 for &field in ["alt", "name"].iter() {
10994 if self._additional_params.contains_key(field) {
10995 dlg.finished(false);
10996 return Err(common::Error::FieldClash(field));
10997 }
10998 }
10999
11000 let mut params = Params::with_capacity(3 + self._additional_params.len());
11001 params.push("name", self._name);
11002
11003 params.extend(self._additional_params.iter());
11004
11005 params.push("alt", "json");
11006 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11007 if self._scopes.is_empty() {
11008 self._scopes
11009 .insert(Scope::CloudPlatform.as_ref().to_string());
11010 }
11011
11012 #[allow(clippy::single_element_loop)]
11013 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11014 url = params.uri_replacement(url, param_name, find_this, true);
11015 }
11016 {
11017 let to_remove = ["name"];
11018 params.remove_params(&to_remove);
11019 }
11020
11021 let url = params.parse_with_url(&url);
11022
11023 loop {
11024 let token = match self
11025 .hub
11026 .auth
11027 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11028 .await
11029 {
11030 Ok(token) => token,
11031 Err(e) => match dlg.token(e) {
11032 Ok(token) => token,
11033 Err(e) => {
11034 dlg.finished(false);
11035 return Err(common::Error::MissingToken(e));
11036 }
11037 },
11038 };
11039 let mut req_result = {
11040 let client = &self.hub.client;
11041 dlg.pre_request();
11042 let mut req_builder = hyper::Request::builder()
11043 .method(hyper::Method::DELETE)
11044 .uri(url.as_str())
11045 .header(USER_AGENT, self.hub._user_agent.clone());
11046
11047 if let Some(token) = token.as_ref() {
11048 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11049 }
11050
11051 let request = req_builder
11052 .header(CONTENT_LENGTH, 0_u64)
11053 .body(common::to_body::<String>(None));
11054
11055 client.request(request.unwrap()).await
11056 };
11057
11058 match req_result {
11059 Err(err) => {
11060 if let common::Retry::After(d) = dlg.http_error(&err) {
11061 sleep(d).await;
11062 continue;
11063 }
11064 dlg.finished(false);
11065 return Err(common::Error::HttpError(err));
11066 }
11067 Ok(res) => {
11068 let (mut parts, body) = res.into_parts();
11069 let mut body = common::Body::new(body);
11070 if !parts.status.is_success() {
11071 let bytes = common::to_bytes(body).await.unwrap_or_default();
11072 let error = serde_json::from_str(&common::to_string(&bytes));
11073 let response = common::to_response(parts, bytes.into());
11074
11075 if let common::Retry::After(d) =
11076 dlg.http_failure(&response, error.as_ref().ok())
11077 {
11078 sleep(d).await;
11079 continue;
11080 }
11081
11082 dlg.finished(false);
11083
11084 return Err(match error {
11085 Ok(value) => common::Error::BadRequest(value),
11086 _ => common::Error::Failure(response),
11087 });
11088 }
11089 let response = {
11090 let bytes = common::to_bytes(body).await.unwrap_or_default();
11091 let encoded = common::to_string(&bytes);
11092 match serde_json::from_str(&encoded) {
11093 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11094 Err(error) => {
11095 dlg.response_json_decode_error(&encoded, &error);
11096 return Err(common::Error::JsonDecodeError(
11097 encoded.to_string(),
11098 error,
11099 ));
11100 }
11101 }
11102 };
11103
11104 dlg.finished(true);
11105 return Ok(response);
11106 }
11107 }
11108 }
11109 }
11110
11111 /// The name of the operation resource to be deleted.
11112 ///
11113 /// Sets the *name* path property to the given value.
11114 ///
11115 /// Even though the property as already been set when instantiating this call,
11116 /// we provide this method for API completeness.
11117 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
11118 self._name = new_value.to_string();
11119 self
11120 }
11121 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11122 /// while executing the actual API request.
11123 ///
11124 /// ````text
11125 /// It should be used to handle progress information, and to implement a certain level of resilience.
11126 /// ````
11127 ///
11128 /// Sets the *delegate* property to the given value.
11129 pub fn delegate(
11130 mut self,
11131 new_value: &'a mut dyn common::Delegate,
11132 ) -> ProjectLocationOperationDeleteCall<'a, C> {
11133 self._delegate = Some(new_value);
11134 self
11135 }
11136
11137 /// Set any additional parameter of the query string used in the request.
11138 /// It should be used to set parameters which are not yet available through their own
11139 /// setters.
11140 ///
11141 /// Please note that this method must not be used to set any of the known parameters
11142 /// which have their own setter method. If done anyway, the request will fail.
11143 ///
11144 /// # Additional Parameters
11145 ///
11146 /// * *$.xgafv* (query-string) - V1 error format.
11147 /// * *access_token* (query-string) - OAuth access token.
11148 /// * *alt* (query-string) - Data format for response.
11149 /// * *callback* (query-string) - JSONP
11150 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11151 /// * *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.
11152 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11153 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11154 /// * *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.
11155 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11156 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11157 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
11158 where
11159 T: AsRef<str>,
11160 {
11161 self._additional_params
11162 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11163 self
11164 }
11165
11166 /// Identifies the authorization scope for the method you are building.
11167 ///
11168 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11169 /// [`Scope::CloudPlatform`].
11170 ///
11171 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11172 /// tokens for more than one scope.
11173 ///
11174 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11175 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11176 /// sufficient, a read-write scope will do as well.
11177 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
11178 where
11179 St: AsRef<str>,
11180 {
11181 self._scopes.insert(String::from(scope.as_ref()));
11182 self
11183 }
11184 /// Identifies the authorization scope(s) for the method you are building.
11185 ///
11186 /// See [`Self::add_scope()`] for details.
11187 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
11188 where
11189 I: IntoIterator<Item = St>,
11190 St: AsRef<str>,
11191 {
11192 self._scopes
11193 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11194 self
11195 }
11196
11197 /// Removes all scopes, and no default scope will be used either.
11198 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11199 /// for details).
11200 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
11201 self._scopes.clear();
11202 self
11203 }
11204}
11205
11206/// 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.
11207///
11208/// A builder for the *locations.operations.get* method supported by a *project* resource.
11209/// It is not used directly, but through a [`ProjectMethods`] instance.
11210///
11211/// # Example
11212///
11213/// Instantiate a resource method builder
11214///
11215/// ```test_harness,no_run
11216/// # extern crate hyper;
11217/// # extern crate hyper_rustls;
11218/// # extern crate google_redis1 as redis1;
11219/// # async fn dox() {
11220/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11221///
11222/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11223/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11224/// # .with_native_roots()
11225/// # .unwrap()
11226/// # .https_only()
11227/// # .enable_http2()
11228/// # .build();
11229///
11230/// # let executor = hyper_util::rt::TokioExecutor::new();
11231/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11232/// # secret,
11233/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11234/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11235/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11236/// # ),
11237/// # ).build().await.unwrap();
11238///
11239/// # let client = hyper_util::client::legacy::Client::builder(
11240/// # hyper_util::rt::TokioExecutor::new()
11241/// # )
11242/// # .build(
11243/// # hyper_rustls::HttpsConnectorBuilder::new()
11244/// # .with_native_roots()
11245/// # .unwrap()
11246/// # .https_or_http()
11247/// # .enable_http2()
11248/// # .build()
11249/// # );
11250/// # let mut hub = CloudRedis::new(client, auth);
11251/// // You can configure optional parameters by calling the respective setters at will, and
11252/// // execute the final call using `doit()`.
11253/// // Values shown here are possibly random and not representative !
11254/// let result = hub.projects().locations_operations_get("name")
11255/// .doit().await;
11256/// # }
11257/// ```
11258pub struct ProjectLocationOperationGetCall<'a, C>
11259where
11260 C: 'a,
11261{
11262 hub: &'a CloudRedis<C>,
11263 _name: String,
11264 _delegate: Option<&'a mut dyn common::Delegate>,
11265 _additional_params: HashMap<String, String>,
11266 _scopes: BTreeSet<String>,
11267}
11268
11269impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
11270
11271impl<'a, C> ProjectLocationOperationGetCall<'a, C>
11272where
11273 C: common::Connector,
11274{
11275 /// Perform the operation you have build so far.
11276 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11277 use std::borrow::Cow;
11278 use std::io::{Read, Seek};
11279
11280 use common::{url::Params, ToParts};
11281 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11282
11283 let mut dd = common::DefaultDelegate;
11284 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11285 dlg.begin(common::MethodInfo {
11286 id: "redis.projects.locations.operations.get",
11287 http_method: hyper::Method::GET,
11288 });
11289
11290 for &field in ["alt", "name"].iter() {
11291 if self._additional_params.contains_key(field) {
11292 dlg.finished(false);
11293 return Err(common::Error::FieldClash(field));
11294 }
11295 }
11296
11297 let mut params = Params::with_capacity(3 + self._additional_params.len());
11298 params.push("name", self._name);
11299
11300 params.extend(self._additional_params.iter());
11301
11302 params.push("alt", "json");
11303 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11304 if self._scopes.is_empty() {
11305 self._scopes
11306 .insert(Scope::CloudPlatform.as_ref().to_string());
11307 }
11308
11309 #[allow(clippy::single_element_loop)]
11310 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11311 url = params.uri_replacement(url, param_name, find_this, true);
11312 }
11313 {
11314 let to_remove = ["name"];
11315 params.remove_params(&to_remove);
11316 }
11317
11318 let url = params.parse_with_url(&url);
11319
11320 loop {
11321 let token = match self
11322 .hub
11323 .auth
11324 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11325 .await
11326 {
11327 Ok(token) => token,
11328 Err(e) => match dlg.token(e) {
11329 Ok(token) => token,
11330 Err(e) => {
11331 dlg.finished(false);
11332 return Err(common::Error::MissingToken(e));
11333 }
11334 },
11335 };
11336 let mut req_result = {
11337 let client = &self.hub.client;
11338 dlg.pre_request();
11339 let mut req_builder = hyper::Request::builder()
11340 .method(hyper::Method::GET)
11341 .uri(url.as_str())
11342 .header(USER_AGENT, self.hub._user_agent.clone());
11343
11344 if let Some(token) = token.as_ref() {
11345 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11346 }
11347
11348 let request = req_builder
11349 .header(CONTENT_LENGTH, 0_u64)
11350 .body(common::to_body::<String>(None));
11351
11352 client.request(request.unwrap()).await
11353 };
11354
11355 match req_result {
11356 Err(err) => {
11357 if let common::Retry::After(d) = dlg.http_error(&err) {
11358 sleep(d).await;
11359 continue;
11360 }
11361 dlg.finished(false);
11362 return Err(common::Error::HttpError(err));
11363 }
11364 Ok(res) => {
11365 let (mut parts, body) = res.into_parts();
11366 let mut body = common::Body::new(body);
11367 if !parts.status.is_success() {
11368 let bytes = common::to_bytes(body).await.unwrap_or_default();
11369 let error = serde_json::from_str(&common::to_string(&bytes));
11370 let response = common::to_response(parts, bytes.into());
11371
11372 if let common::Retry::After(d) =
11373 dlg.http_failure(&response, error.as_ref().ok())
11374 {
11375 sleep(d).await;
11376 continue;
11377 }
11378
11379 dlg.finished(false);
11380
11381 return Err(match error {
11382 Ok(value) => common::Error::BadRequest(value),
11383 _ => common::Error::Failure(response),
11384 });
11385 }
11386 let response = {
11387 let bytes = common::to_bytes(body).await.unwrap_or_default();
11388 let encoded = common::to_string(&bytes);
11389 match serde_json::from_str(&encoded) {
11390 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11391 Err(error) => {
11392 dlg.response_json_decode_error(&encoded, &error);
11393 return Err(common::Error::JsonDecodeError(
11394 encoded.to_string(),
11395 error,
11396 ));
11397 }
11398 }
11399 };
11400
11401 dlg.finished(true);
11402 return Ok(response);
11403 }
11404 }
11405 }
11406 }
11407
11408 /// The name of the operation resource.
11409 ///
11410 /// Sets the *name* path property to the given value.
11411 ///
11412 /// Even though the property as already been set when instantiating this call,
11413 /// we provide this method for API completeness.
11414 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
11415 self._name = new_value.to_string();
11416 self
11417 }
11418 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11419 /// while executing the actual API request.
11420 ///
11421 /// ````text
11422 /// It should be used to handle progress information, and to implement a certain level of resilience.
11423 /// ````
11424 ///
11425 /// Sets the *delegate* property to the given value.
11426 pub fn delegate(
11427 mut self,
11428 new_value: &'a mut dyn common::Delegate,
11429 ) -> ProjectLocationOperationGetCall<'a, C> {
11430 self._delegate = Some(new_value);
11431 self
11432 }
11433
11434 /// Set any additional parameter of the query string used in the request.
11435 /// It should be used to set parameters which are not yet available through their own
11436 /// setters.
11437 ///
11438 /// Please note that this method must not be used to set any of the known parameters
11439 /// which have their own setter method. If done anyway, the request will fail.
11440 ///
11441 /// # Additional Parameters
11442 ///
11443 /// * *$.xgafv* (query-string) - V1 error format.
11444 /// * *access_token* (query-string) - OAuth access token.
11445 /// * *alt* (query-string) - Data format for response.
11446 /// * *callback* (query-string) - JSONP
11447 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11448 /// * *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.
11449 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11450 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11451 /// * *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.
11452 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11453 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11454 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
11455 where
11456 T: AsRef<str>,
11457 {
11458 self._additional_params
11459 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11460 self
11461 }
11462
11463 /// Identifies the authorization scope for the method you are building.
11464 ///
11465 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11466 /// [`Scope::CloudPlatform`].
11467 ///
11468 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11469 /// tokens for more than one scope.
11470 ///
11471 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11472 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11473 /// sufficient, a read-write scope will do as well.
11474 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
11475 where
11476 St: AsRef<str>,
11477 {
11478 self._scopes.insert(String::from(scope.as_ref()));
11479 self
11480 }
11481 /// Identifies the authorization scope(s) for the method you are building.
11482 ///
11483 /// See [`Self::add_scope()`] for details.
11484 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
11485 where
11486 I: IntoIterator<Item = St>,
11487 St: AsRef<str>,
11488 {
11489 self._scopes
11490 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11491 self
11492 }
11493
11494 /// Removes all scopes, and no default scope will be used either.
11495 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11496 /// for details).
11497 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
11498 self._scopes.clear();
11499 self
11500 }
11501}
11502
11503/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
11504///
11505/// A builder for the *locations.operations.list* method supported by a *project* resource.
11506/// It is not used directly, but through a [`ProjectMethods`] instance.
11507///
11508/// # Example
11509///
11510/// Instantiate a resource method builder
11511///
11512/// ```test_harness,no_run
11513/// # extern crate hyper;
11514/// # extern crate hyper_rustls;
11515/// # extern crate google_redis1 as redis1;
11516/// # async fn dox() {
11517/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11518///
11519/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11520/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11521/// # .with_native_roots()
11522/// # .unwrap()
11523/// # .https_only()
11524/// # .enable_http2()
11525/// # .build();
11526///
11527/// # let executor = hyper_util::rt::TokioExecutor::new();
11528/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11529/// # secret,
11530/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11531/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11532/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11533/// # ),
11534/// # ).build().await.unwrap();
11535///
11536/// # let client = hyper_util::client::legacy::Client::builder(
11537/// # hyper_util::rt::TokioExecutor::new()
11538/// # )
11539/// # .build(
11540/// # hyper_rustls::HttpsConnectorBuilder::new()
11541/// # .with_native_roots()
11542/// # .unwrap()
11543/// # .https_or_http()
11544/// # .enable_http2()
11545/// # .build()
11546/// # );
11547/// # let mut hub = CloudRedis::new(client, auth);
11548/// // You can configure optional parameters by calling the respective setters at will, and
11549/// // execute the final call using `doit()`.
11550/// // Values shown here are possibly random and not representative !
11551/// let result = hub.projects().locations_operations_list("name")
11552/// .return_partial_success(false)
11553/// .page_token("diam")
11554/// .page_size(-49)
11555/// .filter("et")
11556/// .doit().await;
11557/// # }
11558/// ```
11559pub struct ProjectLocationOperationListCall<'a, C>
11560where
11561 C: 'a,
11562{
11563 hub: &'a CloudRedis<C>,
11564 _name: String,
11565 _return_partial_success: Option<bool>,
11566 _page_token: Option<String>,
11567 _page_size: Option<i32>,
11568 _filter: Option<String>,
11569 _delegate: Option<&'a mut dyn common::Delegate>,
11570 _additional_params: HashMap<String, String>,
11571 _scopes: BTreeSet<String>,
11572}
11573
11574impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
11575
11576impl<'a, C> ProjectLocationOperationListCall<'a, C>
11577where
11578 C: common::Connector,
11579{
11580 /// Perform the operation you have build so far.
11581 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
11582 use std::borrow::Cow;
11583 use std::io::{Read, Seek};
11584
11585 use common::{url::Params, ToParts};
11586 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11587
11588 let mut dd = common::DefaultDelegate;
11589 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11590 dlg.begin(common::MethodInfo {
11591 id: "redis.projects.locations.operations.list",
11592 http_method: hyper::Method::GET,
11593 });
11594
11595 for &field in [
11596 "alt",
11597 "name",
11598 "returnPartialSuccess",
11599 "pageToken",
11600 "pageSize",
11601 "filter",
11602 ]
11603 .iter()
11604 {
11605 if self._additional_params.contains_key(field) {
11606 dlg.finished(false);
11607 return Err(common::Error::FieldClash(field));
11608 }
11609 }
11610
11611 let mut params = Params::with_capacity(7 + self._additional_params.len());
11612 params.push("name", self._name);
11613 if let Some(value) = self._return_partial_success.as_ref() {
11614 params.push("returnPartialSuccess", value.to_string());
11615 }
11616 if let Some(value) = self._page_token.as_ref() {
11617 params.push("pageToken", value);
11618 }
11619 if let Some(value) = self._page_size.as_ref() {
11620 params.push("pageSize", value.to_string());
11621 }
11622 if let Some(value) = self._filter.as_ref() {
11623 params.push("filter", value);
11624 }
11625
11626 params.extend(self._additional_params.iter());
11627
11628 params.push("alt", "json");
11629 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
11630 if self._scopes.is_empty() {
11631 self._scopes
11632 .insert(Scope::CloudPlatform.as_ref().to_string());
11633 }
11634
11635 #[allow(clippy::single_element_loop)]
11636 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11637 url = params.uri_replacement(url, param_name, find_this, true);
11638 }
11639 {
11640 let to_remove = ["name"];
11641 params.remove_params(&to_remove);
11642 }
11643
11644 let url = params.parse_with_url(&url);
11645
11646 loop {
11647 let token = match self
11648 .hub
11649 .auth
11650 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11651 .await
11652 {
11653 Ok(token) => token,
11654 Err(e) => match dlg.token(e) {
11655 Ok(token) => token,
11656 Err(e) => {
11657 dlg.finished(false);
11658 return Err(common::Error::MissingToken(e));
11659 }
11660 },
11661 };
11662 let mut req_result = {
11663 let client = &self.hub.client;
11664 dlg.pre_request();
11665 let mut req_builder = hyper::Request::builder()
11666 .method(hyper::Method::GET)
11667 .uri(url.as_str())
11668 .header(USER_AGENT, self.hub._user_agent.clone());
11669
11670 if let Some(token) = token.as_ref() {
11671 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11672 }
11673
11674 let request = req_builder
11675 .header(CONTENT_LENGTH, 0_u64)
11676 .body(common::to_body::<String>(None));
11677
11678 client.request(request.unwrap()).await
11679 };
11680
11681 match req_result {
11682 Err(err) => {
11683 if let common::Retry::After(d) = dlg.http_error(&err) {
11684 sleep(d).await;
11685 continue;
11686 }
11687 dlg.finished(false);
11688 return Err(common::Error::HttpError(err));
11689 }
11690 Ok(res) => {
11691 let (mut parts, body) = res.into_parts();
11692 let mut body = common::Body::new(body);
11693 if !parts.status.is_success() {
11694 let bytes = common::to_bytes(body).await.unwrap_or_default();
11695 let error = serde_json::from_str(&common::to_string(&bytes));
11696 let response = common::to_response(parts, bytes.into());
11697
11698 if let common::Retry::After(d) =
11699 dlg.http_failure(&response, error.as_ref().ok())
11700 {
11701 sleep(d).await;
11702 continue;
11703 }
11704
11705 dlg.finished(false);
11706
11707 return Err(match error {
11708 Ok(value) => common::Error::BadRequest(value),
11709 _ => common::Error::Failure(response),
11710 });
11711 }
11712 let response = {
11713 let bytes = common::to_bytes(body).await.unwrap_or_default();
11714 let encoded = common::to_string(&bytes);
11715 match serde_json::from_str(&encoded) {
11716 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11717 Err(error) => {
11718 dlg.response_json_decode_error(&encoded, &error);
11719 return Err(common::Error::JsonDecodeError(
11720 encoded.to_string(),
11721 error,
11722 ));
11723 }
11724 }
11725 };
11726
11727 dlg.finished(true);
11728 return Ok(response);
11729 }
11730 }
11731 }
11732 }
11733
11734 /// The name of the operation's parent resource.
11735 ///
11736 /// Sets the *name* path property to the given value.
11737 ///
11738 /// Even though the property as already been set when instantiating this call,
11739 /// we provide this method for API completeness.
11740 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11741 self._name = new_value.to_string();
11742 self
11743 }
11744 /// 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.
11745 ///
11746 /// Sets the *return partial success* query property to the given value.
11747 pub fn return_partial_success(
11748 mut self,
11749 new_value: bool,
11750 ) -> ProjectLocationOperationListCall<'a, C> {
11751 self._return_partial_success = Some(new_value);
11752 self
11753 }
11754 /// The standard list page token.
11755 ///
11756 /// Sets the *page token* query property to the given value.
11757 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11758 self._page_token = Some(new_value.to_string());
11759 self
11760 }
11761 /// The standard list page size.
11762 ///
11763 /// Sets the *page size* query property to the given value.
11764 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
11765 self._page_size = Some(new_value);
11766 self
11767 }
11768 /// The standard list filter.
11769 ///
11770 /// Sets the *filter* query property to the given value.
11771 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11772 self._filter = Some(new_value.to_string());
11773 self
11774 }
11775 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11776 /// while executing the actual API request.
11777 ///
11778 /// ````text
11779 /// It should be used to handle progress information, and to implement a certain level of resilience.
11780 /// ````
11781 ///
11782 /// Sets the *delegate* property to the given value.
11783 pub fn delegate(
11784 mut self,
11785 new_value: &'a mut dyn common::Delegate,
11786 ) -> ProjectLocationOperationListCall<'a, C> {
11787 self._delegate = Some(new_value);
11788 self
11789 }
11790
11791 /// Set any additional parameter of the query string used in the request.
11792 /// It should be used to set parameters which are not yet available through their own
11793 /// setters.
11794 ///
11795 /// Please note that this method must not be used to set any of the known parameters
11796 /// which have their own setter method. If done anyway, the request will fail.
11797 ///
11798 /// # Additional Parameters
11799 ///
11800 /// * *$.xgafv* (query-string) - V1 error format.
11801 /// * *access_token* (query-string) - OAuth access token.
11802 /// * *alt* (query-string) - Data format for response.
11803 /// * *callback* (query-string) - JSONP
11804 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11805 /// * *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.
11806 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11807 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11808 /// * *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.
11809 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11810 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11811 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
11812 where
11813 T: AsRef<str>,
11814 {
11815 self._additional_params
11816 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11817 self
11818 }
11819
11820 /// Identifies the authorization scope for the method you are building.
11821 ///
11822 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11823 /// [`Scope::CloudPlatform`].
11824 ///
11825 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11826 /// tokens for more than one scope.
11827 ///
11828 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11829 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11830 /// sufficient, a read-write scope will do as well.
11831 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
11832 where
11833 St: AsRef<str>,
11834 {
11835 self._scopes.insert(String::from(scope.as_ref()));
11836 self
11837 }
11838 /// Identifies the authorization scope(s) for the method you are building.
11839 ///
11840 /// See [`Self::add_scope()`] for details.
11841 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
11842 where
11843 I: IntoIterator<Item = St>,
11844 St: AsRef<str>,
11845 {
11846 self._scopes
11847 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11848 self
11849 }
11850
11851 /// Removes all scopes, and no default scope will be used either.
11852 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11853 /// for details).
11854 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
11855 self._scopes.clear();
11856 self
11857 }
11858}
11859
11860/// Gets information about a location.
11861///
11862/// A builder for the *locations.get* method supported by a *project* resource.
11863/// It is not used directly, but through a [`ProjectMethods`] instance.
11864///
11865/// # Example
11866///
11867/// Instantiate a resource method builder
11868///
11869/// ```test_harness,no_run
11870/// # extern crate hyper;
11871/// # extern crate hyper_rustls;
11872/// # extern crate google_redis1 as redis1;
11873/// # async fn dox() {
11874/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11875///
11876/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11877/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11878/// # .with_native_roots()
11879/// # .unwrap()
11880/// # .https_only()
11881/// # .enable_http2()
11882/// # .build();
11883///
11884/// # let executor = hyper_util::rt::TokioExecutor::new();
11885/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11886/// # secret,
11887/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11888/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11889/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11890/// # ),
11891/// # ).build().await.unwrap();
11892///
11893/// # let client = hyper_util::client::legacy::Client::builder(
11894/// # hyper_util::rt::TokioExecutor::new()
11895/// # )
11896/// # .build(
11897/// # hyper_rustls::HttpsConnectorBuilder::new()
11898/// # .with_native_roots()
11899/// # .unwrap()
11900/// # .https_or_http()
11901/// # .enable_http2()
11902/// # .build()
11903/// # );
11904/// # let mut hub = CloudRedis::new(client, auth);
11905/// // You can configure optional parameters by calling the respective setters at will, and
11906/// // execute the final call using `doit()`.
11907/// // Values shown here are possibly random and not representative !
11908/// let result = hub.projects().locations_get("name")
11909/// .doit().await;
11910/// # }
11911/// ```
11912pub struct ProjectLocationGetCall<'a, C>
11913where
11914 C: 'a,
11915{
11916 hub: &'a CloudRedis<C>,
11917 _name: String,
11918 _delegate: Option<&'a mut dyn common::Delegate>,
11919 _additional_params: HashMap<String, String>,
11920 _scopes: BTreeSet<String>,
11921}
11922
11923impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
11924
11925impl<'a, C> ProjectLocationGetCall<'a, C>
11926where
11927 C: common::Connector,
11928{
11929 /// Perform the operation you have build so far.
11930 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
11931 use std::borrow::Cow;
11932 use std::io::{Read, Seek};
11933
11934 use common::{url::Params, ToParts};
11935 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11936
11937 let mut dd = common::DefaultDelegate;
11938 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11939 dlg.begin(common::MethodInfo {
11940 id: "redis.projects.locations.get",
11941 http_method: hyper::Method::GET,
11942 });
11943
11944 for &field in ["alt", "name"].iter() {
11945 if self._additional_params.contains_key(field) {
11946 dlg.finished(false);
11947 return Err(common::Error::FieldClash(field));
11948 }
11949 }
11950
11951 let mut params = Params::with_capacity(3 + self._additional_params.len());
11952 params.push("name", self._name);
11953
11954 params.extend(self._additional_params.iter());
11955
11956 params.push("alt", "json");
11957 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11958 if self._scopes.is_empty() {
11959 self._scopes
11960 .insert(Scope::CloudPlatform.as_ref().to_string());
11961 }
11962
11963 #[allow(clippy::single_element_loop)]
11964 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11965 url = params.uri_replacement(url, param_name, find_this, true);
11966 }
11967 {
11968 let to_remove = ["name"];
11969 params.remove_params(&to_remove);
11970 }
11971
11972 let url = params.parse_with_url(&url);
11973
11974 loop {
11975 let token = match self
11976 .hub
11977 .auth
11978 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11979 .await
11980 {
11981 Ok(token) => token,
11982 Err(e) => match dlg.token(e) {
11983 Ok(token) => token,
11984 Err(e) => {
11985 dlg.finished(false);
11986 return Err(common::Error::MissingToken(e));
11987 }
11988 },
11989 };
11990 let mut req_result = {
11991 let client = &self.hub.client;
11992 dlg.pre_request();
11993 let mut req_builder = hyper::Request::builder()
11994 .method(hyper::Method::GET)
11995 .uri(url.as_str())
11996 .header(USER_AGENT, self.hub._user_agent.clone());
11997
11998 if let Some(token) = token.as_ref() {
11999 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12000 }
12001
12002 let request = req_builder
12003 .header(CONTENT_LENGTH, 0_u64)
12004 .body(common::to_body::<String>(None));
12005
12006 client.request(request.unwrap()).await
12007 };
12008
12009 match req_result {
12010 Err(err) => {
12011 if let common::Retry::After(d) = dlg.http_error(&err) {
12012 sleep(d).await;
12013 continue;
12014 }
12015 dlg.finished(false);
12016 return Err(common::Error::HttpError(err));
12017 }
12018 Ok(res) => {
12019 let (mut parts, body) = res.into_parts();
12020 let mut body = common::Body::new(body);
12021 if !parts.status.is_success() {
12022 let bytes = common::to_bytes(body).await.unwrap_or_default();
12023 let error = serde_json::from_str(&common::to_string(&bytes));
12024 let response = common::to_response(parts, bytes.into());
12025
12026 if let common::Retry::After(d) =
12027 dlg.http_failure(&response, error.as_ref().ok())
12028 {
12029 sleep(d).await;
12030 continue;
12031 }
12032
12033 dlg.finished(false);
12034
12035 return Err(match error {
12036 Ok(value) => common::Error::BadRequest(value),
12037 _ => common::Error::Failure(response),
12038 });
12039 }
12040 let response = {
12041 let bytes = common::to_bytes(body).await.unwrap_or_default();
12042 let encoded = common::to_string(&bytes);
12043 match serde_json::from_str(&encoded) {
12044 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12045 Err(error) => {
12046 dlg.response_json_decode_error(&encoded, &error);
12047 return Err(common::Error::JsonDecodeError(
12048 encoded.to_string(),
12049 error,
12050 ));
12051 }
12052 }
12053 };
12054
12055 dlg.finished(true);
12056 return Ok(response);
12057 }
12058 }
12059 }
12060 }
12061
12062 /// Resource name for the location.
12063 ///
12064 /// Sets the *name* path property to the given value.
12065 ///
12066 /// Even though the property as already been set when instantiating this call,
12067 /// we provide this method for API completeness.
12068 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
12069 self._name = new_value.to_string();
12070 self
12071 }
12072 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12073 /// while executing the actual API request.
12074 ///
12075 /// ````text
12076 /// It should be used to handle progress information, and to implement a certain level of resilience.
12077 /// ````
12078 ///
12079 /// Sets the *delegate* property to the given value.
12080 pub fn delegate(
12081 mut self,
12082 new_value: &'a mut dyn common::Delegate,
12083 ) -> ProjectLocationGetCall<'a, C> {
12084 self._delegate = Some(new_value);
12085 self
12086 }
12087
12088 /// Set any additional parameter of the query string used in the request.
12089 /// It should be used to set parameters which are not yet available through their own
12090 /// setters.
12091 ///
12092 /// Please note that this method must not be used to set any of the known parameters
12093 /// which have their own setter method. If done anyway, the request will fail.
12094 ///
12095 /// # Additional Parameters
12096 ///
12097 /// * *$.xgafv* (query-string) - V1 error format.
12098 /// * *access_token* (query-string) - OAuth access token.
12099 /// * *alt* (query-string) - Data format for response.
12100 /// * *callback* (query-string) - JSONP
12101 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12102 /// * *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.
12103 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12104 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12105 /// * *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.
12106 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12107 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12108 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
12109 where
12110 T: AsRef<str>,
12111 {
12112 self._additional_params
12113 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12114 self
12115 }
12116
12117 /// Identifies the authorization scope for the method you are building.
12118 ///
12119 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12120 /// [`Scope::CloudPlatform`].
12121 ///
12122 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12123 /// tokens for more than one scope.
12124 ///
12125 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12126 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12127 /// sufficient, a read-write scope will do as well.
12128 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
12129 where
12130 St: AsRef<str>,
12131 {
12132 self._scopes.insert(String::from(scope.as_ref()));
12133 self
12134 }
12135 /// Identifies the authorization scope(s) for the method you are building.
12136 ///
12137 /// See [`Self::add_scope()`] for details.
12138 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
12139 where
12140 I: IntoIterator<Item = St>,
12141 St: AsRef<str>,
12142 {
12143 self._scopes
12144 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12145 self
12146 }
12147
12148 /// Removes all scopes, and no default scope will be used either.
12149 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12150 /// for details).
12151 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
12152 self._scopes.clear();
12153 self
12154 }
12155}
12156
12157/// Lists information about the supported locations for this service.
12158///
12159/// A builder for the *locations.list* method supported by a *project* resource.
12160/// It is not used directly, but through a [`ProjectMethods`] instance.
12161///
12162/// # Example
12163///
12164/// Instantiate a resource method builder
12165///
12166/// ```test_harness,no_run
12167/// # extern crate hyper;
12168/// # extern crate hyper_rustls;
12169/// # extern crate google_redis1 as redis1;
12170/// # async fn dox() {
12171/// # use redis1::{CloudRedis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12172///
12173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12174/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12175/// # .with_native_roots()
12176/// # .unwrap()
12177/// # .https_only()
12178/// # .enable_http2()
12179/// # .build();
12180///
12181/// # let executor = hyper_util::rt::TokioExecutor::new();
12182/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12183/// # secret,
12184/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12185/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12186/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12187/// # ),
12188/// # ).build().await.unwrap();
12189///
12190/// # let client = hyper_util::client::legacy::Client::builder(
12191/// # hyper_util::rt::TokioExecutor::new()
12192/// # )
12193/// # .build(
12194/// # hyper_rustls::HttpsConnectorBuilder::new()
12195/// # .with_native_roots()
12196/// # .unwrap()
12197/// # .https_or_http()
12198/// # .enable_http2()
12199/// # .build()
12200/// # );
12201/// # let mut hub = CloudRedis::new(client, auth);
12202/// // You can configure optional parameters by calling the respective setters at will, and
12203/// // execute the final call using `doit()`.
12204/// // Values shown here are possibly random and not representative !
12205/// let result = hub.projects().locations_list("name")
12206/// .page_token("Stet")
12207/// .page_size(-99)
12208/// .filter("duo")
12209/// .add_extra_location_types("vero")
12210/// .doit().await;
12211/// # }
12212/// ```
12213pub struct ProjectLocationListCall<'a, C>
12214where
12215 C: 'a,
12216{
12217 hub: &'a CloudRedis<C>,
12218 _name: String,
12219 _page_token: Option<String>,
12220 _page_size: Option<i32>,
12221 _filter: Option<String>,
12222 _extra_location_types: Vec<String>,
12223 _delegate: Option<&'a mut dyn common::Delegate>,
12224 _additional_params: HashMap<String, String>,
12225 _scopes: BTreeSet<String>,
12226}
12227
12228impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
12229
12230impl<'a, C> ProjectLocationListCall<'a, C>
12231where
12232 C: common::Connector,
12233{
12234 /// Perform the operation you have build so far.
12235 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
12236 use std::borrow::Cow;
12237 use std::io::{Read, Seek};
12238
12239 use common::{url::Params, ToParts};
12240 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12241
12242 let mut dd = common::DefaultDelegate;
12243 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12244 dlg.begin(common::MethodInfo {
12245 id: "redis.projects.locations.list",
12246 http_method: hyper::Method::GET,
12247 });
12248
12249 for &field in [
12250 "alt",
12251 "name",
12252 "pageToken",
12253 "pageSize",
12254 "filter",
12255 "extraLocationTypes",
12256 ]
12257 .iter()
12258 {
12259 if self._additional_params.contains_key(field) {
12260 dlg.finished(false);
12261 return Err(common::Error::FieldClash(field));
12262 }
12263 }
12264
12265 let mut params = Params::with_capacity(7 + self._additional_params.len());
12266 params.push("name", self._name);
12267 if let Some(value) = self._page_token.as_ref() {
12268 params.push("pageToken", value);
12269 }
12270 if let Some(value) = self._page_size.as_ref() {
12271 params.push("pageSize", value.to_string());
12272 }
12273 if let Some(value) = self._filter.as_ref() {
12274 params.push("filter", value);
12275 }
12276 if !self._extra_location_types.is_empty() {
12277 for f in self._extra_location_types.iter() {
12278 params.push("extraLocationTypes", f);
12279 }
12280 }
12281
12282 params.extend(self._additional_params.iter());
12283
12284 params.push("alt", "json");
12285 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
12286 if self._scopes.is_empty() {
12287 self._scopes
12288 .insert(Scope::CloudPlatform.as_ref().to_string());
12289 }
12290
12291 #[allow(clippy::single_element_loop)]
12292 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12293 url = params.uri_replacement(url, param_name, find_this, true);
12294 }
12295 {
12296 let to_remove = ["name"];
12297 params.remove_params(&to_remove);
12298 }
12299
12300 let url = params.parse_with_url(&url);
12301
12302 loop {
12303 let token = match self
12304 .hub
12305 .auth
12306 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12307 .await
12308 {
12309 Ok(token) => token,
12310 Err(e) => match dlg.token(e) {
12311 Ok(token) => token,
12312 Err(e) => {
12313 dlg.finished(false);
12314 return Err(common::Error::MissingToken(e));
12315 }
12316 },
12317 };
12318 let mut req_result = {
12319 let client = &self.hub.client;
12320 dlg.pre_request();
12321 let mut req_builder = hyper::Request::builder()
12322 .method(hyper::Method::GET)
12323 .uri(url.as_str())
12324 .header(USER_AGENT, self.hub._user_agent.clone());
12325
12326 if let Some(token) = token.as_ref() {
12327 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12328 }
12329
12330 let request = req_builder
12331 .header(CONTENT_LENGTH, 0_u64)
12332 .body(common::to_body::<String>(None));
12333
12334 client.request(request.unwrap()).await
12335 };
12336
12337 match req_result {
12338 Err(err) => {
12339 if let common::Retry::After(d) = dlg.http_error(&err) {
12340 sleep(d).await;
12341 continue;
12342 }
12343 dlg.finished(false);
12344 return Err(common::Error::HttpError(err));
12345 }
12346 Ok(res) => {
12347 let (mut parts, body) = res.into_parts();
12348 let mut body = common::Body::new(body);
12349 if !parts.status.is_success() {
12350 let bytes = common::to_bytes(body).await.unwrap_or_default();
12351 let error = serde_json::from_str(&common::to_string(&bytes));
12352 let response = common::to_response(parts, bytes.into());
12353
12354 if let common::Retry::After(d) =
12355 dlg.http_failure(&response, error.as_ref().ok())
12356 {
12357 sleep(d).await;
12358 continue;
12359 }
12360
12361 dlg.finished(false);
12362
12363 return Err(match error {
12364 Ok(value) => common::Error::BadRequest(value),
12365 _ => common::Error::Failure(response),
12366 });
12367 }
12368 let response = {
12369 let bytes = common::to_bytes(body).await.unwrap_or_default();
12370 let encoded = common::to_string(&bytes);
12371 match serde_json::from_str(&encoded) {
12372 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12373 Err(error) => {
12374 dlg.response_json_decode_error(&encoded, &error);
12375 return Err(common::Error::JsonDecodeError(
12376 encoded.to_string(),
12377 error,
12378 ));
12379 }
12380 }
12381 };
12382
12383 dlg.finished(true);
12384 return Ok(response);
12385 }
12386 }
12387 }
12388 }
12389
12390 /// The resource that owns the locations collection, if applicable.
12391 ///
12392 /// Sets the *name* path property to the given value.
12393 ///
12394 /// Even though the property as already been set when instantiating this call,
12395 /// we provide this method for API completeness.
12396 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
12397 self._name = new_value.to_string();
12398 self
12399 }
12400 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
12401 ///
12402 /// Sets the *page token* query property to the given value.
12403 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
12404 self._page_token = Some(new_value.to_string());
12405 self
12406 }
12407 /// The maximum number of results to return. If not set, the service selects a default.
12408 ///
12409 /// Sets the *page size* query property to the given value.
12410 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
12411 self._page_size = Some(new_value);
12412 self
12413 }
12414 /// 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).
12415 ///
12416 /// Sets the *filter* query property to the given value.
12417 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
12418 self._filter = Some(new_value.to_string());
12419 self
12420 }
12421 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
12422 ///
12423 /// Append the given value to the *extra location types* query property.
12424 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
12425 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
12426 self._extra_location_types.push(new_value.to_string());
12427 self
12428 }
12429 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12430 /// while executing the actual API request.
12431 ///
12432 /// ````text
12433 /// It should be used to handle progress information, and to implement a certain level of resilience.
12434 /// ````
12435 ///
12436 /// Sets the *delegate* property to the given value.
12437 pub fn delegate(
12438 mut self,
12439 new_value: &'a mut dyn common::Delegate,
12440 ) -> ProjectLocationListCall<'a, C> {
12441 self._delegate = Some(new_value);
12442 self
12443 }
12444
12445 /// Set any additional parameter of the query string used in the request.
12446 /// It should be used to set parameters which are not yet available through their own
12447 /// setters.
12448 ///
12449 /// Please note that this method must not be used to set any of the known parameters
12450 /// which have their own setter method. If done anyway, the request will fail.
12451 ///
12452 /// # Additional Parameters
12453 ///
12454 /// * *$.xgafv* (query-string) - V1 error format.
12455 /// * *access_token* (query-string) - OAuth access token.
12456 /// * *alt* (query-string) - Data format for response.
12457 /// * *callback* (query-string) - JSONP
12458 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12459 /// * *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.
12460 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12461 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12462 /// * *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.
12463 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12464 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12465 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
12466 where
12467 T: AsRef<str>,
12468 {
12469 self._additional_params
12470 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12471 self
12472 }
12473
12474 /// Identifies the authorization scope for the method you are building.
12475 ///
12476 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12477 /// [`Scope::CloudPlatform`].
12478 ///
12479 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12480 /// tokens for more than one scope.
12481 ///
12482 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12483 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12484 /// sufficient, a read-write scope will do as well.
12485 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
12486 where
12487 St: AsRef<str>,
12488 {
12489 self._scopes.insert(String::from(scope.as_ref()));
12490 self
12491 }
12492 /// Identifies the authorization scope(s) for the method you are building.
12493 ///
12494 /// See [`Self::add_scope()`] for details.
12495 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
12496 where
12497 I: IntoIterator<Item = St>,
12498 St: AsRef<str>,
12499 {
12500 self._scopes
12501 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12502 self
12503 }
12504
12505 /// Removes all scopes, and no default scope will be used either.
12506 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12507 /// for details).
12508 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
12509 self._scopes.clear();
12510 self
12511 }
12512}