google_manager1_beta2/
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    /// View and manage your applications deployed on Google App Engine
17    AppengineAdmin,
18
19    /// View and manage your data across Google Cloud Platform services
20    CloudPlatform,
21
22    /// View your data across Google Cloud Platform services
23    CloudPlatformReadOnly,
24
25    /// View and manage your Google Compute Engine resources
26    Compute,
27
28    /// Manage your data in Google Cloud Storage
29    DevstorageReadWrite,
30
31    /// View and manage your Google Cloud Platform management resources and deployment status information
32    NdevCloudman,
33
34    /// View your Google Cloud Platform management resources and deployment status information
35    NdevCloudmanReadonly,
36}
37
38impl AsRef<str> for Scope {
39    fn as_ref(&self) -> &str {
40        match *self {
41            Scope::AppengineAdmin => "https://www.googleapis.com/auth/appengine.admin",
42            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
43            Scope::CloudPlatformReadOnly => {
44                "https://www.googleapis.com/auth/cloud-platform.read-only"
45            }
46            Scope::Compute => "https://www.googleapis.com/auth/compute",
47            Scope::DevstorageReadWrite => "https://www.googleapis.com/auth/devstorage.read_write",
48            Scope::NdevCloudman => "https://www.googleapis.com/auth/ndev.cloudman",
49            Scope::NdevCloudmanReadonly => "https://www.googleapis.com/auth/ndev.cloudman.readonly",
50        }
51    }
52}
53
54#[allow(clippy::derivable_impls)]
55impl Default for Scope {
56    fn default() -> Scope {
57        Scope::NdevCloudmanReadonly
58    }
59}
60
61// ########
62// HUB ###
63// ######
64
65/// Central instance to access all Manager related resource activities
66///
67/// # Examples
68///
69/// Instantiate a new hub
70///
71/// ```test_harness,no_run
72/// extern crate hyper;
73/// extern crate hyper_rustls;
74/// extern crate google_manager1_beta2 as manager1_beta2;
75/// use manager1_beta2::{Result, Error};
76/// # async fn dox() {
77/// use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
78///
79/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
80/// // `client_secret`, among other things.
81/// let secret: yup_oauth2::ApplicationSecret = Default::default();
82/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
83/// // unless you replace  `None` with the desired Flow.
84/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
85/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
86/// // retrieve them from storage.
87/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
88///     .with_native_roots()
89///     .unwrap()
90///     .https_only()
91///     .enable_http2()
92///     .build();
93///
94/// let executor = hyper_util::rt::TokioExecutor::new();
95/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
96///     secret,
97///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
98///     yup_oauth2::client::CustomHyperClientBuilder::from(
99///         hyper_util::client::legacy::Client::builder(executor).build(connector),
100///     ),
101/// ).build().await.unwrap();
102///
103/// let client = hyper_util::client::legacy::Client::builder(
104///     hyper_util::rt::TokioExecutor::new()
105/// )
106/// .build(
107///     hyper_rustls::HttpsConnectorBuilder::new()
108///         .with_native_roots()
109///         .unwrap()
110///         .https_or_http()
111///         .enable_http2()
112///         .build()
113/// );
114/// let mut hub = Manager::new(client, auth);
115/// // You can configure optional parameters by calling the respective setters at will, and
116/// // execute the final call using `doit()`.
117/// // Values shown here are possibly random and not representative !
118/// let result = hub.deployments().list("projectId", "region")
119///              .page_token("amet.")
120///              .max_results(-20)
121///              .doit().await;
122///
123/// match result {
124///     Err(e) => match e {
125///         // The Error enum provides details about what exactly happened.
126///         // You can also just use its `Debug`, `Display` or `Error` traits
127///          Error::HttpError(_)
128///         |Error::Io(_)
129///         |Error::MissingAPIKey
130///         |Error::MissingToken(_)
131///         |Error::Cancelled
132///         |Error::UploadSizeLimitExceeded(_, _)
133///         |Error::Failure(_)
134///         |Error::BadRequest(_)
135///         |Error::FieldClash(_)
136///         |Error::JsonDecodeError(_, _) => println!("{}", e),
137///     },
138///     Ok(res) => println!("Success: {:?}", res),
139/// }
140/// # }
141/// ```
142#[derive(Clone)]
143pub struct Manager<C> {
144    pub client: common::Client<C>,
145    pub auth: Box<dyn common::GetToken>,
146    _user_agent: String,
147    _base_url: String,
148    _root_url: String,
149}
150
151impl<C> common::Hub for Manager<C> {}
152
153impl<'a, C> Manager<C> {
154    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Manager<C> {
155        Manager {
156            client,
157            auth: Box::new(auth),
158            _user_agent: "google-api-rust-client/7.0.0".to_string(),
159            _base_url: "https://www.googleapis.com/manager/v1beta2/projects/".to_string(),
160            _root_url: "https://www.googleapis.com/".to_string(),
161        }
162    }
163
164    pub fn deployments(&'a self) -> DeploymentMethods<'a, C> {
165        DeploymentMethods { hub: self }
166    }
167    pub fn templates(&'a self) -> TemplateMethods<'a, C> {
168        TemplateMethods { hub: self }
169    }
170
171    /// Set the user-agent header field to use in all requests to the server.
172    /// It defaults to `google-api-rust-client/7.0.0`.
173    ///
174    /// Returns the previously set user-agent.
175    pub fn user_agent(&mut self, agent_name: String) -> String {
176        std::mem::replace(&mut self._user_agent, agent_name)
177    }
178
179    /// Set the base url to use in all requests to the server.
180    /// It defaults to `https://www.googleapis.com/manager/v1beta2/projects/`.
181    ///
182    /// Returns the previously set base url.
183    pub fn base_url(&mut self, new_base_url: String) -> String {
184        std::mem::replace(&mut self._base_url, new_base_url)
185    }
186
187    /// Set the root url to use in all requests to the server.
188    /// It defaults to `https://www.googleapis.com/`.
189    ///
190    /// Returns the previously set root url.
191    pub fn root_url(&mut self, new_root_url: String) -> String {
192        std::mem::replace(&mut self._root_url, new_root_url)
193    }
194}
195
196// ############
197// SCHEMAS ###
198// ##########
199/// A Compute Engine network accessConfig. Identical to the accessConfig on corresponding Compute Engine resource.
200///
201/// This type is not used in any activity, and only used as *part* of another schema.
202///
203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
204#[serde_with::serde_as]
205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
206pub struct AccessConfig {
207    /// Name of this access configuration.
208    pub name: Option<String>,
209    /// An external IP address associated with this instance.
210    #[serde(rename = "natIp")]
211    pub nat_ip: Option<String>,
212    /// Type of this access configuration file. (Currently only ONE_TO_ONE_NAT is legal.)
213    #[serde(rename = "type")]
214    pub type_: Option<String>,
215}
216
217impl common::Part for AccessConfig {}
218
219/// An Action encapsulates a set of commands as a single runnable module with additional information needed during run-time.
220///
221/// This type is not used in any activity, and only used as *part* of another schema.
222///
223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
224#[serde_with::serde_as]
225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
226pub struct Action {
227    /// A list of commands to run sequentially for this action.
228    pub commands: Option<Vec<String>>,
229    /// The timeout in milliseconds for this action to run.
230    #[serde(rename = "timeoutMs")]
231    pub timeout_ms: Option<i32>,
232}
233
234impl common::Part for Action {}
235
236/// An allowed port resource.
237///
238/// This type is not used in any activity, and only used as *part* of another schema.
239///
240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
241#[serde_with::serde_as]
242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
243pub struct AllowedRule {
244    /// ?tcp?, ?udp? or ?icmp?
245    #[serde(rename = "IPProtocol")]
246    pub ip_protocol: Option<String>,
247    /// List of ports or port ranges (Example inputs include: ["22"], [?33?, "12345-12349"].
248    pub ports: Option<Vec<String>>,
249}
250
251impl common::Part for AllowedRule {}
252
253/// There is no detailed description.
254///
255/// This type is not used in any activity, and only used as *part* of another schema.
256///
257#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
258#[serde_with::serde_as]
259#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
260pub struct AutoscalingModule {
261    /// no description provided
262    #[serde(rename = "coolDownPeriodSec")]
263    pub cool_down_period_sec: Option<i32>,
264    /// no description provided
265    pub description: Option<String>,
266    /// no description provided
267    #[serde(rename = "maxNumReplicas")]
268    pub max_num_replicas: Option<i32>,
269    /// no description provided
270    #[serde(rename = "minNumReplicas")]
271    pub min_num_replicas: Option<i32>,
272    /// no description provided
273    #[serde(rename = "signalType")]
274    pub signal_type: Option<String>,
275    /// no description provided
276    #[serde(rename = "targetModule")]
277    pub target_module: Option<String>,
278    /// target_utilization should be in range [0,1].
279    #[serde(rename = "targetUtilization")]
280    pub target_utilization: Option<f64>,
281}
282
283impl common::Part for AutoscalingModule {}
284
285/// There is no detailed description.
286///
287/// This type is not used in any activity, and only used as *part* of another schema.
288///
289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
290#[serde_with::serde_as]
291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
292pub struct AutoscalingModuleStatus {
293    /// [Output Only] The URL of the corresponding Autoscaling configuration.
294    #[serde(rename = "autoscalingConfigUrl")]
295    pub autoscaling_config_url: Option<String>,
296}
297
298impl common::Part for AutoscalingModuleStatus {}
299
300/// [Output Only] The current state of a replica or module.
301///
302/// This type is not used in any activity, and only used as *part* of another schema.
303///
304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
305#[serde_with::serde_as]
306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
307pub struct DeployState {
308    /// [Output Only] Human readable details about the current state.
309    pub details: Option<String>,
310    /// [Output Only] The status of the deployment. Possible values include:
311    /// - UNKNOWN
312    /// - DEPLOYING
313    /// - DEPLOYED
314    /// - DEPLOYMENT_FAILED
315    /// - DELETING
316    /// - DELETED
317    /// - DELETE_FAILED
318    pub status: Option<String>,
319}
320
321impl common::Part for DeployState {}
322
323/// A deployment represents a physical instantiation of a Template.
324///
325/// # Activities
326///
327/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
328/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
329///
330/// * [delete deployments](DeploymentDeleteCall) (none)
331/// * [get deployments](DeploymentGetCall) (response)
332/// * [insert deployments](DeploymentInsertCall) (request|response)
333/// * [list deployments](DeploymentListCall) (none)
334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
335#[serde_with::serde_as]
336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
337pub struct Deployment {
338    /// [Output Only] The time when this deployment was created.
339    #[serde(rename = "creationDate")]
340    pub creation_date: Option<String>,
341    /// A user-supplied description of this Deployment.
342    pub description: Option<String>,
343    /// [Output Only] List of status for the modules in this deployment.
344    pub modules: Option<HashMap<String, ModuleStatus>>,
345    /// Name of this deployment. The name must conform to the following regular expression: [a-zA-Z0-9-_]{1,64}
346    pub name: Option<String>,
347    /// The set of parameter overrides to apply to the corresponding Template before deploying.
348    pub overrides: Option<Vec<ParamOverride>>,
349    /// [Output Only] Current status of this deployment.
350    pub state: Option<DeployState>,
351    /// The name of the Template on which this deployment is based.
352    #[serde(rename = "templateName")]
353    pub template_name: Option<String>,
354}
355
356impl common::RequestValue for Deployment {}
357impl common::Resource for Deployment {}
358impl common::ResponseResult for Deployment {}
359
360/// There is no detailed description.
361///
362/// # Activities
363///
364/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
365/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
366///
367/// * [list deployments](DeploymentListCall) (response)
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct DeploymentsListResponse {
372    /// no description provided
373    #[serde(rename = "nextPageToken")]
374    pub next_page_token: Option<String>,
375    /// no description provided
376    pub resources: Option<Vec<Deployment>>,
377}
378
379impl common::ResponseResult for DeploymentsListResponse {}
380
381/// How to attach a disk to a Replica.
382///
383/// This type is not used in any activity, and only used as *part* of another schema.
384///
385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
386#[serde_with::serde_as]
387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
388pub struct DiskAttachment {
389    /// The device name of this disk.
390    #[serde(rename = "deviceName")]
391    pub device_name: Option<String>,
392    /// A zero-based index to assign to this disk, where 0 is reserved for the boot disk. If not specified, this is assigned by the server.
393    pub index: Option<u32>,
394}
395
396impl common::Part for DiskAttachment {}
397
398/// An environment variable.
399///
400/// This type is not used in any activity, and only used as *part* of another schema.
401///
402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
403#[serde_with::serde_as]
404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
405pub struct EnvVariable {
406    /// Whether this variable is hidden or visible.
407    pub hidden: Option<bool>,
408    /// Value of the environment variable.
409    pub value: Option<String>,
410}
411
412impl common::Part for EnvVariable {}
413
414/// A pre-existing persistent disk that will be attached to every Replica in the Pool.
415///
416/// This type is not used in any activity, and only used as *part* of another schema.
417///
418#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
419#[serde_with::serde_as]
420#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
421pub struct ExistingDisk {
422    /// Optional. How the disk will be attached to the Replica.
423    pub attachment: Option<DiskAttachment>,
424    /// The fully-qualified URL of the Persistent Disk resource. It must be in the same zone as the Pool.
425    pub source: Option<String>,
426}
427
428impl common::Part for ExistingDisk {}
429
430/// A Firewall resource
431///
432/// This type is not used in any activity, and only used as *part* of another schema.
433///
434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
435#[serde_with::serde_as]
436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
437pub struct FirewallModule {
438    /// The allowed ports or port ranges.
439    pub allowed: Option<Vec<AllowedRule>>,
440    /// The description of the firewall (optional)
441    pub description: Option<String>,
442    /// The NetworkModule to which this firewall should apply. If not specified, or if specified as 'default', this firewall will be applied to the 'default' network.
443    pub network: Option<String>,
444    /// Source IP ranges to apply this firewall to, see the GCE Spec for details on syntax
445    #[serde(rename = "sourceRanges")]
446    pub source_ranges: Option<Vec<String>>,
447    /// Source Tags to apply this firewall to, see the GCE Spec for details on syntax
448    #[serde(rename = "sourceTags")]
449    pub source_tags: Option<Vec<String>>,
450    /// Target Tags to apply this firewall to, see the GCE Spec for details on syntax
451    #[serde(rename = "targetTags")]
452    pub target_tags: Option<Vec<String>>,
453}
454
455impl common::Part for FirewallModule {}
456
457/// There is no detailed description.
458///
459/// This type is not used in any activity, and only used as *part* of another schema.
460///
461#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
462#[serde_with::serde_as]
463#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
464pub struct FirewallModuleStatus {
465    /// [Output Only] The URL of the corresponding Firewall resource.
466    #[serde(rename = "firewallUrl")]
467    pub firewall_url: Option<String>,
468}
469
470impl common::Part for FirewallModuleStatus {}
471
472/// There is no detailed description.
473///
474/// This type is not used in any activity, and only used as *part* of another schema.
475///
476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
477#[serde_with::serde_as]
478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
479pub struct HealthCheckModule {
480    /// no description provided
481    #[serde(rename = "checkIntervalSec")]
482    pub check_interval_sec: Option<i32>,
483    /// no description provided
484    pub description: Option<String>,
485    /// no description provided
486    #[serde(rename = "healthyThreshold")]
487    pub healthy_threshold: Option<i32>,
488    /// no description provided
489    pub host: Option<String>,
490    /// no description provided
491    pub path: Option<String>,
492    /// no description provided
493    pub port: Option<i32>,
494    /// no description provided
495    #[serde(rename = "timeoutSec")]
496    pub timeout_sec: Option<i32>,
497    /// no description provided
498    #[serde(rename = "unhealthyThreshold")]
499    pub unhealthy_threshold: Option<i32>,
500}
501
502impl common::Part for HealthCheckModule {}
503
504/// There is no detailed description.
505///
506/// This type is not used in any activity, and only used as *part* of another schema.
507///
508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
509#[serde_with::serde_as]
510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
511pub struct HealthCheckModuleStatus {
512    /// [Output Only] The HealthCheck URL.
513    #[serde(rename = "healthCheckUrl")]
514    pub health_check_url: Option<String>,
515}
516
517impl common::Part for HealthCheckModuleStatus {}
518
519/// There is no detailed description.
520///
521/// This type is not used in any activity, and only used as *part* of another schema.
522///
523#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
524#[serde_with::serde_as]
525#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
526pub struct LbModule {
527    /// no description provided
528    pub description: Option<String>,
529    /// no description provided
530    #[serde(rename = "healthChecks")]
531    pub health_checks: Option<Vec<String>>,
532    /// no description provided
533    #[serde(rename = "ipAddress")]
534    pub ip_address: Option<String>,
535    /// no description provided
536    #[serde(rename = "ipProtocol")]
537    pub ip_protocol: Option<String>,
538    /// no description provided
539    #[serde(rename = "portRange")]
540    pub port_range: Option<String>,
541    /// no description provided
542    #[serde(rename = "sessionAffinity")]
543    pub session_affinity: Option<String>,
544    /// no description provided
545    #[serde(rename = "targetModules")]
546    pub target_modules: Option<Vec<String>>,
547}
548
549impl common::Part for LbModule {}
550
551/// There is no detailed description.
552///
553/// This type is not used in any activity, and only used as *part* of another schema.
554///
555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
556#[serde_with::serde_as]
557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
558pub struct LbModuleStatus {
559    /// [Output Only] The URL of the corresponding ForwardingRule in GCE.
560    #[serde(rename = "forwardingRuleUrl")]
561    pub forwarding_rule_url: Option<String>,
562    /// [Output Only] The URL of the corresponding TargetPool resource in GCE.
563    #[serde(rename = "targetPoolUrl")]
564    pub target_pool_url: Option<String>,
565}
566
567impl common::Part for LbModuleStatus {}
568
569/// A Compute Engine metadata entry. Identical to the metadata on the corresponding Compute Engine resource.
570///
571/// This type is not used in any activity, and only used as *part* of another schema.
572///
573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
574#[serde_with::serde_as]
575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
576pub struct Metadata {
577    /// The fingerprint of the metadata.
578    #[serde(rename = "fingerPrint")]
579    pub finger_print: Option<String>,
580    /// A list of metadata items.
581    pub items: Option<Vec<MetadataItem>>,
582}
583
584impl common::Part for Metadata {}
585
586/// A Compute Engine metadata item, defined as a key:value pair. Identical to the metadata on the corresponding Compute Engine resource.
587///
588/// This type is not used in any activity, and only used as *part* of another schema.
589///
590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
591#[serde_with::serde_as]
592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
593pub struct MetadataItem {
594    /// A metadata key.
595    pub key: Option<String>,
596    /// A metadata value.
597    pub value: Option<String>,
598}
599
600impl common::Part for MetadataItem {}
601
602/// A module in a configuration. A module represents a single homogeneous, possibly replicated task.
603///
604/// This type is not used in any activity, and only used as *part* of another schema.
605///
606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
607#[serde_with::serde_as]
608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
609pub struct Module {
610    /// no description provided
611    #[serde(rename = "autoscalingModule")]
612    pub autoscaling_module: Option<AutoscalingModule>,
613    /// no description provided
614    #[serde(rename = "firewallModule")]
615    pub firewall_module: Option<FirewallModule>,
616    /// no description provided
617    #[serde(rename = "healthCheckModule")]
618    pub health_check_module: Option<HealthCheckModule>,
619    /// no description provided
620    #[serde(rename = "lbModule")]
621    pub lb_module: Option<LbModule>,
622    /// no description provided
623    #[serde(rename = "networkModule")]
624    pub network_module: Option<NetworkModule>,
625    /// no description provided
626    #[serde(rename = "replicaPoolModule")]
627    pub replica_pool_module: Option<ReplicaPoolModule>,
628    /// The type of this module. Valid values ("AUTOSCALING", "FIREWALL", "HEALTH_CHECK", "LOAD_BALANCING", "NETWORK", "REPLICA_POOL")
629    #[serde(rename = "type")]
630    pub type_: Option<String>,
631}
632
633impl common::Part for Module {}
634
635/// [Output Only] Aggregate status for a module.
636///
637/// This type is not used in any activity, and only used as *part* of another schema.
638///
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct ModuleStatus {
643    /// [Output Only] The status of the AutoscalingModule, set for type AUTOSCALING.
644    #[serde(rename = "autoscalingModuleStatus")]
645    pub autoscaling_module_status: Option<AutoscalingModuleStatus>,
646    /// [Output Only] The status of the FirewallModule, set for type FIREWALL.
647    #[serde(rename = "firewallModuleStatus")]
648    pub firewall_module_status: Option<FirewallModuleStatus>,
649    /// [Output Only] The status of the HealthCheckModule, set for type HEALTH_CHECK.
650    #[serde(rename = "healthCheckModuleStatus")]
651    pub health_check_module_status: Option<HealthCheckModuleStatus>,
652    /// [Output Only] The status of the LbModule, set for type LOAD_BALANCING.
653    #[serde(rename = "lbModuleStatus")]
654    pub lb_module_status: Option<LbModuleStatus>,
655    /// [Output Only] The status of the NetworkModule, set for type NETWORK.
656    #[serde(rename = "networkModuleStatus")]
657    pub network_module_status: Option<NetworkModuleStatus>,
658    /// [Output Only] The status of the ReplicaPoolModule, set for type VM.
659    #[serde(rename = "replicaPoolModuleStatus")]
660    pub replica_pool_module_status: Option<ReplicaPoolModuleStatus>,
661    /// [Output Only] The current state of the module.
662    pub state: Option<DeployState>,
663    /// [Output Only] The type of the module.
664    #[serde(rename = "type")]
665    pub type_: Option<String>,
666}
667
668impl common::Part for ModuleStatus {}
669
670/// A Compute Engine NetworkInterface resource. Identical to the NetworkInterface on the corresponding Compute Engine resource.
671///
672/// This type is not used in any activity, and only used as *part* of another schema.
673///
674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
675#[serde_with::serde_as]
676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
677pub struct NetworkInterface {
678    /// An array of configurations for this interface. This specifies how this interface is configured to interact with other network services
679    #[serde(rename = "accessConfigs")]
680    pub access_configs: Option<Vec<AccessConfig>>,
681    /// Name of the interface.
682    pub name: Option<String>,
683    /// The name of the NetworkModule to which this interface applies. If not specified, or specified as 'default', this will use the 'default' network.
684    pub network: Option<String>,
685    /// An optional IPV4 internal network address to assign to the instance for this network interface.
686    #[serde(rename = "networkIp")]
687    pub network_ip: Option<String>,
688}
689
690impl common::Part for NetworkInterface {}
691
692/// There is no detailed description.
693///
694/// This type is not used in any activity, and only used as *part* of another schema.
695///
696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
697#[serde_with::serde_as]
698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
699pub struct NetworkModule {
700    /// Required; The range of internal addresses that are legal on this network. This range is a CIDR specification, for example: 192.168.0.0/16.
701    #[serde(rename = "IPv4Range")]
702    pub i_pv4_range: Option<String>,
703    /// The description of the network.
704    pub description: Option<String>,
705    /// An optional address that is used for default routing to other networks. This must be within the range specified by IPv4Range, and is typicall the first usable address in that range. If not specified, the default value is the first usable address in IPv4Range.
706    #[serde(rename = "gatewayIPv4")]
707    pub gateway_i_pv4: Option<String>,
708}
709
710impl common::Part for NetworkModule {}
711
712/// There is no detailed description.
713///
714/// This type is not used in any activity, and only used as *part* of another schema.
715///
716#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
717#[serde_with::serde_as]
718#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
719pub struct NetworkModuleStatus {
720    /// [Output Only] The URL of the corresponding Network resource.
721    #[serde(rename = "networkUrl")]
722    pub network_url: Option<String>,
723}
724
725impl common::Part for NetworkModuleStatus {}
726
727/// A Persistent Disk resource that will be created and attached to each Replica in the Pool. Each Replica will have a unique persistent disk that is created and attached to that Replica.
728///
729/// This type is not used in any activity, and only used as *part* of another schema.
730///
731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
732#[serde_with::serde_as]
733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
734pub struct NewDisk {
735    /// How the disk will be attached to the Replica.
736    pub attachment: Option<DiskAttachment>,
737    /// If true, then this disk will be deleted when the instance is deleted.
738    #[serde(rename = "autoDelete")]
739    pub auto_delete: Option<bool>,
740    /// If true, indicates that this is the root persistent disk.
741    pub boot: Option<bool>,
742    /// Create the new disk using these parameters. The name of the disk will be <instance_name>-<five_random_charactersgt;.
743    #[serde(rename = "initializeParams")]
744    pub initialize_params: Option<NewDiskInitializeParams>,
745}
746
747impl common::Part for NewDisk {}
748
749/// Initialization parameters for creating a new disk.
750///
751/// This type is not used in any activity, and only used as *part* of another schema.
752///
753#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
754#[serde_with::serde_as]
755#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
756pub struct NewDiskInitializeParams {
757    /// The size of the created disk in gigabytes.
758    #[serde(rename = "diskSizeGb")]
759    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
760    pub disk_size_gb: Option<i64>,
761    /// Name of the disk type resource describing which disk type to use to create the disk. For example 'pd-ssd' or 'pd-standard'. Default is 'pd-standard'
762    #[serde(rename = "diskType")]
763    pub disk_type: Option<String>,
764    /// The fully-qualified URL of a source image to use to create this disk.
765    #[serde(rename = "sourceImage")]
766    pub source_image: Option<String>,
767}
768
769impl common::Part for NewDiskInitializeParams {}
770
771/// A specification for overriding parameters in a Template that corresponds to the Deployment.
772///
773/// This type is not used in any activity, and only used as *part* of another schema.
774///
775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
776#[serde_with::serde_as]
777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
778pub struct ParamOverride {
779    /// A JSON Path expression that specifies which parameter should be overridden.
780    pub path: Option<String>,
781    /// The new value to assign to the overridden parameter.
782    pub value: Option<String>,
783}
784
785impl common::Part for ParamOverride {}
786
787/// There is no detailed description.
788///
789/// This type is not used in any activity, and only used as *part* of another schema.
790///
791#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
792#[serde_with::serde_as]
793#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
794pub struct ReplicaPoolModule {
795    /// A list of environment variables.
796    #[serde(rename = "envVariables")]
797    pub env_variables: Option<HashMap<String, EnvVariable>>,
798    /// The Health Checks to configure for the ReplicaPoolModule
799    #[serde(rename = "healthChecks")]
800    pub health_checks: Option<Vec<String>>,
801    /// Number of replicas in this module.
802    #[serde(rename = "numReplicas")]
803    pub num_replicas: Option<i32>,
804    /// Information for a ReplicaPoolModule.
805    #[serde(rename = "replicaPoolParams")]
806    pub replica_pool_params: Option<ReplicaPoolParams>,
807    /// [Output Only] The name of the Resource View associated with a ReplicaPoolModule. This field will be generated by the service.
808    #[serde(rename = "resourceView")]
809    pub resource_view: Option<String>,
810}
811
812impl common::Part for ReplicaPoolModule {}
813
814/// There is no detailed description.
815///
816/// This type is not used in any activity, and only used as *part* of another schema.
817///
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct ReplicaPoolModuleStatus {
822    /// [Output Only] The URL of the associated ReplicaPool resource.
823    #[serde(rename = "replicaPoolUrl")]
824    pub replica_pool_url: Option<String>,
825    /// [Output Only] The URL of the Resource Group associated with this ReplicaPool.
826    #[serde(rename = "resourceViewUrl")]
827    pub resource_view_url: Option<String>,
828}
829
830impl common::Part for ReplicaPoolModuleStatus {}
831
832/// Configuration information for a ReplicaPools resource. Specifying an item within will determine the ReplicaPools API version used for a ReplicaPoolModule. Only one may be specified.
833///
834/// This type is not used in any activity, and only used as *part* of another schema.
835///
836#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
837#[serde_with::serde_as]
838#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
839pub struct ReplicaPoolParams {
840    /// ReplicaPoolParams specifications for use with ReplicaPools v1beta1.
841    pub v1beta1: Option<ReplicaPoolParamsV1Beta1>,
842}
843
844impl common::Part for ReplicaPoolParams {}
845
846/// Configuration information for a ReplicaPools v1beta1 API resource. Directly maps to ReplicaPool InitTemplate.
847///
848/// This type is not used in any activity, and only used as *part* of another schema.
849///
850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
851#[serde_with::serde_as]
852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
853pub struct ReplicaPoolParamsV1Beta1 {
854    /// Whether these replicas should be restarted if they experience a failure. The default value is true.
855    #[serde(rename = "autoRestart")]
856    pub auto_restart: Option<bool>,
857    /// The base name for instances within this ReplicaPool.
858    #[serde(rename = "baseInstanceName")]
859    pub base_instance_name: Option<String>,
860    /// Enables IP Forwarding
861    #[serde(rename = "canIpForward")]
862    pub can_ip_forward: Option<bool>,
863    /// An optional textual description of the resource.
864    pub description: Option<String>,
865    /// A list of existing Persistent Disk resources to attach to each replica in the pool. Each disk will be attached in read-only mode to every replica.
866    #[serde(rename = "disksToAttach")]
867    pub disks_to_attach: Option<Vec<ExistingDisk>>,
868    /// A list of Disk resources to create and attach to each Replica in the Pool. Currently, you can only define one disk and it must be a root persistent disk. Note that Replica Pool will create a root persistent disk for each replica.
869    #[serde(rename = "disksToCreate")]
870    pub disks_to_create: Option<Vec<NewDisk>>,
871    /// Name of the Action to be run during initialization of a ReplicaPoolModule.
872    #[serde(rename = "initAction")]
873    pub init_action: Option<String>,
874    /// The machine type for this instance. Either a complete URL, or the resource name (e.g. n1-standard-1).
875    #[serde(rename = "machineType")]
876    pub machine_type: Option<String>,
877    /// The metadata key/value pairs assigned to this instance.
878    pub metadata: Option<Metadata>,
879    /// A list of network interfaces for the instance. Currently only one interface is supported by Google Compute Engine.
880    #[serde(rename = "networkInterfaces")]
881    pub network_interfaces: Option<Vec<NetworkInterface>>,
882    /// no description provided
883    #[serde(rename = "onHostMaintenance")]
884    pub on_host_maintenance: Option<String>,
885    /// A list of Service Accounts to enable for this instance.
886    #[serde(rename = "serviceAccounts")]
887    pub service_accounts: Option<Vec<ServiceAccount>>,
888    /// A list of tags to apply to the Google Compute Engine instance to identify resources.
889    pub tags: Option<Tag>,
890    /// The zone for this ReplicaPool.
891    pub zone: Option<String>,
892}
893
894impl common::Part for ReplicaPoolParamsV1Beta1 {}
895
896/// A Compute Engine service account, identical to the Compute Engine resource.
897///
898/// This type is not used in any activity, and only used as *part* of another schema.
899///
900#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
901#[serde_with::serde_as]
902#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
903pub struct ServiceAccount {
904    /// Service account email address.
905    pub email: Option<String>,
906    /// List of OAuth2 scopes to obtain for the service account.
907    pub scopes: Option<Vec<String>>,
908}
909
910impl common::Part for ServiceAccount {}
911
912/// A Compute Engine Instance tag, identical to the tags on the corresponding Compute Engine Instance resource.
913///
914/// This type is not used in any activity, and only used as *part* of another schema.
915///
916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
917#[serde_with::serde_as]
918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
919pub struct Tag {
920    /// The fingerprint of the tag.
921    #[serde(rename = "fingerPrint")]
922    pub finger_print: Option<String>,
923    /// Items contained in this tag.
924    pub items: Option<Vec<String>>,
925}
926
927impl common::Part for Tag {}
928
929/// A Template represents a complete configuration for a Deployment.
930///
931/// # Activities
932///
933/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
934/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
935///
936/// * [delete templates](TemplateDeleteCall) (none)
937/// * [get templates](TemplateGetCall) (response)
938/// * [insert templates](TemplateInsertCall) (request|response)
939/// * [list templates](TemplateListCall) (none)
940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
941#[serde_with::serde_as]
942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
943pub struct Template {
944    /// Action definitions for use in Module intents in this Template.
945    pub actions: Option<HashMap<String, Action>>,
946    /// A user-supplied description of this Template.
947    pub description: Option<String>,
948    /// A list of modules for this Template.
949    pub modules: Option<HashMap<String, Module>>,
950    /// Name of this Template. The name must conform to the expression: [a-zA-Z0-9-_]{1,64}
951    pub name: Option<String>,
952}
953
954impl common::RequestValue for Template {}
955impl common::Resource for Template {}
956impl common::ResponseResult for Template {}
957
958/// There is no detailed description.
959///
960/// # Activities
961///
962/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
963/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
964///
965/// * [list templates](TemplateListCall) (response)
966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
967#[serde_with::serde_as]
968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
969pub struct TemplatesListResponse {
970    /// no description provided
971    #[serde(rename = "nextPageToken")]
972    pub next_page_token: Option<String>,
973    /// no description provided
974    pub resources: Option<Vec<Template>>,
975}
976
977impl common::ResponseResult for TemplatesListResponse {}
978
979// ###################
980// MethodBuilders ###
981// #################
982
983/// A builder providing access to all methods supported on *deployment* resources.
984/// It is not used directly, but through the [`Manager`] hub.
985///
986/// # Example
987///
988/// Instantiate a resource builder
989///
990/// ```test_harness,no_run
991/// extern crate hyper;
992/// extern crate hyper_rustls;
993/// extern crate google_manager1_beta2 as manager1_beta2;
994///
995/// # async fn dox() {
996/// use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
997///
998/// let secret: yup_oauth2::ApplicationSecret = Default::default();
999/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1000///     .with_native_roots()
1001///     .unwrap()
1002///     .https_only()
1003///     .enable_http2()
1004///     .build();
1005///
1006/// let executor = hyper_util::rt::TokioExecutor::new();
1007/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1008///     secret,
1009///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1010///     yup_oauth2::client::CustomHyperClientBuilder::from(
1011///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1012///     ),
1013/// ).build().await.unwrap();
1014///
1015/// let client = hyper_util::client::legacy::Client::builder(
1016///     hyper_util::rt::TokioExecutor::new()
1017/// )
1018/// .build(
1019///     hyper_rustls::HttpsConnectorBuilder::new()
1020///         .with_native_roots()
1021///         .unwrap()
1022///         .https_or_http()
1023///         .enable_http2()
1024///         .build()
1025/// );
1026/// let mut hub = Manager::new(client, auth);
1027/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1028/// // like `delete(...)`, `get(...)`, `insert(...)` and `list(...)`
1029/// // to build up your call.
1030/// let rb = hub.deployments();
1031/// # }
1032/// ```
1033pub struct DeploymentMethods<'a, C>
1034where
1035    C: 'a,
1036{
1037    hub: &'a Manager<C>,
1038}
1039
1040impl<'a, C> common::MethodsBuilder for DeploymentMethods<'a, C> {}
1041
1042impl<'a, C> DeploymentMethods<'a, C> {
1043    /// Create a builder to help you perform the following task:
1044    ///
1045    ///
1046    ///
1047    /// # Arguments
1048    ///
1049    /// * `projectId` - No description provided.
1050    /// * `region` - No description provided.
1051    /// * `deploymentName` - No description provided.
1052    pub fn delete(
1053        &self,
1054        project_id: &str,
1055        region: &str,
1056        deployment_name: &str,
1057    ) -> DeploymentDeleteCall<'a, C> {
1058        DeploymentDeleteCall {
1059            hub: self.hub,
1060            _project_id: project_id.to_string(),
1061            _region: region.to_string(),
1062            _deployment_name: deployment_name.to_string(),
1063            _delegate: Default::default(),
1064            _additional_params: Default::default(),
1065            _scopes: Default::default(),
1066        }
1067    }
1068
1069    /// Create a builder to help you perform the following task:
1070    ///
1071    ///
1072    ///
1073    /// # Arguments
1074    ///
1075    /// * `projectId` - No description provided.
1076    /// * `region` - No description provided.
1077    /// * `deploymentName` - No description provided.
1078    pub fn get(
1079        &self,
1080        project_id: &str,
1081        region: &str,
1082        deployment_name: &str,
1083    ) -> DeploymentGetCall<'a, C> {
1084        DeploymentGetCall {
1085            hub: self.hub,
1086            _project_id: project_id.to_string(),
1087            _region: region.to_string(),
1088            _deployment_name: deployment_name.to_string(),
1089            _delegate: Default::default(),
1090            _additional_params: Default::default(),
1091            _scopes: Default::default(),
1092        }
1093    }
1094
1095    /// Create a builder to help you perform the following task:
1096    ///
1097    ///
1098    ///
1099    /// # Arguments
1100    ///
1101    /// * `request` - No description provided.
1102    /// * `projectId` - No description provided.
1103    /// * `region` - No description provided.
1104    pub fn insert(
1105        &self,
1106        request: Deployment,
1107        project_id: &str,
1108        region: &str,
1109    ) -> DeploymentInsertCall<'a, C> {
1110        DeploymentInsertCall {
1111            hub: self.hub,
1112            _request: request,
1113            _project_id: project_id.to_string(),
1114            _region: region.to_string(),
1115            _delegate: Default::default(),
1116            _additional_params: Default::default(),
1117            _scopes: Default::default(),
1118        }
1119    }
1120
1121    /// Create a builder to help you perform the following task:
1122    ///
1123    ///
1124    ///
1125    /// # Arguments
1126    ///
1127    /// * `projectId` - No description provided.
1128    /// * `region` - No description provided.
1129    pub fn list(&self, project_id: &str, region: &str) -> DeploymentListCall<'a, C> {
1130        DeploymentListCall {
1131            hub: self.hub,
1132            _project_id: project_id.to_string(),
1133            _region: region.to_string(),
1134            _page_token: Default::default(),
1135            _max_results: Default::default(),
1136            _delegate: Default::default(),
1137            _additional_params: Default::default(),
1138            _scopes: Default::default(),
1139        }
1140    }
1141}
1142
1143/// A builder providing access to all methods supported on *template* resources.
1144/// It is not used directly, but through the [`Manager`] hub.
1145///
1146/// # Example
1147///
1148/// Instantiate a resource builder
1149///
1150/// ```test_harness,no_run
1151/// extern crate hyper;
1152/// extern crate hyper_rustls;
1153/// extern crate google_manager1_beta2 as manager1_beta2;
1154///
1155/// # async fn dox() {
1156/// use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1157///
1158/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1159/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1160///     .with_native_roots()
1161///     .unwrap()
1162///     .https_only()
1163///     .enable_http2()
1164///     .build();
1165///
1166/// let executor = hyper_util::rt::TokioExecutor::new();
1167/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1168///     secret,
1169///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1170///     yup_oauth2::client::CustomHyperClientBuilder::from(
1171///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1172///     ),
1173/// ).build().await.unwrap();
1174///
1175/// let client = hyper_util::client::legacy::Client::builder(
1176///     hyper_util::rt::TokioExecutor::new()
1177/// )
1178/// .build(
1179///     hyper_rustls::HttpsConnectorBuilder::new()
1180///         .with_native_roots()
1181///         .unwrap()
1182///         .https_or_http()
1183///         .enable_http2()
1184///         .build()
1185/// );
1186/// let mut hub = Manager::new(client, auth);
1187/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1188/// // like `delete(...)`, `get(...)`, `insert(...)` and `list(...)`
1189/// // to build up your call.
1190/// let rb = hub.templates();
1191/// # }
1192/// ```
1193pub struct TemplateMethods<'a, C>
1194where
1195    C: 'a,
1196{
1197    hub: &'a Manager<C>,
1198}
1199
1200impl<'a, C> common::MethodsBuilder for TemplateMethods<'a, C> {}
1201
1202impl<'a, C> TemplateMethods<'a, C> {
1203    /// Create a builder to help you perform the following task:
1204    ///
1205    ///
1206    ///
1207    /// # Arguments
1208    ///
1209    /// * `projectId` - No description provided.
1210    /// * `templateName` - No description provided.
1211    pub fn delete(&self, project_id: &str, template_name: &str) -> TemplateDeleteCall<'a, C> {
1212        TemplateDeleteCall {
1213            hub: self.hub,
1214            _project_id: project_id.to_string(),
1215            _template_name: template_name.to_string(),
1216            _delegate: Default::default(),
1217            _additional_params: Default::default(),
1218            _scopes: Default::default(),
1219        }
1220    }
1221
1222    /// Create a builder to help you perform the following task:
1223    ///
1224    ///
1225    ///
1226    /// # Arguments
1227    ///
1228    /// * `projectId` - No description provided.
1229    /// * `templateName` - No description provided.
1230    pub fn get(&self, project_id: &str, template_name: &str) -> TemplateGetCall<'a, C> {
1231        TemplateGetCall {
1232            hub: self.hub,
1233            _project_id: project_id.to_string(),
1234            _template_name: template_name.to_string(),
1235            _delegate: Default::default(),
1236            _additional_params: Default::default(),
1237            _scopes: Default::default(),
1238        }
1239    }
1240
1241    /// Create a builder to help you perform the following task:
1242    ///
1243    ///
1244    ///
1245    /// # Arguments
1246    ///
1247    /// * `request` - No description provided.
1248    /// * `projectId` - No description provided.
1249    pub fn insert(&self, request: Template, project_id: &str) -> TemplateInsertCall<'a, C> {
1250        TemplateInsertCall {
1251            hub: self.hub,
1252            _request: request,
1253            _project_id: project_id.to_string(),
1254            _delegate: Default::default(),
1255            _additional_params: Default::default(),
1256            _scopes: Default::default(),
1257        }
1258    }
1259
1260    /// Create a builder to help you perform the following task:
1261    ///
1262    ///
1263    ///
1264    /// # Arguments
1265    ///
1266    /// * `projectId` - No description provided.
1267    pub fn list(&self, project_id: &str) -> TemplateListCall<'a, C> {
1268        TemplateListCall {
1269            hub: self.hub,
1270            _project_id: project_id.to_string(),
1271            _page_token: Default::default(),
1272            _max_results: Default::default(),
1273            _delegate: Default::default(),
1274            _additional_params: Default::default(),
1275            _scopes: Default::default(),
1276        }
1277    }
1278}
1279
1280// ###################
1281// CallBuilders   ###
1282// #################
1283
1284///
1285///
1286/// A builder for the *delete* method supported by a *deployment* resource.
1287/// It is not used directly, but through a [`DeploymentMethods`] instance.
1288///
1289/// # Example
1290///
1291/// Instantiate a resource method builder
1292///
1293/// ```test_harness,no_run
1294/// # extern crate hyper;
1295/// # extern crate hyper_rustls;
1296/// # extern crate google_manager1_beta2 as manager1_beta2;
1297/// # async fn dox() {
1298/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1299///
1300/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1301/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1302/// #     .with_native_roots()
1303/// #     .unwrap()
1304/// #     .https_only()
1305/// #     .enable_http2()
1306/// #     .build();
1307///
1308/// # let executor = hyper_util::rt::TokioExecutor::new();
1309/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1310/// #     secret,
1311/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1312/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1313/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1314/// #     ),
1315/// # ).build().await.unwrap();
1316///
1317/// # let client = hyper_util::client::legacy::Client::builder(
1318/// #     hyper_util::rt::TokioExecutor::new()
1319/// # )
1320/// # .build(
1321/// #     hyper_rustls::HttpsConnectorBuilder::new()
1322/// #         .with_native_roots()
1323/// #         .unwrap()
1324/// #         .https_or_http()
1325/// #         .enable_http2()
1326/// #         .build()
1327/// # );
1328/// # let mut hub = Manager::new(client, auth);
1329/// // You can configure optional parameters by calling the respective setters at will, and
1330/// // execute the final call using `doit()`.
1331/// // Values shown here are possibly random and not representative !
1332/// let result = hub.deployments().delete("projectId", "region", "deploymentName")
1333///              .doit().await;
1334/// # }
1335/// ```
1336pub struct DeploymentDeleteCall<'a, C>
1337where
1338    C: 'a,
1339{
1340    hub: &'a Manager<C>,
1341    _project_id: String,
1342    _region: String,
1343    _deployment_name: String,
1344    _delegate: Option<&'a mut dyn common::Delegate>,
1345    _additional_params: HashMap<String, String>,
1346    _scopes: BTreeSet<String>,
1347}
1348
1349impl<'a, C> common::CallBuilder for DeploymentDeleteCall<'a, C> {}
1350
1351impl<'a, C> DeploymentDeleteCall<'a, C>
1352where
1353    C: common::Connector,
1354{
1355    /// Perform the operation you have build so far.
1356    pub async fn doit(mut self) -> common::Result<common::Response> {
1357        use std::borrow::Cow;
1358        use std::io::{Read, Seek};
1359
1360        use common::{url::Params, ToParts};
1361        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1362
1363        let mut dd = common::DefaultDelegate;
1364        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1365        dlg.begin(common::MethodInfo {
1366            id: "manager.deployments.delete",
1367            http_method: hyper::Method::DELETE,
1368        });
1369
1370        for &field in ["projectId", "region", "deploymentName"].iter() {
1371            if self._additional_params.contains_key(field) {
1372                dlg.finished(false);
1373                return Err(common::Error::FieldClash(field));
1374            }
1375        }
1376
1377        let mut params = Params::with_capacity(4 + self._additional_params.len());
1378        params.push("projectId", self._project_id);
1379        params.push("region", self._region);
1380        params.push("deploymentName", self._deployment_name);
1381
1382        params.extend(self._additional_params.iter());
1383
1384        let mut url = self.hub._base_url.clone()
1385            + "{projectId}/regions/{region}/deployments/{deploymentName}";
1386        if self._scopes.is_empty() {
1387            self._scopes
1388                .insert(Scope::CloudPlatform.as_ref().to_string());
1389        }
1390
1391        #[allow(clippy::single_element_loop)]
1392        for &(find_this, param_name) in [
1393            ("{projectId}", "projectId"),
1394            ("{region}", "region"),
1395            ("{deploymentName}", "deploymentName"),
1396        ]
1397        .iter()
1398        {
1399            url = params.uri_replacement(url, param_name, find_this, false);
1400        }
1401        {
1402            let to_remove = ["deploymentName", "region", "projectId"];
1403            params.remove_params(&to_remove);
1404        }
1405
1406        let url = params.parse_with_url(&url);
1407
1408        loop {
1409            let token = match self
1410                .hub
1411                .auth
1412                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1413                .await
1414            {
1415                Ok(token) => token,
1416                Err(e) => match dlg.token(e) {
1417                    Ok(token) => token,
1418                    Err(e) => {
1419                        dlg.finished(false);
1420                        return Err(common::Error::MissingToken(e));
1421                    }
1422                },
1423            };
1424            let mut req_result = {
1425                let client = &self.hub.client;
1426                dlg.pre_request();
1427                let mut req_builder = hyper::Request::builder()
1428                    .method(hyper::Method::DELETE)
1429                    .uri(url.as_str())
1430                    .header(USER_AGENT, self.hub._user_agent.clone());
1431
1432                if let Some(token) = token.as_ref() {
1433                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1434                }
1435
1436                let request = req_builder
1437                    .header(CONTENT_LENGTH, 0_u64)
1438                    .body(common::to_body::<String>(None));
1439
1440                client.request(request.unwrap()).await
1441            };
1442
1443            match req_result {
1444                Err(err) => {
1445                    if let common::Retry::After(d) = dlg.http_error(&err) {
1446                        sleep(d).await;
1447                        continue;
1448                    }
1449                    dlg.finished(false);
1450                    return Err(common::Error::HttpError(err));
1451                }
1452                Ok(res) => {
1453                    let (mut parts, body) = res.into_parts();
1454                    let mut body = common::Body::new(body);
1455                    if !parts.status.is_success() {
1456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1457                        let error = serde_json::from_str(&common::to_string(&bytes));
1458                        let response = common::to_response(parts, bytes.into());
1459
1460                        if let common::Retry::After(d) =
1461                            dlg.http_failure(&response, error.as_ref().ok())
1462                        {
1463                            sleep(d).await;
1464                            continue;
1465                        }
1466
1467                        dlg.finished(false);
1468
1469                        return Err(match error {
1470                            Ok(value) => common::Error::BadRequest(value),
1471                            _ => common::Error::Failure(response),
1472                        });
1473                    }
1474                    let response = common::Response::from_parts(parts, body);
1475
1476                    dlg.finished(true);
1477                    return Ok(response);
1478                }
1479            }
1480        }
1481    }
1482
1483    ///
1484    /// Sets the *project id* path property to the given value.
1485    ///
1486    /// Even though the property as already been set when instantiating this call,
1487    /// we provide this method for API completeness.
1488    pub fn project_id(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
1489        self._project_id = new_value.to_string();
1490        self
1491    }
1492    ///
1493    /// Sets the *region* path property to the given value.
1494    ///
1495    /// Even though the property as already been set when instantiating this call,
1496    /// we provide this method for API completeness.
1497    pub fn region(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
1498        self._region = new_value.to_string();
1499        self
1500    }
1501    ///
1502    /// Sets the *deployment name* path property to the given value.
1503    ///
1504    /// Even though the property as already been set when instantiating this call,
1505    /// we provide this method for API completeness.
1506    pub fn deployment_name(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
1507        self._deployment_name = new_value.to_string();
1508        self
1509    }
1510    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1511    /// while executing the actual API request.
1512    ///
1513    /// ````text
1514    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1515    /// ````
1516    ///
1517    /// Sets the *delegate* property to the given value.
1518    pub fn delegate(
1519        mut self,
1520        new_value: &'a mut dyn common::Delegate,
1521    ) -> DeploymentDeleteCall<'a, C> {
1522        self._delegate = Some(new_value);
1523        self
1524    }
1525
1526    /// Set any additional parameter of the query string used in the request.
1527    /// It should be used to set parameters which are not yet available through their own
1528    /// setters.
1529    ///
1530    /// Please note that this method must not be used to set any of the known parameters
1531    /// which have their own setter method. If done anyway, the request will fail.
1532    ///
1533    /// # Additional Parameters
1534    ///
1535    /// * *alt* (query-string) - Data format for the response.
1536    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1537    /// * *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.
1538    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1539    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1540    /// * *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. Overrides userIp if both are provided.
1541    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1542    pub fn param<T>(mut self, name: T, value: T) -> DeploymentDeleteCall<'a, C>
1543    where
1544        T: AsRef<str>,
1545    {
1546        self._additional_params
1547            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1548        self
1549    }
1550
1551    /// Identifies the authorization scope for the method you are building.
1552    ///
1553    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1554    /// [`Scope::CloudPlatform`].
1555    ///
1556    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1557    /// tokens for more than one scope.
1558    ///
1559    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1560    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1561    /// sufficient, a read-write scope will do as well.
1562    pub fn add_scope<St>(mut self, scope: St) -> DeploymentDeleteCall<'a, C>
1563    where
1564        St: AsRef<str>,
1565    {
1566        self._scopes.insert(String::from(scope.as_ref()));
1567        self
1568    }
1569    /// Identifies the authorization scope(s) for the method you are building.
1570    ///
1571    /// See [`Self::add_scope()`] for details.
1572    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentDeleteCall<'a, C>
1573    where
1574        I: IntoIterator<Item = St>,
1575        St: AsRef<str>,
1576    {
1577        self._scopes
1578            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1579        self
1580    }
1581
1582    /// Removes all scopes, and no default scope will be used either.
1583    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1584    /// for details).
1585    pub fn clear_scopes(mut self) -> DeploymentDeleteCall<'a, C> {
1586        self._scopes.clear();
1587        self
1588    }
1589}
1590
1591///
1592///
1593/// A builder for the *get* method supported by a *deployment* resource.
1594/// It is not used directly, but through a [`DeploymentMethods`] instance.
1595///
1596/// # Example
1597///
1598/// Instantiate a resource method builder
1599///
1600/// ```test_harness,no_run
1601/// # extern crate hyper;
1602/// # extern crate hyper_rustls;
1603/// # extern crate google_manager1_beta2 as manager1_beta2;
1604/// # async fn dox() {
1605/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1606///
1607/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1608/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1609/// #     .with_native_roots()
1610/// #     .unwrap()
1611/// #     .https_only()
1612/// #     .enable_http2()
1613/// #     .build();
1614///
1615/// # let executor = hyper_util::rt::TokioExecutor::new();
1616/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1617/// #     secret,
1618/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1619/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1620/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1621/// #     ),
1622/// # ).build().await.unwrap();
1623///
1624/// # let client = hyper_util::client::legacy::Client::builder(
1625/// #     hyper_util::rt::TokioExecutor::new()
1626/// # )
1627/// # .build(
1628/// #     hyper_rustls::HttpsConnectorBuilder::new()
1629/// #         .with_native_roots()
1630/// #         .unwrap()
1631/// #         .https_or_http()
1632/// #         .enable_http2()
1633/// #         .build()
1634/// # );
1635/// # let mut hub = Manager::new(client, auth);
1636/// // You can configure optional parameters by calling the respective setters at will, and
1637/// // execute the final call using `doit()`.
1638/// // Values shown here are possibly random and not representative !
1639/// let result = hub.deployments().get("projectId", "region", "deploymentName")
1640///              .doit().await;
1641/// # }
1642/// ```
1643pub struct DeploymentGetCall<'a, C>
1644where
1645    C: 'a,
1646{
1647    hub: &'a Manager<C>,
1648    _project_id: String,
1649    _region: String,
1650    _deployment_name: String,
1651    _delegate: Option<&'a mut dyn common::Delegate>,
1652    _additional_params: HashMap<String, String>,
1653    _scopes: BTreeSet<String>,
1654}
1655
1656impl<'a, C> common::CallBuilder for DeploymentGetCall<'a, C> {}
1657
1658impl<'a, C> DeploymentGetCall<'a, C>
1659where
1660    C: common::Connector,
1661{
1662    /// Perform the operation you have build so far.
1663    pub async fn doit(mut self) -> common::Result<(common::Response, Deployment)> {
1664        use std::borrow::Cow;
1665        use std::io::{Read, Seek};
1666
1667        use common::{url::Params, ToParts};
1668        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1669
1670        let mut dd = common::DefaultDelegate;
1671        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1672        dlg.begin(common::MethodInfo {
1673            id: "manager.deployments.get",
1674            http_method: hyper::Method::GET,
1675        });
1676
1677        for &field in ["alt", "projectId", "region", "deploymentName"].iter() {
1678            if self._additional_params.contains_key(field) {
1679                dlg.finished(false);
1680                return Err(common::Error::FieldClash(field));
1681            }
1682        }
1683
1684        let mut params = Params::with_capacity(5 + self._additional_params.len());
1685        params.push("projectId", self._project_id);
1686        params.push("region", self._region);
1687        params.push("deploymentName", self._deployment_name);
1688
1689        params.extend(self._additional_params.iter());
1690
1691        params.push("alt", "json");
1692        let mut url = self.hub._base_url.clone()
1693            + "{projectId}/regions/{region}/deployments/{deploymentName}";
1694        if self._scopes.is_empty() {
1695            self._scopes
1696                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
1697        }
1698
1699        #[allow(clippy::single_element_loop)]
1700        for &(find_this, param_name) in [
1701            ("{projectId}", "projectId"),
1702            ("{region}", "region"),
1703            ("{deploymentName}", "deploymentName"),
1704        ]
1705        .iter()
1706        {
1707            url = params.uri_replacement(url, param_name, find_this, false);
1708        }
1709        {
1710            let to_remove = ["deploymentName", "region", "projectId"];
1711            params.remove_params(&to_remove);
1712        }
1713
1714        let url = params.parse_with_url(&url);
1715
1716        loop {
1717            let token = match self
1718                .hub
1719                .auth
1720                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1721                .await
1722            {
1723                Ok(token) => token,
1724                Err(e) => match dlg.token(e) {
1725                    Ok(token) => token,
1726                    Err(e) => {
1727                        dlg.finished(false);
1728                        return Err(common::Error::MissingToken(e));
1729                    }
1730                },
1731            };
1732            let mut req_result = {
1733                let client = &self.hub.client;
1734                dlg.pre_request();
1735                let mut req_builder = hyper::Request::builder()
1736                    .method(hyper::Method::GET)
1737                    .uri(url.as_str())
1738                    .header(USER_AGENT, self.hub._user_agent.clone());
1739
1740                if let Some(token) = token.as_ref() {
1741                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1742                }
1743
1744                let request = req_builder
1745                    .header(CONTENT_LENGTH, 0_u64)
1746                    .body(common::to_body::<String>(None));
1747
1748                client.request(request.unwrap()).await
1749            };
1750
1751            match req_result {
1752                Err(err) => {
1753                    if let common::Retry::After(d) = dlg.http_error(&err) {
1754                        sleep(d).await;
1755                        continue;
1756                    }
1757                    dlg.finished(false);
1758                    return Err(common::Error::HttpError(err));
1759                }
1760                Ok(res) => {
1761                    let (mut parts, body) = res.into_parts();
1762                    let mut body = common::Body::new(body);
1763                    if !parts.status.is_success() {
1764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1765                        let error = serde_json::from_str(&common::to_string(&bytes));
1766                        let response = common::to_response(parts, bytes.into());
1767
1768                        if let common::Retry::After(d) =
1769                            dlg.http_failure(&response, error.as_ref().ok())
1770                        {
1771                            sleep(d).await;
1772                            continue;
1773                        }
1774
1775                        dlg.finished(false);
1776
1777                        return Err(match error {
1778                            Ok(value) => common::Error::BadRequest(value),
1779                            _ => common::Error::Failure(response),
1780                        });
1781                    }
1782                    let response = {
1783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1784                        let encoded = common::to_string(&bytes);
1785                        match serde_json::from_str(&encoded) {
1786                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1787                            Err(error) => {
1788                                dlg.response_json_decode_error(&encoded, &error);
1789                                return Err(common::Error::JsonDecodeError(
1790                                    encoded.to_string(),
1791                                    error,
1792                                ));
1793                            }
1794                        }
1795                    };
1796
1797                    dlg.finished(true);
1798                    return Ok(response);
1799                }
1800            }
1801        }
1802    }
1803
1804    ///
1805    /// Sets the *project id* path property to the given value.
1806    ///
1807    /// Even though the property as already been set when instantiating this call,
1808    /// we provide this method for API completeness.
1809    pub fn project_id(mut self, new_value: &str) -> DeploymentGetCall<'a, C> {
1810        self._project_id = new_value.to_string();
1811        self
1812    }
1813    ///
1814    /// Sets the *region* path property to the given value.
1815    ///
1816    /// Even though the property as already been set when instantiating this call,
1817    /// we provide this method for API completeness.
1818    pub fn region(mut self, new_value: &str) -> DeploymentGetCall<'a, C> {
1819        self._region = new_value.to_string();
1820        self
1821    }
1822    ///
1823    /// Sets the *deployment name* path property to the given value.
1824    ///
1825    /// Even though the property as already been set when instantiating this call,
1826    /// we provide this method for API completeness.
1827    pub fn deployment_name(mut self, new_value: &str) -> DeploymentGetCall<'a, C> {
1828        self._deployment_name = new_value.to_string();
1829        self
1830    }
1831    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1832    /// while executing the actual API request.
1833    ///
1834    /// ````text
1835    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1836    /// ````
1837    ///
1838    /// Sets the *delegate* property to the given value.
1839    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeploymentGetCall<'a, C> {
1840        self._delegate = Some(new_value);
1841        self
1842    }
1843
1844    /// Set any additional parameter of the query string used in the request.
1845    /// It should be used to set parameters which are not yet available through their own
1846    /// setters.
1847    ///
1848    /// Please note that this method must not be used to set any of the known parameters
1849    /// which have their own setter method. If done anyway, the request will fail.
1850    ///
1851    /// # Additional Parameters
1852    ///
1853    /// * *alt* (query-string) - Data format for the response.
1854    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1855    /// * *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.
1856    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1857    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1858    /// * *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. Overrides userIp if both are provided.
1859    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1860    pub fn param<T>(mut self, name: T, value: T) -> DeploymentGetCall<'a, C>
1861    where
1862        T: AsRef<str>,
1863    {
1864        self._additional_params
1865            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1866        self
1867    }
1868
1869    /// Identifies the authorization scope for the method you are building.
1870    ///
1871    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1872    /// [`Scope::NdevCloudmanReadonly`].
1873    ///
1874    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1875    /// tokens for more than one scope.
1876    ///
1877    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1878    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1879    /// sufficient, a read-write scope will do as well.
1880    pub fn add_scope<St>(mut self, scope: St) -> DeploymentGetCall<'a, C>
1881    where
1882        St: AsRef<str>,
1883    {
1884        self._scopes.insert(String::from(scope.as_ref()));
1885        self
1886    }
1887    /// Identifies the authorization scope(s) for the method you are building.
1888    ///
1889    /// See [`Self::add_scope()`] for details.
1890    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentGetCall<'a, C>
1891    where
1892        I: IntoIterator<Item = St>,
1893        St: AsRef<str>,
1894    {
1895        self._scopes
1896            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1897        self
1898    }
1899
1900    /// Removes all scopes, and no default scope will be used either.
1901    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1902    /// for details).
1903    pub fn clear_scopes(mut self) -> DeploymentGetCall<'a, C> {
1904        self._scopes.clear();
1905        self
1906    }
1907}
1908
1909///
1910///
1911/// A builder for the *insert* method supported by a *deployment* resource.
1912/// It is not used directly, but through a [`DeploymentMethods`] instance.
1913///
1914/// # Example
1915///
1916/// Instantiate a resource method builder
1917///
1918/// ```test_harness,no_run
1919/// # extern crate hyper;
1920/// # extern crate hyper_rustls;
1921/// # extern crate google_manager1_beta2 as manager1_beta2;
1922/// use manager1_beta2::api::Deployment;
1923/// # async fn dox() {
1924/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1925///
1926/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1927/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1928/// #     .with_native_roots()
1929/// #     .unwrap()
1930/// #     .https_only()
1931/// #     .enable_http2()
1932/// #     .build();
1933///
1934/// # let executor = hyper_util::rt::TokioExecutor::new();
1935/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1936/// #     secret,
1937/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1938/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1939/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1940/// #     ),
1941/// # ).build().await.unwrap();
1942///
1943/// # let client = hyper_util::client::legacy::Client::builder(
1944/// #     hyper_util::rt::TokioExecutor::new()
1945/// # )
1946/// # .build(
1947/// #     hyper_rustls::HttpsConnectorBuilder::new()
1948/// #         .with_native_roots()
1949/// #         .unwrap()
1950/// #         .https_or_http()
1951/// #         .enable_http2()
1952/// #         .build()
1953/// # );
1954/// # let mut hub = Manager::new(client, auth);
1955/// // As the method needs a request, you would usually fill it with the desired information
1956/// // into the respective structure. Some of the parts shown here might not be applicable !
1957/// // Values shown here are possibly random and not representative !
1958/// let mut req = Deployment::default();
1959///
1960/// // You can configure optional parameters by calling the respective setters at will, and
1961/// // execute the final call using `doit()`.
1962/// // Values shown here are possibly random and not representative !
1963/// let result = hub.deployments().insert(req, "projectId", "region")
1964///              .doit().await;
1965/// # }
1966/// ```
1967pub struct DeploymentInsertCall<'a, C>
1968where
1969    C: 'a,
1970{
1971    hub: &'a Manager<C>,
1972    _request: Deployment,
1973    _project_id: String,
1974    _region: String,
1975    _delegate: Option<&'a mut dyn common::Delegate>,
1976    _additional_params: HashMap<String, String>,
1977    _scopes: BTreeSet<String>,
1978}
1979
1980impl<'a, C> common::CallBuilder for DeploymentInsertCall<'a, C> {}
1981
1982impl<'a, C> DeploymentInsertCall<'a, C>
1983where
1984    C: common::Connector,
1985{
1986    /// Perform the operation you have build so far.
1987    pub async fn doit(mut self) -> common::Result<(common::Response, Deployment)> {
1988        use std::borrow::Cow;
1989        use std::io::{Read, Seek};
1990
1991        use common::{url::Params, ToParts};
1992        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1993
1994        let mut dd = common::DefaultDelegate;
1995        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1996        dlg.begin(common::MethodInfo {
1997            id: "manager.deployments.insert",
1998            http_method: hyper::Method::POST,
1999        });
2000
2001        for &field in ["alt", "projectId", "region"].iter() {
2002            if self._additional_params.contains_key(field) {
2003                dlg.finished(false);
2004                return Err(common::Error::FieldClash(field));
2005            }
2006        }
2007
2008        let mut params = Params::with_capacity(5 + self._additional_params.len());
2009        params.push("projectId", self._project_id);
2010        params.push("region", self._region);
2011
2012        params.extend(self._additional_params.iter());
2013
2014        params.push("alt", "json");
2015        let mut url = self.hub._base_url.clone() + "{projectId}/regions/{region}/deployments";
2016        if self._scopes.is_empty() {
2017            self._scopes
2018                .insert(Scope::DevstorageReadWrite.as_ref().to_string());
2019        }
2020
2021        #[allow(clippy::single_element_loop)]
2022        for &(find_this, param_name) in
2023            [("{projectId}", "projectId"), ("{region}", "region")].iter()
2024        {
2025            url = params.uri_replacement(url, param_name, find_this, false);
2026        }
2027        {
2028            let to_remove = ["region", "projectId"];
2029            params.remove_params(&to_remove);
2030        }
2031
2032        let url = params.parse_with_url(&url);
2033
2034        let mut json_mime_type = mime::APPLICATION_JSON;
2035        let mut request_value_reader = {
2036            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2037            common::remove_json_null_values(&mut value);
2038            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2039            serde_json::to_writer(&mut dst, &value).unwrap();
2040            dst
2041        };
2042        let request_size = request_value_reader
2043            .seek(std::io::SeekFrom::End(0))
2044            .unwrap();
2045        request_value_reader
2046            .seek(std::io::SeekFrom::Start(0))
2047            .unwrap();
2048
2049        loop {
2050            let token = match self
2051                .hub
2052                .auth
2053                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2054                .await
2055            {
2056                Ok(token) => token,
2057                Err(e) => match dlg.token(e) {
2058                    Ok(token) => token,
2059                    Err(e) => {
2060                        dlg.finished(false);
2061                        return Err(common::Error::MissingToken(e));
2062                    }
2063                },
2064            };
2065            request_value_reader
2066                .seek(std::io::SeekFrom::Start(0))
2067                .unwrap();
2068            let mut req_result = {
2069                let client = &self.hub.client;
2070                dlg.pre_request();
2071                let mut req_builder = hyper::Request::builder()
2072                    .method(hyper::Method::POST)
2073                    .uri(url.as_str())
2074                    .header(USER_AGENT, self.hub._user_agent.clone());
2075
2076                if let Some(token) = token.as_ref() {
2077                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2078                }
2079
2080                let request = req_builder
2081                    .header(CONTENT_TYPE, json_mime_type.to_string())
2082                    .header(CONTENT_LENGTH, request_size as u64)
2083                    .body(common::to_body(
2084                        request_value_reader.get_ref().clone().into(),
2085                    ));
2086
2087                client.request(request.unwrap()).await
2088            };
2089
2090            match req_result {
2091                Err(err) => {
2092                    if let common::Retry::After(d) = dlg.http_error(&err) {
2093                        sleep(d).await;
2094                        continue;
2095                    }
2096                    dlg.finished(false);
2097                    return Err(common::Error::HttpError(err));
2098                }
2099                Ok(res) => {
2100                    let (mut parts, body) = res.into_parts();
2101                    let mut body = common::Body::new(body);
2102                    if !parts.status.is_success() {
2103                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2104                        let error = serde_json::from_str(&common::to_string(&bytes));
2105                        let response = common::to_response(parts, bytes.into());
2106
2107                        if let common::Retry::After(d) =
2108                            dlg.http_failure(&response, error.as_ref().ok())
2109                        {
2110                            sleep(d).await;
2111                            continue;
2112                        }
2113
2114                        dlg.finished(false);
2115
2116                        return Err(match error {
2117                            Ok(value) => common::Error::BadRequest(value),
2118                            _ => common::Error::Failure(response),
2119                        });
2120                    }
2121                    let response = {
2122                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2123                        let encoded = common::to_string(&bytes);
2124                        match serde_json::from_str(&encoded) {
2125                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2126                            Err(error) => {
2127                                dlg.response_json_decode_error(&encoded, &error);
2128                                return Err(common::Error::JsonDecodeError(
2129                                    encoded.to_string(),
2130                                    error,
2131                                ));
2132                            }
2133                        }
2134                    };
2135
2136                    dlg.finished(true);
2137                    return Ok(response);
2138                }
2139            }
2140        }
2141    }
2142
2143    ///
2144    /// Sets the *request* property to the given value.
2145    ///
2146    /// Even though the property as already been set when instantiating this call,
2147    /// we provide this method for API completeness.
2148    pub fn request(mut self, new_value: Deployment) -> DeploymentInsertCall<'a, C> {
2149        self._request = new_value;
2150        self
2151    }
2152    ///
2153    /// Sets the *project id* path property to the given value.
2154    ///
2155    /// Even though the property as already been set when instantiating this call,
2156    /// we provide this method for API completeness.
2157    pub fn project_id(mut self, new_value: &str) -> DeploymentInsertCall<'a, C> {
2158        self._project_id = new_value.to_string();
2159        self
2160    }
2161    ///
2162    /// Sets the *region* path property to the given value.
2163    ///
2164    /// Even though the property as already been set when instantiating this call,
2165    /// we provide this method for API completeness.
2166    pub fn region(mut self, new_value: &str) -> DeploymentInsertCall<'a, C> {
2167        self._region = new_value.to_string();
2168        self
2169    }
2170    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2171    /// while executing the actual API request.
2172    ///
2173    /// ````text
2174    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2175    /// ````
2176    ///
2177    /// Sets the *delegate* property to the given value.
2178    pub fn delegate(
2179        mut self,
2180        new_value: &'a mut dyn common::Delegate,
2181    ) -> DeploymentInsertCall<'a, C> {
2182        self._delegate = Some(new_value);
2183        self
2184    }
2185
2186    /// Set any additional parameter of the query string used in the request.
2187    /// It should be used to set parameters which are not yet available through their own
2188    /// setters.
2189    ///
2190    /// Please note that this method must not be used to set any of the known parameters
2191    /// which have their own setter method. If done anyway, the request will fail.
2192    ///
2193    /// # Additional Parameters
2194    ///
2195    /// * *alt* (query-string) - Data format for the response.
2196    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2197    /// * *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.
2198    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2199    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2200    /// * *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. Overrides userIp if both are provided.
2201    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2202    pub fn param<T>(mut self, name: T, value: T) -> DeploymentInsertCall<'a, C>
2203    where
2204        T: AsRef<str>,
2205    {
2206        self._additional_params
2207            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2208        self
2209    }
2210
2211    /// Identifies the authorization scope for the method you are building.
2212    ///
2213    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2214    /// [`Scope::DevstorageReadWrite`].
2215    ///
2216    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2217    /// tokens for more than one scope.
2218    ///
2219    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2220    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2221    /// sufficient, a read-write scope will do as well.
2222    pub fn add_scope<St>(mut self, scope: St) -> DeploymentInsertCall<'a, C>
2223    where
2224        St: AsRef<str>,
2225    {
2226        self._scopes.insert(String::from(scope.as_ref()));
2227        self
2228    }
2229    /// Identifies the authorization scope(s) for the method you are building.
2230    ///
2231    /// See [`Self::add_scope()`] for details.
2232    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentInsertCall<'a, C>
2233    where
2234        I: IntoIterator<Item = St>,
2235        St: AsRef<str>,
2236    {
2237        self._scopes
2238            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2239        self
2240    }
2241
2242    /// Removes all scopes, and no default scope will be used either.
2243    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2244    /// for details).
2245    pub fn clear_scopes(mut self) -> DeploymentInsertCall<'a, C> {
2246        self._scopes.clear();
2247        self
2248    }
2249}
2250
2251///
2252///
2253/// A builder for the *list* method supported by a *deployment* resource.
2254/// It is not used directly, but through a [`DeploymentMethods`] instance.
2255///
2256/// # Example
2257///
2258/// Instantiate a resource method builder
2259///
2260/// ```test_harness,no_run
2261/// # extern crate hyper;
2262/// # extern crate hyper_rustls;
2263/// # extern crate google_manager1_beta2 as manager1_beta2;
2264/// # async fn dox() {
2265/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2266///
2267/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2268/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2269/// #     .with_native_roots()
2270/// #     .unwrap()
2271/// #     .https_only()
2272/// #     .enable_http2()
2273/// #     .build();
2274///
2275/// # let executor = hyper_util::rt::TokioExecutor::new();
2276/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2277/// #     secret,
2278/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2279/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2280/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2281/// #     ),
2282/// # ).build().await.unwrap();
2283///
2284/// # let client = hyper_util::client::legacy::Client::builder(
2285/// #     hyper_util::rt::TokioExecutor::new()
2286/// # )
2287/// # .build(
2288/// #     hyper_rustls::HttpsConnectorBuilder::new()
2289/// #         .with_native_roots()
2290/// #         .unwrap()
2291/// #         .https_or_http()
2292/// #         .enable_http2()
2293/// #         .build()
2294/// # );
2295/// # let mut hub = Manager::new(client, auth);
2296/// // You can configure optional parameters by calling the respective setters at will, and
2297/// // execute the final call using `doit()`.
2298/// // Values shown here are possibly random and not representative !
2299/// let result = hub.deployments().list("projectId", "region")
2300///              .page_token("duo")
2301///              .max_results(-50)
2302///              .doit().await;
2303/// # }
2304/// ```
2305pub struct DeploymentListCall<'a, C>
2306where
2307    C: 'a,
2308{
2309    hub: &'a Manager<C>,
2310    _project_id: String,
2311    _region: String,
2312    _page_token: Option<String>,
2313    _max_results: Option<i32>,
2314    _delegate: Option<&'a mut dyn common::Delegate>,
2315    _additional_params: HashMap<String, String>,
2316    _scopes: BTreeSet<String>,
2317}
2318
2319impl<'a, C> common::CallBuilder for DeploymentListCall<'a, C> {}
2320
2321impl<'a, C> DeploymentListCall<'a, C>
2322where
2323    C: common::Connector,
2324{
2325    /// Perform the operation you have build so far.
2326    pub async fn doit(mut self) -> common::Result<(common::Response, DeploymentsListResponse)> {
2327        use std::borrow::Cow;
2328        use std::io::{Read, Seek};
2329
2330        use common::{url::Params, ToParts};
2331        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2332
2333        let mut dd = common::DefaultDelegate;
2334        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2335        dlg.begin(common::MethodInfo {
2336            id: "manager.deployments.list",
2337            http_method: hyper::Method::GET,
2338        });
2339
2340        for &field in ["alt", "projectId", "region", "pageToken", "maxResults"].iter() {
2341            if self._additional_params.contains_key(field) {
2342                dlg.finished(false);
2343                return Err(common::Error::FieldClash(field));
2344            }
2345        }
2346
2347        let mut params = Params::with_capacity(6 + self._additional_params.len());
2348        params.push("projectId", self._project_id);
2349        params.push("region", self._region);
2350        if let Some(value) = self._page_token.as_ref() {
2351            params.push("pageToken", value);
2352        }
2353        if let Some(value) = self._max_results.as_ref() {
2354            params.push("maxResults", value.to_string());
2355        }
2356
2357        params.extend(self._additional_params.iter());
2358
2359        params.push("alt", "json");
2360        let mut url = self.hub._base_url.clone() + "{projectId}/regions/{region}/deployments";
2361        if self._scopes.is_empty() {
2362            self._scopes
2363                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
2364        }
2365
2366        #[allow(clippy::single_element_loop)]
2367        for &(find_this, param_name) in
2368            [("{projectId}", "projectId"), ("{region}", "region")].iter()
2369        {
2370            url = params.uri_replacement(url, param_name, find_this, false);
2371        }
2372        {
2373            let to_remove = ["region", "projectId"];
2374            params.remove_params(&to_remove);
2375        }
2376
2377        let url = params.parse_with_url(&url);
2378
2379        loop {
2380            let token = match self
2381                .hub
2382                .auth
2383                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2384                .await
2385            {
2386                Ok(token) => token,
2387                Err(e) => match dlg.token(e) {
2388                    Ok(token) => token,
2389                    Err(e) => {
2390                        dlg.finished(false);
2391                        return Err(common::Error::MissingToken(e));
2392                    }
2393                },
2394            };
2395            let mut req_result = {
2396                let client = &self.hub.client;
2397                dlg.pre_request();
2398                let mut req_builder = hyper::Request::builder()
2399                    .method(hyper::Method::GET)
2400                    .uri(url.as_str())
2401                    .header(USER_AGENT, self.hub._user_agent.clone());
2402
2403                if let Some(token) = token.as_ref() {
2404                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2405                }
2406
2407                let request = req_builder
2408                    .header(CONTENT_LENGTH, 0_u64)
2409                    .body(common::to_body::<String>(None));
2410
2411                client.request(request.unwrap()).await
2412            };
2413
2414            match req_result {
2415                Err(err) => {
2416                    if let common::Retry::After(d) = dlg.http_error(&err) {
2417                        sleep(d).await;
2418                        continue;
2419                    }
2420                    dlg.finished(false);
2421                    return Err(common::Error::HttpError(err));
2422                }
2423                Ok(res) => {
2424                    let (mut parts, body) = res.into_parts();
2425                    let mut body = common::Body::new(body);
2426                    if !parts.status.is_success() {
2427                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2428                        let error = serde_json::from_str(&common::to_string(&bytes));
2429                        let response = common::to_response(parts, bytes.into());
2430
2431                        if let common::Retry::After(d) =
2432                            dlg.http_failure(&response, error.as_ref().ok())
2433                        {
2434                            sleep(d).await;
2435                            continue;
2436                        }
2437
2438                        dlg.finished(false);
2439
2440                        return Err(match error {
2441                            Ok(value) => common::Error::BadRequest(value),
2442                            _ => common::Error::Failure(response),
2443                        });
2444                    }
2445                    let response = {
2446                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2447                        let encoded = common::to_string(&bytes);
2448                        match serde_json::from_str(&encoded) {
2449                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2450                            Err(error) => {
2451                                dlg.response_json_decode_error(&encoded, &error);
2452                                return Err(common::Error::JsonDecodeError(
2453                                    encoded.to_string(),
2454                                    error,
2455                                ));
2456                            }
2457                        }
2458                    };
2459
2460                    dlg.finished(true);
2461                    return Ok(response);
2462                }
2463            }
2464        }
2465    }
2466
2467    ///
2468    /// Sets the *project id* path property to the given value.
2469    ///
2470    /// Even though the property as already been set when instantiating this call,
2471    /// we provide this method for API completeness.
2472    pub fn project_id(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
2473        self._project_id = new_value.to_string();
2474        self
2475    }
2476    ///
2477    /// Sets the *region* path property to the given value.
2478    ///
2479    /// Even though the property as already been set when instantiating this call,
2480    /// we provide this method for API completeness.
2481    pub fn region(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
2482        self._region = new_value.to_string();
2483        self
2484    }
2485    /// Specifies a nextPageToken returned by a previous list request. This token can be used to request the next page of results from a previous list request.
2486    ///
2487    /// Sets the *page token* query property to the given value.
2488    pub fn page_token(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
2489        self._page_token = Some(new_value.to_string());
2490        self
2491    }
2492    /// Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)
2493    ///
2494    /// Sets the *max results* query property to the given value.
2495    pub fn max_results(mut self, new_value: i32) -> DeploymentListCall<'a, C> {
2496        self._max_results = Some(new_value);
2497        self
2498    }
2499    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2500    /// while executing the actual API request.
2501    ///
2502    /// ````text
2503    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2504    /// ````
2505    ///
2506    /// Sets the *delegate* property to the given value.
2507    pub fn delegate(
2508        mut self,
2509        new_value: &'a mut dyn common::Delegate,
2510    ) -> DeploymentListCall<'a, C> {
2511        self._delegate = Some(new_value);
2512        self
2513    }
2514
2515    /// Set any additional parameter of the query string used in the request.
2516    /// It should be used to set parameters which are not yet available through their own
2517    /// setters.
2518    ///
2519    /// Please note that this method must not be used to set any of the known parameters
2520    /// which have their own setter method. If done anyway, the request will fail.
2521    ///
2522    /// # Additional Parameters
2523    ///
2524    /// * *alt* (query-string) - Data format for the response.
2525    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2526    /// * *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.
2527    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2528    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2529    /// * *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. Overrides userIp if both are provided.
2530    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2531    pub fn param<T>(mut self, name: T, value: T) -> DeploymentListCall<'a, C>
2532    where
2533        T: AsRef<str>,
2534    {
2535        self._additional_params
2536            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2537        self
2538    }
2539
2540    /// Identifies the authorization scope for the method you are building.
2541    ///
2542    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2543    /// [`Scope::NdevCloudmanReadonly`].
2544    ///
2545    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2546    /// tokens for more than one scope.
2547    ///
2548    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2549    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2550    /// sufficient, a read-write scope will do as well.
2551    pub fn add_scope<St>(mut self, scope: St) -> DeploymentListCall<'a, C>
2552    where
2553        St: AsRef<str>,
2554    {
2555        self._scopes.insert(String::from(scope.as_ref()));
2556        self
2557    }
2558    /// Identifies the authorization scope(s) for the method you are building.
2559    ///
2560    /// See [`Self::add_scope()`] for details.
2561    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentListCall<'a, C>
2562    where
2563        I: IntoIterator<Item = St>,
2564        St: AsRef<str>,
2565    {
2566        self._scopes
2567            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2568        self
2569    }
2570
2571    /// Removes all scopes, and no default scope will be used either.
2572    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2573    /// for details).
2574    pub fn clear_scopes(mut self) -> DeploymentListCall<'a, C> {
2575        self._scopes.clear();
2576        self
2577    }
2578}
2579
2580///
2581///
2582/// A builder for the *delete* method supported by a *template* resource.
2583/// It is not used directly, but through a [`TemplateMethods`] instance.
2584///
2585/// # Example
2586///
2587/// Instantiate a resource method builder
2588///
2589/// ```test_harness,no_run
2590/// # extern crate hyper;
2591/// # extern crate hyper_rustls;
2592/// # extern crate google_manager1_beta2 as manager1_beta2;
2593/// # async fn dox() {
2594/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2595///
2596/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2597/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2598/// #     .with_native_roots()
2599/// #     .unwrap()
2600/// #     .https_only()
2601/// #     .enable_http2()
2602/// #     .build();
2603///
2604/// # let executor = hyper_util::rt::TokioExecutor::new();
2605/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2606/// #     secret,
2607/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2608/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2609/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2610/// #     ),
2611/// # ).build().await.unwrap();
2612///
2613/// # let client = hyper_util::client::legacy::Client::builder(
2614/// #     hyper_util::rt::TokioExecutor::new()
2615/// # )
2616/// # .build(
2617/// #     hyper_rustls::HttpsConnectorBuilder::new()
2618/// #         .with_native_roots()
2619/// #         .unwrap()
2620/// #         .https_or_http()
2621/// #         .enable_http2()
2622/// #         .build()
2623/// # );
2624/// # let mut hub = Manager::new(client, auth);
2625/// // You can configure optional parameters by calling the respective setters at will, and
2626/// // execute the final call using `doit()`.
2627/// // Values shown here are possibly random and not representative !
2628/// let result = hub.templates().delete("projectId", "templateName")
2629///              .doit().await;
2630/// # }
2631/// ```
2632pub struct TemplateDeleteCall<'a, C>
2633where
2634    C: 'a,
2635{
2636    hub: &'a Manager<C>,
2637    _project_id: String,
2638    _template_name: String,
2639    _delegate: Option<&'a mut dyn common::Delegate>,
2640    _additional_params: HashMap<String, String>,
2641    _scopes: BTreeSet<String>,
2642}
2643
2644impl<'a, C> common::CallBuilder for TemplateDeleteCall<'a, C> {}
2645
2646impl<'a, C> TemplateDeleteCall<'a, C>
2647where
2648    C: common::Connector,
2649{
2650    /// Perform the operation you have build so far.
2651    pub async fn doit(mut self) -> common::Result<common::Response> {
2652        use std::borrow::Cow;
2653        use std::io::{Read, Seek};
2654
2655        use common::{url::Params, ToParts};
2656        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2657
2658        let mut dd = common::DefaultDelegate;
2659        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2660        dlg.begin(common::MethodInfo {
2661            id: "manager.templates.delete",
2662            http_method: hyper::Method::DELETE,
2663        });
2664
2665        for &field in ["projectId", "templateName"].iter() {
2666            if self._additional_params.contains_key(field) {
2667                dlg.finished(false);
2668                return Err(common::Error::FieldClash(field));
2669            }
2670        }
2671
2672        let mut params = Params::with_capacity(3 + self._additional_params.len());
2673        params.push("projectId", self._project_id);
2674        params.push("templateName", self._template_name);
2675
2676        params.extend(self._additional_params.iter());
2677
2678        let mut url = self.hub._base_url.clone() + "{projectId}/templates/{templateName}";
2679        if self._scopes.is_empty() {
2680            self._scopes
2681                .insert(Scope::CloudPlatform.as_ref().to_string());
2682        }
2683
2684        #[allow(clippy::single_element_loop)]
2685        for &(find_this, param_name) in [
2686            ("{projectId}", "projectId"),
2687            ("{templateName}", "templateName"),
2688        ]
2689        .iter()
2690        {
2691            url = params.uri_replacement(url, param_name, find_this, false);
2692        }
2693        {
2694            let to_remove = ["templateName", "projectId"];
2695            params.remove_params(&to_remove);
2696        }
2697
2698        let url = params.parse_with_url(&url);
2699
2700        loop {
2701            let token = match self
2702                .hub
2703                .auth
2704                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2705                .await
2706            {
2707                Ok(token) => token,
2708                Err(e) => match dlg.token(e) {
2709                    Ok(token) => token,
2710                    Err(e) => {
2711                        dlg.finished(false);
2712                        return Err(common::Error::MissingToken(e));
2713                    }
2714                },
2715            };
2716            let mut req_result = {
2717                let client = &self.hub.client;
2718                dlg.pre_request();
2719                let mut req_builder = hyper::Request::builder()
2720                    .method(hyper::Method::DELETE)
2721                    .uri(url.as_str())
2722                    .header(USER_AGENT, self.hub._user_agent.clone());
2723
2724                if let Some(token) = token.as_ref() {
2725                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2726                }
2727
2728                let request = req_builder
2729                    .header(CONTENT_LENGTH, 0_u64)
2730                    .body(common::to_body::<String>(None));
2731
2732                client.request(request.unwrap()).await
2733            };
2734
2735            match req_result {
2736                Err(err) => {
2737                    if let common::Retry::After(d) = dlg.http_error(&err) {
2738                        sleep(d).await;
2739                        continue;
2740                    }
2741                    dlg.finished(false);
2742                    return Err(common::Error::HttpError(err));
2743                }
2744                Ok(res) => {
2745                    let (mut parts, body) = res.into_parts();
2746                    let mut body = common::Body::new(body);
2747                    if !parts.status.is_success() {
2748                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2749                        let error = serde_json::from_str(&common::to_string(&bytes));
2750                        let response = common::to_response(parts, bytes.into());
2751
2752                        if let common::Retry::After(d) =
2753                            dlg.http_failure(&response, error.as_ref().ok())
2754                        {
2755                            sleep(d).await;
2756                            continue;
2757                        }
2758
2759                        dlg.finished(false);
2760
2761                        return Err(match error {
2762                            Ok(value) => common::Error::BadRequest(value),
2763                            _ => common::Error::Failure(response),
2764                        });
2765                    }
2766                    let response = common::Response::from_parts(parts, body);
2767
2768                    dlg.finished(true);
2769                    return Ok(response);
2770                }
2771            }
2772        }
2773    }
2774
2775    ///
2776    /// Sets the *project id* path property to the given value.
2777    ///
2778    /// Even though the property as already been set when instantiating this call,
2779    /// we provide this method for API completeness.
2780    pub fn project_id(mut self, new_value: &str) -> TemplateDeleteCall<'a, C> {
2781        self._project_id = new_value.to_string();
2782        self
2783    }
2784    ///
2785    /// Sets the *template name* path property to the given value.
2786    ///
2787    /// Even though the property as already been set when instantiating this call,
2788    /// we provide this method for API completeness.
2789    pub fn template_name(mut self, new_value: &str) -> TemplateDeleteCall<'a, C> {
2790        self._template_name = new_value.to_string();
2791        self
2792    }
2793    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2794    /// while executing the actual API request.
2795    ///
2796    /// ````text
2797    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2798    /// ````
2799    ///
2800    /// Sets the *delegate* property to the given value.
2801    pub fn delegate(
2802        mut self,
2803        new_value: &'a mut dyn common::Delegate,
2804    ) -> TemplateDeleteCall<'a, C> {
2805        self._delegate = Some(new_value);
2806        self
2807    }
2808
2809    /// Set any additional parameter of the query string used in the request.
2810    /// It should be used to set parameters which are not yet available through their own
2811    /// setters.
2812    ///
2813    /// Please note that this method must not be used to set any of the known parameters
2814    /// which have their own setter method. If done anyway, the request will fail.
2815    ///
2816    /// # Additional Parameters
2817    ///
2818    /// * *alt* (query-string) - Data format for the response.
2819    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2820    /// * *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.
2821    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2822    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2823    /// * *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. Overrides userIp if both are provided.
2824    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2825    pub fn param<T>(mut self, name: T, value: T) -> TemplateDeleteCall<'a, C>
2826    where
2827        T: AsRef<str>,
2828    {
2829        self._additional_params
2830            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2831        self
2832    }
2833
2834    /// Identifies the authorization scope for the method you are building.
2835    ///
2836    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2837    /// [`Scope::CloudPlatform`].
2838    ///
2839    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2840    /// tokens for more than one scope.
2841    ///
2842    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2843    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2844    /// sufficient, a read-write scope will do as well.
2845    pub fn add_scope<St>(mut self, scope: St) -> TemplateDeleteCall<'a, C>
2846    where
2847        St: AsRef<str>,
2848    {
2849        self._scopes.insert(String::from(scope.as_ref()));
2850        self
2851    }
2852    /// Identifies the authorization scope(s) for the method you are building.
2853    ///
2854    /// See [`Self::add_scope()`] for details.
2855    pub fn add_scopes<I, St>(mut self, scopes: I) -> TemplateDeleteCall<'a, C>
2856    where
2857        I: IntoIterator<Item = St>,
2858        St: AsRef<str>,
2859    {
2860        self._scopes
2861            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2862        self
2863    }
2864
2865    /// Removes all scopes, and no default scope will be used either.
2866    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2867    /// for details).
2868    pub fn clear_scopes(mut self) -> TemplateDeleteCall<'a, C> {
2869        self._scopes.clear();
2870        self
2871    }
2872}
2873
2874///
2875///
2876/// A builder for the *get* method supported by a *template* resource.
2877/// It is not used directly, but through a [`TemplateMethods`] instance.
2878///
2879/// # Example
2880///
2881/// Instantiate a resource method builder
2882///
2883/// ```test_harness,no_run
2884/// # extern crate hyper;
2885/// # extern crate hyper_rustls;
2886/// # extern crate google_manager1_beta2 as manager1_beta2;
2887/// # async fn dox() {
2888/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2889///
2890/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2891/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2892/// #     .with_native_roots()
2893/// #     .unwrap()
2894/// #     .https_only()
2895/// #     .enable_http2()
2896/// #     .build();
2897///
2898/// # let executor = hyper_util::rt::TokioExecutor::new();
2899/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2900/// #     secret,
2901/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2902/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2903/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2904/// #     ),
2905/// # ).build().await.unwrap();
2906///
2907/// # let client = hyper_util::client::legacy::Client::builder(
2908/// #     hyper_util::rt::TokioExecutor::new()
2909/// # )
2910/// # .build(
2911/// #     hyper_rustls::HttpsConnectorBuilder::new()
2912/// #         .with_native_roots()
2913/// #         .unwrap()
2914/// #         .https_or_http()
2915/// #         .enable_http2()
2916/// #         .build()
2917/// # );
2918/// # let mut hub = Manager::new(client, auth);
2919/// // You can configure optional parameters by calling the respective setters at will, and
2920/// // execute the final call using `doit()`.
2921/// // Values shown here are possibly random and not representative !
2922/// let result = hub.templates().get("projectId", "templateName")
2923///              .doit().await;
2924/// # }
2925/// ```
2926pub struct TemplateGetCall<'a, C>
2927where
2928    C: 'a,
2929{
2930    hub: &'a Manager<C>,
2931    _project_id: String,
2932    _template_name: String,
2933    _delegate: Option<&'a mut dyn common::Delegate>,
2934    _additional_params: HashMap<String, String>,
2935    _scopes: BTreeSet<String>,
2936}
2937
2938impl<'a, C> common::CallBuilder for TemplateGetCall<'a, C> {}
2939
2940impl<'a, C> TemplateGetCall<'a, C>
2941where
2942    C: common::Connector,
2943{
2944    /// Perform the operation you have build so far.
2945    pub async fn doit(mut self) -> common::Result<(common::Response, Template)> {
2946        use std::borrow::Cow;
2947        use std::io::{Read, Seek};
2948
2949        use common::{url::Params, ToParts};
2950        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2951
2952        let mut dd = common::DefaultDelegate;
2953        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2954        dlg.begin(common::MethodInfo {
2955            id: "manager.templates.get",
2956            http_method: hyper::Method::GET,
2957        });
2958
2959        for &field in ["alt", "projectId", "templateName"].iter() {
2960            if self._additional_params.contains_key(field) {
2961                dlg.finished(false);
2962                return Err(common::Error::FieldClash(field));
2963            }
2964        }
2965
2966        let mut params = Params::with_capacity(4 + self._additional_params.len());
2967        params.push("projectId", self._project_id);
2968        params.push("templateName", self._template_name);
2969
2970        params.extend(self._additional_params.iter());
2971
2972        params.push("alt", "json");
2973        let mut url = self.hub._base_url.clone() + "{projectId}/templates/{templateName}";
2974        if self._scopes.is_empty() {
2975            self._scopes
2976                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
2977        }
2978
2979        #[allow(clippy::single_element_loop)]
2980        for &(find_this, param_name) in [
2981            ("{projectId}", "projectId"),
2982            ("{templateName}", "templateName"),
2983        ]
2984        .iter()
2985        {
2986            url = params.uri_replacement(url, param_name, find_this, false);
2987        }
2988        {
2989            let to_remove = ["templateName", "projectId"];
2990            params.remove_params(&to_remove);
2991        }
2992
2993        let url = params.parse_with_url(&url);
2994
2995        loop {
2996            let token = match self
2997                .hub
2998                .auth
2999                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3000                .await
3001            {
3002                Ok(token) => token,
3003                Err(e) => match dlg.token(e) {
3004                    Ok(token) => token,
3005                    Err(e) => {
3006                        dlg.finished(false);
3007                        return Err(common::Error::MissingToken(e));
3008                    }
3009                },
3010            };
3011            let mut req_result = {
3012                let client = &self.hub.client;
3013                dlg.pre_request();
3014                let mut req_builder = hyper::Request::builder()
3015                    .method(hyper::Method::GET)
3016                    .uri(url.as_str())
3017                    .header(USER_AGENT, self.hub._user_agent.clone());
3018
3019                if let Some(token) = token.as_ref() {
3020                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3021                }
3022
3023                let request = req_builder
3024                    .header(CONTENT_LENGTH, 0_u64)
3025                    .body(common::to_body::<String>(None));
3026
3027                client.request(request.unwrap()).await
3028            };
3029
3030            match req_result {
3031                Err(err) => {
3032                    if let common::Retry::After(d) = dlg.http_error(&err) {
3033                        sleep(d).await;
3034                        continue;
3035                    }
3036                    dlg.finished(false);
3037                    return Err(common::Error::HttpError(err));
3038                }
3039                Ok(res) => {
3040                    let (mut parts, body) = res.into_parts();
3041                    let mut body = common::Body::new(body);
3042                    if !parts.status.is_success() {
3043                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3044                        let error = serde_json::from_str(&common::to_string(&bytes));
3045                        let response = common::to_response(parts, bytes.into());
3046
3047                        if let common::Retry::After(d) =
3048                            dlg.http_failure(&response, error.as_ref().ok())
3049                        {
3050                            sleep(d).await;
3051                            continue;
3052                        }
3053
3054                        dlg.finished(false);
3055
3056                        return Err(match error {
3057                            Ok(value) => common::Error::BadRequest(value),
3058                            _ => common::Error::Failure(response),
3059                        });
3060                    }
3061                    let response = {
3062                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3063                        let encoded = common::to_string(&bytes);
3064                        match serde_json::from_str(&encoded) {
3065                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3066                            Err(error) => {
3067                                dlg.response_json_decode_error(&encoded, &error);
3068                                return Err(common::Error::JsonDecodeError(
3069                                    encoded.to_string(),
3070                                    error,
3071                                ));
3072                            }
3073                        }
3074                    };
3075
3076                    dlg.finished(true);
3077                    return Ok(response);
3078                }
3079            }
3080        }
3081    }
3082
3083    ///
3084    /// Sets the *project id* path property to the given value.
3085    ///
3086    /// Even though the property as already been set when instantiating this call,
3087    /// we provide this method for API completeness.
3088    pub fn project_id(mut self, new_value: &str) -> TemplateGetCall<'a, C> {
3089        self._project_id = new_value.to_string();
3090        self
3091    }
3092    ///
3093    /// Sets the *template name* path property to the given value.
3094    ///
3095    /// Even though the property as already been set when instantiating this call,
3096    /// we provide this method for API completeness.
3097    pub fn template_name(mut self, new_value: &str) -> TemplateGetCall<'a, C> {
3098        self._template_name = new_value.to_string();
3099        self
3100    }
3101    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3102    /// while executing the actual API request.
3103    ///
3104    /// ````text
3105    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3106    /// ````
3107    ///
3108    /// Sets the *delegate* property to the given value.
3109    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TemplateGetCall<'a, C> {
3110        self._delegate = Some(new_value);
3111        self
3112    }
3113
3114    /// Set any additional parameter of the query string used in the request.
3115    /// It should be used to set parameters which are not yet available through their own
3116    /// setters.
3117    ///
3118    /// Please note that this method must not be used to set any of the known parameters
3119    /// which have their own setter method. If done anyway, the request will fail.
3120    ///
3121    /// # Additional Parameters
3122    ///
3123    /// * *alt* (query-string) - Data format for the response.
3124    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3125    /// * *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.
3126    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3127    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3128    /// * *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. Overrides userIp if both are provided.
3129    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3130    pub fn param<T>(mut self, name: T, value: T) -> TemplateGetCall<'a, C>
3131    where
3132        T: AsRef<str>,
3133    {
3134        self._additional_params
3135            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3136        self
3137    }
3138
3139    /// Identifies the authorization scope for the method you are building.
3140    ///
3141    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3142    /// [`Scope::NdevCloudmanReadonly`].
3143    ///
3144    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3145    /// tokens for more than one scope.
3146    ///
3147    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3148    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3149    /// sufficient, a read-write scope will do as well.
3150    pub fn add_scope<St>(mut self, scope: St) -> TemplateGetCall<'a, C>
3151    where
3152        St: AsRef<str>,
3153    {
3154        self._scopes.insert(String::from(scope.as_ref()));
3155        self
3156    }
3157    /// Identifies the authorization scope(s) for the method you are building.
3158    ///
3159    /// See [`Self::add_scope()`] for details.
3160    pub fn add_scopes<I, St>(mut self, scopes: I) -> TemplateGetCall<'a, C>
3161    where
3162        I: IntoIterator<Item = St>,
3163        St: AsRef<str>,
3164    {
3165        self._scopes
3166            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3167        self
3168    }
3169
3170    /// Removes all scopes, and no default scope will be used either.
3171    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3172    /// for details).
3173    pub fn clear_scopes(mut self) -> TemplateGetCall<'a, C> {
3174        self._scopes.clear();
3175        self
3176    }
3177}
3178
3179///
3180///
3181/// A builder for the *insert* method supported by a *template* resource.
3182/// It is not used directly, but through a [`TemplateMethods`] instance.
3183///
3184/// # Example
3185///
3186/// Instantiate a resource method builder
3187///
3188/// ```test_harness,no_run
3189/// # extern crate hyper;
3190/// # extern crate hyper_rustls;
3191/// # extern crate google_manager1_beta2 as manager1_beta2;
3192/// use manager1_beta2::api::Template;
3193/// # async fn dox() {
3194/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3195///
3196/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3197/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3198/// #     .with_native_roots()
3199/// #     .unwrap()
3200/// #     .https_only()
3201/// #     .enable_http2()
3202/// #     .build();
3203///
3204/// # let executor = hyper_util::rt::TokioExecutor::new();
3205/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3206/// #     secret,
3207/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3208/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3209/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3210/// #     ),
3211/// # ).build().await.unwrap();
3212///
3213/// # let client = hyper_util::client::legacy::Client::builder(
3214/// #     hyper_util::rt::TokioExecutor::new()
3215/// # )
3216/// # .build(
3217/// #     hyper_rustls::HttpsConnectorBuilder::new()
3218/// #         .with_native_roots()
3219/// #         .unwrap()
3220/// #         .https_or_http()
3221/// #         .enable_http2()
3222/// #         .build()
3223/// # );
3224/// # let mut hub = Manager::new(client, auth);
3225/// // As the method needs a request, you would usually fill it with the desired information
3226/// // into the respective structure. Some of the parts shown here might not be applicable !
3227/// // Values shown here are possibly random and not representative !
3228/// let mut req = Template::default();
3229///
3230/// // You can configure optional parameters by calling the respective setters at will, and
3231/// // execute the final call using `doit()`.
3232/// // Values shown here are possibly random and not representative !
3233/// let result = hub.templates().insert(req, "projectId")
3234///              .doit().await;
3235/// # }
3236/// ```
3237pub struct TemplateInsertCall<'a, C>
3238where
3239    C: 'a,
3240{
3241    hub: &'a Manager<C>,
3242    _request: Template,
3243    _project_id: String,
3244    _delegate: Option<&'a mut dyn common::Delegate>,
3245    _additional_params: HashMap<String, String>,
3246    _scopes: BTreeSet<String>,
3247}
3248
3249impl<'a, C> common::CallBuilder for TemplateInsertCall<'a, C> {}
3250
3251impl<'a, C> TemplateInsertCall<'a, C>
3252where
3253    C: common::Connector,
3254{
3255    /// Perform the operation you have build so far.
3256    pub async fn doit(mut self) -> common::Result<(common::Response, Template)> {
3257        use std::borrow::Cow;
3258        use std::io::{Read, Seek};
3259
3260        use common::{url::Params, ToParts};
3261        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3262
3263        let mut dd = common::DefaultDelegate;
3264        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3265        dlg.begin(common::MethodInfo {
3266            id: "manager.templates.insert",
3267            http_method: hyper::Method::POST,
3268        });
3269
3270        for &field in ["alt", "projectId"].iter() {
3271            if self._additional_params.contains_key(field) {
3272                dlg.finished(false);
3273                return Err(common::Error::FieldClash(field));
3274            }
3275        }
3276
3277        let mut params = Params::with_capacity(4 + self._additional_params.len());
3278        params.push("projectId", self._project_id);
3279
3280        params.extend(self._additional_params.iter());
3281
3282        params.push("alt", "json");
3283        let mut url = self.hub._base_url.clone() + "{projectId}/templates";
3284        if self._scopes.is_empty() {
3285            self._scopes
3286                .insert(Scope::CloudPlatform.as_ref().to_string());
3287        }
3288
3289        #[allow(clippy::single_element_loop)]
3290        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
3291            url = params.uri_replacement(url, param_name, find_this, false);
3292        }
3293        {
3294            let to_remove = ["projectId"];
3295            params.remove_params(&to_remove);
3296        }
3297
3298        let url = params.parse_with_url(&url);
3299
3300        let mut json_mime_type = mime::APPLICATION_JSON;
3301        let mut request_value_reader = {
3302            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3303            common::remove_json_null_values(&mut value);
3304            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3305            serde_json::to_writer(&mut dst, &value).unwrap();
3306            dst
3307        };
3308        let request_size = request_value_reader
3309            .seek(std::io::SeekFrom::End(0))
3310            .unwrap();
3311        request_value_reader
3312            .seek(std::io::SeekFrom::Start(0))
3313            .unwrap();
3314
3315        loop {
3316            let token = match self
3317                .hub
3318                .auth
3319                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3320                .await
3321            {
3322                Ok(token) => token,
3323                Err(e) => match dlg.token(e) {
3324                    Ok(token) => token,
3325                    Err(e) => {
3326                        dlg.finished(false);
3327                        return Err(common::Error::MissingToken(e));
3328                    }
3329                },
3330            };
3331            request_value_reader
3332                .seek(std::io::SeekFrom::Start(0))
3333                .unwrap();
3334            let mut req_result = {
3335                let client = &self.hub.client;
3336                dlg.pre_request();
3337                let mut req_builder = hyper::Request::builder()
3338                    .method(hyper::Method::POST)
3339                    .uri(url.as_str())
3340                    .header(USER_AGENT, self.hub._user_agent.clone());
3341
3342                if let Some(token) = token.as_ref() {
3343                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3344                }
3345
3346                let request = req_builder
3347                    .header(CONTENT_TYPE, json_mime_type.to_string())
3348                    .header(CONTENT_LENGTH, request_size as u64)
3349                    .body(common::to_body(
3350                        request_value_reader.get_ref().clone().into(),
3351                    ));
3352
3353                client.request(request.unwrap()).await
3354            };
3355
3356            match req_result {
3357                Err(err) => {
3358                    if let common::Retry::After(d) = dlg.http_error(&err) {
3359                        sleep(d).await;
3360                        continue;
3361                    }
3362                    dlg.finished(false);
3363                    return Err(common::Error::HttpError(err));
3364                }
3365                Ok(res) => {
3366                    let (mut parts, body) = res.into_parts();
3367                    let mut body = common::Body::new(body);
3368                    if !parts.status.is_success() {
3369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3370                        let error = serde_json::from_str(&common::to_string(&bytes));
3371                        let response = common::to_response(parts, bytes.into());
3372
3373                        if let common::Retry::After(d) =
3374                            dlg.http_failure(&response, error.as_ref().ok())
3375                        {
3376                            sleep(d).await;
3377                            continue;
3378                        }
3379
3380                        dlg.finished(false);
3381
3382                        return Err(match error {
3383                            Ok(value) => common::Error::BadRequest(value),
3384                            _ => common::Error::Failure(response),
3385                        });
3386                    }
3387                    let response = {
3388                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3389                        let encoded = common::to_string(&bytes);
3390                        match serde_json::from_str(&encoded) {
3391                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3392                            Err(error) => {
3393                                dlg.response_json_decode_error(&encoded, &error);
3394                                return Err(common::Error::JsonDecodeError(
3395                                    encoded.to_string(),
3396                                    error,
3397                                ));
3398                            }
3399                        }
3400                    };
3401
3402                    dlg.finished(true);
3403                    return Ok(response);
3404                }
3405            }
3406        }
3407    }
3408
3409    ///
3410    /// Sets the *request* property to the given value.
3411    ///
3412    /// Even though the property as already been set when instantiating this call,
3413    /// we provide this method for API completeness.
3414    pub fn request(mut self, new_value: Template) -> TemplateInsertCall<'a, C> {
3415        self._request = new_value;
3416        self
3417    }
3418    ///
3419    /// Sets the *project id* path property to the given value.
3420    ///
3421    /// Even though the property as already been set when instantiating this call,
3422    /// we provide this method for API completeness.
3423    pub fn project_id(mut self, new_value: &str) -> TemplateInsertCall<'a, C> {
3424        self._project_id = new_value.to_string();
3425        self
3426    }
3427    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3428    /// while executing the actual API request.
3429    ///
3430    /// ````text
3431    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3432    /// ````
3433    ///
3434    /// Sets the *delegate* property to the given value.
3435    pub fn delegate(
3436        mut self,
3437        new_value: &'a mut dyn common::Delegate,
3438    ) -> TemplateInsertCall<'a, C> {
3439        self._delegate = Some(new_value);
3440        self
3441    }
3442
3443    /// Set any additional parameter of the query string used in the request.
3444    /// It should be used to set parameters which are not yet available through their own
3445    /// setters.
3446    ///
3447    /// Please note that this method must not be used to set any of the known parameters
3448    /// which have their own setter method. If done anyway, the request will fail.
3449    ///
3450    /// # Additional Parameters
3451    ///
3452    /// * *alt* (query-string) - Data format for the response.
3453    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3454    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3455    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3456    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3457    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
3458    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3459    pub fn param<T>(mut self, name: T, value: T) -> TemplateInsertCall<'a, C>
3460    where
3461        T: AsRef<str>,
3462    {
3463        self._additional_params
3464            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3465        self
3466    }
3467
3468    /// Identifies the authorization scope for the method you are building.
3469    ///
3470    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3471    /// [`Scope::CloudPlatform`].
3472    ///
3473    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3474    /// tokens for more than one scope.
3475    ///
3476    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3477    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3478    /// sufficient, a read-write scope will do as well.
3479    pub fn add_scope<St>(mut self, scope: St) -> TemplateInsertCall<'a, C>
3480    where
3481        St: AsRef<str>,
3482    {
3483        self._scopes.insert(String::from(scope.as_ref()));
3484        self
3485    }
3486    /// Identifies the authorization scope(s) for the method you are building.
3487    ///
3488    /// See [`Self::add_scope()`] for details.
3489    pub fn add_scopes<I, St>(mut self, scopes: I) -> TemplateInsertCall<'a, C>
3490    where
3491        I: IntoIterator<Item = St>,
3492        St: AsRef<str>,
3493    {
3494        self._scopes
3495            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3496        self
3497    }
3498
3499    /// Removes all scopes, and no default scope will be used either.
3500    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3501    /// for details).
3502    pub fn clear_scopes(mut self) -> TemplateInsertCall<'a, C> {
3503        self._scopes.clear();
3504        self
3505    }
3506}
3507
3508///
3509///
3510/// A builder for the *list* method supported by a *template* resource.
3511/// It is not used directly, but through a [`TemplateMethods`] instance.
3512///
3513/// # Example
3514///
3515/// Instantiate a resource method builder
3516///
3517/// ```test_harness,no_run
3518/// # extern crate hyper;
3519/// # extern crate hyper_rustls;
3520/// # extern crate google_manager1_beta2 as manager1_beta2;
3521/// # async fn dox() {
3522/// # use manager1_beta2::{Manager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3523///
3524/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3525/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3526/// #     .with_native_roots()
3527/// #     .unwrap()
3528/// #     .https_only()
3529/// #     .enable_http2()
3530/// #     .build();
3531///
3532/// # let executor = hyper_util::rt::TokioExecutor::new();
3533/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3534/// #     secret,
3535/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3536/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3537/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3538/// #     ),
3539/// # ).build().await.unwrap();
3540///
3541/// # let client = hyper_util::client::legacy::Client::builder(
3542/// #     hyper_util::rt::TokioExecutor::new()
3543/// # )
3544/// # .build(
3545/// #     hyper_rustls::HttpsConnectorBuilder::new()
3546/// #         .with_native_roots()
3547/// #         .unwrap()
3548/// #         .https_or_http()
3549/// #         .enable_http2()
3550/// #         .build()
3551/// # );
3552/// # let mut hub = Manager::new(client, auth);
3553/// // You can configure optional parameters by calling the respective setters at will, and
3554/// // execute the final call using `doit()`.
3555/// // Values shown here are possibly random and not representative !
3556/// let result = hub.templates().list("projectId")
3557///              .page_token("ipsum")
3558///              .max_results(-7)
3559///              .doit().await;
3560/// # }
3561/// ```
3562pub struct TemplateListCall<'a, C>
3563where
3564    C: 'a,
3565{
3566    hub: &'a Manager<C>,
3567    _project_id: String,
3568    _page_token: Option<String>,
3569    _max_results: Option<i32>,
3570    _delegate: Option<&'a mut dyn common::Delegate>,
3571    _additional_params: HashMap<String, String>,
3572    _scopes: BTreeSet<String>,
3573}
3574
3575impl<'a, C> common::CallBuilder for TemplateListCall<'a, C> {}
3576
3577impl<'a, C> TemplateListCall<'a, C>
3578where
3579    C: common::Connector,
3580{
3581    /// Perform the operation you have build so far.
3582    pub async fn doit(mut self) -> common::Result<(common::Response, TemplatesListResponse)> {
3583        use std::borrow::Cow;
3584        use std::io::{Read, Seek};
3585
3586        use common::{url::Params, ToParts};
3587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3588
3589        let mut dd = common::DefaultDelegate;
3590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3591        dlg.begin(common::MethodInfo {
3592            id: "manager.templates.list",
3593            http_method: hyper::Method::GET,
3594        });
3595
3596        for &field in ["alt", "projectId", "pageToken", "maxResults"].iter() {
3597            if self._additional_params.contains_key(field) {
3598                dlg.finished(false);
3599                return Err(common::Error::FieldClash(field));
3600            }
3601        }
3602
3603        let mut params = Params::with_capacity(5 + self._additional_params.len());
3604        params.push("projectId", self._project_id);
3605        if let Some(value) = self._page_token.as_ref() {
3606            params.push("pageToken", value);
3607        }
3608        if let Some(value) = self._max_results.as_ref() {
3609            params.push("maxResults", value.to_string());
3610        }
3611
3612        params.extend(self._additional_params.iter());
3613
3614        params.push("alt", "json");
3615        let mut url = self.hub._base_url.clone() + "{projectId}/templates";
3616        if self._scopes.is_empty() {
3617            self._scopes
3618                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
3619        }
3620
3621        #[allow(clippy::single_element_loop)]
3622        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
3623            url = params.uri_replacement(url, param_name, find_this, false);
3624        }
3625        {
3626            let to_remove = ["projectId"];
3627            params.remove_params(&to_remove);
3628        }
3629
3630        let url = params.parse_with_url(&url);
3631
3632        loop {
3633            let token = match self
3634                .hub
3635                .auth
3636                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3637                .await
3638            {
3639                Ok(token) => token,
3640                Err(e) => match dlg.token(e) {
3641                    Ok(token) => token,
3642                    Err(e) => {
3643                        dlg.finished(false);
3644                        return Err(common::Error::MissingToken(e));
3645                    }
3646                },
3647            };
3648            let mut req_result = {
3649                let client = &self.hub.client;
3650                dlg.pre_request();
3651                let mut req_builder = hyper::Request::builder()
3652                    .method(hyper::Method::GET)
3653                    .uri(url.as_str())
3654                    .header(USER_AGENT, self.hub._user_agent.clone());
3655
3656                if let Some(token) = token.as_ref() {
3657                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3658                }
3659
3660                let request = req_builder
3661                    .header(CONTENT_LENGTH, 0_u64)
3662                    .body(common::to_body::<String>(None));
3663
3664                client.request(request.unwrap()).await
3665            };
3666
3667            match req_result {
3668                Err(err) => {
3669                    if let common::Retry::After(d) = dlg.http_error(&err) {
3670                        sleep(d).await;
3671                        continue;
3672                    }
3673                    dlg.finished(false);
3674                    return Err(common::Error::HttpError(err));
3675                }
3676                Ok(res) => {
3677                    let (mut parts, body) = res.into_parts();
3678                    let mut body = common::Body::new(body);
3679                    if !parts.status.is_success() {
3680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3681                        let error = serde_json::from_str(&common::to_string(&bytes));
3682                        let response = common::to_response(parts, bytes.into());
3683
3684                        if let common::Retry::After(d) =
3685                            dlg.http_failure(&response, error.as_ref().ok())
3686                        {
3687                            sleep(d).await;
3688                            continue;
3689                        }
3690
3691                        dlg.finished(false);
3692
3693                        return Err(match error {
3694                            Ok(value) => common::Error::BadRequest(value),
3695                            _ => common::Error::Failure(response),
3696                        });
3697                    }
3698                    let response = {
3699                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3700                        let encoded = common::to_string(&bytes);
3701                        match serde_json::from_str(&encoded) {
3702                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3703                            Err(error) => {
3704                                dlg.response_json_decode_error(&encoded, &error);
3705                                return Err(common::Error::JsonDecodeError(
3706                                    encoded.to_string(),
3707                                    error,
3708                                ));
3709                            }
3710                        }
3711                    };
3712
3713                    dlg.finished(true);
3714                    return Ok(response);
3715                }
3716            }
3717        }
3718    }
3719
3720    ///
3721    /// Sets the *project id* path property to the given value.
3722    ///
3723    /// Even though the property as already been set when instantiating this call,
3724    /// we provide this method for API completeness.
3725    pub fn project_id(mut self, new_value: &str) -> TemplateListCall<'a, C> {
3726        self._project_id = new_value.to_string();
3727        self
3728    }
3729    /// Specifies a nextPageToken returned by a previous list request. This token can be used to request the next page of results from a previous list request.
3730    ///
3731    /// Sets the *page token* query property to the given value.
3732    pub fn page_token(mut self, new_value: &str) -> TemplateListCall<'a, C> {
3733        self._page_token = Some(new_value.to_string());
3734        self
3735    }
3736    /// Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)
3737    ///
3738    /// Sets the *max results* query property to the given value.
3739    pub fn max_results(mut self, new_value: i32) -> TemplateListCall<'a, C> {
3740        self._max_results = Some(new_value);
3741        self
3742    }
3743    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3744    /// while executing the actual API request.
3745    ///
3746    /// ````text
3747    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3748    /// ````
3749    ///
3750    /// Sets the *delegate* property to the given value.
3751    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TemplateListCall<'a, C> {
3752        self._delegate = Some(new_value);
3753        self
3754    }
3755
3756    /// Set any additional parameter of the query string used in the request.
3757    /// It should be used to set parameters which are not yet available through their own
3758    /// setters.
3759    ///
3760    /// Please note that this method must not be used to set any of the known parameters
3761    /// which have their own setter method. If done anyway, the request will fail.
3762    ///
3763    /// # Additional Parameters
3764    ///
3765    /// * *alt* (query-string) - Data format for the response.
3766    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3767    /// * *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.
3768    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3769    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3770    /// * *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. Overrides userIp if both are provided.
3771    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3772    pub fn param<T>(mut self, name: T, value: T) -> TemplateListCall<'a, C>
3773    where
3774        T: AsRef<str>,
3775    {
3776        self._additional_params
3777            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3778        self
3779    }
3780
3781    /// Identifies the authorization scope for the method you are building.
3782    ///
3783    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3784    /// [`Scope::NdevCloudmanReadonly`].
3785    ///
3786    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3787    /// tokens for more than one scope.
3788    ///
3789    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3790    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3791    /// sufficient, a read-write scope will do as well.
3792    pub fn add_scope<St>(mut self, scope: St) -> TemplateListCall<'a, C>
3793    where
3794        St: AsRef<str>,
3795    {
3796        self._scopes.insert(String::from(scope.as_ref()));
3797        self
3798    }
3799    /// Identifies the authorization scope(s) for the method you are building.
3800    ///
3801    /// See [`Self::add_scope()`] for details.
3802    pub fn add_scopes<I, St>(mut self, scopes: I) -> TemplateListCall<'a, C>
3803    where
3804        I: IntoIterator<Item = St>,
3805        St: AsRef<str>,
3806    {
3807        self._scopes
3808            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3809        self
3810    }
3811
3812    /// Removes all scopes, and no default scope will be used either.
3813    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3814    /// for details).
3815    pub fn clear_scopes(mut self) -> TemplateListCall<'a, C> {
3816        self._scopes.clear();
3817        self
3818    }
3819}