google_appengine1_beta4/
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    Admin,
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
26impl AsRef<str> for Scope {
27    fn as_ref(&self) -> &str {
28        match *self {
29            Scope::Admin => "https://www.googleapis.com/auth/appengine.admin",
30            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
31            Scope::CloudPlatformReadOnly => {
32                "https://www.googleapis.com/auth/cloud-platform.read-only"
33            }
34        }
35    }
36}
37
38#[allow(clippy::derivable_impls)]
39impl Default for Scope {
40    fn default() -> Scope {
41        Scope::CloudPlatform
42    }
43}
44
45// ########
46// HUB ###
47// ######
48
49/// Central instance to access all Appengine related resource activities
50///
51/// # Examples
52///
53/// Instantiate a new hub
54///
55/// ```test_harness,no_run
56/// extern crate hyper;
57/// extern crate hyper_rustls;
58/// extern crate google_appengine1_beta4 as appengine1_beta4;
59/// use appengine1_beta4::api::DebugInstanceRequest;
60/// use appengine1_beta4::{Result, Error};
61/// # async fn dox() {
62/// use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
63///
64/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
65/// // `client_secret`, among other things.
66/// let secret: yup_oauth2::ApplicationSecret = Default::default();
67/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
68/// // unless you replace  `None` with the desired Flow.
69/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
70/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
71/// // retrieve them from storage.
72/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
73///     .with_native_roots()
74///     .unwrap()
75///     .https_only()
76///     .enable_http2()
77///     .build();
78///
79/// let executor = hyper_util::rt::TokioExecutor::new();
80/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
81///     secret,
82///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
83///     yup_oauth2::client::CustomHyperClientBuilder::from(
84///         hyper_util::client::legacy::Client::builder(executor).build(connector),
85///     ),
86/// ).build().await.unwrap();
87///
88/// let client = hyper_util::client::legacy::Client::builder(
89///     hyper_util::rt::TokioExecutor::new()
90/// )
91/// .build(
92///     hyper_rustls::HttpsConnectorBuilder::new()
93///         .with_native_roots()
94///         .unwrap()
95///         .https_or_http()
96///         .enable_http2()
97///         .build()
98/// );
99/// let mut hub = Appengine::new(client, auth);
100/// // As the method needs a request, you would usually fill it with the desired information
101/// // into the respective structure. Some of the parts shown here might not be applicable !
102/// // Values shown here are possibly random and not representative !
103/// let mut req = DebugInstanceRequest::default();
104///
105/// // You can configure optional parameters by calling the respective setters at will, and
106/// // execute the final call using `doit()`.
107/// // Values shown here are possibly random and not representative !
108/// let result = hub.apps().modules_versions_instances_debug(req, "appsId", "modulesId", "versionsId", "instancesId")
109///              .doit().await;
110///
111/// match result {
112///     Err(e) => match e {
113///         // The Error enum provides details about what exactly happened.
114///         // You can also just use its `Debug`, `Display` or `Error` traits
115///          Error::HttpError(_)
116///         |Error::Io(_)
117///         |Error::MissingAPIKey
118///         |Error::MissingToken(_)
119///         |Error::Cancelled
120///         |Error::UploadSizeLimitExceeded(_, _)
121///         |Error::Failure(_)
122///         |Error::BadRequest(_)
123///         |Error::FieldClash(_)
124///         |Error::JsonDecodeError(_, _) => println!("{}", e),
125///     },
126///     Ok(res) => println!("Success: {:?}", res),
127/// }
128/// # }
129/// ```
130#[derive(Clone)]
131pub struct Appengine<C> {
132    pub client: common::Client<C>,
133    pub auth: Box<dyn common::GetToken>,
134    _user_agent: String,
135    _base_url: String,
136    _root_url: String,
137}
138
139impl<C> common::Hub for Appengine<C> {}
140
141impl<'a, C> Appengine<C> {
142    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Appengine<C> {
143        Appengine {
144            client,
145            auth: Box::new(auth),
146            _user_agent: "google-api-rust-client/7.0.0".to_string(),
147            _base_url: "https://appengine.googleapis.com/".to_string(),
148            _root_url: "https://appengine.googleapis.com/".to_string(),
149        }
150    }
151
152    pub fn apps(&'a self) -> AppMethods<'a, C> {
153        AppMethods { hub: self }
154    }
155
156    /// Set the user-agent header field to use in all requests to the server.
157    /// It defaults to `google-api-rust-client/7.0.0`.
158    ///
159    /// Returns the previously set user-agent.
160    pub fn user_agent(&mut self, agent_name: String) -> String {
161        std::mem::replace(&mut self._user_agent, agent_name)
162    }
163
164    /// Set the base url to use in all requests to the server.
165    /// It defaults to `https://appengine.googleapis.com/`.
166    ///
167    /// Returns the previously set base url.
168    pub fn base_url(&mut self, new_base_url: String) -> String {
169        std::mem::replace(&mut self._base_url, new_base_url)
170    }
171
172    /// Set the root url to use in all requests to the server.
173    /// It defaults to `https://appengine.googleapis.com/`.
174    ///
175    /// Returns the previously set root url.
176    pub fn root_url(&mut self, new_root_url: String) -> String {
177        std::mem::replace(&mut self._root_url, new_root_url)
178    }
179}
180
181// ############
182// SCHEMAS ###
183// ##########
184/// Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.
185///
186/// This type is not used in any activity, and only used as *part* of another schema.
187///
188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
189#[serde_with::serde_as]
190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
191pub struct ApiConfigHandler {
192    /// Action to take when users access resources that require authentication. Defaults to redirect.
193    #[serde(rename = "authFailAction")]
194    pub auth_fail_action: Option<String>,
195    /// Level of login required to access this resource. Defaults to optional.
196    pub login: Option<String>,
197    /// Path to the script from the application root directory.
198    pub script: Option<String>,
199    /// Security (HTTPS) enforcement for this URL.
200    #[serde(rename = "securityLevel")]
201    pub security_level: Option<String>,
202    /// URL to serve the endpoint at.
203    pub url: Option<String>,
204}
205
206impl common::Part for ApiConfigHandler {}
207
208/// Uses Google Cloud Endpoints to handle requests.
209///
210/// This type is not used in any activity, and only used as *part* of another schema.
211///
212#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
213#[serde_with::serde_as]
214#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
215pub struct ApiEndpointHandler {
216    /// Path to the script from the application root directory.
217    #[serde(rename = "scriptPath")]
218    pub script_path: Option<String>,
219}
220
221impl common::Part for ApiEndpointHandler {}
222
223/// An Application resource contains the top-level configuration of an App Engine application.
224///
225/// # Activities
226///
227/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
228/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
229///
230/// * [create apps](AppCreateCall) (request)
231/// * [get apps](AppGetCall) (response)
232/// * [patch apps](AppPatchCall) (request)
233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
234#[serde_with::serde_as]
235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
236pub struct Application {
237    /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account.
238    #[serde(rename = "authDomain")]
239    pub auth_domain: Option<String>,
240    /// Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly
241    #[serde(rename = "codeBucket")]
242    pub code_bucket: Option<String>,
243    /// Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly
244    #[serde(rename = "defaultBucket")]
245    pub default_bucket: Option<String>,
246    /// Cookie expiration policy for this application.
247    #[serde(rename = "defaultCookieExpiration")]
248    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
249    pub default_cookie_expiration: Option<chrono::Duration>,
250    /// Hostname used to reach the application, as resolved by App Engine.@OutputOnly
251    #[serde(rename = "defaultHostname")]
252    pub default_hostname: Option<String>,
253    /// HTTP path dispatch rules for requests to the application that do not explicitly target a module or version. Rules are order-dependent.@OutputOnly
254    #[serde(rename = "dispatchRules")]
255    pub dispatch_rules: Option<Vec<UrlDispatchRule>>,
256    /// no description provided
257    pub iap: Option<IdentityAwareProxy>,
258    /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp.
259    pub id: Option<String>,
260    /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US
261    pub location: Option<String>,
262    /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly
263    pub name: Option<String>,
264}
265
266impl common::RequestValue for Application {}
267impl common::ResponseResult for Application {}
268
269/// Automatic scaling is based on request rate, response latencies, and other application metrics.
270///
271/// This type is not used in any activity, and only used as *part* of another schema.
272///
273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
274#[serde_with::serde_as]
275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
276pub struct AutomaticScaling {
277    /// The time period that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. Only applicable in the App Engine flexible environment.
278    #[serde(rename = "coolDownPeriod")]
279    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
280    pub cool_down_period: Option<chrono::Duration>,
281    /// Target scaling by CPU usage.
282    #[serde(rename = "cpuUtilization")]
283    pub cpu_utilization: Option<CpuUtilization>,
284    /// Target scaling by disk usage.
285    #[serde(rename = "diskUtilization")]
286    pub disk_utilization: Option<DiskUtilization>,
287    /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value.
288    #[serde(rename = "maxConcurrentRequests")]
289    pub max_concurrent_requests: Option<i32>,
290    /// Maximum number of idle instances that should be maintained for this version.
291    #[serde(rename = "maxIdleInstances")]
292    pub max_idle_instances: Option<i32>,
293    /// Maximum amount of time that a request should wait in the pending queue before starting a new instance to handle it.
294    #[serde(rename = "maxPendingLatency")]
295    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
296    pub max_pending_latency: Option<chrono::Duration>,
297    /// Maximum number of instances that should be started to handle requests.
298    #[serde(rename = "maxTotalInstances")]
299    pub max_total_instances: Option<i32>,
300    /// Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a module.
301    #[serde(rename = "minIdleInstances")]
302    pub min_idle_instances: Option<i32>,
303    /// Minimum amount of time a request should wait in the pending queue before starting a new instance to handle it.
304    #[serde(rename = "minPendingLatency")]
305    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
306    pub min_pending_latency: Option<chrono::Duration>,
307    /// Minimum number of instances that should be maintained for this version.
308    #[serde(rename = "minTotalInstances")]
309    pub min_total_instances: Option<i32>,
310    /// Target scaling by network usage.
311    #[serde(rename = "networkUtilization")]
312    pub network_utilization: Option<NetworkUtilization>,
313    /// Target scaling by request utilization.
314    #[serde(rename = "requestUtilization")]
315    pub request_utilization: Option<RequestUtilization>,
316}
317
318impl common::Part for AutomaticScaling {}
319
320/// A module with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity.
321///
322/// This type is not used in any activity, and only used as *part* of another schema.
323///
324#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
325#[serde_with::serde_as]
326#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
327pub struct BasicScaling {
328    /// Duration of time after the last request that an instance must wait before the instance is shut down.
329    #[serde(rename = "idleTimeout")]
330    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
331    pub idle_timeout: Option<chrono::Duration>,
332    /// Maximum number of instances to create for this version.
333    #[serde(rename = "maxInstances")]
334    pub max_instances: Option<i32>,
335}
336
337impl common::Part for BasicScaling {}
338
339/// Docker image that is used to create a container and start a VM instance for the version that you deploy. Only applicable for instances running in the App Engine flexible environment.
340///
341/// This type is not used in any activity, and only used as *part* of another schema.
342///
343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
344#[serde_with::serde_as]
345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
346pub struct ContainerInfo {
347    /// URI to the hosted container image in Google Container Registry. The URI must be fully qualified and include a tag or digest. Examples: "gcr.io/my-project/image:tag" or "gcr.io/my-project/image@digest"
348    pub image: Option<String>,
349}
350
351impl common::Part for ContainerInfo {}
352
353/// Target scaling by CPU usage.
354///
355/// This type is not used in any activity, and only used as *part* of another schema.
356///
357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
358#[serde_with::serde_as]
359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
360pub struct CpuUtilization {
361    /// Period of time over which CPU utilization is calculated.
362    #[serde(rename = "aggregationWindowLength")]
363    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
364    pub aggregation_window_length: Option<chrono::Duration>,
365    /// Target CPU utilization ratio to maintain when scaling. Must be between 0 and 1.
366    #[serde(rename = "targetUtilization")]
367    pub target_utilization: Option<f64>,
368}
369
370impl common::Part for CpuUtilization {}
371
372/// Request message for Instances.DebugInstance.
373///
374/// # Activities
375///
376/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
377/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
378///
379/// * [modules versions instances debug apps](AppModuleVersionInstanceDebugCall) (request)
380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
381#[serde_with::serde_as]
382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
383pub struct DebugInstanceRequest {
384    /// Public SSH key to add to the instance. Examples:
385    /// [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME]
386    /// [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}For more information, see Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys).
387    #[serde(rename = "sshKey")]
388    pub ssh_key: Option<String>,
389}
390
391impl common::RequestValue for DebugInstanceRequest {}
392
393/// Code and application artifacts used to deploy a version to App Engine.
394///
395/// This type is not used in any activity, and only used as *part* of another schema.
396///
397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
398#[serde_with::serde_as]
399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
400pub struct Deployment {
401    /// The Docker image for the container that runs the version. Only applicable for instances running in the App Engine flexible environment.
402    pub container: Option<ContainerInfo>,
403    /// Manifest of the files stored in Google Cloud Storage that are included as part of this version. All files must be readable using the credentials supplied with this call.
404    pub files: Option<HashMap<String, FileInfo>>,
405    /// Origin of the source code for this deployment. There can be more than one source reference per version if source code is distributed among multiple repositories.
406    #[serde(rename = "sourceReferences")]
407    pub source_references: Option<Vec<SourceReference>>,
408}
409
410impl common::Part for Deployment {}
411
412/// Target scaling by disk usage. Only applicable for VM runtimes.
413///
414/// This type is not used in any activity, and only used as *part* of another schema.
415///
416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
417#[serde_with::serde_as]
418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
419pub struct DiskUtilization {
420    /// Target bytes read per second.
421    #[serde(rename = "targetReadBytesPerSec")]
422    pub target_read_bytes_per_sec: Option<i32>,
423    /// Target ops read per second.
424    #[serde(rename = "targetReadOpsPerSec")]
425    pub target_read_ops_per_sec: Option<i32>,
426    /// Target bytes written per second.
427    #[serde(rename = "targetWriteBytesPerSec")]
428    pub target_write_bytes_per_sec: Option<i32>,
429    /// Target ops written per second.
430    #[serde(rename = "targetWriteOpsPerSec")]
431    pub target_write_ops_per_sec: Option<i32>,
432}
433
434impl common::Part for DiskUtilization {}
435
436/// Cloud Endpoints (https://cloud.google.com/endpoints) configuration. The Endpoints API Service provides tooling for serving Open API and gRPC endpoints via an NGINX proxy. Only valid for App Engine Flexible environment deployments..The fields here refer to the name and configuration id of a "service" resource in the Service Management API (https://cloud.google.com/service-management/overview).
437///
438/// This type is not used in any activity, and only used as *part* of another schema.
439///
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct EndpointsApiService {
444    /// Endpoints service configuration id as specified by the Service Management API. For example "2016-09-19r1"By default, the Endpoints service configuration id is fixed and config_id must be specified. To keep the Endpoints service configuration id updated with each rollout, specify RolloutStrategy.MANAGED and omit config_id.
445    #[serde(rename = "configId")]
446    pub config_id: Option<String>,
447    /// Enable or disable trace sampling. By default, this is set to false for enabled.
448    #[serde(rename = "disableTraceSampling")]
449    pub disable_trace_sampling: Option<bool>,
450    /// Endpoints service name which is the name of the "service" resource in the Service Management API. For example "myapi.endpoints.myproject.cloud.goog"
451    pub name: Option<String>,
452    /// Endpoints rollout strategy. If FIXED, config_id must be specified. If MANAGED, config_id must be omitted.
453    #[serde(rename = "rolloutStrategy")]
454    pub rollout_strategy: Option<String>,
455}
456
457impl common::Part for EndpointsApiService {}
458
459/// Custom static error page to be served when an error occurs.
460///
461/// This type is not used in any activity, and only used as *part* of another schema.
462///
463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
464#[serde_with::serde_as]
465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
466pub struct ErrorHandler {
467    /// Error condition this handler applies to.
468    #[serde(rename = "errorCode")]
469    pub error_code: Option<String>,
470    /// MIME type of file. Defaults to text/html.
471    #[serde(rename = "mimeType")]
472    pub mime_type: Option<String>,
473    /// Static file content to be served for this error.
474    #[serde(rename = "staticFile")]
475    pub static_file: Option<String>,
476}
477
478impl common::Part for ErrorHandler {}
479
480/// Single source file that is part of the version to be deployed. Each source file that is deployed must be specified separately.
481///
482/// This type is not used in any activity, and only used as *part* of another schema.
483///
484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
485#[serde_with::serde_as]
486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
487pub struct FileInfo {
488    /// The MIME type of the file.Defaults to the value from Google Cloud Storage.
489    #[serde(rename = "mimeType")]
490    pub mime_type: Option<String>,
491    /// The SHA1 hash of the file, in hex.
492    #[serde(rename = "sha1Sum")]
493    pub sha1_sum: Option<String>,
494    /// URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/<bucket>/<object>'.
495    #[serde(rename = "sourceUrl")]
496    pub source_url: Option<String>,
497}
498
499impl common::Part for FileInfo {}
500
501/// Health checking configuration for VM instances. Unhealthy instances are killed and replaced with new instances. Only applicable for instances in App Engine flexible environment.
502///
503/// This type is not used in any activity, and only used as *part* of another schema.
504///
505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
506#[serde_with::serde_as]
507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
508pub struct HealthCheck {
509    /// Interval between health checks.
510    #[serde(rename = "checkInterval")]
511    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
512    pub check_interval: Option<chrono::Duration>,
513    /// Whether to explicitly disable health checks for this instance.
514    #[serde(rename = "disableHealthCheck")]
515    pub disable_health_check: Option<bool>,
516    /// Number of consecutive successful health checks required before receiving traffic.
517    #[serde(rename = "healthyThreshold")]
518    pub healthy_threshold: Option<u32>,
519    /// Host header to send when performing an HTTP health check. Example: "myapp.appspot.com"
520    pub host: Option<String>,
521    /// Number of consecutive failed health checks required before an instance is restarted.
522    #[serde(rename = "restartThreshold")]
523    pub restart_threshold: Option<u32>,
524    /// Time before the health check is considered failed.
525    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
526    pub timeout: Option<chrono::Duration>,
527    /// Number of consecutive failed health checks required before removing traffic.
528    #[serde(rename = "unhealthyThreshold")]
529    pub unhealthy_threshold: Option<u32>,
530}
531
532impl common::Part for HealthCheck {}
533
534/// Identity-Aware Proxy
535///
536/// This type is not used in any activity, and only used as *part* of another schema.
537///
538#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
539#[serde_with::serde_as]
540#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
541pub struct IdentityAwareProxy {
542    /// Whether the serving infrastructure will authenticate and authorize all incoming requests.If true, the oauth2_client_id and oauth2_client_secret fields must be non-empty.
543    pub enabled: Option<bool>,
544    /// OAuth2 client ID to use for the authentication flow.
545    #[serde(rename = "oauth2ClientId")]
546    pub oauth2_client_id: Option<String>,
547    /// For security reasons, this value cannot be retrieved via the API. Instead, the SHA-256 hash of the value is returned in the oauth2_client_secret_sha256 field.@InputOnly
548    #[serde(rename = "oauth2ClientSecret")]
549    pub oauth2_client_secret: Option<String>,
550    /// Hex-encoded SHA-256 hash of the client secret.@OutputOnly
551    #[serde(rename = "oauth2ClientSecretSha256")]
552    pub oauth2_client_secret_sha256: Option<String>,
553}
554
555impl common::Part for IdentityAwareProxy {}
556
557/// An Instance resource is the computing unit that App Engine uses to automatically scale an application.
558///
559/// # Activities
560///
561/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
562/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
563///
564/// * [modules versions instances get apps](AppModuleVersionInstanceGetCall) (response)
565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
566#[serde_with::serde_as]
567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
568pub struct Instance {
569    /// App Engine release this instance is running on.@OutputOnly
570    #[serde(rename = "appEngineRelease")]
571    pub app_engine_release: Option<String>,
572    /// Availability of the instance.@OutputOnly
573    pub availability: Option<String>,
574    /// Average latency (ms) over the last minute.@OutputOnly
575    #[serde(rename = "averageLatency")]
576    pub average_latency: Option<i32>,
577    /// Number of errors since this instance was started.@OutputOnly
578    pub errors: Option<u32>,
579    /// Relative name of the instance within the version. Example: instance-1.@OutputOnly
580    pub id: Option<String>,
581    /// Total memory in use (bytes).@OutputOnly
582    #[serde(rename = "memoryUsage")]
583    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
584    pub memory_usage: Option<i64>,
585    /// Full path to the Instance resource in the API. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.@OutputOnly
586    pub name: Option<String>,
587    /// Average queries per second (QPS) over the last minute.@OutputOnly
588    pub qps: Option<f32>,
589    /// Number of requests since this instance was started.@OutputOnly
590    pub requests: Option<i32>,
591    /// Time that this instance was started.@OutputOnly
592    #[serde(rename = "startTimestamp")]
593    pub start_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
594    /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly
595    #[serde(rename = "vmId")]
596    pub vm_id: Option<String>,
597    /// The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly
598    #[serde(rename = "vmIp")]
599    pub vm_ip: Option<String>,
600    /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly
601    #[serde(rename = "vmName")]
602    pub vm_name: Option<String>,
603    /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly
604    #[serde(rename = "vmStatus")]
605    pub vm_status: Option<String>,
606    /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly
607    #[serde(rename = "vmUnlocked")]
608    pub vm_unlocked: Option<bool>,
609    /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly
610    #[serde(rename = "vmZoneName")]
611    pub vm_zone_name: Option<String>,
612}
613
614impl common::ResponseResult for Instance {}
615
616/// Third-party Python runtime library that is required by the application.
617///
618/// This type is not used in any activity, and only used as *part* of another schema.
619///
620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
621#[serde_with::serde_as]
622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
623pub struct Library {
624    /// Name of the library. Example: "django".
625    pub name: Option<String>,
626    /// Version of the library to select, or "latest".
627    pub version: Option<String>,
628}
629
630impl common::Part for Library {}
631
632/// Response message for Instances.ListInstances.
633///
634/// # Activities
635///
636/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
637/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
638///
639/// * [modules versions instances list apps](AppModuleVersionInstanceListCall) (response)
640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
641#[serde_with::serde_as]
642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
643pub struct ListInstancesResponse {
644    /// The instances belonging to the requested version.
645    pub instances: Option<Vec<Instance>>,
646    /// Continuation token for fetching the next page of results.
647    #[serde(rename = "nextPageToken")]
648    pub next_page_token: Option<String>,
649}
650
651impl common::ResponseResult for ListInstancesResponse {}
652
653/// The response message for Locations.ListLocations.
654///
655/// # Activities
656///
657/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
658/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
659///
660/// * [locations list apps](AppLocationListCall) (response)
661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
662#[serde_with::serde_as]
663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
664pub struct ListLocationsResponse {
665    /// A list of locations that matches the specified filter in the request.
666    pub locations: Option<Vec<Location>>,
667    /// The standard List next-page token.
668    #[serde(rename = "nextPageToken")]
669    pub next_page_token: Option<String>,
670}
671
672impl common::ResponseResult for ListLocationsResponse {}
673
674/// Response message for Modules.ListModules.
675///
676/// # Activities
677///
678/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
679/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
680///
681/// * [modules list apps](AppModuleListCall) (response)
682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
683#[serde_with::serde_as]
684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
685pub struct ListModulesResponse {
686    /// The modules belonging to the requested application.
687    pub modules: Option<Vec<Module>>,
688    /// Continuation token for fetching the next page of results.
689    #[serde(rename = "nextPageToken")]
690    pub next_page_token: Option<String>,
691}
692
693impl common::ResponseResult for ListModulesResponse {}
694
695/// The response message for Operations.ListOperations.
696///
697/// # Activities
698///
699/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
700/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
701///
702/// * [operations list apps](AppOperationListCall) (response)
703#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
704#[serde_with::serde_as]
705#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
706pub struct ListOperationsResponse {
707    /// The standard List next-page token.
708    #[serde(rename = "nextPageToken")]
709    pub next_page_token: Option<String>,
710    /// A list of operations that matches the specified filter in the request.
711    pub operations: Option<Vec<Operation>>,
712}
713
714impl common::ResponseResult for ListOperationsResponse {}
715
716/// Response message for Versions.ListVersions.
717///
718/// # Activities
719///
720/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
721/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
722///
723/// * [modules versions list apps](AppModuleVersionListCall) (response)
724#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
725#[serde_with::serde_as]
726#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
727pub struct ListVersionsResponse {
728    /// Continuation token for fetching the next page of results.
729    #[serde(rename = "nextPageToken")]
730    pub next_page_token: Option<String>,
731    /// The versions belonging to the requested module.
732    pub versions: Option<Vec<Version>>,
733}
734
735impl common::ResponseResult for ListVersionsResponse {}
736
737/// A resource that represents Google Cloud Platform location.
738///
739/// # Activities
740///
741/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
742/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
743///
744/// * [locations get apps](AppLocationGetCall) (response)
745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
746#[serde_with::serde_as]
747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
748pub struct Location {
749    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
750    #[serde(rename = "displayName")]
751    pub display_name: Option<String>,
752    /// Cross-service attributes for the location. For example
753    /// {"cloud.googleapis.com/region": "us-east1"}
754    ///
755    pub labels: Option<HashMap<String, String>>,
756    /// The canonical id for this location. For example: "us-east1".
757    #[serde(rename = "locationId")]
758    pub location_id: Option<String>,
759    /// Service-specific metadata. For example the available capacity at the given location.
760    pub metadata: Option<HashMap<String, serde_json::Value>>,
761    /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1"
762    pub name: Option<String>,
763}
764
765impl common::ResponseResult for Location {}
766
767/// A module with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time.
768///
769/// This type is not used in any activity, and only used as *part* of another schema.
770///
771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
772#[serde_with::serde_as]
773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
774pub struct ManualScaling {
775    /// Number of instances to assign to the module at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function.
776    pub instances: Option<i32>,
777}
778
779impl common::Part for ManualScaling {}
780
781/// A Module resource is a logical component of an application that can share state and communicate in a secure fashion with other modules. For example, an application that handles customer requests might include separate modules to handle tasks such as backend data analysis or API requests from mobile devices. Each module has a collection of versions that define a specific set of code used to implement the functionality of that module.
782///
783/// # Activities
784///
785/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
786/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
787///
788/// * [modules get apps](AppModuleGetCall) (response)
789/// * [modules patch apps](AppModulePatchCall) (request)
790#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
791#[serde_with::serde_as]
792#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
793pub struct Module {
794    /// Relative name of the module within the application. Example: default.@OutputOnly
795    pub id: Option<String>,
796    /// Full path to the Module resource in the API. Example: apps/myapp/modules/default.@OutputOnly
797    pub name: Option<String>,
798    /// Mapping that defines fractional HTTP traffic diversion to different versions within the module.
799    pub split: Option<TrafficSplit>,
800}
801
802impl common::RequestValue for Module {}
803impl common::ResponseResult for Module {}
804
805/// Extra network settings. Only applicable for VM runtimes.
806///
807/// This type is not used in any activity, and only used as *part* of another schema.
808///
809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
810#[serde_with::serde_as]
811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
812pub struct Network {
813    /// List of ports, or port pairs, to forward from the virtual machine to the application container.
814    #[serde(rename = "forwardedPorts")]
815    pub forwarded_ports: Option<Vec<String>>,
816    /// Tag to apply to the VM instance during creation.
817    #[serde(rename = "instanceTag")]
818    pub instance_tag: Option<String>,
819    /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default.
820    pub name: Option<String>,
821}
822
823impl common::Part for Network {}
824
825/// Target scaling by network usage. Only applicable for VM runtimes.
826///
827/// This type is not used in any activity, and only used as *part* of another schema.
828///
829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
830#[serde_with::serde_as]
831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
832pub struct NetworkUtilization {
833    /// Target bytes received per second.
834    #[serde(rename = "targetReceivedBytesPerSec")]
835    pub target_received_bytes_per_sec: Option<i32>,
836    /// Target packets received per second.
837    #[serde(rename = "targetReceivedPacketsPerSec")]
838    pub target_received_packets_per_sec: Option<i32>,
839    /// Target bytes sent per second.
840    #[serde(rename = "targetSentBytesPerSec")]
841    pub target_sent_bytes_per_sec: Option<i32>,
842    /// Target packets sent per second.
843    #[serde(rename = "targetSentPacketsPerSec")]
844    pub target_sent_packets_per_sec: Option<i32>,
845}
846
847impl common::Part for NetworkUtilization {}
848
849/// This resource represents a long-running operation that is the result of a network API call.
850///
851/// # Activities
852///
853/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
854/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
855///
856/// * [modules versions instances debug apps](AppModuleVersionInstanceDebugCall) (response)
857/// * [modules versions instances delete apps](AppModuleVersionInstanceDeleteCall) (response)
858/// * [modules versions create apps](AppModuleVersionCreateCall) (response)
859/// * [modules versions delete apps](AppModuleVersionDeleteCall) (response)
860/// * [modules versions patch apps](AppModuleVersionPatchCall) (response)
861/// * [modules delete apps](AppModuleDeleteCall) (response)
862/// * [modules patch apps](AppModulePatchCall) (response)
863/// * [operations get apps](AppOperationGetCall) (response)
864/// * [create apps](AppCreateCall) (response)
865/// * [patch apps](AppPatchCall) (response)
866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
867#[serde_with::serde_as]
868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
869pub struct Operation {
870    /// If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
871    pub done: Option<bool>,
872    /// The error result of the operation in case of failure or cancellation.
873    pub error: Option<Status>,
874    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
875    pub metadata: Option<HashMap<String, serde_json::Value>>,
876    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name.
877    pub name: Option<String>,
878    /// The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse.
879    pub response: Option<HashMap<String, serde_json::Value>>,
880}
881
882impl common::ResponseResult for Operation {}
883
884/// Target scaling by request utilization. Only applicable for VM runtimes.
885///
886/// This type is not used in any activity, and only used as *part* of another schema.
887///
888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
889#[serde_with::serde_as]
890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
891pub struct RequestUtilization {
892    /// Target number of concurrent requests.
893    #[serde(rename = "targetConcurrentRequests")]
894    pub target_concurrent_requests: Option<i32>,
895    /// Target requests per second.
896    #[serde(rename = "targetRequestCountPerSec")]
897    pub target_request_count_per_sec: Option<i32>,
898}
899
900impl common::Part for RequestUtilization {}
901
902/// Machine resources for a version.
903///
904/// This type is not used in any activity, and only used as *part* of another schema.
905///
906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
907#[serde_with::serde_as]
908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
909pub struct Resources {
910    /// Number of CPU cores needed.
911    pub cpu: Option<f64>,
912    /// Disk size (GB) needed.
913    #[serde(rename = "diskGb")]
914    pub disk_gb: Option<f64>,
915    /// Memory (GB) needed.
916    #[serde(rename = "memoryGb")]
917    pub memory_gb: Option<f64>,
918    /// User specified volumes.
919    pub volumes: Option<Vec<Volume>>,
920}
921
922impl common::Part for Resources {}
923
924/// Executes a script to handle the request that matches the URL pattern.
925///
926/// This type is not used in any activity, and only used as *part* of another schema.
927///
928#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
929#[serde_with::serde_as]
930#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
931pub struct ScriptHandler {
932    /// Path to the script from the application root directory.
933    #[serde(rename = "scriptPath")]
934    pub script_path: Option<String>,
935}
936
937impl common::Part for ScriptHandler {}
938
939/// Reference to a particular snapshot of the source tree used to build and deploy the application.
940///
941/// This type is not used in any activity, and only used as *part* of another schema.
942///
943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
944#[serde_with::serde_as]
945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
946pub struct SourceReference {
947    /// URI string identifying the repository. Example: "https://source.developers.google.com/p/app-123/r/default"
948    pub repository: Option<String>,
949    /// The canonical, persistent identifier of the deployed revision. Aliases that include tags or branch names are not allowed. Example (git): "2198322f89e0bb2e25021667c2ed489d1fd34e6b"
950    #[serde(rename = "revisionId")]
951    pub revision_id: Option<String>,
952}
953
954impl common::Part for SourceReference {}
955
956/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static directory handlers make it easy to serve the entire contents of a directory as static files.
957///
958/// This type is not used in any activity, and only used as *part* of another schema.
959///
960#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
961#[serde_with::serde_as]
962#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
963pub struct StaticDirectoryHandler {
964    /// Whether files should also be uploaded as code data. By default, files declared in static directory handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas.
965    #[serde(rename = "applicationReadable")]
966    pub application_readable: Option<bool>,
967    /// Path to the directory containing the static files from the application root directory. Everything after the end of the matched URL pattern is appended to static_dir to form the full path to the requested file.
968    pub directory: Option<String>,
969    /// Time a static file served by this handler should be cached.
970    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
971    pub expiration: Option<chrono::Duration>,
972    /// HTTP headers to use for all responses from these URLs.
973    #[serde(rename = "httpHeaders")]
974    pub http_headers: Option<HashMap<String, String>>,
975    /// MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are direved from each file's filename extension.
976    #[serde(rename = "mimeType")]
977    pub mime_type: Option<String>,
978    /// Whether this handler should match the request if the file referenced by the handler does not exist.
979    #[serde(rename = "requireMatchingFile")]
980    pub require_matching_file: Option<bool>,
981}
982
983impl common::Part for StaticDirectoryHandler {}
984
985/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them.
986///
987/// This type is not used in any activity, and only used as *part* of another schema.
988///
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct StaticFilesHandler {
993    /// Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas.
994    #[serde(rename = "applicationReadable")]
995    pub application_readable: Option<bool>,
996    /// Time a static file served by this handler should be cached.
997    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
998    pub expiration: Option<chrono::Duration>,
999    /// HTTP headers to use for all responses from these URLs.
1000    #[serde(rename = "httpHeaders")]
1001    pub http_headers: Option<HashMap<String, String>>,
1002    /// MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension.
1003    #[serde(rename = "mimeType")]
1004    pub mime_type: Option<String>,
1005    /// Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern.
1006    pub path: Option<String>,
1007    /// Whether this handler should match the request if the file referenced by the handler does not exist.
1008    #[serde(rename = "requireMatchingFile")]
1009    pub require_matching_file: Option<bool>,
1010    /// Regular expression that matches the file paths for all files that should be referenced by this handler.
1011    #[serde(rename = "uploadPathRegex")]
1012    pub upload_path_regex: Option<String>,
1013}
1014
1015impl common::Part for StaticFilesHandler {}
1016
1017/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be:
1018/// Simple to use and understand for most users
1019/// Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc that can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include:
1020/// Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors.
1021/// Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting.
1022/// Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response.
1023/// Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message.
1024/// Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons.
1025///
1026/// This type is not used in any activity, and only used as *part* of another schema.
1027///
1028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1029#[serde_with::serde_as]
1030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1031pub struct Status {
1032    /// The status code, which should be an enum value of google.rpc.Code.
1033    pub code: Option<i32>,
1034    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1035    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1036    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1037    pub message: Option<String>,
1038}
1039
1040impl common::Part for Status {}
1041
1042/// Traffic routing configuration for versions within a single module. Traffic splits define how traffic directed to the module is assigned to versions.
1043///
1044/// This type is not used in any activity, and only used as *part* of another schema.
1045///
1046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1047#[serde_with::serde_as]
1048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1049pub struct TrafficSplit {
1050    /// Mapping from version IDs within the module to fractional (0.000, 1] allocations of traffic for that version. Each version can be specified only once, but some versions in the module may not have any traffic allocation. Modules that have traffic allocated cannot be deleted until either the module is deleted or their traffic allocation is removed. Allocations must sum to 1. Up to two decimal place precision is supported for IP-based splits and up to three decimal places is supported for cookie-based splits.
1051    pub allocations: Option<HashMap<String, f64>>,
1052    /// Mechanism used to determine which version a request is sent to. The traffic selection algorithm will be stable for either type until allocations are changed.
1053    #[serde(rename = "shardBy")]
1054    pub shard_by: Option<String>,
1055}
1056
1057impl common::Part for TrafficSplit {}
1058
1059/// Rules to match an HTTP request and dispatch that request to a module.
1060///
1061/// This type is not used in any activity, and only used as *part* of another schema.
1062///
1063#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1064#[serde_with::serde_as]
1065#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1066pub struct UrlDispatchRule {
1067    /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*".
1068    pub domain: Option<String>,
1069    /// Resource ID of a module in this application that should serve the matched request. The module must already exist. Example: default.
1070    pub module: Option<String>,
1071    /// Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters.
1072    pub path: Option<String>,
1073}
1074
1075impl common::Part for UrlDispatchRule {}
1076
1077/// URL pattern and description of how the URL should be handled. App Engine can handle URLs by executing application code, or by serving static files uploaded with the version, such as images, CSS, or JavaScript.
1078///
1079/// This type is not used in any activity, and only used as *part* of another schema.
1080///
1081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1082#[serde_with::serde_as]
1083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1084pub struct UrlMap {
1085    /// Uses API Endpoints to handle requests.
1086    #[serde(rename = "apiEndpoint")]
1087    pub api_endpoint: Option<ApiEndpointHandler>,
1088    /// Action to take when users access resources that require authentication. Defaults to redirect.
1089    #[serde(rename = "authFailAction")]
1090    pub auth_fail_action: Option<String>,
1091    /// Level of login required to access this resource.
1092    pub login: Option<String>,
1093    /// 30x code to use when performing redirects for the secure field. Defaults to 302.
1094    #[serde(rename = "redirectHttpResponseCode")]
1095    pub redirect_http_response_code: Option<String>,
1096    /// Executes a script to handle the request that matches this URL pattern.
1097    pub script: Option<ScriptHandler>,
1098    /// Security (HTTPS) enforcement for this URL.
1099    #[serde(rename = "securityLevel")]
1100    pub security_level: Option<String>,
1101    /// Serves the entire contents of a directory as static files.This attribute is deprecated. You can mimic the behavior of static directories using static files.
1102    #[serde(rename = "staticDirectory")]
1103    pub static_directory: Option<StaticDirectoryHandler>,
1104    /// Returns the contents of a file, such as an image, as the response.
1105    #[serde(rename = "staticFiles")]
1106    pub static_files: Option<StaticFilesHandler>,
1107    /// A URL prefix. Uses regular expression syntax, which means regexp special characters must be escaped, but should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path.
1108    #[serde(rename = "urlRegex")]
1109    pub url_regex: Option<String>,
1110}
1111
1112impl common::Part for UrlMap {}
1113
1114/// A Version resource is a specific set of source code and configuration files that are deployed into a module.
1115///
1116/// # Activities
1117///
1118/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1119/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1120///
1121/// * [modules versions create apps](AppModuleVersionCreateCall) (request)
1122/// * [modules versions get apps](AppModuleVersionGetCall) (response)
1123/// * [modules versions patch apps](AppModuleVersionPatchCall) (request)
1124#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1125#[serde_with::serde_as]
1126#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1127pub struct Version {
1128    /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set.
1129    #[serde(rename = "apiConfig")]
1130    pub api_config: Option<ApiConfigHandler>,
1131    /// Automatic scaling is based on request rate, response latencies, and other application metrics.
1132    #[serde(rename = "automaticScaling")]
1133    pub automatic_scaling: Option<AutomaticScaling>,
1134    /// A module with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity.
1135    #[serde(rename = "basicScaling")]
1136    pub basic_scaling: Option<BasicScaling>,
1137    /// Metadata settings that are supplied to this version to enable beta runtime features.
1138    #[serde(rename = "betaSettings")]
1139    pub beta_settings: Option<HashMap<String, String>>,
1140    /// Time that this version was created.@OutputOnly
1141    #[serde(rename = "creationTime")]
1142    pub creation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1143    /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set.
1144    #[serde(rename = "defaultExpiration")]
1145    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1146    pub default_expiration: Option<chrono::Duration>,
1147    /// Email address of the user who created this version.@OutputOnly
1148    pub deployer: Option<String>,
1149    /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set.
1150    pub deployment: Option<Deployment>,
1151    /// Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app.
1152    #[serde(rename = "endpointsApiService")]
1153    pub endpoints_api_service: Option<EndpointsApiService>,
1154    /// App Engine execution environment to use for this version.Defaults to 1.
1155    pub env: Option<String>,
1156    /// Environment variables made available to the application.Only returned in GET requests if view=FULL is set.
1157    #[serde(rename = "envVariables")]
1158    pub env_variables: Option<HashMap<String, String>>,
1159    /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set.
1160    #[serde(rename = "errorHandlers")]
1161    pub error_handlers: Option<Vec<ErrorHandler>>,
1162    /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set.
1163    pub handlers: Option<Vec<UrlMap>>,
1164    /// Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set.
1165    #[serde(rename = "healthCheck")]
1166    pub health_check: Option<HealthCheck>,
1167    /// Relative name of the version within the module. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-".
1168    pub id: Option<String>,
1169    /// Before an application can receive email or XMPP messages, the application must be configured to enable the service.
1170    #[serde(rename = "inboundServices")]
1171    pub inbound_services: Option<Vec<String>>,
1172    /// Instance class that is used to run this version. Valid values are:
1173    /// AutomaticScaling: F1, F2, F4, F4_1G
1174    /// ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling.
1175    #[serde(rename = "instanceClass")]
1176    pub instance_class: Option<String>,
1177    /// Configuration for third-party Python runtime libraries required by the application.Only returned in GET requests if view=FULL is set.
1178    pub libraries: Option<Vec<Library>>,
1179    /// A module with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time.
1180    #[serde(rename = "manualScaling")]
1181    pub manual_scaling: Option<ManualScaling>,
1182    /// Full path to the Version resource in the API. Example: apps/myapp/modules/default/versions/v1.@OutputOnly
1183    pub name: Option<String>,
1184    /// Extra network settings. Only applicable for VM runtimes.
1185    pub network: Option<Network>,
1186    /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set.
1187    #[serde(rename = "nobuildFilesRegex")]
1188    pub nobuild_files_regex: Option<String>,
1189    /// Machine resources for this version. Only applicable for VM runtimes.
1190    pub resources: Option<Resources>,
1191    /// Desired runtime. Example: python27.
1192    pub runtime: Option<String>,
1193    /// The version of the API in the given runtime environment. Please see the app.yaml reference for valid values at https://cloud.google.com/appengine/docs/standard/<language>/config/appref
1194    #[serde(rename = "runtimeApiVersion")]
1195    pub runtime_api_version: Option<String>,
1196    /// Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING.
1197    #[serde(rename = "servingStatus")]
1198    pub serving_status: Option<String>,
1199    /// Whether multiple requests can be dispatched to this version at once.
1200    pub threadsafe: Option<bool>,
1201    /// Whether to deploy this version in a container on a virtual machine.
1202    pub vm: Option<bool>,
1203}
1204
1205impl common::RequestValue for Version {}
1206impl common::ResponseResult for Version {}
1207
1208/// Volumes mounted within the app container. Only applicable for VM runtimes.
1209///
1210/// This type is not used in any activity, and only used as *part* of another schema.
1211///
1212#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1213#[serde_with::serde_as]
1214#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1215pub struct Volume {
1216    /// Unique name for the volume.
1217    pub name: Option<String>,
1218    /// Volume size in gigabytes.
1219    #[serde(rename = "sizeGb")]
1220    pub size_gb: Option<f64>,
1221    /// Underlying volume type, e.g. 'tmpfs'.
1222    #[serde(rename = "volumeType")]
1223    pub volume_type: Option<String>,
1224}
1225
1226impl common::Part for Volume {}
1227
1228// ###################
1229// MethodBuilders ###
1230// #################
1231
1232/// A builder providing access to all methods supported on *app* resources.
1233/// It is not used directly, but through the [`Appengine`] hub.
1234///
1235/// # Example
1236///
1237/// Instantiate a resource builder
1238///
1239/// ```test_harness,no_run
1240/// extern crate hyper;
1241/// extern crate hyper_rustls;
1242/// extern crate google_appengine1_beta4 as appengine1_beta4;
1243///
1244/// # async fn dox() {
1245/// use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1246///
1247/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1248/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1249///     .with_native_roots()
1250///     .unwrap()
1251///     .https_only()
1252///     .enable_http2()
1253///     .build();
1254///
1255/// let executor = hyper_util::rt::TokioExecutor::new();
1256/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1257///     secret,
1258///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1259///     yup_oauth2::client::CustomHyperClientBuilder::from(
1260///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1261///     ),
1262/// ).build().await.unwrap();
1263///
1264/// let client = hyper_util::client::legacy::Client::builder(
1265///     hyper_util::rt::TokioExecutor::new()
1266/// )
1267/// .build(
1268///     hyper_rustls::HttpsConnectorBuilder::new()
1269///         .with_native_roots()
1270///         .unwrap()
1271///         .https_or_http()
1272///         .enable_http2()
1273///         .build()
1274/// );
1275/// let mut hub = Appengine::new(client, auth);
1276/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1277/// // like `create(...)`, `get(...)`, `locations_get(...)`, `locations_list(...)`, `modules_delete(...)`, `modules_get(...)`, `modules_list(...)`, `modules_patch(...)`, `modules_versions_create(...)`, `modules_versions_delete(...)`, `modules_versions_get(...)`, `modules_versions_instances_debug(...)`, `modules_versions_instances_delete(...)`, `modules_versions_instances_get(...)`, `modules_versions_instances_list(...)`, `modules_versions_list(...)`, `modules_versions_patch(...)`, `operations_get(...)`, `operations_list(...)` and `patch(...)`
1278/// // to build up your call.
1279/// let rb = hub.apps();
1280/// # }
1281/// ```
1282pub struct AppMethods<'a, C>
1283where
1284    C: 'a,
1285{
1286    hub: &'a Appengine<C>,
1287}
1288
1289impl<'a, C> common::MethodsBuilder for AppMethods<'a, C> {}
1290
1291impl<'a, C> AppMethods<'a, C> {
1292    /// Create a builder to help you perform the following task:
1293    ///
1294    /// Gets information about a location.
1295    ///
1296    /// # Arguments
1297    ///
1298    /// * `appsId` - Part of `name`. Resource name for the location.
1299    /// * `locationsId` - Part of `name`. See documentation of `appsId`.
1300    pub fn locations_get(&self, apps_id: &str, locations_id: &str) -> AppLocationGetCall<'a, C> {
1301        AppLocationGetCall {
1302            hub: self.hub,
1303            _apps_id: apps_id.to_string(),
1304            _locations_id: locations_id.to_string(),
1305            _delegate: Default::default(),
1306            _additional_params: Default::default(),
1307            _scopes: Default::default(),
1308        }
1309    }
1310
1311    /// Create a builder to help you perform the following task:
1312    ///
1313    /// Lists information about the supported locations for this service.
1314    ///
1315    /// # Arguments
1316    ///
1317    /// * `appsId` - Part of `name`. The resource that owns the locations collection, if applicable.
1318    pub fn locations_list(&self, apps_id: &str) -> AppLocationListCall<'a, C> {
1319        AppLocationListCall {
1320            hub: self.hub,
1321            _apps_id: apps_id.to_string(),
1322            _page_token: Default::default(),
1323            _page_size: Default::default(),
1324            _filter: Default::default(),
1325            _delegate: Default::default(),
1326            _additional_params: Default::default(),
1327            _scopes: Default::default(),
1328        }
1329    }
1330
1331    /// Create a builder to help you perform the following task:
1332    ///
1333    /// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment.
1334    ///
1335    /// # Arguments
1336    ///
1337    /// * `request` - No description provided.
1338    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.
1339    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1340    /// * `versionsId` - Part of `name`. See documentation of `appsId`.
1341    /// * `instancesId` - Part of `name`. See documentation of `appsId`.
1342    pub fn modules_versions_instances_debug(
1343        &self,
1344        request: DebugInstanceRequest,
1345        apps_id: &str,
1346        modules_id: &str,
1347        versions_id: &str,
1348        instances_id: &str,
1349    ) -> AppModuleVersionInstanceDebugCall<'a, C> {
1350        AppModuleVersionInstanceDebugCall {
1351            hub: self.hub,
1352            _request: request,
1353            _apps_id: apps_id.to_string(),
1354            _modules_id: modules_id.to_string(),
1355            _versions_id: versions_id.to_string(),
1356            _instances_id: instances_id.to_string(),
1357            _delegate: Default::default(),
1358            _additional_params: Default::default(),
1359            _scopes: Default::default(),
1360        }
1361    }
1362
1363    /// Create a builder to help you perform the following task:
1364    ///
1365    /// Stops a running instance.
1366    ///
1367    /// # Arguments
1368    ///
1369    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.
1370    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1371    /// * `versionsId` - Part of `name`. See documentation of `appsId`.
1372    /// * `instancesId` - Part of `name`. See documentation of `appsId`.
1373    pub fn modules_versions_instances_delete(
1374        &self,
1375        apps_id: &str,
1376        modules_id: &str,
1377        versions_id: &str,
1378        instances_id: &str,
1379    ) -> AppModuleVersionInstanceDeleteCall<'a, C> {
1380        AppModuleVersionInstanceDeleteCall {
1381            hub: self.hub,
1382            _apps_id: apps_id.to_string(),
1383            _modules_id: modules_id.to_string(),
1384            _versions_id: versions_id.to_string(),
1385            _instances_id: instances_id.to_string(),
1386            _delegate: Default::default(),
1387            _additional_params: Default::default(),
1388            _scopes: Default::default(),
1389        }
1390    }
1391
1392    /// Create a builder to help you perform the following task:
1393    ///
1394    /// Gets instance information.
1395    ///
1396    /// # Arguments
1397    ///
1398    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.
1399    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1400    /// * `versionsId` - Part of `name`. See documentation of `appsId`.
1401    /// * `instancesId` - Part of `name`. See documentation of `appsId`.
1402    pub fn modules_versions_instances_get(
1403        &self,
1404        apps_id: &str,
1405        modules_id: &str,
1406        versions_id: &str,
1407        instances_id: &str,
1408    ) -> AppModuleVersionInstanceGetCall<'a, C> {
1409        AppModuleVersionInstanceGetCall {
1410            hub: self.hub,
1411            _apps_id: apps_id.to_string(),
1412            _modules_id: modules_id.to_string(),
1413            _versions_id: versions_id.to_string(),
1414            _instances_id: instances_id.to_string(),
1415            _delegate: Default::default(),
1416            _additional_params: Default::default(),
1417            _scopes: Default::default(),
1418        }
1419    }
1420
1421    /// Create a builder to help you perform the following task:
1422    ///
1423    /// Lists the instances of a version.Tip: To aggregate details about instances over time, see the Stackdriver Monitoring API (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
1424    ///
1425    /// # Arguments
1426    ///
1427    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.
1428    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1429    /// * `versionsId` - Part of `name`. See documentation of `appsId`.
1430    pub fn modules_versions_instances_list(
1431        &self,
1432        apps_id: &str,
1433        modules_id: &str,
1434        versions_id: &str,
1435    ) -> AppModuleVersionInstanceListCall<'a, C> {
1436        AppModuleVersionInstanceListCall {
1437            hub: self.hub,
1438            _apps_id: apps_id.to_string(),
1439            _modules_id: modules_id.to_string(),
1440            _versions_id: versions_id.to_string(),
1441            _page_token: Default::default(),
1442            _page_size: Default::default(),
1443            _delegate: Default::default(),
1444            _additional_params: Default::default(),
1445            _scopes: Default::default(),
1446        }
1447    }
1448
1449    /// Create a builder to help you perform the following task:
1450    ///
1451    /// Deploys code and resource files to a new version.
1452    ///
1453    /// # Arguments
1454    ///
1455    /// * `request` - No description provided.
1456    /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default.
1457    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1458    pub fn modules_versions_create(
1459        &self,
1460        request: Version,
1461        apps_id: &str,
1462        modules_id: &str,
1463    ) -> AppModuleVersionCreateCall<'a, C> {
1464        AppModuleVersionCreateCall {
1465            hub: self.hub,
1466            _request: request,
1467            _apps_id: apps_id.to_string(),
1468            _modules_id: modules_id.to_string(),
1469            _delegate: Default::default(),
1470            _additional_params: Default::default(),
1471            _scopes: Default::default(),
1472        }
1473    }
1474
1475    /// Create a builder to help you perform the following task:
1476    ///
1477    /// Deletes an existing version.
1478    ///
1479    /// # Arguments
1480    ///
1481    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.
1482    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1483    /// * `versionsId` - Part of `name`. See documentation of `appsId`.
1484    pub fn modules_versions_delete(
1485        &self,
1486        apps_id: &str,
1487        modules_id: &str,
1488        versions_id: &str,
1489    ) -> AppModuleVersionDeleteCall<'a, C> {
1490        AppModuleVersionDeleteCall {
1491            hub: self.hub,
1492            _apps_id: apps_id.to_string(),
1493            _modules_id: modules_id.to_string(),
1494            _versions_id: versions_id.to_string(),
1495            _delegate: Default::default(),
1496            _additional_params: Default::default(),
1497            _scopes: Default::default(),
1498        }
1499    }
1500
1501    /// Create a builder to help you perform the following task:
1502    ///
1503    /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.
1504    ///
1505    /// # Arguments
1506    ///
1507    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.
1508    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1509    /// * `versionsId` - Part of `name`. See documentation of `appsId`.
1510    pub fn modules_versions_get(
1511        &self,
1512        apps_id: &str,
1513        modules_id: &str,
1514        versions_id: &str,
1515    ) -> AppModuleVersionGetCall<'a, C> {
1516        AppModuleVersionGetCall {
1517            hub: self.hub,
1518            _apps_id: apps_id.to_string(),
1519            _modules_id: modules_id.to_string(),
1520            _versions_id: versions_id.to_string(),
1521            _view: Default::default(),
1522            _delegate: Default::default(),
1523            _additional_params: Default::default(),
1524            _scopes: Default::default(),
1525        }
1526    }
1527
1528    /// Create a builder to help you perform the following task:
1529    ///
1530    /// Lists the versions of a module.
1531    ///
1532    /// # Arguments
1533    ///
1534    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.
1535    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1536    pub fn modules_versions_list(
1537        &self,
1538        apps_id: &str,
1539        modules_id: &str,
1540    ) -> AppModuleVersionListCall<'a, C> {
1541        AppModuleVersionListCall {
1542            hub: self.hub,
1543            _apps_id: apps_id.to_string(),
1544            _modules_id: modules_id.to_string(),
1545            _view: Default::default(),
1546            _page_token: Default::default(),
1547            _page_size: Default::default(),
1548            _delegate: Default::default(),
1549            _additional_params: Default::default(),
1550            _scopes: Default::default(),
1551        }
1552    }
1553
1554    /// Create a builder to help you perform the following task:
1555    ///
1556    /// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses:
1557    /// serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status):  For Version resources that use basic scaling, manual scaling, or run in  the App Engine flexible environment.
1558    /// instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class):  For Version resources that run in the App Engine standard environment.
1559    /// automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling):  For Version resources that use automatic scaling and run in the App  Engine standard environment.
1560    /// automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling):  For Version resources that use automatic scaling and run in the App  Engine standard environment.
1561    ///
1562    /// # Arguments
1563    ///
1564    /// * `request` - No description provided.
1565    /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default/versions/1.
1566    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1567    /// * `versionsId` - Part of `name`. See documentation of `appsId`.
1568    pub fn modules_versions_patch(
1569        &self,
1570        request: Version,
1571        apps_id: &str,
1572        modules_id: &str,
1573        versions_id: &str,
1574    ) -> AppModuleVersionPatchCall<'a, C> {
1575        AppModuleVersionPatchCall {
1576            hub: self.hub,
1577            _request: request,
1578            _apps_id: apps_id.to_string(),
1579            _modules_id: modules_id.to_string(),
1580            _versions_id: versions_id.to_string(),
1581            _mask: Default::default(),
1582            _delegate: Default::default(),
1583            _additional_params: Default::default(),
1584            _scopes: Default::default(),
1585        }
1586    }
1587
1588    /// Create a builder to help you perform the following task:
1589    ///
1590    /// Deletes the specified module and all enclosed versions.
1591    ///
1592    /// # Arguments
1593    ///
1594    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.
1595    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1596    pub fn modules_delete(&self, apps_id: &str, modules_id: &str) -> AppModuleDeleteCall<'a, C> {
1597        AppModuleDeleteCall {
1598            hub: self.hub,
1599            _apps_id: apps_id.to_string(),
1600            _modules_id: modules_id.to_string(),
1601            _delegate: Default::default(),
1602            _additional_params: Default::default(),
1603            _scopes: Default::default(),
1604        }
1605    }
1606
1607    /// Create a builder to help you perform the following task:
1608    ///
1609    /// Gets the current configuration of the specified module.
1610    ///
1611    /// # Arguments
1612    ///
1613    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.
1614    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1615    pub fn modules_get(&self, apps_id: &str, modules_id: &str) -> AppModuleGetCall<'a, C> {
1616        AppModuleGetCall {
1617            hub: self.hub,
1618            _apps_id: apps_id.to_string(),
1619            _modules_id: modules_id.to_string(),
1620            _delegate: Default::default(),
1621            _additional_params: Default::default(),
1622            _scopes: Default::default(),
1623        }
1624    }
1625
1626    /// Create a builder to help you perform the following task:
1627    ///
1628    /// Lists all the modules in the application.
1629    ///
1630    /// # Arguments
1631    ///
1632    /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp.
1633    pub fn modules_list(&self, apps_id: &str) -> AppModuleListCall<'a, C> {
1634        AppModuleListCall {
1635            hub: self.hub,
1636            _apps_id: apps_id.to_string(),
1637            _page_token: Default::default(),
1638            _page_size: Default::default(),
1639            _delegate: Default::default(),
1640            _additional_params: Default::default(),
1641            _scopes: Default::default(),
1642        }
1643    }
1644
1645    /// Create a builder to help you perform the following task:
1646    ///
1647    /// Updates the configuration of the specified module.
1648    ///
1649    /// # Arguments
1650    ///
1651    /// * `request` - No description provided.
1652    /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default.
1653    /// * `modulesId` - Part of `name`. See documentation of `appsId`.
1654    pub fn modules_patch(
1655        &self,
1656        request: Module,
1657        apps_id: &str,
1658        modules_id: &str,
1659    ) -> AppModulePatchCall<'a, C> {
1660        AppModulePatchCall {
1661            hub: self.hub,
1662            _request: request,
1663            _apps_id: apps_id.to_string(),
1664            _modules_id: modules_id.to_string(),
1665            _migrate_traffic: Default::default(),
1666            _mask: Default::default(),
1667            _delegate: Default::default(),
1668            _additional_params: Default::default(),
1669            _scopes: Default::default(),
1670        }
1671    }
1672
1673    /// Create a builder to help you perform the following task:
1674    ///
1675    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1676    ///
1677    /// # Arguments
1678    ///
1679    /// * `appsId` - Part of `name`. The name of the operation resource.
1680    /// * `operationsId` - Part of `name`. See documentation of `appsId`.
1681    pub fn operations_get(&self, apps_id: &str, operations_id: &str) -> AppOperationGetCall<'a, C> {
1682        AppOperationGetCall {
1683            hub: self.hub,
1684            _apps_id: apps_id.to_string(),
1685            _operations_id: operations_id.to_string(),
1686            _delegate: Default::default(),
1687            _additional_params: Default::default(),
1688            _scopes: Default::default(),
1689        }
1690    }
1691
1692    /// Create a builder to help you perform the following task:
1693    ///
1694    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
1695    ///
1696    /// # Arguments
1697    ///
1698    /// * `appsId` - Part of `name`. The name of the operation's parent resource.
1699    pub fn operations_list(&self, apps_id: &str) -> AppOperationListCall<'a, C> {
1700        AppOperationListCall {
1701            hub: self.hub,
1702            _apps_id: apps_id.to_string(),
1703            _page_token: Default::default(),
1704            _page_size: Default::default(),
1705            _filter: Default::default(),
1706            _delegate: Default::default(),
1707            _additional_params: Default::default(),
1708            _scopes: Default::default(),
1709        }
1710    }
1711
1712    /// Create a builder to help you perform the following task:
1713    ///
1714    /// Creates an App Engine application for a Google Cloud Platform project. Required fields:
1715    /// id - The ID of the target Cloud Platform project.
1716    /// location - The region (https://cloud.google.com/appengine/docs/locations) where you want the App Engine application located.For more information about App Engine applications, see Managing Projects, Applications, and Billing (https://cloud.google.com/appengine/docs/python/console/).
1717    ///
1718    /// # Arguments
1719    ///
1720    /// * `request` - No description provided.
1721    pub fn create(&self, request: Application) -> AppCreateCall<'a, C> {
1722        AppCreateCall {
1723            hub: self.hub,
1724            _request: request,
1725            _delegate: Default::default(),
1726            _additional_params: Default::default(),
1727            _scopes: Default::default(),
1728        }
1729    }
1730
1731    /// Create a builder to help you perform the following task:
1732    ///
1733    /// Gets information about an application.
1734    ///
1735    /// # Arguments
1736    ///
1737    /// * `appsId` - Part of `name`. Name of the application to get. Example: apps/myapp.
1738    pub fn get(&self, apps_id: &str) -> AppGetCall<'a, C> {
1739        AppGetCall {
1740            hub: self.hub,
1741            _apps_id: apps_id.to_string(),
1742            _ensure_resources_exist: Default::default(),
1743            _delegate: Default::default(),
1744            _additional_params: Default::default(),
1745            _scopes: Default::default(),
1746        }
1747    }
1748
1749    /// Create a builder to help you perform the following task:
1750    ///
1751    /// Updates the specified Application resource. You can update the following fields:
1752    /// auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.auth_domain)
1753    /// default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.default_cookie_expiration)
1754    ///
1755    /// # Arguments
1756    ///
1757    /// * `request` - No description provided.
1758    /// * `appsId` - Part of `name`. Name of the Application resource to update. Example: apps/myapp.
1759    pub fn patch(&self, request: Application, apps_id: &str) -> AppPatchCall<'a, C> {
1760        AppPatchCall {
1761            hub: self.hub,
1762            _request: request,
1763            _apps_id: apps_id.to_string(),
1764            _mask: Default::default(),
1765            _delegate: Default::default(),
1766            _additional_params: Default::default(),
1767            _scopes: Default::default(),
1768        }
1769    }
1770}
1771
1772// ###################
1773// CallBuilders   ###
1774// #################
1775
1776/// Gets information about a location.
1777///
1778/// A builder for the *locations.get* method supported by a *app* resource.
1779/// It is not used directly, but through a [`AppMethods`] instance.
1780///
1781/// # Example
1782///
1783/// Instantiate a resource method builder
1784///
1785/// ```test_harness,no_run
1786/// # extern crate hyper;
1787/// # extern crate hyper_rustls;
1788/// # extern crate google_appengine1_beta4 as appengine1_beta4;
1789/// # async fn dox() {
1790/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1791///
1792/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1793/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1794/// #     .with_native_roots()
1795/// #     .unwrap()
1796/// #     .https_only()
1797/// #     .enable_http2()
1798/// #     .build();
1799///
1800/// # let executor = hyper_util::rt::TokioExecutor::new();
1801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1802/// #     secret,
1803/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1804/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1805/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1806/// #     ),
1807/// # ).build().await.unwrap();
1808///
1809/// # let client = hyper_util::client::legacy::Client::builder(
1810/// #     hyper_util::rt::TokioExecutor::new()
1811/// # )
1812/// # .build(
1813/// #     hyper_rustls::HttpsConnectorBuilder::new()
1814/// #         .with_native_roots()
1815/// #         .unwrap()
1816/// #         .https_or_http()
1817/// #         .enable_http2()
1818/// #         .build()
1819/// # );
1820/// # let mut hub = Appengine::new(client, auth);
1821/// // You can configure optional parameters by calling the respective setters at will, and
1822/// // execute the final call using `doit()`.
1823/// // Values shown here are possibly random and not representative !
1824/// let result = hub.apps().locations_get("appsId", "locationsId")
1825///              .doit().await;
1826/// # }
1827/// ```
1828pub struct AppLocationGetCall<'a, C>
1829where
1830    C: 'a,
1831{
1832    hub: &'a Appengine<C>,
1833    _apps_id: String,
1834    _locations_id: String,
1835    _delegate: Option<&'a mut dyn common::Delegate>,
1836    _additional_params: HashMap<String, String>,
1837    _scopes: BTreeSet<String>,
1838}
1839
1840impl<'a, C> common::CallBuilder for AppLocationGetCall<'a, C> {}
1841
1842impl<'a, C> AppLocationGetCall<'a, C>
1843where
1844    C: common::Connector,
1845{
1846    /// Perform the operation you have build so far.
1847    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
1848        use std::borrow::Cow;
1849        use std::io::{Read, Seek};
1850
1851        use common::{url::Params, ToParts};
1852        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1853
1854        let mut dd = common::DefaultDelegate;
1855        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1856        dlg.begin(common::MethodInfo {
1857            id: "appengine.apps.locations.get",
1858            http_method: hyper::Method::GET,
1859        });
1860
1861        for &field in ["alt", "appsId", "locationsId"].iter() {
1862            if self._additional_params.contains_key(field) {
1863                dlg.finished(false);
1864                return Err(common::Error::FieldClash(field));
1865            }
1866        }
1867
1868        let mut params = Params::with_capacity(4 + self._additional_params.len());
1869        params.push("appsId", self._apps_id);
1870        params.push("locationsId", self._locations_id);
1871
1872        params.extend(self._additional_params.iter());
1873
1874        params.push("alt", "json");
1875        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/locations/{locationsId}";
1876        if self._scopes.is_empty() {
1877            self._scopes
1878                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1879        }
1880
1881        #[allow(clippy::single_element_loop)]
1882        for &(find_this, param_name) in
1883            [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter()
1884        {
1885            url = params.uri_replacement(url, param_name, find_this, false);
1886        }
1887        {
1888            let to_remove = ["locationsId", "appsId"];
1889            params.remove_params(&to_remove);
1890        }
1891
1892        let url = params.parse_with_url(&url);
1893
1894        loop {
1895            let token = match self
1896                .hub
1897                .auth
1898                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1899                .await
1900            {
1901                Ok(token) => token,
1902                Err(e) => match dlg.token(e) {
1903                    Ok(token) => token,
1904                    Err(e) => {
1905                        dlg.finished(false);
1906                        return Err(common::Error::MissingToken(e));
1907                    }
1908                },
1909            };
1910            let mut req_result = {
1911                let client = &self.hub.client;
1912                dlg.pre_request();
1913                let mut req_builder = hyper::Request::builder()
1914                    .method(hyper::Method::GET)
1915                    .uri(url.as_str())
1916                    .header(USER_AGENT, self.hub._user_agent.clone());
1917
1918                if let Some(token) = token.as_ref() {
1919                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1920                }
1921
1922                let request = req_builder
1923                    .header(CONTENT_LENGTH, 0_u64)
1924                    .body(common::to_body::<String>(None));
1925
1926                client.request(request.unwrap()).await
1927            };
1928
1929            match req_result {
1930                Err(err) => {
1931                    if let common::Retry::After(d) = dlg.http_error(&err) {
1932                        sleep(d).await;
1933                        continue;
1934                    }
1935                    dlg.finished(false);
1936                    return Err(common::Error::HttpError(err));
1937                }
1938                Ok(res) => {
1939                    let (mut parts, body) = res.into_parts();
1940                    let mut body = common::Body::new(body);
1941                    if !parts.status.is_success() {
1942                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1943                        let error = serde_json::from_str(&common::to_string(&bytes));
1944                        let response = common::to_response(parts, bytes.into());
1945
1946                        if let common::Retry::After(d) =
1947                            dlg.http_failure(&response, error.as_ref().ok())
1948                        {
1949                            sleep(d).await;
1950                            continue;
1951                        }
1952
1953                        dlg.finished(false);
1954
1955                        return Err(match error {
1956                            Ok(value) => common::Error::BadRequest(value),
1957                            _ => common::Error::Failure(response),
1958                        });
1959                    }
1960                    let response = {
1961                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1962                        let encoded = common::to_string(&bytes);
1963                        match serde_json::from_str(&encoded) {
1964                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1965                            Err(error) => {
1966                                dlg.response_json_decode_error(&encoded, &error);
1967                                return Err(common::Error::JsonDecodeError(
1968                                    encoded.to_string(),
1969                                    error,
1970                                ));
1971                            }
1972                        }
1973                    };
1974
1975                    dlg.finished(true);
1976                    return Ok(response);
1977                }
1978            }
1979        }
1980    }
1981
1982    /// Part of `name`. Resource name for the location.
1983    ///
1984    /// Sets the *apps id* path property to the given value.
1985    ///
1986    /// Even though the property as already been set when instantiating this call,
1987    /// we provide this method for API completeness.
1988    pub fn apps_id(mut self, new_value: &str) -> AppLocationGetCall<'a, C> {
1989        self._apps_id = new_value.to_string();
1990        self
1991    }
1992    /// Part of `name`. See documentation of `appsId`.
1993    ///
1994    /// Sets the *locations id* path property to the given value.
1995    ///
1996    /// Even though the property as already been set when instantiating this call,
1997    /// we provide this method for API completeness.
1998    pub fn locations_id(mut self, new_value: &str) -> AppLocationGetCall<'a, C> {
1999        self._locations_id = new_value.to_string();
2000        self
2001    }
2002    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2003    /// while executing the actual API request.
2004    ///
2005    /// ````text
2006    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2007    /// ````
2008    ///
2009    /// Sets the *delegate* property to the given value.
2010    pub fn delegate(
2011        mut self,
2012        new_value: &'a mut dyn common::Delegate,
2013    ) -> AppLocationGetCall<'a, C> {
2014        self._delegate = Some(new_value);
2015        self
2016    }
2017
2018    /// Set any additional parameter of the query string used in the request.
2019    /// It should be used to set parameters which are not yet available through their own
2020    /// setters.
2021    ///
2022    /// Please note that this method must not be used to set any of the known parameters
2023    /// which have their own setter method. If done anyway, the request will fail.
2024    ///
2025    /// # Additional Parameters
2026    ///
2027    /// * *$.xgafv* (query-string) - V1 error format.
2028    /// * *access_token* (query-string) - OAuth access token.
2029    /// * *alt* (query-string) - Data format for response.
2030    /// * *callback* (query-string) - JSONP
2031    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2032    /// * *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.
2033    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2034    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2035    /// * *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.
2036    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2037    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2038    pub fn param<T>(mut self, name: T, value: T) -> AppLocationGetCall<'a, C>
2039    where
2040        T: AsRef<str>,
2041    {
2042        self._additional_params
2043            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2044        self
2045    }
2046
2047    /// Identifies the authorization scope for the method you are building.
2048    ///
2049    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2050    /// [`Scope::CloudPlatformReadOnly`].
2051    ///
2052    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2053    /// tokens for more than one scope.
2054    ///
2055    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2056    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2057    /// sufficient, a read-write scope will do as well.
2058    pub fn add_scope<St>(mut self, scope: St) -> AppLocationGetCall<'a, C>
2059    where
2060        St: AsRef<str>,
2061    {
2062        self._scopes.insert(String::from(scope.as_ref()));
2063        self
2064    }
2065    /// Identifies the authorization scope(s) for the method you are building.
2066    ///
2067    /// See [`Self::add_scope()`] for details.
2068    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppLocationGetCall<'a, C>
2069    where
2070        I: IntoIterator<Item = St>,
2071        St: AsRef<str>,
2072    {
2073        self._scopes
2074            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2075        self
2076    }
2077
2078    /// Removes all scopes, and no default scope will be used either.
2079    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2080    /// for details).
2081    pub fn clear_scopes(mut self) -> AppLocationGetCall<'a, C> {
2082        self._scopes.clear();
2083        self
2084    }
2085}
2086
2087/// Lists information about the supported locations for this service.
2088///
2089/// A builder for the *locations.list* method supported by a *app* resource.
2090/// It is not used directly, but through a [`AppMethods`] instance.
2091///
2092/// # Example
2093///
2094/// Instantiate a resource method builder
2095///
2096/// ```test_harness,no_run
2097/// # extern crate hyper;
2098/// # extern crate hyper_rustls;
2099/// # extern crate google_appengine1_beta4 as appengine1_beta4;
2100/// # async fn dox() {
2101/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2102///
2103/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2104/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2105/// #     .with_native_roots()
2106/// #     .unwrap()
2107/// #     .https_only()
2108/// #     .enable_http2()
2109/// #     .build();
2110///
2111/// # let executor = hyper_util::rt::TokioExecutor::new();
2112/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2113/// #     secret,
2114/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2115/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2116/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2117/// #     ),
2118/// # ).build().await.unwrap();
2119///
2120/// # let client = hyper_util::client::legacy::Client::builder(
2121/// #     hyper_util::rt::TokioExecutor::new()
2122/// # )
2123/// # .build(
2124/// #     hyper_rustls::HttpsConnectorBuilder::new()
2125/// #         .with_native_roots()
2126/// #         .unwrap()
2127/// #         .https_or_http()
2128/// #         .enable_http2()
2129/// #         .build()
2130/// # );
2131/// # let mut hub = Appengine::new(client, auth);
2132/// // You can configure optional parameters by calling the respective setters at will, and
2133/// // execute the final call using `doit()`.
2134/// // Values shown here are possibly random and not representative !
2135/// let result = hub.apps().locations_list("appsId")
2136///              .page_token("gubergren")
2137///              .page_size(-75)
2138///              .filter("dolor")
2139///              .doit().await;
2140/// # }
2141/// ```
2142pub struct AppLocationListCall<'a, C>
2143where
2144    C: 'a,
2145{
2146    hub: &'a Appengine<C>,
2147    _apps_id: String,
2148    _page_token: Option<String>,
2149    _page_size: Option<i32>,
2150    _filter: Option<String>,
2151    _delegate: Option<&'a mut dyn common::Delegate>,
2152    _additional_params: HashMap<String, String>,
2153    _scopes: BTreeSet<String>,
2154}
2155
2156impl<'a, C> common::CallBuilder for AppLocationListCall<'a, C> {}
2157
2158impl<'a, C> AppLocationListCall<'a, C>
2159where
2160    C: common::Connector,
2161{
2162    /// Perform the operation you have build so far.
2163    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
2164        use std::borrow::Cow;
2165        use std::io::{Read, Seek};
2166
2167        use common::{url::Params, ToParts};
2168        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2169
2170        let mut dd = common::DefaultDelegate;
2171        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2172        dlg.begin(common::MethodInfo {
2173            id: "appengine.apps.locations.list",
2174            http_method: hyper::Method::GET,
2175        });
2176
2177        for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() {
2178            if self._additional_params.contains_key(field) {
2179                dlg.finished(false);
2180                return Err(common::Error::FieldClash(field));
2181            }
2182        }
2183
2184        let mut params = Params::with_capacity(6 + self._additional_params.len());
2185        params.push("appsId", self._apps_id);
2186        if let Some(value) = self._page_token.as_ref() {
2187            params.push("pageToken", value);
2188        }
2189        if let Some(value) = self._page_size.as_ref() {
2190            params.push("pageSize", value.to_string());
2191        }
2192        if let Some(value) = self._filter.as_ref() {
2193            params.push("filter", value);
2194        }
2195
2196        params.extend(self._additional_params.iter());
2197
2198        params.push("alt", "json");
2199        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/locations";
2200        if self._scopes.is_empty() {
2201            self._scopes
2202                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
2203        }
2204
2205        #[allow(clippy::single_element_loop)]
2206        for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
2207            url = params.uri_replacement(url, param_name, find_this, false);
2208        }
2209        {
2210            let to_remove = ["appsId"];
2211            params.remove_params(&to_remove);
2212        }
2213
2214        let url = params.parse_with_url(&url);
2215
2216        loop {
2217            let token = match self
2218                .hub
2219                .auth
2220                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2221                .await
2222            {
2223                Ok(token) => token,
2224                Err(e) => match dlg.token(e) {
2225                    Ok(token) => token,
2226                    Err(e) => {
2227                        dlg.finished(false);
2228                        return Err(common::Error::MissingToken(e));
2229                    }
2230                },
2231            };
2232            let mut req_result = {
2233                let client = &self.hub.client;
2234                dlg.pre_request();
2235                let mut req_builder = hyper::Request::builder()
2236                    .method(hyper::Method::GET)
2237                    .uri(url.as_str())
2238                    .header(USER_AGENT, self.hub._user_agent.clone());
2239
2240                if let Some(token) = token.as_ref() {
2241                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2242                }
2243
2244                let request = req_builder
2245                    .header(CONTENT_LENGTH, 0_u64)
2246                    .body(common::to_body::<String>(None));
2247
2248                client.request(request.unwrap()).await
2249            };
2250
2251            match req_result {
2252                Err(err) => {
2253                    if let common::Retry::After(d) = dlg.http_error(&err) {
2254                        sleep(d).await;
2255                        continue;
2256                    }
2257                    dlg.finished(false);
2258                    return Err(common::Error::HttpError(err));
2259                }
2260                Ok(res) => {
2261                    let (mut parts, body) = res.into_parts();
2262                    let mut body = common::Body::new(body);
2263                    if !parts.status.is_success() {
2264                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2265                        let error = serde_json::from_str(&common::to_string(&bytes));
2266                        let response = common::to_response(parts, bytes.into());
2267
2268                        if let common::Retry::After(d) =
2269                            dlg.http_failure(&response, error.as_ref().ok())
2270                        {
2271                            sleep(d).await;
2272                            continue;
2273                        }
2274
2275                        dlg.finished(false);
2276
2277                        return Err(match error {
2278                            Ok(value) => common::Error::BadRequest(value),
2279                            _ => common::Error::Failure(response),
2280                        });
2281                    }
2282                    let response = {
2283                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2284                        let encoded = common::to_string(&bytes);
2285                        match serde_json::from_str(&encoded) {
2286                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2287                            Err(error) => {
2288                                dlg.response_json_decode_error(&encoded, &error);
2289                                return Err(common::Error::JsonDecodeError(
2290                                    encoded.to_string(),
2291                                    error,
2292                                ));
2293                            }
2294                        }
2295                    };
2296
2297                    dlg.finished(true);
2298                    return Ok(response);
2299                }
2300            }
2301        }
2302    }
2303
2304    /// Part of `name`. The resource that owns the locations collection, if applicable.
2305    ///
2306    /// Sets the *apps id* path property to the given value.
2307    ///
2308    /// Even though the property as already been set when instantiating this call,
2309    /// we provide this method for API completeness.
2310    pub fn apps_id(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
2311        self._apps_id = new_value.to_string();
2312        self
2313    }
2314    /// The standard list page token.
2315    ///
2316    /// Sets the *page token* query property to the given value.
2317    pub fn page_token(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
2318        self._page_token = Some(new_value.to_string());
2319        self
2320    }
2321    /// The standard list page size.
2322    ///
2323    /// Sets the *page size* query property to the given value.
2324    pub fn page_size(mut self, new_value: i32) -> AppLocationListCall<'a, C> {
2325        self._page_size = Some(new_value);
2326        self
2327    }
2328    /// The standard list filter.
2329    ///
2330    /// Sets the *filter* query property to the given value.
2331    pub fn filter(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
2332        self._filter = Some(new_value.to_string());
2333        self
2334    }
2335    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2336    /// while executing the actual API request.
2337    ///
2338    /// ````text
2339    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2340    /// ````
2341    ///
2342    /// Sets the *delegate* property to the given value.
2343    pub fn delegate(
2344        mut self,
2345        new_value: &'a mut dyn common::Delegate,
2346    ) -> AppLocationListCall<'a, C> {
2347        self._delegate = Some(new_value);
2348        self
2349    }
2350
2351    /// Set any additional parameter of the query string used in the request.
2352    /// It should be used to set parameters which are not yet available through their own
2353    /// setters.
2354    ///
2355    /// Please note that this method must not be used to set any of the known parameters
2356    /// which have their own setter method. If done anyway, the request will fail.
2357    ///
2358    /// # Additional Parameters
2359    ///
2360    /// * *$.xgafv* (query-string) - V1 error format.
2361    /// * *access_token* (query-string) - OAuth access token.
2362    /// * *alt* (query-string) - Data format for response.
2363    /// * *callback* (query-string) - JSONP
2364    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2365    /// * *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.
2366    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2367    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2368    /// * *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.
2369    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2370    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2371    pub fn param<T>(mut self, name: T, value: T) -> AppLocationListCall<'a, C>
2372    where
2373        T: AsRef<str>,
2374    {
2375        self._additional_params
2376            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2377        self
2378    }
2379
2380    /// Identifies the authorization scope for the method you are building.
2381    ///
2382    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2383    /// [`Scope::CloudPlatformReadOnly`].
2384    ///
2385    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2386    /// tokens for more than one scope.
2387    ///
2388    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2389    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2390    /// sufficient, a read-write scope will do as well.
2391    pub fn add_scope<St>(mut self, scope: St) -> AppLocationListCall<'a, C>
2392    where
2393        St: AsRef<str>,
2394    {
2395        self._scopes.insert(String::from(scope.as_ref()));
2396        self
2397    }
2398    /// Identifies the authorization scope(s) for the method you are building.
2399    ///
2400    /// See [`Self::add_scope()`] for details.
2401    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppLocationListCall<'a, C>
2402    where
2403        I: IntoIterator<Item = St>,
2404        St: AsRef<str>,
2405    {
2406        self._scopes
2407            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2408        self
2409    }
2410
2411    /// Removes all scopes, and no default scope will be used either.
2412    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2413    /// for details).
2414    pub fn clear_scopes(mut self) -> AppLocationListCall<'a, C> {
2415        self._scopes.clear();
2416        self
2417    }
2418}
2419
2420/// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment.
2421///
2422/// A builder for the *modules.versions.instances.debug* method supported by a *app* resource.
2423/// It is not used directly, but through a [`AppMethods`] instance.
2424///
2425/// # Example
2426///
2427/// Instantiate a resource method builder
2428///
2429/// ```test_harness,no_run
2430/// # extern crate hyper;
2431/// # extern crate hyper_rustls;
2432/// # extern crate google_appengine1_beta4 as appengine1_beta4;
2433/// use appengine1_beta4::api::DebugInstanceRequest;
2434/// # async fn dox() {
2435/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2436///
2437/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2438/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2439/// #     .with_native_roots()
2440/// #     .unwrap()
2441/// #     .https_only()
2442/// #     .enable_http2()
2443/// #     .build();
2444///
2445/// # let executor = hyper_util::rt::TokioExecutor::new();
2446/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2447/// #     secret,
2448/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2449/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2450/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2451/// #     ),
2452/// # ).build().await.unwrap();
2453///
2454/// # let client = hyper_util::client::legacy::Client::builder(
2455/// #     hyper_util::rt::TokioExecutor::new()
2456/// # )
2457/// # .build(
2458/// #     hyper_rustls::HttpsConnectorBuilder::new()
2459/// #         .with_native_roots()
2460/// #         .unwrap()
2461/// #         .https_or_http()
2462/// #         .enable_http2()
2463/// #         .build()
2464/// # );
2465/// # let mut hub = Appengine::new(client, auth);
2466/// // As the method needs a request, you would usually fill it with the desired information
2467/// // into the respective structure. Some of the parts shown here might not be applicable !
2468/// // Values shown here are possibly random and not representative !
2469/// let mut req = DebugInstanceRequest::default();
2470///
2471/// // You can configure optional parameters by calling the respective setters at will, and
2472/// // execute the final call using `doit()`.
2473/// // Values shown here are possibly random and not representative !
2474/// let result = hub.apps().modules_versions_instances_debug(req, "appsId", "modulesId", "versionsId", "instancesId")
2475///              .doit().await;
2476/// # }
2477/// ```
2478pub struct AppModuleVersionInstanceDebugCall<'a, C>
2479where
2480    C: 'a,
2481{
2482    hub: &'a Appengine<C>,
2483    _request: DebugInstanceRequest,
2484    _apps_id: String,
2485    _modules_id: String,
2486    _versions_id: String,
2487    _instances_id: String,
2488    _delegate: Option<&'a mut dyn common::Delegate>,
2489    _additional_params: HashMap<String, String>,
2490    _scopes: BTreeSet<String>,
2491}
2492
2493impl<'a, C> common::CallBuilder for AppModuleVersionInstanceDebugCall<'a, C> {}
2494
2495impl<'a, C> AppModuleVersionInstanceDebugCall<'a, C>
2496where
2497    C: common::Connector,
2498{
2499    /// Perform the operation you have build so far.
2500    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2501        use std::borrow::Cow;
2502        use std::io::{Read, Seek};
2503
2504        use common::{url::Params, ToParts};
2505        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2506
2507        let mut dd = common::DefaultDelegate;
2508        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2509        dlg.begin(common::MethodInfo {
2510            id: "appengine.apps.modules.versions.instances.debug",
2511            http_method: hyper::Method::POST,
2512        });
2513
2514        for &field in ["alt", "appsId", "modulesId", "versionsId", "instancesId"].iter() {
2515            if self._additional_params.contains_key(field) {
2516                dlg.finished(false);
2517                return Err(common::Error::FieldClash(field));
2518            }
2519        }
2520
2521        let mut params = Params::with_capacity(7 + self._additional_params.len());
2522        params.push("appsId", self._apps_id);
2523        params.push("modulesId", self._modules_id);
2524        params.push("versionsId", self._versions_id);
2525        params.push("instancesId", self._instances_id);
2526
2527        params.extend(self._additional_params.iter());
2528
2529        params.push("alt", "json");
2530        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}/instances/{instancesId}:debug";
2531        if self._scopes.is_empty() {
2532            self._scopes
2533                .insert(Scope::CloudPlatform.as_ref().to_string());
2534        }
2535
2536        #[allow(clippy::single_element_loop)]
2537        for &(find_this, param_name) in [
2538            ("{appsId}", "appsId"),
2539            ("{modulesId}", "modulesId"),
2540            ("{versionsId}", "versionsId"),
2541            ("{instancesId}", "instancesId"),
2542        ]
2543        .iter()
2544        {
2545            url = params.uri_replacement(url, param_name, find_this, false);
2546        }
2547        {
2548            let to_remove = ["instancesId", "versionsId", "modulesId", "appsId"];
2549            params.remove_params(&to_remove);
2550        }
2551
2552        let url = params.parse_with_url(&url);
2553
2554        let mut json_mime_type = mime::APPLICATION_JSON;
2555        let mut request_value_reader = {
2556            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2557            common::remove_json_null_values(&mut value);
2558            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2559            serde_json::to_writer(&mut dst, &value).unwrap();
2560            dst
2561        };
2562        let request_size = request_value_reader
2563            .seek(std::io::SeekFrom::End(0))
2564            .unwrap();
2565        request_value_reader
2566            .seek(std::io::SeekFrom::Start(0))
2567            .unwrap();
2568
2569        loop {
2570            let token = match self
2571                .hub
2572                .auth
2573                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2574                .await
2575            {
2576                Ok(token) => token,
2577                Err(e) => match dlg.token(e) {
2578                    Ok(token) => token,
2579                    Err(e) => {
2580                        dlg.finished(false);
2581                        return Err(common::Error::MissingToken(e));
2582                    }
2583                },
2584            };
2585            request_value_reader
2586                .seek(std::io::SeekFrom::Start(0))
2587                .unwrap();
2588            let mut req_result = {
2589                let client = &self.hub.client;
2590                dlg.pre_request();
2591                let mut req_builder = hyper::Request::builder()
2592                    .method(hyper::Method::POST)
2593                    .uri(url.as_str())
2594                    .header(USER_AGENT, self.hub._user_agent.clone());
2595
2596                if let Some(token) = token.as_ref() {
2597                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2598                }
2599
2600                let request = req_builder
2601                    .header(CONTENT_TYPE, json_mime_type.to_string())
2602                    .header(CONTENT_LENGTH, request_size as u64)
2603                    .body(common::to_body(
2604                        request_value_reader.get_ref().clone().into(),
2605                    ));
2606
2607                client.request(request.unwrap()).await
2608            };
2609
2610            match req_result {
2611                Err(err) => {
2612                    if let common::Retry::After(d) = dlg.http_error(&err) {
2613                        sleep(d).await;
2614                        continue;
2615                    }
2616                    dlg.finished(false);
2617                    return Err(common::Error::HttpError(err));
2618                }
2619                Ok(res) => {
2620                    let (mut parts, body) = res.into_parts();
2621                    let mut body = common::Body::new(body);
2622                    if !parts.status.is_success() {
2623                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2624                        let error = serde_json::from_str(&common::to_string(&bytes));
2625                        let response = common::to_response(parts, bytes.into());
2626
2627                        if let common::Retry::After(d) =
2628                            dlg.http_failure(&response, error.as_ref().ok())
2629                        {
2630                            sleep(d).await;
2631                            continue;
2632                        }
2633
2634                        dlg.finished(false);
2635
2636                        return Err(match error {
2637                            Ok(value) => common::Error::BadRequest(value),
2638                            _ => common::Error::Failure(response),
2639                        });
2640                    }
2641                    let response = {
2642                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2643                        let encoded = common::to_string(&bytes);
2644                        match serde_json::from_str(&encoded) {
2645                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2646                            Err(error) => {
2647                                dlg.response_json_decode_error(&encoded, &error);
2648                                return Err(common::Error::JsonDecodeError(
2649                                    encoded.to_string(),
2650                                    error,
2651                                ));
2652                            }
2653                        }
2654                    };
2655
2656                    dlg.finished(true);
2657                    return Ok(response);
2658                }
2659            }
2660        }
2661    }
2662
2663    ///
2664    /// Sets the *request* property to the given value.
2665    ///
2666    /// Even though the property as already been set when instantiating this call,
2667    /// we provide this method for API completeness.
2668    pub fn request(
2669        mut self,
2670        new_value: DebugInstanceRequest,
2671    ) -> AppModuleVersionInstanceDebugCall<'a, C> {
2672        self._request = new_value;
2673        self
2674    }
2675    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.
2676    ///
2677    /// Sets the *apps id* path property to the given value.
2678    ///
2679    /// Even though the property as already been set when instantiating this call,
2680    /// we provide this method for API completeness.
2681    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionInstanceDebugCall<'a, C> {
2682        self._apps_id = new_value.to_string();
2683        self
2684    }
2685    /// Part of `name`. See documentation of `appsId`.
2686    ///
2687    /// Sets the *modules id* path property to the given value.
2688    ///
2689    /// Even though the property as already been set when instantiating this call,
2690    /// we provide this method for API completeness.
2691    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionInstanceDebugCall<'a, C> {
2692        self._modules_id = new_value.to_string();
2693        self
2694    }
2695    /// Part of `name`. See documentation of `appsId`.
2696    ///
2697    /// Sets the *versions id* path property to the given value.
2698    ///
2699    /// Even though the property as already been set when instantiating this call,
2700    /// we provide this method for API completeness.
2701    pub fn versions_id(mut self, new_value: &str) -> AppModuleVersionInstanceDebugCall<'a, C> {
2702        self._versions_id = new_value.to_string();
2703        self
2704    }
2705    /// Part of `name`. See documentation of `appsId`.
2706    ///
2707    /// Sets the *instances id* path property to the given value.
2708    ///
2709    /// Even though the property as already been set when instantiating this call,
2710    /// we provide this method for API completeness.
2711    pub fn instances_id(mut self, new_value: &str) -> AppModuleVersionInstanceDebugCall<'a, C> {
2712        self._instances_id = new_value.to_string();
2713        self
2714    }
2715    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2716    /// while executing the actual API request.
2717    ///
2718    /// ````text
2719    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2720    /// ````
2721    ///
2722    /// Sets the *delegate* property to the given value.
2723    pub fn delegate(
2724        mut self,
2725        new_value: &'a mut dyn common::Delegate,
2726    ) -> AppModuleVersionInstanceDebugCall<'a, C> {
2727        self._delegate = Some(new_value);
2728        self
2729    }
2730
2731    /// Set any additional parameter of the query string used in the request.
2732    /// It should be used to set parameters which are not yet available through their own
2733    /// setters.
2734    ///
2735    /// Please note that this method must not be used to set any of the known parameters
2736    /// which have their own setter method. If done anyway, the request will fail.
2737    ///
2738    /// # Additional Parameters
2739    ///
2740    /// * *$.xgafv* (query-string) - V1 error format.
2741    /// * *access_token* (query-string) - OAuth access token.
2742    /// * *alt* (query-string) - Data format for response.
2743    /// * *callback* (query-string) - JSONP
2744    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2745    /// * *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.
2746    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2747    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2748    /// * *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.
2749    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2750    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2751    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionInstanceDebugCall<'a, C>
2752    where
2753        T: AsRef<str>,
2754    {
2755        self._additional_params
2756            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2757        self
2758    }
2759
2760    /// Identifies the authorization scope for the method you are building.
2761    ///
2762    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2763    /// [`Scope::CloudPlatform`].
2764    ///
2765    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2766    /// tokens for more than one scope.
2767    ///
2768    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2769    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2770    /// sufficient, a read-write scope will do as well.
2771    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionInstanceDebugCall<'a, C>
2772    where
2773        St: AsRef<str>,
2774    {
2775        self._scopes.insert(String::from(scope.as_ref()));
2776        self
2777    }
2778    /// Identifies the authorization scope(s) for the method you are building.
2779    ///
2780    /// See [`Self::add_scope()`] for details.
2781    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionInstanceDebugCall<'a, C>
2782    where
2783        I: IntoIterator<Item = St>,
2784        St: AsRef<str>,
2785    {
2786        self._scopes
2787            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2788        self
2789    }
2790
2791    /// Removes all scopes, and no default scope will be used either.
2792    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2793    /// for details).
2794    pub fn clear_scopes(mut self) -> AppModuleVersionInstanceDebugCall<'a, C> {
2795        self._scopes.clear();
2796        self
2797    }
2798}
2799
2800/// Stops a running instance.
2801///
2802/// A builder for the *modules.versions.instances.delete* method supported by a *app* resource.
2803/// It is not used directly, but through a [`AppMethods`] instance.
2804///
2805/// # Example
2806///
2807/// Instantiate a resource method builder
2808///
2809/// ```test_harness,no_run
2810/// # extern crate hyper;
2811/// # extern crate hyper_rustls;
2812/// # extern crate google_appengine1_beta4 as appengine1_beta4;
2813/// # async fn dox() {
2814/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2815///
2816/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2817/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2818/// #     .with_native_roots()
2819/// #     .unwrap()
2820/// #     .https_only()
2821/// #     .enable_http2()
2822/// #     .build();
2823///
2824/// # let executor = hyper_util::rt::TokioExecutor::new();
2825/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2826/// #     secret,
2827/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2828/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2829/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2830/// #     ),
2831/// # ).build().await.unwrap();
2832///
2833/// # let client = hyper_util::client::legacy::Client::builder(
2834/// #     hyper_util::rt::TokioExecutor::new()
2835/// # )
2836/// # .build(
2837/// #     hyper_rustls::HttpsConnectorBuilder::new()
2838/// #         .with_native_roots()
2839/// #         .unwrap()
2840/// #         .https_or_http()
2841/// #         .enable_http2()
2842/// #         .build()
2843/// # );
2844/// # let mut hub = Appengine::new(client, auth);
2845/// // You can configure optional parameters by calling the respective setters at will, and
2846/// // execute the final call using `doit()`.
2847/// // Values shown here are possibly random and not representative !
2848/// let result = hub.apps().modules_versions_instances_delete("appsId", "modulesId", "versionsId", "instancesId")
2849///              .doit().await;
2850/// # }
2851/// ```
2852pub struct AppModuleVersionInstanceDeleteCall<'a, C>
2853where
2854    C: 'a,
2855{
2856    hub: &'a Appengine<C>,
2857    _apps_id: String,
2858    _modules_id: String,
2859    _versions_id: String,
2860    _instances_id: String,
2861    _delegate: Option<&'a mut dyn common::Delegate>,
2862    _additional_params: HashMap<String, String>,
2863    _scopes: BTreeSet<String>,
2864}
2865
2866impl<'a, C> common::CallBuilder for AppModuleVersionInstanceDeleteCall<'a, C> {}
2867
2868impl<'a, C> AppModuleVersionInstanceDeleteCall<'a, C>
2869where
2870    C: common::Connector,
2871{
2872    /// Perform the operation you have build so far.
2873    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2874        use std::borrow::Cow;
2875        use std::io::{Read, Seek};
2876
2877        use common::{url::Params, ToParts};
2878        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2879
2880        let mut dd = common::DefaultDelegate;
2881        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2882        dlg.begin(common::MethodInfo {
2883            id: "appengine.apps.modules.versions.instances.delete",
2884            http_method: hyper::Method::DELETE,
2885        });
2886
2887        for &field in ["alt", "appsId", "modulesId", "versionsId", "instancesId"].iter() {
2888            if self._additional_params.contains_key(field) {
2889                dlg.finished(false);
2890                return Err(common::Error::FieldClash(field));
2891            }
2892        }
2893
2894        let mut params = Params::with_capacity(6 + self._additional_params.len());
2895        params.push("appsId", self._apps_id);
2896        params.push("modulesId", self._modules_id);
2897        params.push("versionsId", self._versions_id);
2898        params.push("instancesId", self._instances_id);
2899
2900        params.extend(self._additional_params.iter());
2901
2902        params.push("alt", "json");
2903        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}/instances/{instancesId}";
2904        if self._scopes.is_empty() {
2905            self._scopes
2906                .insert(Scope::CloudPlatform.as_ref().to_string());
2907        }
2908
2909        #[allow(clippy::single_element_loop)]
2910        for &(find_this, param_name) in [
2911            ("{appsId}", "appsId"),
2912            ("{modulesId}", "modulesId"),
2913            ("{versionsId}", "versionsId"),
2914            ("{instancesId}", "instancesId"),
2915        ]
2916        .iter()
2917        {
2918            url = params.uri_replacement(url, param_name, find_this, false);
2919        }
2920        {
2921            let to_remove = ["instancesId", "versionsId", "modulesId", "appsId"];
2922            params.remove_params(&to_remove);
2923        }
2924
2925        let url = params.parse_with_url(&url);
2926
2927        loop {
2928            let token = match self
2929                .hub
2930                .auth
2931                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2932                .await
2933            {
2934                Ok(token) => token,
2935                Err(e) => match dlg.token(e) {
2936                    Ok(token) => token,
2937                    Err(e) => {
2938                        dlg.finished(false);
2939                        return Err(common::Error::MissingToken(e));
2940                    }
2941                },
2942            };
2943            let mut req_result = {
2944                let client = &self.hub.client;
2945                dlg.pre_request();
2946                let mut req_builder = hyper::Request::builder()
2947                    .method(hyper::Method::DELETE)
2948                    .uri(url.as_str())
2949                    .header(USER_AGENT, self.hub._user_agent.clone());
2950
2951                if let Some(token) = token.as_ref() {
2952                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2953                }
2954
2955                let request = req_builder
2956                    .header(CONTENT_LENGTH, 0_u64)
2957                    .body(common::to_body::<String>(None));
2958
2959                client.request(request.unwrap()).await
2960            };
2961
2962            match req_result {
2963                Err(err) => {
2964                    if let common::Retry::After(d) = dlg.http_error(&err) {
2965                        sleep(d).await;
2966                        continue;
2967                    }
2968                    dlg.finished(false);
2969                    return Err(common::Error::HttpError(err));
2970                }
2971                Ok(res) => {
2972                    let (mut parts, body) = res.into_parts();
2973                    let mut body = common::Body::new(body);
2974                    if !parts.status.is_success() {
2975                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2976                        let error = serde_json::from_str(&common::to_string(&bytes));
2977                        let response = common::to_response(parts, bytes.into());
2978
2979                        if let common::Retry::After(d) =
2980                            dlg.http_failure(&response, error.as_ref().ok())
2981                        {
2982                            sleep(d).await;
2983                            continue;
2984                        }
2985
2986                        dlg.finished(false);
2987
2988                        return Err(match error {
2989                            Ok(value) => common::Error::BadRequest(value),
2990                            _ => common::Error::Failure(response),
2991                        });
2992                    }
2993                    let response = {
2994                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2995                        let encoded = common::to_string(&bytes);
2996                        match serde_json::from_str(&encoded) {
2997                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2998                            Err(error) => {
2999                                dlg.response_json_decode_error(&encoded, &error);
3000                                return Err(common::Error::JsonDecodeError(
3001                                    encoded.to_string(),
3002                                    error,
3003                                ));
3004                            }
3005                        }
3006                    };
3007
3008                    dlg.finished(true);
3009                    return Ok(response);
3010                }
3011            }
3012        }
3013    }
3014
3015    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.
3016    ///
3017    /// Sets the *apps id* path property to the given value.
3018    ///
3019    /// Even though the property as already been set when instantiating this call,
3020    /// we provide this method for API completeness.
3021    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionInstanceDeleteCall<'a, C> {
3022        self._apps_id = new_value.to_string();
3023        self
3024    }
3025    /// Part of `name`. See documentation of `appsId`.
3026    ///
3027    /// Sets the *modules id* path property to the given value.
3028    ///
3029    /// Even though the property as already been set when instantiating this call,
3030    /// we provide this method for API completeness.
3031    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionInstanceDeleteCall<'a, C> {
3032        self._modules_id = new_value.to_string();
3033        self
3034    }
3035    /// Part of `name`. See documentation of `appsId`.
3036    ///
3037    /// Sets the *versions id* path property to the given value.
3038    ///
3039    /// Even though the property as already been set when instantiating this call,
3040    /// we provide this method for API completeness.
3041    pub fn versions_id(mut self, new_value: &str) -> AppModuleVersionInstanceDeleteCall<'a, C> {
3042        self._versions_id = new_value.to_string();
3043        self
3044    }
3045    /// Part of `name`. See documentation of `appsId`.
3046    ///
3047    /// Sets the *instances id* path property to the given value.
3048    ///
3049    /// Even though the property as already been set when instantiating this call,
3050    /// we provide this method for API completeness.
3051    pub fn instances_id(mut self, new_value: &str) -> AppModuleVersionInstanceDeleteCall<'a, C> {
3052        self._instances_id = new_value.to_string();
3053        self
3054    }
3055    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3056    /// while executing the actual API request.
3057    ///
3058    /// ````text
3059    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3060    /// ````
3061    ///
3062    /// Sets the *delegate* property to the given value.
3063    pub fn delegate(
3064        mut self,
3065        new_value: &'a mut dyn common::Delegate,
3066    ) -> AppModuleVersionInstanceDeleteCall<'a, C> {
3067        self._delegate = Some(new_value);
3068        self
3069    }
3070
3071    /// Set any additional parameter of the query string used in the request.
3072    /// It should be used to set parameters which are not yet available through their own
3073    /// setters.
3074    ///
3075    /// Please note that this method must not be used to set any of the known parameters
3076    /// which have their own setter method. If done anyway, the request will fail.
3077    ///
3078    /// # Additional Parameters
3079    ///
3080    /// * *$.xgafv* (query-string) - V1 error format.
3081    /// * *access_token* (query-string) - OAuth access token.
3082    /// * *alt* (query-string) - Data format for response.
3083    /// * *callback* (query-string) - JSONP
3084    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3085    /// * *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.
3086    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3087    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3088    /// * *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.
3089    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3090    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3091    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionInstanceDeleteCall<'a, C>
3092    where
3093        T: AsRef<str>,
3094    {
3095        self._additional_params
3096            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3097        self
3098    }
3099
3100    /// Identifies the authorization scope for the method you are building.
3101    ///
3102    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3103    /// [`Scope::CloudPlatform`].
3104    ///
3105    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3106    /// tokens for more than one scope.
3107    ///
3108    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3109    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3110    /// sufficient, a read-write scope will do as well.
3111    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionInstanceDeleteCall<'a, C>
3112    where
3113        St: AsRef<str>,
3114    {
3115        self._scopes.insert(String::from(scope.as_ref()));
3116        self
3117    }
3118    /// Identifies the authorization scope(s) for the method you are building.
3119    ///
3120    /// See [`Self::add_scope()`] for details.
3121    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionInstanceDeleteCall<'a, C>
3122    where
3123        I: IntoIterator<Item = St>,
3124        St: AsRef<str>,
3125    {
3126        self._scopes
3127            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3128        self
3129    }
3130
3131    /// Removes all scopes, and no default scope will be used either.
3132    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3133    /// for details).
3134    pub fn clear_scopes(mut self) -> AppModuleVersionInstanceDeleteCall<'a, C> {
3135        self._scopes.clear();
3136        self
3137    }
3138}
3139
3140/// Gets instance information.
3141///
3142/// A builder for the *modules.versions.instances.get* method supported by a *app* resource.
3143/// It is not used directly, but through a [`AppMethods`] instance.
3144///
3145/// # Example
3146///
3147/// Instantiate a resource method builder
3148///
3149/// ```test_harness,no_run
3150/// # extern crate hyper;
3151/// # extern crate hyper_rustls;
3152/// # extern crate google_appengine1_beta4 as appengine1_beta4;
3153/// # async fn dox() {
3154/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3155///
3156/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3157/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3158/// #     .with_native_roots()
3159/// #     .unwrap()
3160/// #     .https_only()
3161/// #     .enable_http2()
3162/// #     .build();
3163///
3164/// # let executor = hyper_util::rt::TokioExecutor::new();
3165/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3166/// #     secret,
3167/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3168/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3169/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3170/// #     ),
3171/// # ).build().await.unwrap();
3172///
3173/// # let client = hyper_util::client::legacy::Client::builder(
3174/// #     hyper_util::rt::TokioExecutor::new()
3175/// # )
3176/// # .build(
3177/// #     hyper_rustls::HttpsConnectorBuilder::new()
3178/// #         .with_native_roots()
3179/// #         .unwrap()
3180/// #         .https_or_http()
3181/// #         .enable_http2()
3182/// #         .build()
3183/// # );
3184/// # let mut hub = Appengine::new(client, auth);
3185/// // You can configure optional parameters by calling the respective setters at will, and
3186/// // execute the final call using `doit()`.
3187/// // Values shown here are possibly random and not representative !
3188/// let result = hub.apps().modules_versions_instances_get("appsId", "modulesId", "versionsId", "instancesId")
3189///              .doit().await;
3190/// # }
3191/// ```
3192pub struct AppModuleVersionInstanceGetCall<'a, C>
3193where
3194    C: 'a,
3195{
3196    hub: &'a Appengine<C>,
3197    _apps_id: String,
3198    _modules_id: String,
3199    _versions_id: String,
3200    _instances_id: String,
3201    _delegate: Option<&'a mut dyn common::Delegate>,
3202    _additional_params: HashMap<String, String>,
3203    _scopes: BTreeSet<String>,
3204}
3205
3206impl<'a, C> common::CallBuilder for AppModuleVersionInstanceGetCall<'a, C> {}
3207
3208impl<'a, C> AppModuleVersionInstanceGetCall<'a, C>
3209where
3210    C: common::Connector,
3211{
3212    /// Perform the operation you have build so far.
3213    pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
3214        use std::borrow::Cow;
3215        use std::io::{Read, Seek};
3216
3217        use common::{url::Params, ToParts};
3218        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3219
3220        let mut dd = common::DefaultDelegate;
3221        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3222        dlg.begin(common::MethodInfo {
3223            id: "appengine.apps.modules.versions.instances.get",
3224            http_method: hyper::Method::GET,
3225        });
3226
3227        for &field in ["alt", "appsId", "modulesId", "versionsId", "instancesId"].iter() {
3228            if self._additional_params.contains_key(field) {
3229                dlg.finished(false);
3230                return Err(common::Error::FieldClash(field));
3231            }
3232        }
3233
3234        let mut params = Params::with_capacity(6 + self._additional_params.len());
3235        params.push("appsId", self._apps_id);
3236        params.push("modulesId", self._modules_id);
3237        params.push("versionsId", self._versions_id);
3238        params.push("instancesId", self._instances_id);
3239
3240        params.extend(self._additional_params.iter());
3241
3242        params.push("alt", "json");
3243        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}/instances/{instancesId}";
3244        if self._scopes.is_empty() {
3245            self._scopes
3246                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3247        }
3248
3249        #[allow(clippy::single_element_loop)]
3250        for &(find_this, param_name) in [
3251            ("{appsId}", "appsId"),
3252            ("{modulesId}", "modulesId"),
3253            ("{versionsId}", "versionsId"),
3254            ("{instancesId}", "instancesId"),
3255        ]
3256        .iter()
3257        {
3258            url = params.uri_replacement(url, param_name, find_this, false);
3259        }
3260        {
3261            let to_remove = ["instancesId", "versionsId", "modulesId", "appsId"];
3262            params.remove_params(&to_remove);
3263        }
3264
3265        let url = params.parse_with_url(&url);
3266
3267        loop {
3268            let token = match self
3269                .hub
3270                .auth
3271                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3272                .await
3273            {
3274                Ok(token) => token,
3275                Err(e) => match dlg.token(e) {
3276                    Ok(token) => token,
3277                    Err(e) => {
3278                        dlg.finished(false);
3279                        return Err(common::Error::MissingToken(e));
3280                    }
3281                },
3282            };
3283            let mut req_result = {
3284                let client = &self.hub.client;
3285                dlg.pre_request();
3286                let mut req_builder = hyper::Request::builder()
3287                    .method(hyper::Method::GET)
3288                    .uri(url.as_str())
3289                    .header(USER_AGENT, self.hub._user_agent.clone());
3290
3291                if let Some(token) = token.as_ref() {
3292                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3293                }
3294
3295                let request = req_builder
3296                    .header(CONTENT_LENGTH, 0_u64)
3297                    .body(common::to_body::<String>(None));
3298
3299                client.request(request.unwrap()).await
3300            };
3301
3302            match req_result {
3303                Err(err) => {
3304                    if let common::Retry::After(d) = dlg.http_error(&err) {
3305                        sleep(d).await;
3306                        continue;
3307                    }
3308                    dlg.finished(false);
3309                    return Err(common::Error::HttpError(err));
3310                }
3311                Ok(res) => {
3312                    let (mut parts, body) = res.into_parts();
3313                    let mut body = common::Body::new(body);
3314                    if !parts.status.is_success() {
3315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3316                        let error = serde_json::from_str(&common::to_string(&bytes));
3317                        let response = common::to_response(parts, bytes.into());
3318
3319                        if let common::Retry::After(d) =
3320                            dlg.http_failure(&response, error.as_ref().ok())
3321                        {
3322                            sleep(d).await;
3323                            continue;
3324                        }
3325
3326                        dlg.finished(false);
3327
3328                        return Err(match error {
3329                            Ok(value) => common::Error::BadRequest(value),
3330                            _ => common::Error::Failure(response),
3331                        });
3332                    }
3333                    let response = {
3334                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3335                        let encoded = common::to_string(&bytes);
3336                        match serde_json::from_str(&encoded) {
3337                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3338                            Err(error) => {
3339                                dlg.response_json_decode_error(&encoded, &error);
3340                                return Err(common::Error::JsonDecodeError(
3341                                    encoded.to_string(),
3342                                    error,
3343                                ));
3344                            }
3345                        }
3346                    };
3347
3348                    dlg.finished(true);
3349                    return Ok(response);
3350                }
3351            }
3352        }
3353    }
3354
3355    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.
3356    ///
3357    /// Sets the *apps id* path property to the given value.
3358    ///
3359    /// Even though the property as already been set when instantiating this call,
3360    /// we provide this method for API completeness.
3361    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionInstanceGetCall<'a, C> {
3362        self._apps_id = new_value.to_string();
3363        self
3364    }
3365    /// Part of `name`. See documentation of `appsId`.
3366    ///
3367    /// Sets the *modules id* path property to the given value.
3368    ///
3369    /// Even though the property as already been set when instantiating this call,
3370    /// we provide this method for API completeness.
3371    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionInstanceGetCall<'a, C> {
3372        self._modules_id = new_value.to_string();
3373        self
3374    }
3375    /// Part of `name`. See documentation of `appsId`.
3376    ///
3377    /// Sets the *versions id* path property to the given value.
3378    ///
3379    /// Even though the property as already been set when instantiating this call,
3380    /// we provide this method for API completeness.
3381    pub fn versions_id(mut self, new_value: &str) -> AppModuleVersionInstanceGetCall<'a, C> {
3382        self._versions_id = new_value.to_string();
3383        self
3384    }
3385    /// Part of `name`. See documentation of `appsId`.
3386    ///
3387    /// Sets the *instances id* path property to the given value.
3388    ///
3389    /// Even though the property as already been set when instantiating this call,
3390    /// we provide this method for API completeness.
3391    pub fn instances_id(mut self, new_value: &str) -> AppModuleVersionInstanceGetCall<'a, C> {
3392        self._instances_id = new_value.to_string();
3393        self
3394    }
3395    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3396    /// while executing the actual API request.
3397    ///
3398    /// ````text
3399    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3400    /// ````
3401    ///
3402    /// Sets the *delegate* property to the given value.
3403    pub fn delegate(
3404        mut self,
3405        new_value: &'a mut dyn common::Delegate,
3406    ) -> AppModuleVersionInstanceGetCall<'a, C> {
3407        self._delegate = Some(new_value);
3408        self
3409    }
3410
3411    /// Set any additional parameter of the query string used in the request.
3412    /// It should be used to set parameters which are not yet available through their own
3413    /// setters.
3414    ///
3415    /// Please note that this method must not be used to set any of the known parameters
3416    /// which have their own setter method. If done anyway, the request will fail.
3417    ///
3418    /// # Additional Parameters
3419    ///
3420    /// * *$.xgafv* (query-string) - V1 error format.
3421    /// * *access_token* (query-string) - OAuth access token.
3422    /// * *alt* (query-string) - Data format for response.
3423    /// * *callback* (query-string) - JSONP
3424    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3425    /// * *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.
3426    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3427    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3428    /// * *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.
3429    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3430    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3431    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionInstanceGetCall<'a, C>
3432    where
3433        T: AsRef<str>,
3434    {
3435        self._additional_params
3436            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3437        self
3438    }
3439
3440    /// Identifies the authorization scope for the method you are building.
3441    ///
3442    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3443    /// [`Scope::CloudPlatformReadOnly`].
3444    ///
3445    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3446    /// tokens for more than one scope.
3447    ///
3448    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3449    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3450    /// sufficient, a read-write scope will do as well.
3451    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionInstanceGetCall<'a, C>
3452    where
3453        St: AsRef<str>,
3454    {
3455        self._scopes.insert(String::from(scope.as_ref()));
3456        self
3457    }
3458    /// Identifies the authorization scope(s) for the method you are building.
3459    ///
3460    /// See [`Self::add_scope()`] for details.
3461    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionInstanceGetCall<'a, C>
3462    where
3463        I: IntoIterator<Item = St>,
3464        St: AsRef<str>,
3465    {
3466        self._scopes
3467            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3468        self
3469    }
3470
3471    /// Removes all scopes, and no default scope will be used either.
3472    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3473    /// for details).
3474    pub fn clear_scopes(mut self) -> AppModuleVersionInstanceGetCall<'a, C> {
3475        self._scopes.clear();
3476        self
3477    }
3478}
3479
3480/// Lists the instances of a version.Tip: To aggregate details about instances over time, see the Stackdriver Monitoring API (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
3481///
3482/// A builder for the *modules.versions.instances.list* method supported by a *app* resource.
3483/// It is not used directly, but through a [`AppMethods`] instance.
3484///
3485/// # Example
3486///
3487/// Instantiate a resource method builder
3488///
3489/// ```test_harness,no_run
3490/// # extern crate hyper;
3491/// # extern crate hyper_rustls;
3492/// # extern crate google_appengine1_beta4 as appengine1_beta4;
3493/// # async fn dox() {
3494/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3495///
3496/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3497/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3498/// #     .with_native_roots()
3499/// #     .unwrap()
3500/// #     .https_only()
3501/// #     .enable_http2()
3502/// #     .build();
3503///
3504/// # let executor = hyper_util::rt::TokioExecutor::new();
3505/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3506/// #     secret,
3507/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3508/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3509/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3510/// #     ),
3511/// # ).build().await.unwrap();
3512///
3513/// # let client = hyper_util::client::legacy::Client::builder(
3514/// #     hyper_util::rt::TokioExecutor::new()
3515/// # )
3516/// # .build(
3517/// #     hyper_rustls::HttpsConnectorBuilder::new()
3518/// #         .with_native_roots()
3519/// #         .unwrap()
3520/// #         .https_or_http()
3521/// #         .enable_http2()
3522/// #         .build()
3523/// # );
3524/// # let mut hub = Appengine::new(client, auth);
3525/// // You can configure optional parameters by calling the respective setters at will, and
3526/// // execute the final call using `doit()`.
3527/// // Values shown here are possibly random and not representative !
3528/// let result = hub.apps().modules_versions_instances_list("appsId", "modulesId", "versionsId")
3529///              .page_token("ea")
3530///              .page_size(-99)
3531///              .doit().await;
3532/// # }
3533/// ```
3534pub struct AppModuleVersionInstanceListCall<'a, C>
3535where
3536    C: 'a,
3537{
3538    hub: &'a Appengine<C>,
3539    _apps_id: String,
3540    _modules_id: String,
3541    _versions_id: String,
3542    _page_token: Option<String>,
3543    _page_size: Option<i32>,
3544    _delegate: Option<&'a mut dyn common::Delegate>,
3545    _additional_params: HashMap<String, String>,
3546    _scopes: BTreeSet<String>,
3547}
3548
3549impl<'a, C> common::CallBuilder for AppModuleVersionInstanceListCall<'a, C> {}
3550
3551impl<'a, C> AppModuleVersionInstanceListCall<'a, C>
3552where
3553    C: common::Connector,
3554{
3555    /// Perform the operation you have build so far.
3556    pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
3557        use std::borrow::Cow;
3558        use std::io::{Read, Seek};
3559
3560        use common::{url::Params, ToParts};
3561        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3562
3563        let mut dd = common::DefaultDelegate;
3564        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3565        dlg.begin(common::MethodInfo {
3566            id: "appengine.apps.modules.versions.instances.list",
3567            http_method: hyper::Method::GET,
3568        });
3569
3570        for &field in [
3571            "alt",
3572            "appsId",
3573            "modulesId",
3574            "versionsId",
3575            "pageToken",
3576            "pageSize",
3577        ]
3578        .iter()
3579        {
3580            if self._additional_params.contains_key(field) {
3581                dlg.finished(false);
3582                return Err(common::Error::FieldClash(field));
3583            }
3584        }
3585
3586        let mut params = Params::with_capacity(7 + self._additional_params.len());
3587        params.push("appsId", self._apps_id);
3588        params.push("modulesId", self._modules_id);
3589        params.push("versionsId", self._versions_id);
3590        if let Some(value) = self._page_token.as_ref() {
3591            params.push("pageToken", value);
3592        }
3593        if let Some(value) = self._page_size.as_ref() {
3594            params.push("pageSize", value.to_string());
3595        }
3596
3597        params.extend(self._additional_params.iter());
3598
3599        params.push("alt", "json");
3600        let mut url = self.hub._base_url.clone()
3601            + "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}/instances";
3602        if self._scopes.is_empty() {
3603            self._scopes
3604                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3605        }
3606
3607        #[allow(clippy::single_element_loop)]
3608        for &(find_this, param_name) in [
3609            ("{appsId}", "appsId"),
3610            ("{modulesId}", "modulesId"),
3611            ("{versionsId}", "versionsId"),
3612        ]
3613        .iter()
3614        {
3615            url = params.uri_replacement(url, param_name, find_this, false);
3616        }
3617        {
3618            let to_remove = ["versionsId", "modulesId", "appsId"];
3619            params.remove_params(&to_remove);
3620        }
3621
3622        let url = params.parse_with_url(&url);
3623
3624        loop {
3625            let token = match self
3626                .hub
3627                .auth
3628                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3629                .await
3630            {
3631                Ok(token) => token,
3632                Err(e) => match dlg.token(e) {
3633                    Ok(token) => token,
3634                    Err(e) => {
3635                        dlg.finished(false);
3636                        return Err(common::Error::MissingToken(e));
3637                    }
3638                },
3639            };
3640            let mut req_result = {
3641                let client = &self.hub.client;
3642                dlg.pre_request();
3643                let mut req_builder = hyper::Request::builder()
3644                    .method(hyper::Method::GET)
3645                    .uri(url.as_str())
3646                    .header(USER_AGENT, self.hub._user_agent.clone());
3647
3648                if let Some(token) = token.as_ref() {
3649                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3650                }
3651
3652                let request = req_builder
3653                    .header(CONTENT_LENGTH, 0_u64)
3654                    .body(common::to_body::<String>(None));
3655
3656                client.request(request.unwrap()).await
3657            };
3658
3659            match req_result {
3660                Err(err) => {
3661                    if let common::Retry::After(d) = dlg.http_error(&err) {
3662                        sleep(d).await;
3663                        continue;
3664                    }
3665                    dlg.finished(false);
3666                    return Err(common::Error::HttpError(err));
3667                }
3668                Ok(res) => {
3669                    let (mut parts, body) = res.into_parts();
3670                    let mut body = common::Body::new(body);
3671                    if !parts.status.is_success() {
3672                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3673                        let error = serde_json::from_str(&common::to_string(&bytes));
3674                        let response = common::to_response(parts, bytes.into());
3675
3676                        if let common::Retry::After(d) =
3677                            dlg.http_failure(&response, error.as_ref().ok())
3678                        {
3679                            sleep(d).await;
3680                            continue;
3681                        }
3682
3683                        dlg.finished(false);
3684
3685                        return Err(match error {
3686                            Ok(value) => common::Error::BadRequest(value),
3687                            _ => common::Error::Failure(response),
3688                        });
3689                    }
3690                    let response = {
3691                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3692                        let encoded = common::to_string(&bytes);
3693                        match serde_json::from_str(&encoded) {
3694                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3695                            Err(error) => {
3696                                dlg.response_json_decode_error(&encoded, &error);
3697                                return Err(common::Error::JsonDecodeError(
3698                                    encoded.to_string(),
3699                                    error,
3700                                ));
3701                            }
3702                        }
3703                    };
3704
3705                    dlg.finished(true);
3706                    return Ok(response);
3707                }
3708            }
3709        }
3710    }
3711
3712    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.
3713    ///
3714    /// Sets the *apps id* path property to the given value.
3715    ///
3716    /// Even though the property as already been set when instantiating this call,
3717    /// we provide this method for API completeness.
3718    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionInstanceListCall<'a, C> {
3719        self._apps_id = new_value.to_string();
3720        self
3721    }
3722    /// Part of `name`. See documentation of `appsId`.
3723    ///
3724    /// Sets the *modules id* path property to the given value.
3725    ///
3726    /// Even though the property as already been set when instantiating this call,
3727    /// we provide this method for API completeness.
3728    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionInstanceListCall<'a, C> {
3729        self._modules_id = new_value.to_string();
3730        self
3731    }
3732    /// Part of `name`. See documentation of `appsId`.
3733    ///
3734    /// Sets the *versions id* path property to the given value.
3735    ///
3736    /// Even though the property as already been set when instantiating this call,
3737    /// we provide this method for API completeness.
3738    pub fn versions_id(mut self, new_value: &str) -> AppModuleVersionInstanceListCall<'a, C> {
3739        self._versions_id = new_value.to_string();
3740        self
3741    }
3742    /// Continuation token for fetching the next page of results.
3743    ///
3744    /// Sets the *page token* query property to the given value.
3745    pub fn page_token(mut self, new_value: &str) -> AppModuleVersionInstanceListCall<'a, C> {
3746        self._page_token = Some(new_value.to_string());
3747        self
3748    }
3749    /// Maximum results to return per page.
3750    ///
3751    /// Sets the *page size* query property to the given value.
3752    pub fn page_size(mut self, new_value: i32) -> AppModuleVersionInstanceListCall<'a, C> {
3753        self._page_size = Some(new_value);
3754        self
3755    }
3756    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3757    /// while executing the actual API request.
3758    ///
3759    /// ````text
3760    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3761    /// ````
3762    ///
3763    /// Sets the *delegate* property to the given value.
3764    pub fn delegate(
3765        mut self,
3766        new_value: &'a mut dyn common::Delegate,
3767    ) -> AppModuleVersionInstanceListCall<'a, C> {
3768        self._delegate = Some(new_value);
3769        self
3770    }
3771
3772    /// Set any additional parameter of the query string used in the request.
3773    /// It should be used to set parameters which are not yet available through their own
3774    /// setters.
3775    ///
3776    /// Please note that this method must not be used to set any of the known parameters
3777    /// which have their own setter method. If done anyway, the request will fail.
3778    ///
3779    /// # Additional Parameters
3780    ///
3781    /// * *$.xgafv* (query-string) - V1 error format.
3782    /// * *access_token* (query-string) - OAuth access token.
3783    /// * *alt* (query-string) - Data format for response.
3784    /// * *callback* (query-string) - JSONP
3785    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3786    /// * *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.
3787    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3788    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3789    /// * *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.
3790    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3791    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3792    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionInstanceListCall<'a, C>
3793    where
3794        T: AsRef<str>,
3795    {
3796        self._additional_params
3797            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3798        self
3799    }
3800
3801    /// Identifies the authorization scope for the method you are building.
3802    ///
3803    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3804    /// [`Scope::CloudPlatformReadOnly`].
3805    ///
3806    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3807    /// tokens for more than one scope.
3808    ///
3809    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3810    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3811    /// sufficient, a read-write scope will do as well.
3812    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionInstanceListCall<'a, C>
3813    where
3814        St: AsRef<str>,
3815    {
3816        self._scopes.insert(String::from(scope.as_ref()));
3817        self
3818    }
3819    /// Identifies the authorization scope(s) for the method you are building.
3820    ///
3821    /// See [`Self::add_scope()`] for details.
3822    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionInstanceListCall<'a, C>
3823    where
3824        I: IntoIterator<Item = St>,
3825        St: AsRef<str>,
3826    {
3827        self._scopes
3828            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3829        self
3830    }
3831
3832    /// Removes all scopes, and no default scope will be used either.
3833    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3834    /// for details).
3835    pub fn clear_scopes(mut self) -> AppModuleVersionInstanceListCall<'a, C> {
3836        self._scopes.clear();
3837        self
3838    }
3839}
3840
3841/// Deploys code and resource files to a new version.
3842///
3843/// A builder for the *modules.versions.create* method supported by a *app* resource.
3844/// It is not used directly, but through a [`AppMethods`] instance.
3845///
3846/// # Example
3847///
3848/// Instantiate a resource method builder
3849///
3850/// ```test_harness,no_run
3851/// # extern crate hyper;
3852/// # extern crate hyper_rustls;
3853/// # extern crate google_appengine1_beta4 as appengine1_beta4;
3854/// use appengine1_beta4::api::Version;
3855/// # async fn dox() {
3856/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3857///
3858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3859/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3860/// #     .with_native_roots()
3861/// #     .unwrap()
3862/// #     .https_only()
3863/// #     .enable_http2()
3864/// #     .build();
3865///
3866/// # let executor = hyper_util::rt::TokioExecutor::new();
3867/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3868/// #     secret,
3869/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3870/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3871/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3872/// #     ),
3873/// # ).build().await.unwrap();
3874///
3875/// # let client = hyper_util::client::legacy::Client::builder(
3876/// #     hyper_util::rt::TokioExecutor::new()
3877/// # )
3878/// # .build(
3879/// #     hyper_rustls::HttpsConnectorBuilder::new()
3880/// #         .with_native_roots()
3881/// #         .unwrap()
3882/// #         .https_or_http()
3883/// #         .enable_http2()
3884/// #         .build()
3885/// # );
3886/// # let mut hub = Appengine::new(client, auth);
3887/// // As the method needs a request, you would usually fill it with the desired information
3888/// // into the respective structure. Some of the parts shown here might not be applicable !
3889/// // Values shown here are possibly random and not representative !
3890/// let mut req = Version::default();
3891///
3892/// // You can configure optional parameters by calling the respective setters at will, and
3893/// // execute the final call using `doit()`.
3894/// // Values shown here are possibly random and not representative !
3895/// let result = hub.apps().modules_versions_create(req, "appsId", "modulesId")
3896///              .doit().await;
3897/// # }
3898/// ```
3899pub struct AppModuleVersionCreateCall<'a, C>
3900where
3901    C: 'a,
3902{
3903    hub: &'a Appengine<C>,
3904    _request: Version,
3905    _apps_id: String,
3906    _modules_id: String,
3907    _delegate: Option<&'a mut dyn common::Delegate>,
3908    _additional_params: HashMap<String, String>,
3909    _scopes: BTreeSet<String>,
3910}
3911
3912impl<'a, C> common::CallBuilder for AppModuleVersionCreateCall<'a, C> {}
3913
3914impl<'a, C> AppModuleVersionCreateCall<'a, C>
3915where
3916    C: common::Connector,
3917{
3918    /// Perform the operation you have build so far.
3919    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3920        use std::borrow::Cow;
3921        use std::io::{Read, Seek};
3922
3923        use common::{url::Params, ToParts};
3924        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3925
3926        let mut dd = common::DefaultDelegate;
3927        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3928        dlg.begin(common::MethodInfo {
3929            id: "appengine.apps.modules.versions.create",
3930            http_method: hyper::Method::POST,
3931        });
3932
3933        for &field in ["alt", "appsId", "modulesId"].iter() {
3934            if self._additional_params.contains_key(field) {
3935                dlg.finished(false);
3936                return Err(common::Error::FieldClash(field));
3937            }
3938        }
3939
3940        let mut params = Params::with_capacity(5 + self._additional_params.len());
3941        params.push("appsId", self._apps_id);
3942        params.push("modulesId", self._modules_id);
3943
3944        params.extend(self._additional_params.iter());
3945
3946        params.push("alt", "json");
3947        let mut url =
3948            self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}/versions";
3949        if self._scopes.is_empty() {
3950            self._scopes
3951                .insert(Scope::CloudPlatform.as_ref().to_string());
3952        }
3953
3954        #[allow(clippy::single_element_loop)]
3955        for &(find_this, param_name) in
3956            [("{appsId}", "appsId"), ("{modulesId}", "modulesId")].iter()
3957        {
3958            url = params.uri_replacement(url, param_name, find_this, false);
3959        }
3960        {
3961            let to_remove = ["modulesId", "appsId"];
3962            params.remove_params(&to_remove);
3963        }
3964
3965        let url = params.parse_with_url(&url);
3966
3967        let mut json_mime_type = mime::APPLICATION_JSON;
3968        let mut request_value_reader = {
3969            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3970            common::remove_json_null_values(&mut value);
3971            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3972            serde_json::to_writer(&mut dst, &value).unwrap();
3973            dst
3974        };
3975        let request_size = request_value_reader
3976            .seek(std::io::SeekFrom::End(0))
3977            .unwrap();
3978        request_value_reader
3979            .seek(std::io::SeekFrom::Start(0))
3980            .unwrap();
3981
3982        loop {
3983            let token = match self
3984                .hub
3985                .auth
3986                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3987                .await
3988            {
3989                Ok(token) => token,
3990                Err(e) => match dlg.token(e) {
3991                    Ok(token) => token,
3992                    Err(e) => {
3993                        dlg.finished(false);
3994                        return Err(common::Error::MissingToken(e));
3995                    }
3996                },
3997            };
3998            request_value_reader
3999                .seek(std::io::SeekFrom::Start(0))
4000                .unwrap();
4001            let mut req_result = {
4002                let client = &self.hub.client;
4003                dlg.pre_request();
4004                let mut req_builder = hyper::Request::builder()
4005                    .method(hyper::Method::POST)
4006                    .uri(url.as_str())
4007                    .header(USER_AGENT, self.hub._user_agent.clone());
4008
4009                if let Some(token) = token.as_ref() {
4010                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4011                }
4012
4013                let request = req_builder
4014                    .header(CONTENT_TYPE, json_mime_type.to_string())
4015                    .header(CONTENT_LENGTH, request_size as u64)
4016                    .body(common::to_body(
4017                        request_value_reader.get_ref().clone().into(),
4018                    ));
4019
4020                client.request(request.unwrap()).await
4021            };
4022
4023            match req_result {
4024                Err(err) => {
4025                    if let common::Retry::After(d) = dlg.http_error(&err) {
4026                        sleep(d).await;
4027                        continue;
4028                    }
4029                    dlg.finished(false);
4030                    return Err(common::Error::HttpError(err));
4031                }
4032                Ok(res) => {
4033                    let (mut parts, body) = res.into_parts();
4034                    let mut body = common::Body::new(body);
4035                    if !parts.status.is_success() {
4036                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4037                        let error = serde_json::from_str(&common::to_string(&bytes));
4038                        let response = common::to_response(parts, bytes.into());
4039
4040                        if let common::Retry::After(d) =
4041                            dlg.http_failure(&response, error.as_ref().ok())
4042                        {
4043                            sleep(d).await;
4044                            continue;
4045                        }
4046
4047                        dlg.finished(false);
4048
4049                        return Err(match error {
4050                            Ok(value) => common::Error::BadRequest(value),
4051                            _ => common::Error::Failure(response),
4052                        });
4053                    }
4054                    let response = {
4055                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4056                        let encoded = common::to_string(&bytes);
4057                        match serde_json::from_str(&encoded) {
4058                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4059                            Err(error) => {
4060                                dlg.response_json_decode_error(&encoded, &error);
4061                                return Err(common::Error::JsonDecodeError(
4062                                    encoded.to_string(),
4063                                    error,
4064                                ));
4065                            }
4066                        }
4067                    };
4068
4069                    dlg.finished(true);
4070                    return Ok(response);
4071                }
4072            }
4073        }
4074    }
4075
4076    ///
4077    /// Sets the *request* property to the given value.
4078    ///
4079    /// Even though the property as already been set when instantiating this call,
4080    /// we provide this method for API completeness.
4081    pub fn request(mut self, new_value: Version) -> AppModuleVersionCreateCall<'a, C> {
4082        self._request = new_value;
4083        self
4084    }
4085    /// Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default.
4086    ///
4087    /// Sets the *apps id* path property to the given value.
4088    ///
4089    /// Even though the property as already been set when instantiating this call,
4090    /// we provide this method for API completeness.
4091    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionCreateCall<'a, C> {
4092        self._apps_id = new_value.to_string();
4093        self
4094    }
4095    /// Part of `name`. See documentation of `appsId`.
4096    ///
4097    /// Sets the *modules id* path property to the given value.
4098    ///
4099    /// Even though the property as already been set when instantiating this call,
4100    /// we provide this method for API completeness.
4101    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionCreateCall<'a, C> {
4102        self._modules_id = new_value.to_string();
4103        self
4104    }
4105    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4106    /// while executing the actual API request.
4107    ///
4108    /// ````text
4109    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4110    /// ````
4111    ///
4112    /// Sets the *delegate* property to the given value.
4113    pub fn delegate(
4114        mut self,
4115        new_value: &'a mut dyn common::Delegate,
4116    ) -> AppModuleVersionCreateCall<'a, C> {
4117        self._delegate = Some(new_value);
4118        self
4119    }
4120
4121    /// Set any additional parameter of the query string used in the request.
4122    /// It should be used to set parameters which are not yet available through their own
4123    /// setters.
4124    ///
4125    /// Please note that this method must not be used to set any of the known parameters
4126    /// which have their own setter method. If done anyway, the request will fail.
4127    ///
4128    /// # Additional Parameters
4129    ///
4130    /// * *$.xgafv* (query-string) - V1 error format.
4131    /// * *access_token* (query-string) - OAuth access token.
4132    /// * *alt* (query-string) - Data format for response.
4133    /// * *callback* (query-string) - JSONP
4134    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4135    /// * *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.
4136    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4137    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4138    /// * *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.
4139    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4140    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4141    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionCreateCall<'a, C>
4142    where
4143        T: AsRef<str>,
4144    {
4145        self._additional_params
4146            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4147        self
4148    }
4149
4150    /// Identifies the authorization scope for the method you are building.
4151    ///
4152    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4153    /// [`Scope::CloudPlatform`].
4154    ///
4155    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4156    /// tokens for more than one scope.
4157    ///
4158    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4159    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4160    /// sufficient, a read-write scope will do as well.
4161    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionCreateCall<'a, C>
4162    where
4163        St: AsRef<str>,
4164    {
4165        self._scopes.insert(String::from(scope.as_ref()));
4166        self
4167    }
4168    /// Identifies the authorization scope(s) for the method you are building.
4169    ///
4170    /// See [`Self::add_scope()`] for details.
4171    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionCreateCall<'a, C>
4172    where
4173        I: IntoIterator<Item = St>,
4174        St: AsRef<str>,
4175    {
4176        self._scopes
4177            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4178        self
4179    }
4180
4181    /// Removes all scopes, and no default scope will be used either.
4182    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4183    /// for details).
4184    pub fn clear_scopes(mut self) -> AppModuleVersionCreateCall<'a, C> {
4185        self._scopes.clear();
4186        self
4187    }
4188}
4189
4190/// Deletes an existing version.
4191///
4192/// A builder for the *modules.versions.delete* method supported by a *app* resource.
4193/// It is not used directly, but through a [`AppMethods`] instance.
4194///
4195/// # Example
4196///
4197/// Instantiate a resource method builder
4198///
4199/// ```test_harness,no_run
4200/// # extern crate hyper;
4201/// # extern crate hyper_rustls;
4202/// # extern crate google_appengine1_beta4 as appengine1_beta4;
4203/// # async fn dox() {
4204/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4205///
4206/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4207/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4208/// #     .with_native_roots()
4209/// #     .unwrap()
4210/// #     .https_only()
4211/// #     .enable_http2()
4212/// #     .build();
4213///
4214/// # let executor = hyper_util::rt::TokioExecutor::new();
4215/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4216/// #     secret,
4217/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4218/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4219/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4220/// #     ),
4221/// # ).build().await.unwrap();
4222///
4223/// # let client = hyper_util::client::legacy::Client::builder(
4224/// #     hyper_util::rt::TokioExecutor::new()
4225/// # )
4226/// # .build(
4227/// #     hyper_rustls::HttpsConnectorBuilder::new()
4228/// #         .with_native_roots()
4229/// #         .unwrap()
4230/// #         .https_or_http()
4231/// #         .enable_http2()
4232/// #         .build()
4233/// # );
4234/// # let mut hub = Appengine::new(client, auth);
4235/// // You can configure optional parameters by calling the respective setters at will, and
4236/// // execute the final call using `doit()`.
4237/// // Values shown here are possibly random and not representative !
4238/// let result = hub.apps().modules_versions_delete("appsId", "modulesId", "versionsId")
4239///              .doit().await;
4240/// # }
4241/// ```
4242pub struct AppModuleVersionDeleteCall<'a, C>
4243where
4244    C: 'a,
4245{
4246    hub: &'a Appengine<C>,
4247    _apps_id: String,
4248    _modules_id: String,
4249    _versions_id: String,
4250    _delegate: Option<&'a mut dyn common::Delegate>,
4251    _additional_params: HashMap<String, String>,
4252    _scopes: BTreeSet<String>,
4253}
4254
4255impl<'a, C> common::CallBuilder for AppModuleVersionDeleteCall<'a, C> {}
4256
4257impl<'a, C> AppModuleVersionDeleteCall<'a, C>
4258where
4259    C: common::Connector,
4260{
4261    /// Perform the operation you have build so far.
4262    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4263        use std::borrow::Cow;
4264        use std::io::{Read, Seek};
4265
4266        use common::{url::Params, ToParts};
4267        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4268
4269        let mut dd = common::DefaultDelegate;
4270        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4271        dlg.begin(common::MethodInfo {
4272            id: "appengine.apps.modules.versions.delete",
4273            http_method: hyper::Method::DELETE,
4274        });
4275
4276        for &field in ["alt", "appsId", "modulesId", "versionsId"].iter() {
4277            if self._additional_params.contains_key(field) {
4278                dlg.finished(false);
4279                return Err(common::Error::FieldClash(field));
4280            }
4281        }
4282
4283        let mut params = Params::with_capacity(5 + self._additional_params.len());
4284        params.push("appsId", self._apps_id);
4285        params.push("modulesId", self._modules_id);
4286        params.push("versionsId", self._versions_id);
4287
4288        params.extend(self._additional_params.iter());
4289
4290        params.push("alt", "json");
4291        let mut url = self.hub._base_url.clone()
4292            + "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}";
4293        if self._scopes.is_empty() {
4294            self._scopes
4295                .insert(Scope::CloudPlatform.as_ref().to_string());
4296        }
4297
4298        #[allow(clippy::single_element_loop)]
4299        for &(find_this, param_name) in [
4300            ("{appsId}", "appsId"),
4301            ("{modulesId}", "modulesId"),
4302            ("{versionsId}", "versionsId"),
4303        ]
4304        .iter()
4305        {
4306            url = params.uri_replacement(url, param_name, find_this, false);
4307        }
4308        {
4309            let to_remove = ["versionsId", "modulesId", "appsId"];
4310            params.remove_params(&to_remove);
4311        }
4312
4313        let url = params.parse_with_url(&url);
4314
4315        loop {
4316            let token = match self
4317                .hub
4318                .auth
4319                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4320                .await
4321            {
4322                Ok(token) => token,
4323                Err(e) => match dlg.token(e) {
4324                    Ok(token) => token,
4325                    Err(e) => {
4326                        dlg.finished(false);
4327                        return Err(common::Error::MissingToken(e));
4328                    }
4329                },
4330            };
4331            let mut req_result = {
4332                let client = &self.hub.client;
4333                dlg.pre_request();
4334                let mut req_builder = hyper::Request::builder()
4335                    .method(hyper::Method::DELETE)
4336                    .uri(url.as_str())
4337                    .header(USER_AGENT, self.hub._user_agent.clone());
4338
4339                if let Some(token) = token.as_ref() {
4340                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4341                }
4342
4343                let request = req_builder
4344                    .header(CONTENT_LENGTH, 0_u64)
4345                    .body(common::to_body::<String>(None));
4346
4347                client.request(request.unwrap()).await
4348            };
4349
4350            match req_result {
4351                Err(err) => {
4352                    if let common::Retry::After(d) = dlg.http_error(&err) {
4353                        sleep(d).await;
4354                        continue;
4355                    }
4356                    dlg.finished(false);
4357                    return Err(common::Error::HttpError(err));
4358                }
4359                Ok(res) => {
4360                    let (mut parts, body) = res.into_parts();
4361                    let mut body = common::Body::new(body);
4362                    if !parts.status.is_success() {
4363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4364                        let error = serde_json::from_str(&common::to_string(&bytes));
4365                        let response = common::to_response(parts, bytes.into());
4366
4367                        if let common::Retry::After(d) =
4368                            dlg.http_failure(&response, error.as_ref().ok())
4369                        {
4370                            sleep(d).await;
4371                            continue;
4372                        }
4373
4374                        dlg.finished(false);
4375
4376                        return Err(match error {
4377                            Ok(value) => common::Error::BadRequest(value),
4378                            _ => common::Error::Failure(response),
4379                        });
4380                    }
4381                    let response = {
4382                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4383                        let encoded = common::to_string(&bytes);
4384                        match serde_json::from_str(&encoded) {
4385                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4386                            Err(error) => {
4387                                dlg.response_json_decode_error(&encoded, &error);
4388                                return Err(common::Error::JsonDecodeError(
4389                                    encoded.to_string(),
4390                                    error,
4391                                ));
4392                            }
4393                        }
4394                    };
4395
4396                    dlg.finished(true);
4397                    return Ok(response);
4398                }
4399            }
4400        }
4401    }
4402
4403    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.
4404    ///
4405    /// Sets the *apps id* path property to the given value.
4406    ///
4407    /// Even though the property as already been set when instantiating this call,
4408    /// we provide this method for API completeness.
4409    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionDeleteCall<'a, C> {
4410        self._apps_id = new_value.to_string();
4411        self
4412    }
4413    /// Part of `name`. See documentation of `appsId`.
4414    ///
4415    /// Sets the *modules id* path property to the given value.
4416    ///
4417    /// Even though the property as already been set when instantiating this call,
4418    /// we provide this method for API completeness.
4419    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionDeleteCall<'a, C> {
4420        self._modules_id = new_value.to_string();
4421        self
4422    }
4423    /// Part of `name`. See documentation of `appsId`.
4424    ///
4425    /// Sets the *versions id* path property to the given value.
4426    ///
4427    /// Even though the property as already been set when instantiating this call,
4428    /// we provide this method for API completeness.
4429    pub fn versions_id(mut self, new_value: &str) -> AppModuleVersionDeleteCall<'a, C> {
4430        self._versions_id = new_value.to_string();
4431        self
4432    }
4433    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4434    /// while executing the actual API request.
4435    ///
4436    /// ````text
4437    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4438    /// ````
4439    ///
4440    /// Sets the *delegate* property to the given value.
4441    pub fn delegate(
4442        mut self,
4443        new_value: &'a mut dyn common::Delegate,
4444    ) -> AppModuleVersionDeleteCall<'a, C> {
4445        self._delegate = Some(new_value);
4446        self
4447    }
4448
4449    /// Set any additional parameter of the query string used in the request.
4450    /// It should be used to set parameters which are not yet available through their own
4451    /// setters.
4452    ///
4453    /// Please note that this method must not be used to set any of the known parameters
4454    /// which have their own setter method. If done anyway, the request will fail.
4455    ///
4456    /// # Additional Parameters
4457    ///
4458    /// * *$.xgafv* (query-string) - V1 error format.
4459    /// * *access_token* (query-string) - OAuth access token.
4460    /// * *alt* (query-string) - Data format for response.
4461    /// * *callback* (query-string) - JSONP
4462    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4463    /// * *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.
4464    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4465    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4466    /// * *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.
4467    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4468    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4469    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionDeleteCall<'a, C>
4470    where
4471        T: AsRef<str>,
4472    {
4473        self._additional_params
4474            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4475        self
4476    }
4477
4478    /// Identifies the authorization scope for the method you are building.
4479    ///
4480    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4481    /// [`Scope::CloudPlatform`].
4482    ///
4483    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4484    /// tokens for more than one scope.
4485    ///
4486    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4487    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4488    /// sufficient, a read-write scope will do as well.
4489    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionDeleteCall<'a, C>
4490    where
4491        St: AsRef<str>,
4492    {
4493        self._scopes.insert(String::from(scope.as_ref()));
4494        self
4495    }
4496    /// Identifies the authorization scope(s) for the method you are building.
4497    ///
4498    /// See [`Self::add_scope()`] for details.
4499    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionDeleteCall<'a, C>
4500    where
4501        I: IntoIterator<Item = St>,
4502        St: AsRef<str>,
4503    {
4504        self._scopes
4505            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4506        self
4507    }
4508
4509    /// Removes all scopes, and no default scope will be used either.
4510    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4511    /// for details).
4512    pub fn clear_scopes(mut self) -> AppModuleVersionDeleteCall<'a, C> {
4513        self._scopes.clear();
4514        self
4515    }
4516}
4517
4518/// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.
4519///
4520/// A builder for the *modules.versions.get* method supported by a *app* resource.
4521/// It is not used directly, but through a [`AppMethods`] instance.
4522///
4523/// # Example
4524///
4525/// Instantiate a resource method builder
4526///
4527/// ```test_harness,no_run
4528/// # extern crate hyper;
4529/// # extern crate hyper_rustls;
4530/// # extern crate google_appengine1_beta4 as appengine1_beta4;
4531/// # async fn dox() {
4532/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4533///
4534/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4535/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4536/// #     .with_native_roots()
4537/// #     .unwrap()
4538/// #     .https_only()
4539/// #     .enable_http2()
4540/// #     .build();
4541///
4542/// # let executor = hyper_util::rt::TokioExecutor::new();
4543/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4544/// #     secret,
4545/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4546/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4547/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4548/// #     ),
4549/// # ).build().await.unwrap();
4550///
4551/// # let client = hyper_util::client::legacy::Client::builder(
4552/// #     hyper_util::rt::TokioExecutor::new()
4553/// # )
4554/// # .build(
4555/// #     hyper_rustls::HttpsConnectorBuilder::new()
4556/// #         .with_native_roots()
4557/// #         .unwrap()
4558/// #         .https_or_http()
4559/// #         .enable_http2()
4560/// #         .build()
4561/// # );
4562/// # let mut hub = Appengine::new(client, auth);
4563/// // You can configure optional parameters by calling the respective setters at will, and
4564/// // execute the final call using `doit()`.
4565/// // Values shown here are possibly random and not representative !
4566/// let result = hub.apps().modules_versions_get("appsId", "modulesId", "versionsId")
4567///              .view("kasd")
4568///              .doit().await;
4569/// # }
4570/// ```
4571pub struct AppModuleVersionGetCall<'a, C>
4572where
4573    C: 'a,
4574{
4575    hub: &'a Appengine<C>,
4576    _apps_id: String,
4577    _modules_id: String,
4578    _versions_id: String,
4579    _view: Option<String>,
4580    _delegate: Option<&'a mut dyn common::Delegate>,
4581    _additional_params: HashMap<String, String>,
4582    _scopes: BTreeSet<String>,
4583}
4584
4585impl<'a, C> common::CallBuilder for AppModuleVersionGetCall<'a, C> {}
4586
4587impl<'a, C> AppModuleVersionGetCall<'a, C>
4588where
4589    C: common::Connector,
4590{
4591    /// Perform the operation you have build so far.
4592    pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
4593        use std::borrow::Cow;
4594        use std::io::{Read, Seek};
4595
4596        use common::{url::Params, ToParts};
4597        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4598
4599        let mut dd = common::DefaultDelegate;
4600        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4601        dlg.begin(common::MethodInfo {
4602            id: "appengine.apps.modules.versions.get",
4603            http_method: hyper::Method::GET,
4604        });
4605
4606        for &field in ["alt", "appsId", "modulesId", "versionsId", "view"].iter() {
4607            if self._additional_params.contains_key(field) {
4608                dlg.finished(false);
4609                return Err(common::Error::FieldClash(field));
4610            }
4611        }
4612
4613        let mut params = Params::with_capacity(6 + self._additional_params.len());
4614        params.push("appsId", self._apps_id);
4615        params.push("modulesId", self._modules_id);
4616        params.push("versionsId", self._versions_id);
4617        if let Some(value) = self._view.as_ref() {
4618            params.push("view", value);
4619        }
4620
4621        params.extend(self._additional_params.iter());
4622
4623        params.push("alt", "json");
4624        let mut url = self.hub._base_url.clone()
4625            + "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}";
4626        if self._scopes.is_empty() {
4627            self._scopes
4628                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4629        }
4630
4631        #[allow(clippy::single_element_loop)]
4632        for &(find_this, param_name) in [
4633            ("{appsId}", "appsId"),
4634            ("{modulesId}", "modulesId"),
4635            ("{versionsId}", "versionsId"),
4636        ]
4637        .iter()
4638        {
4639            url = params.uri_replacement(url, param_name, find_this, false);
4640        }
4641        {
4642            let to_remove = ["versionsId", "modulesId", "appsId"];
4643            params.remove_params(&to_remove);
4644        }
4645
4646        let url = params.parse_with_url(&url);
4647
4648        loop {
4649            let token = match self
4650                .hub
4651                .auth
4652                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4653                .await
4654            {
4655                Ok(token) => token,
4656                Err(e) => match dlg.token(e) {
4657                    Ok(token) => token,
4658                    Err(e) => {
4659                        dlg.finished(false);
4660                        return Err(common::Error::MissingToken(e));
4661                    }
4662                },
4663            };
4664            let mut req_result = {
4665                let client = &self.hub.client;
4666                dlg.pre_request();
4667                let mut req_builder = hyper::Request::builder()
4668                    .method(hyper::Method::GET)
4669                    .uri(url.as_str())
4670                    .header(USER_AGENT, self.hub._user_agent.clone());
4671
4672                if let Some(token) = token.as_ref() {
4673                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4674                }
4675
4676                let request = req_builder
4677                    .header(CONTENT_LENGTH, 0_u64)
4678                    .body(common::to_body::<String>(None));
4679
4680                client.request(request.unwrap()).await
4681            };
4682
4683            match req_result {
4684                Err(err) => {
4685                    if let common::Retry::After(d) = dlg.http_error(&err) {
4686                        sleep(d).await;
4687                        continue;
4688                    }
4689                    dlg.finished(false);
4690                    return Err(common::Error::HttpError(err));
4691                }
4692                Ok(res) => {
4693                    let (mut parts, body) = res.into_parts();
4694                    let mut body = common::Body::new(body);
4695                    if !parts.status.is_success() {
4696                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4697                        let error = serde_json::from_str(&common::to_string(&bytes));
4698                        let response = common::to_response(parts, bytes.into());
4699
4700                        if let common::Retry::After(d) =
4701                            dlg.http_failure(&response, error.as_ref().ok())
4702                        {
4703                            sleep(d).await;
4704                            continue;
4705                        }
4706
4707                        dlg.finished(false);
4708
4709                        return Err(match error {
4710                            Ok(value) => common::Error::BadRequest(value),
4711                            _ => common::Error::Failure(response),
4712                        });
4713                    }
4714                    let response = {
4715                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4716                        let encoded = common::to_string(&bytes);
4717                        match serde_json::from_str(&encoded) {
4718                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4719                            Err(error) => {
4720                                dlg.response_json_decode_error(&encoded, &error);
4721                                return Err(common::Error::JsonDecodeError(
4722                                    encoded.to_string(),
4723                                    error,
4724                                ));
4725                            }
4726                        }
4727                    };
4728
4729                    dlg.finished(true);
4730                    return Ok(response);
4731                }
4732            }
4733        }
4734    }
4735
4736    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.
4737    ///
4738    /// Sets the *apps id* path property to the given value.
4739    ///
4740    /// Even though the property as already been set when instantiating this call,
4741    /// we provide this method for API completeness.
4742    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionGetCall<'a, C> {
4743        self._apps_id = new_value.to_string();
4744        self
4745    }
4746    /// Part of `name`. See documentation of `appsId`.
4747    ///
4748    /// Sets the *modules id* path property to the given value.
4749    ///
4750    /// Even though the property as already been set when instantiating this call,
4751    /// we provide this method for API completeness.
4752    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionGetCall<'a, C> {
4753        self._modules_id = new_value.to_string();
4754        self
4755    }
4756    /// Part of `name`. See documentation of `appsId`.
4757    ///
4758    /// Sets the *versions id* path property to the given value.
4759    ///
4760    /// Even though the property as already been set when instantiating this call,
4761    /// we provide this method for API completeness.
4762    pub fn versions_id(mut self, new_value: &str) -> AppModuleVersionGetCall<'a, C> {
4763        self._versions_id = new_value.to_string();
4764        self
4765    }
4766    /// Controls the set of fields returned in the Get response.
4767    ///
4768    /// Sets the *view* query property to the given value.
4769    pub fn view(mut self, new_value: &str) -> AppModuleVersionGetCall<'a, C> {
4770        self._view = Some(new_value.to_string());
4771        self
4772    }
4773    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4774    /// while executing the actual API request.
4775    ///
4776    /// ````text
4777    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4778    /// ````
4779    ///
4780    /// Sets the *delegate* property to the given value.
4781    pub fn delegate(
4782        mut self,
4783        new_value: &'a mut dyn common::Delegate,
4784    ) -> AppModuleVersionGetCall<'a, C> {
4785        self._delegate = Some(new_value);
4786        self
4787    }
4788
4789    /// Set any additional parameter of the query string used in the request.
4790    /// It should be used to set parameters which are not yet available through their own
4791    /// setters.
4792    ///
4793    /// Please note that this method must not be used to set any of the known parameters
4794    /// which have their own setter method. If done anyway, the request will fail.
4795    ///
4796    /// # Additional Parameters
4797    ///
4798    /// * *$.xgafv* (query-string) - V1 error format.
4799    /// * *access_token* (query-string) - OAuth access token.
4800    /// * *alt* (query-string) - Data format for response.
4801    /// * *callback* (query-string) - JSONP
4802    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4803    /// * *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.
4804    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4805    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4806    /// * *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.
4807    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4808    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4809    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionGetCall<'a, C>
4810    where
4811        T: AsRef<str>,
4812    {
4813        self._additional_params
4814            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4815        self
4816    }
4817
4818    /// Identifies the authorization scope for the method you are building.
4819    ///
4820    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4821    /// [`Scope::CloudPlatformReadOnly`].
4822    ///
4823    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4824    /// tokens for more than one scope.
4825    ///
4826    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4827    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4828    /// sufficient, a read-write scope will do as well.
4829    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionGetCall<'a, C>
4830    where
4831        St: AsRef<str>,
4832    {
4833        self._scopes.insert(String::from(scope.as_ref()));
4834        self
4835    }
4836    /// Identifies the authorization scope(s) for the method you are building.
4837    ///
4838    /// See [`Self::add_scope()`] for details.
4839    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionGetCall<'a, C>
4840    where
4841        I: IntoIterator<Item = St>,
4842        St: AsRef<str>,
4843    {
4844        self._scopes
4845            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4846        self
4847    }
4848
4849    /// Removes all scopes, and no default scope will be used either.
4850    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4851    /// for details).
4852    pub fn clear_scopes(mut self) -> AppModuleVersionGetCall<'a, C> {
4853        self._scopes.clear();
4854        self
4855    }
4856}
4857
4858/// Lists the versions of a module.
4859///
4860/// A builder for the *modules.versions.list* method supported by a *app* resource.
4861/// It is not used directly, but through a [`AppMethods`] instance.
4862///
4863/// # Example
4864///
4865/// Instantiate a resource method builder
4866///
4867/// ```test_harness,no_run
4868/// # extern crate hyper;
4869/// # extern crate hyper_rustls;
4870/// # extern crate google_appengine1_beta4 as appengine1_beta4;
4871/// # async fn dox() {
4872/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4873///
4874/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4875/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4876/// #     .with_native_roots()
4877/// #     .unwrap()
4878/// #     .https_only()
4879/// #     .enable_http2()
4880/// #     .build();
4881///
4882/// # let executor = hyper_util::rt::TokioExecutor::new();
4883/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4884/// #     secret,
4885/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4886/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4887/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4888/// #     ),
4889/// # ).build().await.unwrap();
4890///
4891/// # let client = hyper_util::client::legacy::Client::builder(
4892/// #     hyper_util::rt::TokioExecutor::new()
4893/// # )
4894/// # .build(
4895/// #     hyper_rustls::HttpsConnectorBuilder::new()
4896/// #         .with_native_roots()
4897/// #         .unwrap()
4898/// #         .https_or_http()
4899/// #         .enable_http2()
4900/// #         .build()
4901/// # );
4902/// # let mut hub = Appengine::new(client, auth);
4903/// // You can configure optional parameters by calling the respective setters at will, and
4904/// // execute the final call using `doit()`.
4905/// // Values shown here are possibly random and not representative !
4906/// let result = hub.apps().modules_versions_list("appsId", "modulesId")
4907///              .view("et")
4908///              .page_token("et")
4909///              .page_size(-76)
4910///              .doit().await;
4911/// # }
4912/// ```
4913pub struct AppModuleVersionListCall<'a, C>
4914where
4915    C: 'a,
4916{
4917    hub: &'a Appengine<C>,
4918    _apps_id: String,
4919    _modules_id: String,
4920    _view: Option<String>,
4921    _page_token: Option<String>,
4922    _page_size: Option<i32>,
4923    _delegate: Option<&'a mut dyn common::Delegate>,
4924    _additional_params: HashMap<String, String>,
4925    _scopes: BTreeSet<String>,
4926}
4927
4928impl<'a, C> common::CallBuilder for AppModuleVersionListCall<'a, C> {}
4929
4930impl<'a, C> AppModuleVersionListCall<'a, C>
4931where
4932    C: common::Connector,
4933{
4934    /// Perform the operation you have build so far.
4935    pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
4936        use std::borrow::Cow;
4937        use std::io::{Read, Seek};
4938
4939        use common::{url::Params, ToParts};
4940        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4941
4942        let mut dd = common::DefaultDelegate;
4943        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4944        dlg.begin(common::MethodInfo {
4945            id: "appengine.apps.modules.versions.list",
4946            http_method: hyper::Method::GET,
4947        });
4948
4949        for &field in [
4950            "alt",
4951            "appsId",
4952            "modulesId",
4953            "view",
4954            "pageToken",
4955            "pageSize",
4956        ]
4957        .iter()
4958        {
4959            if self._additional_params.contains_key(field) {
4960                dlg.finished(false);
4961                return Err(common::Error::FieldClash(field));
4962            }
4963        }
4964
4965        let mut params = Params::with_capacity(7 + self._additional_params.len());
4966        params.push("appsId", self._apps_id);
4967        params.push("modulesId", self._modules_id);
4968        if let Some(value) = self._view.as_ref() {
4969            params.push("view", value);
4970        }
4971        if let Some(value) = self._page_token.as_ref() {
4972            params.push("pageToken", value);
4973        }
4974        if let Some(value) = self._page_size.as_ref() {
4975            params.push("pageSize", value.to_string());
4976        }
4977
4978        params.extend(self._additional_params.iter());
4979
4980        params.push("alt", "json");
4981        let mut url =
4982            self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}/versions";
4983        if self._scopes.is_empty() {
4984            self._scopes
4985                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4986        }
4987
4988        #[allow(clippy::single_element_loop)]
4989        for &(find_this, param_name) in
4990            [("{appsId}", "appsId"), ("{modulesId}", "modulesId")].iter()
4991        {
4992            url = params.uri_replacement(url, param_name, find_this, false);
4993        }
4994        {
4995            let to_remove = ["modulesId", "appsId"];
4996            params.remove_params(&to_remove);
4997        }
4998
4999        let url = params.parse_with_url(&url);
5000
5001        loop {
5002            let token = match self
5003                .hub
5004                .auth
5005                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5006                .await
5007            {
5008                Ok(token) => token,
5009                Err(e) => match dlg.token(e) {
5010                    Ok(token) => token,
5011                    Err(e) => {
5012                        dlg.finished(false);
5013                        return Err(common::Error::MissingToken(e));
5014                    }
5015                },
5016            };
5017            let mut req_result = {
5018                let client = &self.hub.client;
5019                dlg.pre_request();
5020                let mut req_builder = hyper::Request::builder()
5021                    .method(hyper::Method::GET)
5022                    .uri(url.as_str())
5023                    .header(USER_AGENT, self.hub._user_agent.clone());
5024
5025                if let Some(token) = token.as_ref() {
5026                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5027                }
5028
5029                let request = req_builder
5030                    .header(CONTENT_LENGTH, 0_u64)
5031                    .body(common::to_body::<String>(None));
5032
5033                client.request(request.unwrap()).await
5034            };
5035
5036            match req_result {
5037                Err(err) => {
5038                    if let common::Retry::After(d) = dlg.http_error(&err) {
5039                        sleep(d).await;
5040                        continue;
5041                    }
5042                    dlg.finished(false);
5043                    return Err(common::Error::HttpError(err));
5044                }
5045                Ok(res) => {
5046                    let (mut parts, body) = res.into_parts();
5047                    let mut body = common::Body::new(body);
5048                    if !parts.status.is_success() {
5049                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5050                        let error = serde_json::from_str(&common::to_string(&bytes));
5051                        let response = common::to_response(parts, bytes.into());
5052
5053                        if let common::Retry::After(d) =
5054                            dlg.http_failure(&response, error.as_ref().ok())
5055                        {
5056                            sleep(d).await;
5057                            continue;
5058                        }
5059
5060                        dlg.finished(false);
5061
5062                        return Err(match error {
5063                            Ok(value) => common::Error::BadRequest(value),
5064                            _ => common::Error::Failure(response),
5065                        });
5066                    }
5067                    let response = {
5068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5069                        let encoded = common::to_string(&bytes);
5070                        match serde_json::from_str(&encoded) {
5071                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5072                            Err(error) => {
5073                                dlg.response_json_decode_error(&encoded, &error);
5074                                return Err(common::Error::JsonDecodeError(
5075                                    encoded.to_string(),
5076                                    error,
5077                                ));
5078                            }
5079                        }
5080                    };
5081
5082                    dlg.finished(true);
5083                    return Ok(response);
5084                }
5085            }
5086        }
5087    }
5088
5089    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.
5090    ///
5091    /// Sets the *apps id* path property to the given value.
5092    ///
5093    /// Even though the property as already been set when instantiating this call,
5094    /// we provide this method for API completeness.
5095    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionListCall<'a, C> {
5096        self._apps_id = new_value.to_string();
5097        self
5098    }
5099    /// Part of `name`. See documentation of `appsId`.
5100    ///
5101    /// Sets the *modules id* path property to the given value.
5102    ///
5103    /// Even though the property as already been set when instantiating this call,
5104    /// we provide this method for API completeness.
5105    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionListCall<'a, C> {
5106        self._modules_id = new_value.to_string();
5107        self
5108    }
5109    /// Controls the set of fields returned in the List response.
5110    ///
5111    /// Sets the *view* query property to the given value.
5112    pub fn view(mut self, new_value: &str) -> AppModuleVersionListCall<'a, C> {
5113        self._view = Some(new_value.to_string());
5114        self
5115    }
5116    /// Continuation token for fetching the next page of results.
5117    ///
5118    /// Sets the *page token* query property to the given value.
5119    pub fn page_token(mut self, new_value: &str) -> AppModuleVersionListCall<'a, C> {
5120        self._page_token = Some(new_value.to_string());
5121        self
5122    }
5123    /// Maximum results to return per page.
5124    ///
5125    /// Sets the *page size* query property to the given value.
5126    pub fn page_size(mut self, new_value: i32) -> AppModuleVersionListCall<'a, C> {
5127        self._page_size = Some(new_value);
5128        self
5129    }
5130    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5131    /// while executing the actual API request.
5132    ///
5133    /// ````text
5134    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5135    /// ````
5136    ///
5137    /// Sets the *delegate* property to the given value.
5138    pub fn delegate(
5139        mut self,
5140        new_value: &'a mut dyn common::Delegate,
5141    ) -> AppModuleVersionListCall<'a, C> {
5142        self._delegate = Some(new_value);
5143        self
5144    }
5145
5146    /// Set any additional parameter of the query string used in the request.
5147    /// It should be used to set parameters which are not yet available through their own
5148    /// setters.
5149    ///
5150    /// Please note that this method must not be used to set any of the known parameters
5151    /// which have their own setter method. If done anyway, the request will fail.
5152    ///
5153    /// # Additional Parameters
5154    ///
5155    /// * *$.xgafv* (query-string) - V1 error format.
5156    /// * *access_token* (query-string) - OAuth access token.
5157    /// * *alt* (query-string) - Data format for response.
5158    /// * *callback* (query-string) - JSONP
5159    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5160    /// * *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.
5161    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5162    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5163    /// * *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.
5164    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5165    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5166    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionListCall<'a, C>
5167    where
5168        T: AsRef<str>,
5169    {
5170        self._additional_params
5171            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5172        self
5173    }
5174
5175    /// Identifies the authorization scope for the method you are building.
5176    ///
5177    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5178    /// [`Scope::CloudPlatformReadOnly`].
5179    ///
5180    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5181    /// tokens for more than one scope.
5182    ///
5183    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5184    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5185    /// sufficient, a read-write scope will do as well.
5186    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionListCall<'a, C>
5187    where
5188        St: AsRef<str>,
5189    {
5190        self._scopes.insert(String::from(scope.as_ref()));
5191        self
5192    }
5193    /// Identifies the authorization scope(s) for the method you are building.
5194    ///
5195    /// See [`Self::add_scope()`] for details.
5196    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionListCall<'a, C>
5197    where
5198        I: IntoIterator<Item = St>,
5199        St: AsRef<str>,
5200    {
5201        self._scopes
5202            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5203        self
5204    }
5205
5206    /// Removes all scopes, and no default scope will be used either.
5207    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5208    /// for details).
5209    pub fn clear_scopes(mut self) -> AppModuleVersionListCall<'a, C> {
5210        self._scopes.clear();
5211        self
5212    }
5213}
5214
5215/// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses:
5216/// serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status):  For Version resources that use basic scaling, manual scaling, or run in  the App Engine flexible environment.
5217/// instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class):  For Version resources that run in the App Engine standard environment.
5218/// automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling):  For Version resources that use automatic scaling and run in the App  Engine standard environment.
5219/// automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling):  For Version resources that use automatic scaling and run in the App  Engine standard environment.
5220///
5221/// A builder for the *modules.versions.patch* method supported by a *app* resource.
5222/// It is not used directly, but through a [`AppMethods`] instance.
5223///
5224/// # Example
5225///
5226/// Instantiate a resource method builder
5227///
5228/// ```test_harness,no_run
5229/// # extern crate hyper;
5230/// # extern crate hyper_rustls;
5231/// # extern crate google_appengine1_beta4 as appengine1_beta4;
5232/// use appengine1_beta4::api::Version;
5233/// # async fn dox() {
5234/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5235///
5236/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5237/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5238/// #     .with_native_roots()
5239/// #     .unwrap()
5240/// #     .https_only()
5241/// #     .enable_http2()
5242/// #     .build();
5243///
5244/// # let executor = hyper_util::rt::TokioExecutor::new();
5245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5246/// #     secret,
5247/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5248/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5249/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5250/// #     ),
5251/// # ).build().await.unwrap();
5252///
5253/// # let client = hyper_util::client::legacy::Client::builder(
5254/// #     hyper_util::rt::TokioExecutor::new()
5255/// # )
5256/// # .build(
5257/// #     hyper_rustls::HttpsConnectorBuilder::new()
5258/// #         .with_native_roots()
5259/// #         .unwrap()
5260/// #         .https_or_http()
5261/// #         .enable_http2()
5262/// #         .build()
5263/// # );
5264/// # let mut hub = Appengine::new(client, auth);
5265/// // As the method needs a request, you would usually fill it with the desired information
5266/// // into the respective structure. Some of the parts shown here might not be applicable !
5267/// // Values shown here are possibly random and not representative !
5268/// let mut req = Version::default();
5269///
5270/// // You can configure optional parameters by calling the respective setters at will, and
5271/// // execute the final call using `doit()`.
5272/// // Values shown here are possibly random and not representative !
5273/// let result = hub.apps().modules_versions_patch(req, "appsId", "modulesId", "versionsId")
5274///              .mask(FieldMask::new::<&str>(&[]))
5275///              .doit().await;
5276/// # }
5277/// ```
5278pub struct AppModuleVersionPatchCall<'a, C>
5279where
5280    C: 'a,
5281{
5282    hub: &'a Appengine<C>,
5283    _request: Version,
5284    _apps_id: String,
5285    _modules_id: String,
5286    _versions_id: String,
5287    _mask: Option<common::FieldMask>,
5288    _delegate: Option<&'a mut dyn common::Delegate>,
5289    _additional_params: HashMap<String, String>,
5290    _scopes: BTreeSet<String>,
5291}
5292
5293impl<'a, C> common::CallBuilder for AppModuleVersionPatchCall<'a, C> {}
5294
5295impl<'a, C> AppModuleVersionPatchCall<'a, C>
5296where
5297    C: common::Connector,
5298{
5299    /// Perform the operation you have build so far.
5300    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5301        use std::borrow::Cow;
5302        use std::io::{Read, Seek};
5303
5304        use common::{url::Params, ToParts};
5305        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5306
5307        let mut dd = common::DefaultDelegate;
5308        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5309        dlg.begin(common::MethodInfo {
5310            id: "appengine.apps.modules.versions.patch",
5311            http_method: hyper::Method::PATCH,
5312        });
5313
5314        for &field in ["alt", "appsId", "modulesId", "versionsId", "mask"].iter() {
5315            if self._additional_params.contains_key(field) {
5316                dlg.finished(false);
5317                return Err(common::Error::FieldClash(field));
5318            }
5319        }
5320
5321        let mut params = Params::with_capacity(7 + self._additional_params.len());
5322        params.push("appsId", self._apps_id);
5323        params.push("modulesId", self._modules_id);
5324        params.push("versionsId", self._versions_id);
5325        if let Some(value) = self._mask.as_ref() {
5326            params.push("mask", value.to_string());
5327        }
5328
5329        params.extend(self._additional_params.iter());
5330
5331        params.push("alt", "json");
5332        let mut url = self.hub._base_url.clone()
5333            + "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}";
5334        if self._scopes.is_empty() {
5335            self._scopes
5336                .insert(Scope::CloudPlatform.as_ref().to_string());
5337        }
5338
5339        #[allow(clippy::single_element_loop)]
5340        for &(find_this, param_name) in [
5341            ("{appsId}", "appsId"),
5342            ("{modulesId}", "modulesId"),
5343            ("{versionsId}", "versionsId"),
5344        ]
5345        .iter()
5346        {
5347            url = params.uri_replacement(url, param_name, find_this, false);
5348        }
5349        {
5350            let to_remove = ["versionsId", "modulesId", "appsId"];
5351            params.remove_params(&to_remove);
5352        }
5353
5354        let url = params.parse_with_url(&url);
5355
5356        let mut json_mime_type = mime::APPLICATION_JSON;
5357        let mut request_value_reader = {
5358            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5359            common::remove_json_null_values(&mut value);
5360            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5361            serde_json::to_writer(&mut dst, &value).unwrap();
5362            dst
5363        };
5364        let request_size = request_value_reader
5365            .seek(std::io::SeekFrom::End(0))
5366            .unwrap();
5367        request_value_reader
5368            .seek(std::io::SeekFrom::Start(0))
5369            .unwrap();
5370
5371        loop {
5372            let token = match self
5373                .hub
5374                .auth
5375                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5376                .await
5377            {
5378                Ok(token) => token,
5379                Err(e) => match dlg.token(e) {
5380                    Ok(token) => token,
5381                    Err(e) => {
5382                        dlg.finished(false);
5383                        return Err(common::Error::MissingToken(e));
5384                    }
5385                },
5386            };
5387            request_value_reader
5388                .seek(std::io::SeekFrom::Start(0))
5389                .unwrap();
5390            let mut req_result = {
5391                let client = &self.hub.client;
5392                dlg.pre_request();
5393                let mut req_builder = hyper::Request::builder()
5394                    .method(hyper::Method::PATCH)
5395                    .uri(url.as_str())
5396                    .header(USER_AGENT, self.hub._user_agent.clone());
5397
5398                if let Some(token) = token.as_ref() {
5399                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5400                }
5401
5402                let request = req_builder
5403                    .header(CONTENT_TYPE, json_mime_type.to_string())
5404                    .header(CONTENT_LENGTH, request_size as u64)
5405                    .body(common::to_body(
5406                        request_value_reader.get_ref().clone().into(),
5407                    ));
5408
5409                client.request(request.unwrap()).await
5410            };
5411
5412            match req_result {
5413                Err(err) => {
5414                    if let common::Retry::After(d) = dlg.http_error(&err) {
5415                        sleep(d).await;
5416                        continue;
5417                    }
5418                    dlg.finished(false);
5419                    return Err(common::Error::HttpError(err));
5420                }
5421                Ok(res) => {
5422                    let (mut parts, body) = res.into_parts();
5423                    let mut body = common::Body::new(body);
5424                    if !parts.status.is_success() {
5425                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5426                        let error = serde_json::from_str(&common::to_string(&bytes));
5427                        let response = common::to_response(parts, bytes.into());
5428
5429                        if let common::Retry::After(d) =
5430                            dlg.http_failure(&response, error.as_ref().ok())
5431                        {
5432                            sleep(d).await;
5433                            continue;
5434                        }
5435
5436                        dlg.finished(false);
5437
5438                        return Err(match error {
5439                            Ok(value) => common::Error::BadRequest(value),
5440                            _ => common::Error::Failure(response),
5441                        });
5442                    }
5443                    let response = {
5444                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5445                        let encoded = common::to_string(&bytes);
5446                        match serde_json::from_str(&encoded) {
5447                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5448                            Err(error) => {
5449                                dlg.response_json_decode_error(&encoded, &error);
5450                                return Err(common::Error::JsonDecodeError(
5451                                    encoded.to_string(),
5452                                    error,
5453                                ));
5454                            }
5455                        }
5456                    };
5457
5458                    dlg.finished(true);
5459                    return Ok(response);
5460                }
5461            }
5462        }
5463    }
5464
5465    ///
5466    /// Sets the *request* property to the given value.
5467    ///
5468    /// Even though the property as already been set when instantiating this call,
5469    /// we provide this method for API completeness.
5470    pub fn request(mut self, new_value: Version) -> AppModuleVersionPatchCall<'a, C> {
5471        self._request = new_value;
5472        self
5473    }
5474    /// Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default/versions/1.
5475    ///
5476    /// Sets the *apps id* path property to the given value.
5477    ///
5478    /// Even though the property as already been set when instantiating this call,
5479    /// we provide this method for API completeness.
5480    pub fn apps_id(mut self, new_value: &str) -> AppModuleVersionPatchCall<'a, C> {
5481        self._apps_id = new_value.to_string();
5482        self
5483    }
5484    /// Part of `name`. See documentation of `appsId`.
5485    ///
5486    /// Sets the *modules id* path property to the given value.
5487    ///
5488    /// Even though the property as already been set when instantiating this call,
5489    /// we provide this method for API completeness.
5490    pub fn modules_id(mut self, new_value: &str) -> AppModuleVersionPatchCall<'a, C> {
5491        self._modules_id = new_value.to_string();
5492        self
5493    }
5494    /// Part of `name`. See documentation of `appsId`.
5495    ///
5496    /// Sets the *versions id* path property to the given value.
5497    ///
5498    /// Even though the property as already been set when instantiating this call,
5499    /// we provide this method for API completeness.
5500    pub fn versions_id(mut self, new_value: &str) -> AppModuleVersionPatchCall<'a, C> {
5501        self._versions_id = new_value.to_string();
5502        self
5503    }
5504    /// Standard field mask for the set of fields to be updated.
5505    ///
5506    /// Sets the *mask* query property to the given value.
5507    pub fn mask(mut self, new_value: common::FieldMask) -> AppModuleVersionPatchCall<'a, C> {
5508        self._mask = Some(new_value);
5509        self
5510    }
5511    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5512    /// while executing the actual API request.
5513    ///
5514    /// ````text
5515    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5516    /// ````
5517    ///
5518    /// Sets the *delegate* property to the given value.
5519    pub fn delegate(
5520        mut self,
5521        new_value: &'a mut dyn common::Delegate,
5522    ) -> AppModuleVersionPatchCall<'a, C> {
5523        self._delegate = Some(new_value);
5524        self
5525    }
5526
5527    /// Set any additional parameter of the query string used in the request.
5528    /// It should be used to set parameters which are not yet available through their own
5529    /// setters.
5530    ///
5531    /// Please note that this method must not be used to set any of the known parameters
5532    /// which have their own setter method. If done anyway, the request will fail.
5533    ///
5534    /// # Additional Parameters
5535    ///
5536    /// * *$.xgafv* (query-string) - V1 error format.
5537    /// * *access_token* (query-string) - OAuth access token.
5538    /// * *alt* (query-string) - Data format for response.
5539    /// * *callback* (query-string) - JSONP
5540    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5541    /// * *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.
5542    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5543    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5544    /// * *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.
5545    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5546    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5547    pub fn param<T>(mut self, name: T, value: T) -> AppModuleVersionPatchCall<'a, C>
5548    where
5549        T: AsRef<str>,
5550    {
5551        self._additional_params
5552            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5553        self
5554    }
5555
5556    /// Identifies the authorization scope for the method you are building.
5557    ///
5558    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5559    /// [`Scope::CloudPlatform`].
5560    ///
5561    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5562    /// tokens for more than one scope.
5563    ///
5564    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5565    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5566    /// sufficient, a read-write scope will do as well.
5567    pub fn add_scope<St>(mut self, scope: St) -> AppModuleVersionPatchCall<'a, C>
5568    where
5569        St: AsRef<str>,
5570    {
5571        self._scopes.insert(String::from(scope.as_ref()));
5572        self
5573    }
5574    /// Identifies the authorization scope(s) for the method you are building.
5575    ///
5576    /// See [`Self::add_scope()`] for details.
5577    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleVersionPatchCall<'a, C>
5578    where
5579        I: IntoIterator<Item = St>,
5580        St: AsRef<str>,
5581    {
5582        self._scopes
5583            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5584        self
5585    }
5586
5587    /// Removes all scopes, and no default scope will be used either.
5588    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5589    /// for details).
5590    pub fn clear_scopes(mut self) -> AppModuleVersionPatchCall<'a, C> {
5591        self._scopes.clear();
5592        self
5593    }
5594}
5595
5596/// Deletes the specified module and all enclosed versions.
5597///
5598/// A builder for the *modules.delete* method supported by a *app* resource.
5599/// It is not used directly, but through a [`AppMethods`] instance.
5600///
5601/// # Example
5602///
5603/// Instantiate a resource method builder
5604///
5605/// ```test_harness,no_run
5606/// # extern crate hyper;
5607/// # extern crate hyper_rustls;
5608/// # extern crate google_appengine1_beta4 as appengine1_beta4;
5609/// # async fn dox() {
5610/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5611///
5612/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5613/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5614/// #     .with_native_roots()
5615/// #     .unwrap()
5616/// #     .https_only()
5617/// #     .enable_http2()
5618/// #     .build();
5619///
5620/// # let executor = hyper_util::rt::TokioExecutor::new();
5621/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5622/// #     secret,
5623/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5624/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5625/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5626/// #     ),
5627/// # ).build().await.unwrap();
5628///
5629/// # let client = hyper_util::client::legacy::Client::builder(
5630/// #     hyper_util::rt::TokioExecutor::new()
5631/// # )
5632/// # .build(
5633/// #     hyper_rustls::HttpsConnectorBuilder::new()
5634/// #         .with_native_roots()
5635/// #         .unwrap()
5636/// #         .https_or_http()
5637/// #         .enable_http2()
5638/// #         .build()
5639/// # );
5640/// # let mut hub = Appengine::new(client, auth);
5641/// // You can configure optional parameters by calling the respective setters at will, and
5642/// // execute the final call using `doit()`.
5643/// // Values shown here are possibly random and not representative !
5644/// let result = hub.apps().modules_delete("appsId", "modulesId")
5645///              .doit().await;
5646/// # }
5647/// ```
5648pub struct AppModuleDeleteCall<'a, C>
5649where
5650    C: 'a,
5651{
5652    hub: &'a Appengine<C>,
5653    _apps_id: String,
5654    _modules_id: String,
5655    _delegate: Option<&'a mut dyn common::Delegate>,
5656    _additional_params: HashMap<String, String>,
5657    _scopes: BTreeSet<String>,
5658}
5659
5660impl<'a, C> common::CallBuilder for AppModuleDeleteCall<'a, C> {}
5661
5662impl<'a, C> AppModuleDeleteCall<'a, C>
5663where
5664    C: common::Connector,
5665{
5666    /// Perform the operation you have build so far.
5667    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5668        use std::borrow::Cow;
5669        use std::io::{Read, Seek};
5670
5671        use common::{url::Params, ToParts};
5672        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5673
5674        let mut dd = common::DefaultDelegate;
5675        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5676        dlg.begin(common::MethodInfo {
5677            id: "appengine.apps.modules.delete",
5678            http_method: hyper::Method::DELETE,
5679        });
5680
5681        for &field in ["alt", "appsId", "modulesId"].iter() {
5682            if self._additional_params.contains_key(field) {
5683                dlg.finished(false);
5684                return Err(common::Error::FieldClash(field));
5685            }
5686        }
5687
5688        let mut params = Params::with_capacity(4 + self._additional_params.len());
5689        params.push("appsId", self._apps_id);
5690        params.push("modulesId", self._modules_id);
5691
5692        params.extend(self._additional_params.iter());
5693
5694        params.push("alt", "json");
5695        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}";
5696        if self._scopes.is_empty() {
5697            self._scopes
5698                .insert(Scope::CloudPlatform.as_ref().to_string());
5699        }
5700
5701        #[allow(clippy::single_element_loop)]
5702        for &(find_this, param_name) in
5703            [("{appsId}", "appsId"), ("{modulesId}", "modulesId")].iter()
5704        {
5705            url = params.uri_replacement(url, param_name, find_this, false);
5706        }
5707        {
5708            let to_remove = ["modulesId", "appsId"];
5709            params.remove_params(&to_remove);
5710        }
5711
5712        let url = params.parse_with_url(&url);
5713
5714        loop {
5715            let token = match self
5716                .hub
5717                .auth
5718                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5719                .await
5720            {
5721                Ok(token) => token,
5722                Err(e) => match dlg.token(e) {
5723                    Ok(token) => token,
5724                    Err(e) => {
5725                        dlg.finished(false);
5726                        return Err(common::Error::MissingToken(e));
5727                    }
5728                },
5729            };
5730            let mut req_result = {
5731                let client = &self.hub.client;
5732                dlg.pre_request();
5733                let mut req_builder = hyper::Request::builder()
5734                    .method(hyper::Method::DELETE)
5735                    .uri(url.as_str())
5736                    .header(USER_AGENT, self.hub._user_agent.clone());
5737
5738                if let Some(token) = token.as_ref() {
5739                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5740                }
5741
5742                let request = req_builder
5743                    .header(CONTENT_LENGTH, 0_u64)
5744                    .body(common::to_body::<String>(None));
5745
5746                client.request(request.unwrap()).await
5747            };
5748
5749            match req_result {
5750                Err(err) => {
5751                    if let common::Retry::After(d) = dlg.http_error(&err) {
5752                        sleep(d).await;
5753                        continue;
5754                    }
5755                    dlg.finished(false);
5756                    return Err(common::Error::HttpError(err));
5757                }
5758                Ok(res) => {
5759                    let (mut parts, body) = res.into_parts();
5760                    let mut body = common::Body::new(body);
5761                    if !parts.status.is_success() {
5762                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5763                        let error = serde_json::from_str(&common::to_string(&bytes));
5764                        let response = common::to_response(parts, bytes.into());
5765
5766                        if let common::Retry::After(d) =
5767                            dlg.http_failure(&response, error.as_ref().ok())
5768                        {
5769                            sleep(d).await;
5770                            continue;
5771                        }
5772
5773                        dlg.finished(false);
5774
5775                        return Err(match error {
5776                            Ok(value) => common::Error::BadRequest(value),
5777                            _ => common::Error::Failure(response),
5778                        });
5779                    }
5780                    let response = {
5781                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5782                        let encoded = common::to_string(&bytes);
5783                        match serde_json::from_str(&encoded) {
5784                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5785                            Err(error) => {
5786                                dlg.response_json_decode_error(&encoded, &error);
5787                                return Err(common::Error::JsonDecodeError(
5788                                    encoded.to_string(),
5789                                    error,
5790                                ));
5791                            }
5792                        }
5793                    };
5794
5795                    dlg.finished(true);
5796                    return Ok(response);
5797                }
5798            }
5799        }
5800    }
5801
5802    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.
5803    ///
5804    /// Sets the *apps id* path property to the given value.
5805    ///
5806    /// Even though the property as already been set when instantiating this call,
5807    /// we provide this method for API completeness.
5808    pub fn apps_id(mut self, new_value: &str) -> AppModuleDeleteCall<'a, C> {
5809        self._apps_id = new_value.to_string();
5810        self
5811    }
5812    /// Part of `name`. See documentation of `appsId`.
5813    ///
5814    /// Sets the *modules id* path property to the given value.
5815    ///
5816    /// Even though the property as already been set when instantiating this call,
5817    /// we provide this method for API completeness.
5818    pub fn modules_id(mut self, new_value: &str) -> AppModuleDeleteCall<'a, C> {
5819        self._modules_id = new_value.to_string();
5820        self
5821    }
5822    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5823    /// while executing the actual API request.
5824    ///
5825    /// ````text
5826    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5827    /// ````
5828    ///
5829    /// Sets the *delegate* property to the given value.
5830    pub fn delegate(
5831        mut self,
5832        new_value: &'a mut dyn common::Delegate,
5833    ) -> AppModuleDeleteCall<'a, C> {
5834        self._delegate = Some(new_value);
5835        self
5836    }
5837
5838    /// Set any additional parameter of the query string used in the request.
5839    /// It should be used to set parameters which are not yet available through their own
5840    /// setters.
5841    ///
5842    /// Please note that this method must not be used to set any of the known parameters
5843    /// which have their own setter method. If done anyway, the request will fail.
5844    ///
5845    /// # Additional Parameters
5846    ///
5847    /// * *$.xgafv* (query-string) - V1 error format.
5848    /// * *access_token* (query-string) - OAuth access token.
5849    /// * *alt* (query-string) - Data format for response.
5850    /// * *callback* (query-string) - JSONP
5851    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5852    /// * *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.
5853    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5854    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5855    /// * *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.
5856    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5857    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5858    pub fn param<T>(mut self, name: T, value: T) -> AppModuleDeleteCall<'a, C>
5859    where
5860        T: AsRef<str>,
5861    {
5862        self._additional_params
5863            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5864        self
5865    }
5866
5867    /// Identifies the authorization scope for the method you are building.
5868    ///
5869    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5870    /// [`Scope::CloudPlatform`].
5871    ///
5872    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5873    /// tokens for more than one scope.
5874    ///
5875    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5876    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5877    /// sufficient, a read-write scope will do as well.
5878    pub fn add_scope<St>(mut self, scope: St) -> AppModuleDeleteCall<'a, C>
5879    where
5880        St: AsRef<str>,
5881    {
5882        self._scopes.insert(String::from(scope.as_ref()));
5883        self
5884    }
5885    /// Identifies the authorization scope(s) for the method you are building.
5886    ///
5887    /// See [`Self::add_scope()`] for details.
5888    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleDeleteCall<'a, C>
5889    where
5890        I: IntoIterator<Item = St>,
5891        St: AsRef<str>,
5892    {
5893        self._scopes
5894            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5895        self
5896    }
5897
5898    /// Removes all scopes, and no default scope will be used either.
5899    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5900    /// for details).
5901    pub fn clear_scopes(mut self) -> AppModuleDeleteCall<'a, C> {
5902        self._scopes.clear();
5903        self
5904    }
5905}
5906
5907/// Gets the current configuration of the specified module.
5908///
5909/// A builder for the *modules.get* method supported by a *app* resource.
5910/// It is not used directly, but through a [`AppMethods`] instance.
5911///
5912/// # Example
5913///
5914/// Instantiate a resource method builder
5915///
5916/// ```test_harness,no_run
5917/// # extern crate hyper;
5918/// # extern crate hyper_rustls;
5919/// # extern crate google_appengine1_beta4 as appengine1_beta4;
5920/// # async fn dox() {
5921/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5922///
5923/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5924/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5925/// #     .with_native_roots()
5926/// #     .unwrap()
5927/// #     .https_only()
5928/// #     .enable_http2()
5929/// #     .build();
5930///
5931/// # let executor = hyper_util::rt::TokioExecutor::new();
5932/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5933/// #     secret,
5934/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5935/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5936/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5937/// #     ),
5938/// # ).build().await.unwrap();
5939///
5940/// # let client = hyper_util::client::legacy::Client::builder(
5941/// #     hyper_util::rt::TokioExecutor::new()
5942/// # )
5943/// # .build(
5944/// #     hyper_rustls::HttpsConnectorBuilder::new()
5945/// #         .with_native_roots()
5946/// #         .unwrap()
5947/// #         .https_or_http()
5948/// #         .enable_http2()
5949/// #         .build()
5950/// # );
5951/// # let mut hub = Appengine::new(client, auth);
5952/// // You can configure optional parameters by calling the respective setters at will, and
5953/// // execute the final call using `doit()`.
5954/// // Values shown here are possibly random and not representative !
5955/// let result = hub.apps().modules_get("appsId", "modulesId")
5956///              .doit().await;
5957/// # }
5958/// ```
5959pub struct AppModuleGetCall<'a, C>
5960where
5961    C: 'a,
5962{
5963    hub: &'a Appengine<C>,
5964    _apps_id: String,
5965    _modules_id: String,
5966    _delegate: Option<&'a mut dyn common::Delegate>,
5967    _additional_params: HashMap<String, String>,
5968    _scopes: BTreeSet<String>,
5969}
5970
5971impl<'a, C> common::CallBuilder for AppModuleGetCall<'a, C> {}
5972
5973impl<'a, C> AppModuleGetCall<'a, C>
5974where
5975    C: common::Connector,
5976{
5977    /// Perform the operation you have build so far.
5978    pub async fn doit(mut self) -> common::Result<(common::Response, Module)> {
5979        use std::borrow::Cow;
5980        use std::io::{Read, Seek};
5981
5982        use common::{url::Params, ToParts};
5983        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5984
5985        let mut dd = common::DefaultDelegate;
5986        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5987        dlg.begin(common::MethodInfo {
5988            id: "appengine.apps.modules.get",
5989            http_method: hyper::Method::GET,
5990        });
5991
5992        for &field in ["alt", "appsId", "modulesId"].iter() {
5993            if self._additional_params.contains_key(field) {
5994                dlg.finished(false);
5995                return Err(common::Error::FieldClash(field));
5996            }
5997        }
5998
5999        let mut params = Params::with_capacity(4 + self._additional_params.len());
6000        params.push("appsId", self._apps_id);
6001        params.push("modulesId", self._modules_id);
6002
6003        params.extend(self._additional_params.iter());
6004
6005        params.push("alt", "json");
6006        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}";
6007        if self._scopes.is_empty() {
6008            self._scopes
6009                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6010        }
6011
6012        #[allow(clippy::single_element_loop)]
6013        for &(find_this, param_name) in
6014            [("{appsId}", "appsId"), ("{modulesId}", "modulesId")].iter()
6015        {
6016            url = params.uri_replacement(url, param_name, find_this, false);
6017        }
6018        {
6019            let to_remove = ["modulesId", "appsId"];
6020            params.remove_params(&to_remove);
6021        }
6022
6023        let url = params.parse_with_url(&url);
6024
6025        loop {
6026            let token = match self
6027                .hub
6028                .auth
6029                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6030                .await
6031            {
6032                Ok(token) => token,
6033                Err(e) => match dlg.token(e) {
6034                    Ok(token) => token,
6035                    Err(e) => {
6036                        dlg.finished(false);
6037                        return Err(common::Error::MissingToken(e));
6038                    }
6039                },
6040            };
6041            let mut req_result = {
6042                let client = &self.hub.client;
6043                dlg.pre_request();
6044                let mut req_builder = hyper::Request::builder()
6045                    .method(hyper::Method::GET)
6046                    .uri(url.as_str())
6047                    .header(USER_AGENT, self.hub._user_agent.clone());
6048
6049                if let Some(token) = token.as_ref() {
6050                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6051                }
6052
6053                let request = req_builder
6054                    .header(CONTENT_LENGTH, 0_u64)
6055                    .body(common::to_body::<String>(None));
6056
6057                client.request(request.unwrap()).await
6058            };
6059
6060            match req_result {
6061                Err(err) => {
6062                    if let common::Retry::After(d) = dlg.http_error(&err) {
6063                        sleep(d).await;
6064                        continue;
6065                    }
6066                    dlg.finished(false);
6067                    return Err(common::Error::HttpError(err));
6068                }
6069                Ok(res) => {
6070                    let (mut parts, body) = res.into_parts();
6071                    let mut body = common::Body::new(body);
6072                    if !parts.status.is_success() {
6073                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6074                        let error = serde_json::from_str(&common::to_string(&bytes));
6075                        let response = common::to_response(parts, bytes.into());
6076
6077                        if let common::Retry::After(d) =
6078                            dlg.http_failure(&response, error.as_ref().ok())
6079                        {
6080                            sleep(d).await;
6081                            continue;
6082                        }
6083
6084                        dlg.finished(false);
6085
6086                        return Err(match error {
6087                            Ok(value) => common::Error::BadRequest(value),
6088                            _ => common::Error::Failure(response),
6089                        });
6090                    }
6091                    let response = {
6092                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6093                        let encoded = common::to_string(&bytes);
6094                        match serde_json::from_str(&encoded) {
6095                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6096                            Err(error) => {
6097                                dlg.response_json_decode_error(&encoded, &error);
6098                                return Err(common::Error::JsonDecodeError(
6099                                    encoded.to_string(),
6100                                    error,
6101                                ));
6102                            }
6103                        }
6104                    };
6105
6106                    dlg.finished(true);
6107                    return Ok(response);
6108                }
6109            }
6110        }
6111    }
6112
6113    /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.
6114    ///
6115    /// Sets the *apps id* path property to the given value.
6116    ///
6117    /// Even though the property as already been set when instantiating this call,
6118    /// we provide this method for API completeness.
6119    pub fn apps_id(mut self, new_value: &str) -> AppModuleGetCall<'a, C> {
6120        self._apps_id = new_value.to_string();
6121        self
6122    }
6123    /// Part of `name`. See documentation of `appsId`.
6124    ///
6125    /// Sets the *modules id* path property to the given value.
6126    ///
6127    /// Even though the property as already been set when instantiating this call,
6128    /// we provide this method for API completeness.
6129    pub fn modules_id(mut self, new_value: &str) -> AppModuleGetCall<'a, C> {
6130        self._modules_id = new_value.to_string();
6131        self
6132    }
6133    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6134    /// while executing the actual API request.
6135    ///
6136    /// ````text
6137    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6138    /// ````
6139    ///
6140    /// Sets the *delegate* property to the given value.
6141    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppModuleGetCall<'a, C> {
6142        self._delegate = Some(new_value);
6143        self
6144    }
6145
6146    /// Set any additional parameter of the query string used in the request.
6147    /// It should be used to set parameters which are not yet available through their own
6148    /// setters.
6149    ///
6150    /// Please note that this method must not be used to set any of the known parameters
6151    /// which have their own setter method. If done anyway, the request will fail.
6152    ///
6153    /// # Additional Parameters
6154    ///
6155    /// * *$.xgafv* (query-string) - V1 error format.
6156    /// * *access_token* (query-string) - OAuth access token.
6157    /// * *alt* (query-string) - Data format for response.
6158    /// * *callback* (query-string) - JSONP
6159    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6160    /// * *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.
6161    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6162    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6163    /// * *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.
6164    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6165    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6166    pub fn param<T>(mut self, name: T, value: T) -> AppModuleGetCall<'a, C>
6167    where
6168        T: AsRef<str>,
6169    {
6170        self._additional_params
6171            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6172        self
6173    }
6174
6175    /// Identifies the authorization scope for the method you are building.
6176    ///
6177    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6178    /// [`Scope::CloudPlatformReadOnly`].
6179    ///
6180    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6181    /// tokens for more than one scope.
6182    ///
6183    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6184    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6185    /// sufficient, a read-write scope will do as well.
6186    pub fn add_scope<St>(mut self, scope: St) -> AppModuleGetCall<'a, C>
6187    where
6188        St: AsRef<str>,
6189    {
6190        self._scopes.insert(String::from(scope.as_ref()));
6191        self
6192    }
6193    /// Identifies the authorization scope(s) for the method you are building.
6194    ///
6195    /// See [`Self::add_scope()`] for details.
6196    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleGetCall<'a, C>
6197    where
6198        I: IntoIterator<Item = St>,
6199        St: AsRef<str>,
6200    {
6201        self._scopes
6202            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6203        self
6204    }
6205
6206    /// Removes all scopes, and no default scope will be used either.
6207    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6208    /// for details).
6209    pub fn clear_scopes(mut self) -> AppModuleGetCall<'a, C> {
6210        self._scopes.clear();
6211        self
6212    }
6213}
6214
6215/// Lists all the modules in the application.
6216///
6217/// A builder for the *modules.list* method supported by a *app* resource.
6218/// It is not used directly, but through a [`AppMethods`] instance.
6219///
6220/// # Example
6221///
6222/// Instantiate a resource method builder
6223///
6224/// ```test_harness,no_run
6225/// # extern crate hyper;
6226/// # extern crate hyper_rustls;
6227/// # extern crate google_appengine1_beta4 as appengine1_beta4;
6228/// # async fn dox() {
6229/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6230///
6231/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6232/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6233/// #     .with_native_roots()
6234/// #     .unwrap()
6235/// #     .https_only()
6236/// #     .enable_http2()
6237/// #     .build();
6238///
6239/// # let executor = hyper_util::rt::TokioExecutor::new();
6240/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6241/// #     secret,
6242/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6243/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6244/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6245/// #     ),
6246/// # ).build().await.unwrap();
6247///
6248/// # let client = hyper_util::client::legacy::Client::builder(
6249/// #     hyper_util::rt::TokioExecutor::new()
6250/// # )
6251/// # .build(
6252/// #     hyper_rustls::HttpsConnectorBuilder::new()
6253/// #         .with_native_roots()
6254/// #         .unwrap()
6255/// #         .https_or_http()
6256/// #         .enable_http2()
6257/// #         .build()
6258/// # );
6259/// # let mut hub = Appengine::new(client, auth);
6260/// // You can configure optional parameters by calling the respective setters at will, and
6261/// // execute the final call using `doit()`.
6262/// // Values shown here are possibly random and not representative !
6263/// let result = hub.apps().modules_list("appsId")
6264///              .page_token("diam")
6265///              .page_size(-49)
6266///              .doit().await;
6267/// # }
6268/// ```
6269pub struct AppModuleListCall<'a, C>
6270where
6271    C: 'a,
6272{
6273    hub: &'a Appengine<C>,
6274    _apps_id: String,
6275    _page_token: Option<String>,
6276    _page_size: Option<i32>,
6277    _delegate: Option<&'a mut dyn common::Delegate>,
6278    _additional_params: HashMap<String, String>,
6279    _scopes: BTreeSet<String>,
6280}
6281
6282impl<'a, C> common::CallBuilder for AppModuleListCall<'a, C> {}
6283
6284impl<'a, C> AppModuleListCall<'a, C>
6285where
6286    C: common::Connector,
6287{
6288    /// Perform the operation you have build so far.
6289    pub async fn doit(mut self) -> common::Result<(common::Response, ListModulesResponse)> {
6290        use std::borrow::Cow;
6291        use std::io::{Read, Seek};
6292
6293        use common::{url::Params, ToParts};
6294        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6295
6296        let mut dd = common::DefaultDelegate;
6297        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6298        dlg.begin(common::MethodInfo {
6299            id: "appengine.apps.modules.list",
6300            http_method: hyper::Method::GET,
6301        });
6302
6303        for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
6304            if self._additional_params.contains_key(field) {
6305                dlg.finished(false);
6306                return Err(common::Error::FieldClash(field));
6307            }
6308        }
6309
6310        let mut params = Params::with_capacity(5 + self._additional_params.len());
6311        params.push("appsId", self._apps_id);
6312        if let Some(value) = self._page_token.as_ref() {
6313            params.push("pageToken", value);
6314        }
6315        if let Some(value) = self._page_size.as_ref() {
6316            params.push("pageSize", value.to_string());
6317        }
6318
6319        params.extend(self._additional_params.iter());
6320
6321        params.push("alt", "json");
6322        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules";
6323        if self._scopes.is_empty() {
6324            self._scopes
6325                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6326        }
6327
6328        #[allow(clippy::single_element_loop)]
6329        for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
6330            url = params.uri_replacement(url, param_name, find_this, false);
6331        }
6332        {
6333            let to_remove = ["appsId"];
6334            params.remove_params(&to_remove);
6335        }
6336
6337        let url = params.parse_with_url(&url);
6338
6339        loop {
6340            let token = match self
6341                .hub
6342                .auth
6343                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6344                .await
6345            {
6346                Ok(token) => token,
6347                Err(e) => match dlg.token(e) {
6348                    Ok(token) => token,
6349                    Err(e) => {
6350                        dlg.finished(false);
6351                        return Err(common::Error::MissingToken(e));
6352                    }
6353                },
6354            };
6355            let mut req_result = {
6356                let client = &self.hub.client;
6357                dlg.pre_request();
6358                let mut req_builder = hyper::Request::builder()
6359                    .method(hyper::Method::GET)
6360                    .uri(url.as_str())
6361                    .header(USER_AGENT, self.hub._user_agent.clone());
6362
6363                if let Some(token) = token.as_ref() {
6364                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6365                }
6366
6367                let request = req_builder
6368                    .header(CONTENT_LENGTH, 0_u64)
6369                    .body(common::to_body::<String>(None));
6370
6371                client.request(request.unwrap()).await
6372            };
6373
6374            match req_result {
6375                Err(err) => {
6376                    if let common::Retry::After(d) = dlg.http_error(&err) {
6377                        sleep(d).await;
6378                        continue;
6379                    }
6380                    dlg.finished(false);
6381                    return Err(common::Error::HttpError(err));
6382                }
6383                Ok(res) => {
6384                    let (mut parts, body) = res.into_parts();
6385                    let mut body = common::Body::new(body);
6386                    if !parts.status.is_success() {
6387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6388                        let error = serde_json::from_str(&common::to_string(&bytes));
6389                        let response = common::to_response(parts, bytes.into());
6390
6391                        if let common::Retry::After(d) =
6392                            dlg.http_failure(&response, error.as_ref().ok())
6393                        {
6394                            sleep(d).await;
6395                            continue;
6396                        }
6397
6398                        dlg.finished(false);
6399
6400                        return Err(match error {
6401                            Ok(value) => common::Error::BadRequest(value),
6402                            _ => common::Error::Failure(response),
6403                        });
6404                    }
6405                    let response = {
6406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6407                        let encoded = common::to_string(&bytes);
6408                        match serde_json::from_str(&encoded) {
6409                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6410                            Err(error) => {
6411                                dlg.response_json_decode_error(&encoded, &error);
6412                                return Err(common::Error::JsonDecodeError(
6413                                    encoded.to_string(),
6414                                    error,
6415                                ));
6416                            }
6417                        }
6418                    };
6419
6420                    dlg.finished(true);
6421                    return Ok(response);
6422                }
6423            }
6424        }
6425    }
6426
6427    /// Part of `name`. Name of the resource requested. Example: apps/myapp.
6428    ///
6429    /// Sets the *apps id* path property to the given value.
6430    ///
6431    /// Even though the property as already been set when instantiating this call,
6432    /// we provide this method for API completeness.
6433    pub fn apps_id(mut self, new_value: &str) -> AppModuleListCall<'a, C> {
6434        self._apps_id = new_value.to_string();
6435        self
6436    }
6437    /// Continuation token for fetching the next page of results.
6438    ///
6439    /// Sets the *page token* query property to the given value.
6440    pub fn page_token(mut self, new_value: &str) -> AppModuleListCall<'a, C> {
6441        self._page_token = Some(new_value.to_string());
6442        self
6443    }
6444    /// Maximum results to return per page.
6445    ///
6446    /// Sets the *page size* query property to the given value.
6447    pub fn page_size(mut self, new_value: i32) -> AppModuleListCall<'a, C> {
6448        self._page_size = Some(new_value);
6449        self
6450    }
6451    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6452    /// while executing the actual API request.
6453    ///
6454    /// ````text
6455    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6456    /// ````
6457    ///
6458    /// Sets the *delegate* property to the given value.
6459    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppModuleListCall<'a, C> {
6460        self._delegate = Some(new_value);
6461        self
6462    }
6463
6464    /// Set any additional parameter of the query string used in the request.
6465    /// It should be used to set parameters which are not yet available through their own
6466    /// setters.
6467    ///
6468    /// Please note that this method must not be used to set any of the known parameters
6469    /// which have their own setter method. If done anyway, the request will fail.
6470    ///
6471    /// # Additional Parameters
6472    ///
6473    /// * *$.xgafv* (query-string) - V1 error format.
6474    /// * *access_token* (query-string) - OAuth access token.
6475    /// * *alt* (query-string) - Data format for response.
6476    /// * *callback* (query-string) - JSONP
6477    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6478    /// * *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.
6479    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6480    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6481    /// * *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.
6482    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6483    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6484    pub fn param<T>(mut self, name: T, value: T) -> AppModuleListCall<'a, C>
6485    where
6486        T: AsRef<str>,
6487    {
6488        self._additional_params
6489            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6490        self
6491    }
6492
6493    /// Identifies the authorization scope for the method you are building.
6494    ///
6495    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6496    /// [`Scope::CloudPlatformReadOnly`].
6497    ///
6498    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6499    /// tokens for more than one scope.
6500    ///
6501    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6502    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6503    /// sufficient, a read-write scope will do as well.
6504    pub fn add_scope<St>(mut self, scope: St) -> AppModuleListCall<'a, C>
6505    where
6506        St: AsRef<str>,
6507    {
6508        self._scopes.insert(String::from(scope.as_ref()));
6509        self
6510    }
6511    /// Identifies the authorization scope(s) for the method you are building.
6512    ///
6513    /// See [`Self::add_scope()`] for details.
6514    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModuleListCall<'a, C>
6515    where
6516        I: IntoIterator<Item = St>,
6517        St: AsRef<str>,
6518    {
6519        self._scopes
6520            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6521        self
6522    }
6523
6524    /// Removes all scopes, and no default scope will be used either.
6525    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6526    /// for details).
6527    pub fn clear_scopes(mut self) -> AppModuleListCall<'a, C> {
6528        self._scopes.clear();
6529        self
6530    }
6531}
6532
6533/// Updates the configuration of the specified module.
6534///
6535/// A builder for the *modules.patch* method supported by a *app* resource.
6536/// It is not used directly, but through a [`AppMethods`] instance.
6537///
6538/// # Example
6539///
6540/// Instantiate a resource method builder
6541///
6542/// ```test_harness,no_run
6543/// # extern crate hyper;
6544/// # extern crate hyper_rustls;
6545/// # extern crate google_appengine1_beta4 as appengine1_beta4;
6546/// use appengine1_beta4::api::Module;
6547/// # async fn dox() {
6548/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6549///
6550/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6551/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6552/// #     .with_native_roots()
6553/// #     .unwrap()
6554/// #     .https_only()
6555/// #     .enable_http2()
6556/// #     .build();
6557///
6558/// # let executor = hyper_util::rt::TokioExecutor::new();
6559/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6560/// #     secret,
6561/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6562/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6563/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6564/// #     ),
6565/// # ).build().await.unwrap();
6566///
6567/// # let client = hyper_util::client::legacy::Client::builder(
6568/// #     hyper_util::rt::TokioExecutor::new()
6569/// # )
6570/// # .build(
6571/// #     hyper_rustls::HttpsConnectorBuilder::new()
6572/// #         .with_native_roots()
6573/// #         .unwrap()
6574/// #         .https_or_http()
6575/// #         .enable_http2()
6576/// #         .build()
6577/// # );
6578/// # let mut hub = Appengine::new(client, auth);
6579/// // As the method needs a request, you would usually fill it with the desired information
6580/// // into the respective structure. Some of the parts shown here might not be applicable !
6581/// // Values shown here are possibly random and not representative !
6582/// let mut req = Module::default();
6583///
6584/// // You can configure optional parameters by calling the respective setters at will, and
6585/// // execute the final call using `doit()`.
6586/// // Values shown here are possibly random and not representative !
6587/// let result = hub.apps().modules_patch(req, "appsId", "modulesId")
6588///              .migrate_traffic(false)
6589///              .mask(FieldMask::new::<&str>(&[]))
6590///              .doit().await;
6591/// # }
6592/// ```
6593pub struct AppModulePatchCall<'a, C>
6594where
6595    C: 'a,
6596{
6597    hub: &'a Appengine<C>,
6598    _request: Module,
6599    _apps_id: String,
6600    _modules_id: String,
6601    _migrate_traffic: Option<bool>,
6602    _mask: Option<common::FieldMask>,
6603    _delegate: Option<&'a mut dyn common::Delegate>,
6604    _additional_params: HashMap<String, String>,
6605    _scopes: BTreeSet<String>,
6606}
6607
6608impl<'a, C> common::CallBuilder for AppModulePatchCall<'a, C> {}
6609
6610impl<'a, C> AppModulePatchCall<'a, C>
6611where
6612    C: common::Connector,
6613{
6614    /// Perform the operation you have build so far.
6615    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6616        use std::borrow::Cow;
6617        use std::io::{Read, Seek};
6618
6619        use common::{url::Params, ToParts};
6620        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6621
6622        let mut dd = common::DefaultDelegate;
6623        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6624        dlg.begin(common::MethodInfo {
6625            id: "appengine.apps.modules.patch",
6626            http_method: hyper::Method::PATCH,
6627        });
6628
6629        for &field in ["alt", "appsId", "modulesId", "migrateTraffic", "mask"].iter() {
6630            if self._additional_params.contains_key(field) {
6631                dlg.finished(false);
6632                return Err(common::Error::FieldClash(field));
6633            }
6634        }
6635
6636        let mut params = Params::with_capacity(7 + self._additional_params.len());
6637        params.push("appsId", self._apps_id);
6638        params.push("modulesId", self._modules_id);
6639        if let Some(value) = self._migrate_traffic.as_ref() {
6640            params.push("migrateTraffic", value.to_string());
6641        }
6642        if let Some(value) = self._mask.as_ref() {
6643            params.push("mask", value.to_string());
6644        }
6645
6646        params.extend(self._additional_params.iter());
6647
6648        params.push("alt", "json");
6649        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/modules/{modulesId}";
6650        if self._scopes.is_empty() {
6651            self._scopes
6652                .insert(Scope::CloudPlatform.as_ref().to_string());
6653        }
6654
6655        #[allow(clippy::single_element_loop)]
6656        for &(find_this, param_name) in
6657            [("{appsId}", "appsId"), ("{modulesId}", "modulesId")].iter()
6658        {
6659            url = params.uri_replacement(url, param_name, find_this, false);
6660        }
6661        {
6662            let to_remove = ["modulesId", "appsId"];
6663            params.remove_params(&to_remove);
6664        }
6665
6666        let url = params.parse_with_url(&url);
6667
6668        let mut json_mime_type = mime::APPLICATION_JSON;
6669        let mut request_value_reader = {
6670            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6671            common::remove_json_null_values(&mut value);
6672            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6673            serde_json::to_writer(&mut dst, &value).unwrap();
6674            dst
6675        };
6676        let request_size = request_value_reader
6677            .seek(std::io::SeekFrom::End(0))
6678            .unwrap();
6679        request_value_reader
6680            .seek(std::io::SeekFrom::Start(0))
6681            .unwrap();
6682
6683        loop {
6684            let token = match self
6685                .hub
6686                .auth
6687                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6688                .await
6689            {
6690                Ok(token) => token,
6691                Err(e) => match dlg.token(e) {
6692                    Ok(token) => token,
6693                    Err(e) => {
6694                        dlg.finished(false);
6695                        return Err(common::Error::MissingToken(e));
6696                    }
6697                },
6698            };
6699            request_value_reader
6700                .seek(std::io::SeekFrom::Start(0))
6701                .unwrap();
6702            let mut req_result = {
6703                let client = &self.hub.client;
6704                dlg.pre_request();
6705                let mut req_builder = hyper::Request::builder()
6706                    .method(hyper::Method::PATCH)
6707                    .uri(url.as_str())
6708                    .header(USER_AGENT, self.hub._user_agent.clone());
6709
6710                if let Some(token) = token.as_ref() {
6711                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6712                }
6713
6714                let request = req_builder
6715                    .header(CONTENT_TYPE, json_mime_type.to_string())
6716                    .header(CONTENT_LENGTH, request_size as u64)
6717                    .body(common::to_body(
6718                        request_value_reader.get_ref().clone().into(),
6719                    ));
6720
6721                client.request(request.unwrap()).await
6722            };
6723
6724            match req_result {
6725                Err(err) => {
6726                    if let common::Retry::After(d) = dlg.http_error(&err) {
6727                        sleep(d).await;
6728                        continue;
6729                    }
6730                    dlg.finished(false);
6731                    return Err(common::Error::HttpError(err));
6732                }
6733                Ok(res) => {
6734                    let (mut parts, body) = res.into_parts();
6735                    let mut body = common::Body::new(body);
6736                    if !parts.status.is_success() {
6737                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6738                        let error = serde_json::from_str(&common::to_string(&bytes));
6739                        let response = common::to_response(parts, bytes.into());
6740
6741                        if let common::Retry::After(d) =
6742                            dlg.http_failure(&response, error.as_ref().ok())
6743                        {
6744                            sleep(d).await;
6745                            continue;
6746                        }
6747
6748                        dlg.finished(false);
6749
6750                        return Err(match error {
6751                            Ok(value) => common::Error::BadRequest(value),
6752                            _ => common::Error::Failure(response),
6753                        });
6754                    }
6755                    let response = {
6756                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6757                        let encoded = common::to_string(&bytes);
6758                        match serde_json::from_str(&encoded) {
6759                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6760                            Err(error) => {
6761                                dlg.response_json_decode_error(&encoded, &error);
6762                                return Err(common::Error::JsonDecodeError(
6763                                    encoded.to_string(),
6764                                    error,
6765                                ));
6766                            }
6767                        }
6768                    };
6769
6770                    dlg.finished(true);
6771                    return Ok(response);
6772                }
6773            }
6774        }
6775    }
6776
6777    ///
6778    /// Sets the *request* property to the given value.
6779    ///
6780    /// Even though the property as already been set when instantiating this call,
6781    /// we provide this method for API completeness.
6782    pub fn request(mut self, new_value: Module) -> AppModulePatchCall<'a, C> {
6783        self._request = new_value;
6784        self
6785    }
6786    /// Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default.
6787    ///
6788    /// Sets the *apps id* path property to the given value.
6789    ///
6790    /// Even though the property as already been set when instantiating this call,
6791    /// we provide this method for API completeness.
6792    pub fn apps_id(mut self, new_value: &str) -> AppModulePatchCall<'a, C> {
6793        self._apps_id = new_value.to_string();
6794        self
6795    }
6796    /// Part of `name`. See documentation of `appsId`.
6797    ///
6798    /// Sets the *modules id* path property to the given value.
6799    ///
6800    /// Even though the property as already been set when instantiating this call,
6801    /// we provide this method for API completeness.
6802    pub fn modules_id(mut self, new_value: &str) -> AppModulePatchCall<'a, C> {
6803        self._modules_id = new_value.to_string();
6804        self
6805    }
6806    /// Set to true to gradually shift traffic to one or more versions that you specify. By default, traffic is shifted immediately. For gradual traffic migration, the target versions must be located within instances that are configured for both warmup requests (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#inboundservicetype) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#automaticscaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules#shardby) field in the Module resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).
6807    ///
6808    /// Sets the *migrate traffic* query property to the given value.
6809    pub fn migrate_traffic(mut self, new_value: bool) -> AppModulePatchCall<'a, C> {
6810        self._migrate_traffic = Some(new_value);
6811        self
6812    }
6813    /// Standard field mask for the set of fields to be updated.
6814    ///
6815    /// Sets the *mask* query property to the given value.
6816    pub fn mask(mut self, new_value: common::FieldMask) -> AppModulePatchCall<'a, C> {
6817        self._mask = Some(new_value);
6818        self
6819    }
6820    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6821    /// while executing the actual API request.
6822    ///
6823    /// ````text
6824    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6825    /// ````
6826    ///
6827    /// Sets the *delegate* property to the given value.
6828    pub fn delegate(
6829        mut self,
6830        new_value: &'a mut dyn common::Delegate,
6831    ) -> AppModulePatchCall<'a, C> {
6832        self._delegate = Some(new_value);
6833        self
6834    }
6835
6836    /// Set any additional parameter of the query string used in the request.
6837    /// It should be used to set parameters which are not yet available through their own
6838    /// setters.
6839    ///
6840    /// Please note that this method must not be used to set any of the known parameters
6841    /// which have their own setter method. If done anyway, the request will fail.
6842    ///
6843    /// # Additional Parameters
6844    ///
6845    /// * *$.xgafv* (query-string) - V1 error format.
6846    /// * *access_token* (query-string) - OAuth access token.
6847    /// * *alt* (query-string) - Data format for response.
6848    /// * *callback* (query-string) - JSONP
6849    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6850    /// * *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.
6851    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6852    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6853    /// * *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.
6854    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6855    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6856    pub fn param<T>(mut self, name: T, value: T) -> AppModulePatchCall<'a, C>
6857    where
6858        T: AsRef<str>,
6859    {
6860        self._additional_params
6861            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6862        self
6863    }
6864
6865    /// Identifies the authorization scope for the method you are building.
6866    ///
6867    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6868    /// [`Scope::CloudPlatform`].
6869    ///
6870    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6871    /// tokens for more than one scope.
6872    ///
6873    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6874    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6875    /// sufficient, a read-write scope will do as well.
6876    pub fn add_scope<St>(mut self, scope: St) -> AppModulePatchCall<'a, C>
6877    where
6878        St: AsRef<str>,
6879    {
6880        self._scopes.insert(String::from(scope.as_ref()));
6881        self
6882    }
6883    /// Identifies the authorization scope(s) for the method you are building.
6884    ///
6885    /// See [`Self::add_scope()`] for details.
6886    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppModulePatchCall<'a, C>
6887    where
6888        I: IntoIterator<Item = St>,
6889        St: AsRef<str>,
6890    {
6891        self._scopes
6892            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6893        self
6894    }
6895
6896    /// Removes all scopes, and no default scope will be used either.
6897    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6898    /// for details).
6899    pub fn clear_scopes(mut self) -> AppModulePatchCall<'a, C> {
6900        self._scopes.clear();
6901        self
6902    }
6903}
6904
6905/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
6906///
6907/// A builder for the *operations.get* method supported by a *app* resource.
6908/// It is not used directly, but through a [`AppMethods`] instance.
6909///
6910/// # Example
6911///
6912/// Instantiate a resource method builder
6913///
6914/// ```test_harness,no_run
6915/// # extern crate hyper;
6916/// # extern crate hyper_rustls;
6917/// # extern crate google_appengine1_beta4 as appengine1_beta4;
6918/// # async fn dox() {
6919/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6920///
6921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6922/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6923/// #     .with_native_roots()
6924/// #     .unwrap()
6925/// #     .https_only()
6926/// #     .enable_http2()
6927/// #     .build();
6928///
6929/// # let executor = hyper_util::rt::TokioExecutor::new();
6930/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6931/// #     secret,
6932/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6933/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6934/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6935/// #     ),
6936/// # ).build().await.unwrap();
6937///
6938/// # let client = hyper_util::client::legacy::Client::builder(
6939/// #     hyper_util::rt::TokioExecutor::new()
6940/// # )
6941/// # .build(
6942/// #     hyper_rustls::HttpsConnectorBuilder::new()
6943/// #         .with_native_roots()
6944/// #         .unwrap()
6945/// #         .https_or_http()
6946/// #         .enable_http2()
6947/// #         .build()
6948/// # );
6949/// # let mut hub = Appengine::new(client, auth);
6950/// // You can configure optional parameters by calling the respective setters at will, and
6951/// // execute the final call using `doit()`.
6952/// // Values shown here are possibly random and not representative !
6953/// let result = hub.apps().operations_get("appsId", "operationsId")
6954///              .doit().await;
6955/// # }
6956/// ```
6957pub struct AppOperationGetCall<'a, C>
6958where
6959    C: 'a,
6960{
6961    hub: &'a Appengine<C>,
6962    _apps_id: String,
6963    _operations_id: String,
6964    _delegate: Option<&'a mut dyn common::Delegate>,
6965    _additional_params: HashMap<String, String>,
6966    _scopes: BTreeSet<String>,
6967}
6968
6969impl<'a, C> common::CallBuilder for AppOperationGetCall<'a, C> {}
6970
6971impl<'a, C> AppOperationGetCall<'a, C>
6972where
6973    C: common::Connector,
6974{
6975    /// Perform the operation you have build so far.
6976    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6977        use std::borrow::Cow;
6978        use std::io::{Read, Seek};
6979
6980        use common::{url::Params, ToParts};
6981        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6982
6983        let mut dd = common::DefaultDelegate;
6984        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6985        dlg.begin(common::MethodInfo {
6986            id: "appengine.apps.operations.get",
6987            http_method: hyper::Method::GET,
6988        });
6989
6990        for &field in ["alt", "appsId", "operationsId"].iter() {
6991            if self._additional_params.contains_key(field) {
6992                dlg.finished(false);
6993                return Err(common::Error::FieldClash(field));
6994            }
6995        }
6996
6997        let mut params = Params::with_capacity(4 + self._additional_params.len());
6998        params.push("appsId", self._apps_id);
6999        params.push("operationsId", self._operations_id);
7000
7001        params.extend(self._additional_params.iter());
7002
7003        params.push("alt", "json");
7004        let mut url =
7005            self.hub._base_url.clone() + "v1beta4/apps/{appsId}/operations/{operationsId}";
7006        if self._scopes.is_empty() {
7007            self._scopes
7008                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7009        }
7010
7011        #[allow(clippy::single_element_loop)]
7012        for &(find_this, param_name) in
7013            [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter()
7014        {
7015            url = params.uri_replacement(url, param_name, find_this, false);
7016        }
7017        {
7018            let to_remove = ["operationsId", "appsId"];
7019            params.remove_params(&to_remove);
7020        }
7021
7022        let url = params.parse_with_url(&url);
7023
7024        loop {
7025            let token = match self
7026                .hub
7027                .auth
7028                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7029                .await
7030            {
7031                Ok(token) => token,
7032                Err(e) => match dlg.token(e) {
7033                    Ok(token) => token,
7034                    Err(e) => {
7035                        dlg.finished(false);
7036                        return Err(common::Error::MissingToken(e));
7037                    }
7038                },
7039            };
7040            let mut req_result = {
7041                let client = &self.hub.client;
7042                dlg.pre_request();
7043                let mut req_builder = hyper::Request::builder()
7044                    .method(hyper::Method::GET)
7045                    .uri(url.as_str())
7046                    .header(USER_AGENT, self.hub._user_agent.clone());
7047
7048                if let Some(token) = token.as_ref() {
7049                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7050                }
7051
7052                let request = req_builder
7053                    .header(CONTENT_LENGTH, 0_u64)
7054                    .body(common::to_body::<String>(None));
7055
7056                client.request(request.unwrap()).await
7057            };
7058
7059            match req_result {
7060                Err(err) => {
7061                    if let common::Retry::After(d) = dlg.http_error(&err) {
7062                        sleep(d).await;
7063                        continue;
7064                    }
7065                    dlg.finished(false);
7066                    return Err(common::Error::HttpError(err));
7067                }
7068                Ok(res) => {
7069                    let (mut parts, body) = res.into_parts();
7070                    let mut body = common::Body::new(body);
7071                    if !parts.status.is_success() {
7072                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7073                        let error = serde_json::from_str(&common::to_string(&bytes));
7074                        let response = common::to_response(parts, bytes.into());
7075
7076                        if let common::Retry::After(d) =
7077                            dlg.http_failure(&response, error.as_ref().ok())
7078                        {
7079                            sleep(d).await;
7080                            continue;
7081                        }
7082
7083                        dlg.finished(false);
7084
7085                        return Err(match error {
7086                            Ok(value) => common::Error::BadRequest(value),
7087                            _ => common::Error::Failure(response),
7088                        });
7089                    }
7090                    let response = {
7091                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7092                        let encoded = common::to_string(&bytes);
7093                        match serde_json::from_str(&encoded) {
7094                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7095                            Err(error) => {
7096                                dlg.response_json_decode_error(&encoded, &error);
7097                                return Err(common::Error::JsonDecodeError(
7098                                    encoded.to_string(),
7099                                    error,
7100                                ));
7101                            }
7102                        }
7103                    };
7104
7105                    dlg.finished(true);
7106                    return Ok(response);
7107                }
7108            }
7109        }
7110    }
7111
7112    /// Part of `name`. The name of the operation resource.
7113    ///
7114    /// Sets the *apps id* path property to the given value.
7115    ///
7116    /// Even though the property as already been set when instantiating this call,
7117    /// we provide this method for API completeness.
7118    pub fn apps_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C> {
7119        self._apps_id = new_value.to_string();
7120        self
7121    }
7122    /// Part of `name`. See documentation of `appsId`.
7123    ///
7124    /// Sets the *operations id* path property to the given value.
7125    ///
7126    /// Even though the property as already been set when instantiating this call,
7127    /// we provide this method for API completeness.
7128    pub fn operations_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C> {
7129        self._operations_id = new_value.to_string();
7130        self
7131    }
7132    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7133    /// while executing the actual API request.
7134    ///
7135    /// ````text
7136    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7137    /// ````
7138    ///
7139    /// Sets the *delegate* property to the given value.
7140    pub fn delegate(
7141        mut self,
7142        new_value: &'a mut dyn common::Delegate,
7143    ) -> AppOperationGetCall<'a, C> {
7144        self._delegate = Some(new_value);
7145        self
7146    }
7147
7148    /// Set any additional parameter of the query string used in the request.
7149    /// It should be used to set parameters which are not yet available through their own
7150    /// setters.
7151    ///
7152    /// Please note that this method must not be used to set any of the known parameters
7153    /// which have their own setter method. If done anyway, the request will fail.
7154    ///
7155    /// # Additional Parameters
7156    ///
7157    /// * *$.xgafv* (query-string) - V1 error format.
7158    /// * *access_token* (query-string) - OAuth access token.
7159    /// * *alt* (query-string) - Data format for response.
7160    /// * *callback* (query-string) - JSONP
7161    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7162    /// * *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.
7163    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7164    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7165    /// * *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.
7166    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7167    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7168    pub fn param<T>(mut self, name: T, value: T) -> AppOperationGetCall<'a, C>
7169    where
7170        T: AsRef<str>,
7171    {
7172        self._additional_params
7173            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7174        self
7175    }
7176
7177    /// Identifies the authorization scope for the method you are building.
7178    ///
7179    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7180    /// [`Scope::CloudPlatformReadOnly`].
7181    ///
7182    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7183    /// tokens for more than one scope.
7184    ///
7185    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7186    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7187    /// sufficient, a read-write scope will do as well.
7188    pub fn add_scope<St>(mut self, scope: St) -> AppOperationGetCall<'a, C>
7189    where
7190        St: AsRef<str>,
7191    {
7192        self._scopes.insert(String::from(scope.as_ref()));
7193        self
7194    }
7195    /// Identifies the authorization scope(s) for the method you are building.
7196    ///
7197    /// See [`Self::add_scope()`] for details.
7198    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppOperationGetCall<'a, C>
7199    where
7200        I: IntoIterator<Item = St>,
7201        St: AsRef<str>,
7202    {
7203        self._scopes
7204            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7205        self
7206    }
7207
7208    /// Removes all scopes, and no default scope will be used either.
7209    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7210    /// for details).
7211    pub fn clear_scopes(mut self) -> AppOperationGetCall<'a, C> {
7212        self._scopes.clear();
7213        self
7214    }
7215}
7216
7217/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
7218///
7219/// A builder for the *operations.list* method supported by a *app* resource.
7220/// It is not used directly, but through a [`AppMethods`] instance.
7221///
7222/// # Example
7223///
7224/// Instantiate a resource method builder
7225///
7226/// ```test_harness,no_run
7227/// # extern crate hyper;
7228/// # extern crate hyper_rustls;
7229/// # extern crate google_appengine1_beta4 as appengine1_beta4;
7230/// # async fn dox() {
7231/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7232///
7233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7234/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7235/// #     .with_native_roots()
7236/// #     .unwrap()
7237/// #     .https_only()
7238/// #     .enable_http2()
7239/// #     .build();
7240///
7241/// # let executor = hyper_util::rt::TokioExecutor::new();
7242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7243/// #     secret,
7244/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7245/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7246/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7247/// #     ),
7248/// # ).build().await.unwrap();
7249///
7250/// # let client = hyper_util::client::legacy::Client::builder(
7251/// #     hyper_util::rt::TokioExecutor::new()
7252/// # )
7253/// # .build(
7254/// #     hyper_rustls::HttpsConnectorBuilder::new()
7255/// #         .with_native_roots()
7256/// #         .unwrap()
7257/// #         .https_or_http()
7258/// #         .enable_http2()
7259/// #         .build()
7260/// # );
7261/// # let mut hub = Appengine::new(client, auth);
7262/// // You can configure optional parameters by calling the respective setters at will, and
7263/// // execute the final call using `doit()`.
7264/// // Values shown here are possibly random and not representative !
7265/// let result = hub.apps().operations_list("appsId")
7266///              .page_token("vero")
7267///              .page_size(-76)
7268///              .filter("invidunt")
7269///              .doit().await;
7270/// # }
7271/// ```
7272pub struct AppOperationListCall<'a, C>
7273where
7274    C: 'a,
7275{
7276    hub: &'a Appengine<C>,
7277    _apps_id: String,
7278    _page_token: Option<String>,
7279    _page_size: Option<i32>,
7280    _filter: Option<String>,
7281    _delegate: Option<&'a mut dyn common::Delegate>,
7282    _additional_params: HashMap<String, String>,
7283    _scopes: BTreeSet<String>,
7284}
7285
7286impl<'a, C> common::CallBuilder for AppOperationListCall<'a, C> {}
7287
7288impl<'a, C> AppOperationListCall<'a, C>
7289where
7290    C: common::Connector,
7291{
7292    /// Perform the operation you have build so far.
7293    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
7294        use std::borrow::Cow;
7295        use std::io::{Read, Seek};
7296
7297        use common::{url::Params, ToParts};
7298        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7299
7300        let mut dd = common::DefaultDelegate;
7301        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7302        dlg.begin(common::MethodInfo {
7303            id: "appengine.apps.operations.list",
7304            http_method: hyper::Method::GET,
7305        });
7306
7307        for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() {
7308            if self._additional_params.contains_key(field) {
7309                dlg.finished(false);
7310                return Err(common::Error::FieldClash(field));
7311            }
7312        }
7313
7314        let mut params = Params::with_capacity(6 + self._additional_params.len());
7315        params.push("appsId", self._apps_id);
7316        if let Some(value) = self._page_token.as_ref() {
7317            params.push("pageToken", value);
7318        }
7319        if let Some(value) = self._page_size.as_ref() {
7320            params.push("pageSize", value.to_string());
7321        }
7322        if let Some(value) = self._filter.as_ref() {
7323            params.push("filter", value);
7324        }
7325
7326        params.extend(self._additional_params.iter());
7327
7328        params.push("alt", "json");
7329        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}/operations";
7330        if self._scopes.is_empty() {
7331            self._scopes
7332                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7333        }
7334
7335        #[allow(clippy::single_element_loop)]
7336        for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
7337            url = params.uri_replacement(url, param_name, find_this, false);
7338        }
7339        {
7340            let to_remove = ["appsId"];
7341            params.remove_params(&to_remove);
7342        }
7343
7344        let url = params.parse_with_url(&url);
7345
7346        loop {
7347            let token = match self
7348                .hub
7349                .auth
7350                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7351                .await
7352            {
7353                Ok(token) => token,
7354                Err(e) => match dlg.token(e) {
7355                    Ok(token) => token,
7356                    Err(e) => {
7357                        dlg.finished(false);
7358                        return Err(common::Error::MissingToken(e));
7359                    }
7360                },
7361            };
7362            let mut req_result = {
7363                let client = &self.hub.client;
7364                dlg.pre_request();
7365                let mut req_builder = hyper::Request::builder()
7366                    .method(hyper::Method::GET)
7367                    .uri(url.as_str())
7368                    .header(USER_AGENT, self.hub._user_agent.clone());
7369
7370                if let Some(token) = token.as_ref() {
7371                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7372                }
7373
7374                let request = req_builder
7375                    .header(CONTENT_LENGTH, 0_u64)
7376                    .body(common::to_body::<String>(None));
7377
7378                client.request(request.unwrap()).await
7379            };
7380
7381            match req_result {
7382                Err(err) => {
7383                    if let common::Retry::After(d) = dlg.http_error(&err) {
7384                        sleep(d).await;
7385                        continue;
7386                    }
7387                    dlg.finished(false);
7388                    return Err(common::Error::HttpError(err));
7389                }
7390                Ok(res) => {
7391                    let (mut parts, body) = res.into_parts();
7392                    let mut body = common::Body::new(body);
7393                    if !parts.status.is_success() {
7394                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7395                        let error = serde_json::from_str(&common::to_string(&bytes));
7396                        let response = common::to_response(parts, bytes.into());
7397
7398                        if let common::Retry::After(d) =
7399                            dlg.http_failure(&response, error.as_ref().ok())
7400                        {
7401                            sleep(d).await;
7402                            continue;
7403                        }
7404
7405                        dlg.finished(false);
7406
7407                        return Err(match error {
7408                            Ok(value) => common::Error::BadRequest(value),
7409                            _ => common::Error::Failure(response),
7410                        });
7411                    }
7412                    let response = {
7413                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7414                        let encoded = common::to_string(&bytes);
7415                        match serde_json::from_str(&encoded) {
7416                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7417                            Err(error) => {
7418                                dlg.response_json_decode_error(&encoded, &error);
7419                                return Err(common::Error::JsonDecodeError(
7420                                    encoded.to_string(),
7421                                    error,
7422                                ));
7423                            }
7424                        }
7425                    };
7426
7427                    dlg.finished(true);
7428                    return Ok(response);
7429                }
7430            }
7431        }
7432    }
7433
7434    /// Part of `name`. The name of the operation's parent resource.
7435    ///
7436    /// Sets the *apps id* path property to the given value.
7437    ///
7438    /// Even though the property as already been set when instantiating this call,
7439    /// we provide this method for API completeness.
7440    pub fn apps_id(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
7441        self._apps_id = new_value.to_string();
7442        self
7443    }
7444    /// The standard list page token.
7445    ///
7446    /// Sets the *page token* query property to the given value.
7447    pub fn page_token(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
7448        self._page_token = Some(new_value.to_string());
7449        self
7450    }
7451    /// The standard list page size.
7452    ///
7453    /// Sets the *page size* query property to the given value.
7454    pub fn page_size(mut self, new_value: i32) -> AppOperationListCall<'a, C> {
7455        self._page_size = Some(new_value);
7456        self
7457    }
7458    /// The standard list filter.
7459    ///
7460    /// Sets the *filter* query property to the given value.
7461    pub fn filter(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
7462        self._filter = Some(new_value.to_string());
7463        self
7464    }
7465    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7466    /// while executing the actual API request.
7467    ///
7468    /// ````text
7469    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7470    /// ````
7471    ///
7472    /// Sets the *delegate* property to the given value.
7473    pub fn delegate(
7474        mut self,
7475        new_value: &'a mut dyn common::Delegate,
7476    ) -> AppOperationListCall<'a, C> {
7477        self._delegate = Some(new_value);
7478        self
7479    }
7480
7481    /// Set any additional parameter of the query string used in the request.
7482    /// It should be used to set parameters which are not yet available through their own
7483    /// setters.
7484    ///
7485    /// Please note that this method must not be used to set any of the known parameters
7486    /// which have their own setter method. If done anyway, the request will fail.
7487    ///
7488    /// # Additional Parameters
7489    ///
7490    /// * *$.xgafv* (query-string) - V1 error format.
7491    /// * *access_token* (query-string) - OAuth access token.
7492    /// * *alt* (query-string) - Data format for response.
7493    /// * *callback* (query-string) - JSONP
7494    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7495    /// * *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.
7496    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7497    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7498    /// * *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.
7499    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7500    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7501    pub fn param<T>(mut self, name: T, value: T) -> AppOperationListCall<'a, C>
7502    where
7503        T: AsRef<str>,
7504    {
7505        self._additional_params
7506            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7507        self
7508    }
7509
7510    /// Identifies the authorization scope for the method you are building.
7511    ///
7512    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7513    /// [`Scope::CloudPlatformReadOnly`].
7514    ///
7515    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7516    /// tokens for more than one scope.
7517    ///
7518    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7519    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7520    /// sufficient, a read-write scope will do as well.
7521    pub fn add_scope<St>(mut self, scope: St) -> AppOperationListCall<'a, C>
7522    where
7523        St: AsRef<str>,
7524    {
7525        self._scopes.insert(String::from(scope.as_ref()));
7526        self
7527    }
7528    /// Identifies the authorization scope(s) for the method you are building.
7529    ///
7530    /// See [`Self::add_scope()`] for details.
7531    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppOperationListCall<'a, C>
7532    where
7533        I: IntoIterator<Item = St>,
7534        St: AsRef<str>,
7535    {
7536        self._scopes
7537            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7538        self
7539    }
7540
7541    /// Removes all scopes, and no default scope will be used either.
7542    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7543    /// for details).
7544    pub fn clear_scopes(mut self) -> AppOperationListCall<'a, C> {
7545        self._scopes.clear();
7546        self
7547    }
7548}
7549
7550/// Creates an App Engine application for a Google Cloud Platform project. Required fields:
7551/// id - The ID of the target Cloud Platform project.
7552/// location - The region (https://cloud.google.com/appengine/docs/locations) where you want the App Engine application located.For more information about App Engine applications, see Managing Projects, Applications, and Billing (https://cloud.google.com/appengine/docs/python/console/).
7553///
7554/// A builder for the *create* method supported by a *app* resource.
7555/// It is not used directly, but through a [`AppMethods`] instance.
7556///
7557/// # Example
7558///
7559/// Instantiate a resource method builder
7560///
7561/// ```test_harness,no_run
7562/// # extern crate hyper;
7563/// # extern crate hyper_rustls;
7564/// # extern crate google_appengine1_beta4 as appengine1_beta4;
7565/// use appengine1_beta4::api::Application;
7566/// # async fn dox() {
7567/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7568///
7569/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7570/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7571/// #     .with_native_roots()
7572/// #     .unwrap()
7573/// #     .https_only()
7574/// #     .enable_http2()
7575/// #     .build();
7576///
7577/// # let executor = hyper_util::rt::TokioExecutor::new();
7578/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7579/// #     secret,
7580/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7581/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7582/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7583/// #     ),
7584/// # ).build().await.unwrap();
7585///
7586/// # let client = hyper_util::client::legacy::Client::builder(
7587/// #     hyper_util::rt::TokioExecutor::new()
7588/// # )
7589/// # .build(
7590/// #     hyper_rustls::HttpsConnectorBuilder::new()
7591/// #         .with_native_roots()
7592/// #         .unwrap()
7593/// #         .https_or_http()
7594/// #         .enable_http2()
7595/// #         .build()
7596/// # );
7597/// # let mut hub = Appengine::new(client, auth);
7598/// // As the method needs a request, you would usually fill it with the desired information
7599/// // into the respective structure. Some of the parts shown here might not be applicable !
7600/// // Values shown here are possibly random and not representative !
7601/// let mut req = Application::default();
7602///
7603/// // You can configure optional parameters by calling the respective setters at will, and
7604/// // execute the final call using `doit()`.
7605/// // Values shown here are possibly random and not representative !
7606/// let result = hub.apps().create(req)
7607///              .doit().await;
7608/// # }
7609/// ```
7610pub struct AppCreateCall<'a, C>
7611where
7612    C: 'a,
7613{
7614    hub: &'a Appengine<C>,
7615    _request: Application,
7616    _delegate: Option<&'a mut dyn common::Delegate>,
7617    _additional_params: HashMap<String, String>,
7618    _scopes: BTreeSet<String>,
7619}
7620
7621impl<'a, C> common::CallBuilder for AppCreateCall<'a, C> {}
7622
7623impl<'a, C> AppCreateCall<'a, C>
7624where
7625    C: common::Connector,
7626{
7627    /// Perform the operation you have build so far.
7628    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7629        use std::borrow::Cow;
7630        use std::io::{Read, Seek};
7631
7632        use common::{url::Params, ToParts};
7633        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7634
7635        let mut dd = common::DefaultDelegate;
7636        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7637        dlg.begin(common::MethodInfo {
7638            id: "appengine.apps.create",
7639            http_method: hyper::Method::POST,
7640        });
7641
7642        for &field in ["alt"].iter() {
7643            if self._additional_params.contains_key(field) {
7644                dlg.finished(false);
7645                return Err(common::Error::FieldClash(field));
7646            }
7647        }
7648
7649        let mut params = Params::with_capacity(3 + self._additional_params.len());
7650
7651        params.extend(self._additional_params.iter());
7652
7653        params.push("alt", "json");
7654        let mut url = self.hub._base_url.clone() + "v1beta4/apps";
7655        if self._scopes.is_empty() {
7656            self._scopes
7657                .insert(Scope::CloudPlatform.as_ref().to_string());
7658        }
7659
7660        let url = params.parse_with_url(&url);
7661
7662        let mut json_mime_type = mime::APPLICATION_JSON;
7663        let mut request_value_reader = {
7664            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7665            common::remove_json_null_values(&mut value);
7666            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7667            serde_json::to_writer(&mut dst, &value).unwrap();
7668            dst
7669        };
7670        let request_size = request_value_reader
7671            .seek(std::io::SeekFrom::End(0))
7672            .unwrap();
7673        request_value_reader
7674            .seek(std::io::SeekFrom::Start(0))
7675            .unwrap();
7676
7677        loop {
7678            let token = match self
7679                .hub
7680                .auth
7681                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7682                .await
7683            {
7684                Ok(token) => token,
7685                Err(e) => match dlg.token(e) {
7686                    Ok(token) => token,
7687                    Err(e) => {
7688                        dlg.finished(false);
7689                        return Err(common::Error::MissingToken(e));
7690                    }
7691                },
7692            };
7693            request_value_reader
7694                .seek(std::io::SeekFrom::Start(0))
7695                .unwrap();
7696            let mut req_result = {
7697                let client = &self.hub.client;
7698                dlg.pre_request();
7699                let mut req_builder = hyper::Request::builder()
7700                    .method(hyper::Method::POST)
7701                    .uri(url.as_str())
7702                    .header(USER_AGENT, self.hub._user_agent.clone());
7703
7704                if let Some(token) = token.as_ref() {
7705                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7706                }
7707
7708                let request = req_builder
7709                    .header(CONTENT_TYPE, json_mime_type.to_string())
7710                    .header(CONTENT_LENGTH, request_size as u64)
7711                    .body(common::to_body(
7712                        request_value_reader.get_ref().clone().into(),
7713                    ));
7714
7715                client.request(request.unwrap()).await
7716            };
7717
7718            match req_result {
7719                Err(err) => {
7720                    if let common::Retry::After(d) = dlg.http_error(&err) {
7721                        sleep(d).await;
7722                        continue;
7723                    }
7724                    dlg.finished(false);
7725                    return Err(common::Error::HttpError(err));
7726                }
7727                Ok(res) => {
7728                    let (mut parts, body) = res.into_parts();
7729                    let mut body = common::Body::new(body);
7730                    if !parts.status.is_success() {
7731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7732                        let error = serde_json::from_str(&common::to_string(&bytes));
7733                        let response = common::to_response(parts, bytes.into());
7734
7735                        if let common::Retry::After(d) =
7736                            dlg.http_failure(&response, error.as_ref().ok())
7737                        {
7738                            sleep(d).await;
7739                            continue;
7740                        }
7741
7742                        dlg.finished(false);
7743
7744                        return Err(match error {
7745                            Ok(value) => common::Error::BadRequest(value),
7746                            _ => common::Error::Failure(response),
7747                        });
7748                    }
7749                    let response = {
7750                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7751                        let encoded = common::to_string(&bytes);
7752                        match serde_json::from_str(&encoded) {
7753                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7754                            Err(error) => {
7755                                dlg.response_json_decode_error(&encoded, &error);
7756                                return Err(common::Error::JsonDecodeError(
7757                                    encoded.to_string(),
7758                                    error,
7759                                ));
7760                            }
7761                        }
7762                    };
7763
7764                    dlg.finished(true);
7765                    return Ok(response);
7766                }
7767            }
7768        }
7769    }
7770
7771    ///
7772    /// Sets the *request* property to the given value.
7773    ///
7774    /// Even though the property as already been set when instantiating this call,
7775    /// we provide this method for API completeness.
7776    pub fn request(mut self, new_value: Application) -> AppCreateCall<'a, C> {
7777        self._request = new_value;
7778        self
7779    }
7780    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7781    /// while executing the actual API request.
7782    ///
7783    /// ````text
7784    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7785    /// ````
7786    ///
7787    /// Sets the *delegate* property to the given value.
7788    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppCreateCall<'a, C> {
7789        self._delegate = Some(new_value);
7790        self
7791    }
7792
7793    /// Set any additional parameter of the query string used in the request.
7794    /// It should be used to set parameters which are not yet available through their own
7795    /// setters.
7796    ///
7797    /// Please note that this method must not be used to set any of the known parameters
7798    /// which have their own setter method. If done anyway, the request will fail.
7799    ///
7800    /// # Additional Parameters
7801    ///
7802    /// * *$.xgafv* (query-string) - V1 error format.
7803    /// * *access_token* (query-string) - OAuth access token.
7804    /// * *alt* (query-string) - Data format for response.
7805    /// * *callback* (query-string) - JSONP
7806    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7807    /// * *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.
7808    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7809    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7810    /// * *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.
7811    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7812    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7813    pub fn param<T>(mut self, name: T, value: T) -> AppCreateCall<'a, C>
7814    where
7815        T: AsRef<str>,
7816    {
7817        self._additional_params
7818            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7819        self
7820    }
7821
7822    /// Identifies the authorization scope for the method you are building.
7823    ///
7824    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7825    /// [`Scope::CloudPlatform`].
7826    ///
7827    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7828    /// tokens for more than one scope.
7829    ///
7830    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7831    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7832    /// sufficient, a read-write scope will do as well.
7833    pub fn add_scope<St>(mut self, scope: St) -> AppCreateCall<'a, C>
7834    where
7835        St: AsRef<str>,
7836    {
7837        self._scopes.insert(String::from(scope.as_ref()));
7838        self
7839    }
7840    /// Identifies the authorization scope(s) for the method you are building.
7841    ///
7842    /// See [`Self::add_scope()`] for details.
7843    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppCreateCall<'a, C>
7844    where
7845        I: IntoIterator<Item = St>,
7846        St: AsRef<str>,
7847    {
7848        self._scopes
7849            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7850        self
7851    }
7852
7853    /// Removes all scopes, and no default scope will be used either.
7854    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7855    /// for details).
7856    pub fn clear_scopes(mut self) -> AppCreateCall<'a, C> {
7857        self._scopes.clear();
7858        self
7859    }
7860}
7861
7862/// Gets information about an application.
7863///
7864/// A builder for the *get* method supported by a *app* resource.
7865/// It is not used directly, but through a [`AppMethods`] instance.
7866///
7867/// # Example
7868///
7869/// Instantiate a resource method builder
7870///
7871/// ```test_harness,no_run
7872/// # extern crate hyper;
7873/// # extern crate hyper_rustls;
7874/// # extern crate google_appengine1_beta4 as appengine1_beta4;
7875/// # async fn dox() {
7876/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7877///
7878/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7879/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7880/// #     .with_native_roots()
7881/// #     .unwrap()
7882/// #     .https_only()
7883/// #     .enable_http2()
7884/// #     .build();
7885///
7886/// # let executor = hyper_util::rt::TokioExecutor::new();
7887/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7888/// #     secret,
7889/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7890/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7891/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7892/// #     ),
7893/// # ).build().await.unwrap();
7894///
7895/// # let client = hyper_util::client::legacy::Client::builder(
7896/// #     hyper_util::rt::TokioExecutor::new()
7897/// # )
7898/// # .build(
7899/// #     hyper_rustls::HttpsConnectorBuilder::new()
7900/// #         .with_native_roots()
7901/// #         .unwrap()
7902/// #         .https_or_http()
7903/// #         .enable_http2()
7904/// #         .build()
7905/// # );
7906/// # let mut hub = Appengine::new(client, auth);
7907/// // You can configure optional parameters by calling the respective setters at will, and
7908/// // execute the final call using `doit()`.
7909/// // Values shown here are possibly random and not representative !
7910/// let result = hub.apps().get("appsId")
7911///              .ensure_resources_exist(false)
7912///              .doit().await;
7913/// # }
7914/// ```
7915pub struct AppGetCall<'a, C>
7916where
7917    C: 'a,
7918{
7919    hub: &'a Appengine<C>,
7920    _apps_id: String,
7921    _ensure_resources_exist: Option<bool>,
7922    _delegate: Option<&'a mut dyn common::Delegate>,
7923    _additional_params: HashMap<String, String>,
7924    _scopes: BTreeSet<String>,
7925}
7926
7927impl<'a, C> common::CallBuilder for AppGetCall<'a, C> {}
7928
7929impl<'a, C> AppGetCall<'a, C>
7930where
7931    C: common::Connector,
7932{
7933    /// Perform the operation you have build so far.
7934    pub async fn doit(mut self) -> common::Result<(common::Response, Application)> {
7935        use std::borrow::Cow;
7936        use std::io::{Read, Seek};
7937
7938        use common::{url::Params, ToParts};
7939        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7940
7941        let mut dd = common::DefaultDelegate;
7942        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7943        dlg.begin(common::MethodInfo {
7944            id: "appengine.apps.get",
7945            http_method: hyper::Method::GET,
7946        });
7947
7948        for &field in ["alt", "appsId", "ensureResourcesExist"].iter() {
7949            if self._additional_params.contains_key(field) {
7950                dlg.finished(false);
7951                return Err(common::Error::FieldClash(field));
7952            }
7953        }
7954
7955        let mut params = Params::with_capacity(4 + self._additional_params.len());
7956        params.push("appsId", self._apps_id);
7957        if let Some(value) = self._ensure_resources_exist.as_ref() {
7958            params.push("ensureResourcesExist", value.to_string());
7959        }
7960
7961        params.extend(self._additional_params.iter());
7962
7963        params.push("alt", "json");
7964        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}";
7965        if self._scopes.is_empty() {
7966            self._scopes
7967                .insert(Scope::CloudPlatform.as_ref().to_string());
7968        }
7969
7970        #[allow(clippy::single_element_loop)]
7971        for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
7972            url = params.uri_replacement(url, param_name, find_this, false);
7973        }
7974        {
7975            let to_remove = ["appsId"];
7976            params.remove_params(&to_remove);
7977        }
7978
7979        let url = params.parse_with_url(&url);
7980
7981        loop {
7982            let token = match self
7983                .hub
7984                .auth
7985                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7986                .await
7987            {
7988                Ok(token) => token,
7989                Err(e) => match dlg.token(e) {
7990                    Ok(token) => token,
7991                    Err(e) => {
7992                        dlg.finished(false);
7993                        return Err(common::Error::MissingToken(e));
7994                    }
7995                },
7996            };
7997            let mut req_result = {
7998                let client = &self.hub.client;
7999                dlg.pre_request();
8000                let mut req_builder = hyper::Request::builder()
8001                    .method(hyper::Method::GET)
8002                    .uri(url.as_str())
8003                    .header(USER_AGENT, self.hub._user_agent.clone());
8004
8005                if let Some(token) = token.as_ref() {
8006                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8007                }
8008
8009                let request = req_builder
8010                    .header(CONTENT_LENGTH, 0_u64)
8011                    .body(common::to_body::<String>(None));
8012
8013                client.request(request.unwrap()).await
8014            };
8015
8016            match req_result {
8017                Err(err) => {
8018                    if let common::Retry::After(d) = dlg.http_error(&err) {
8019                        sleep(d).await;
8020                        continue;
8021                    }
8022                    dlg.finished(false);
8023                    return Err(common::Error::HttpError(err));
8024                }
8025                Ok(res) => {
8026                    let (mut parts, body) = res.into_parts();
8027                    let mut body = common::Body::new(body);
8028                    if !parts.status.is_success() {
8029                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8030                        let error = serde_json::from_str(&common::to_string(&bytes));
8031                        let response = common::to_response(parts, bytes.into());
8032
8033                        if let common::Retry::After(d) =
8034                            dlg.http_failure(&response, error.as_ref().ok())
8035                        {
8036                            sleep(d).await;
8037                            continue;
8038                        }
8039
8040                        dlg.finished(false);
8041
8042                        return Err(match error {
8043                            Ok(value) => common::Error::BadRequest(value),
8044                            _ => common::Error::Failure(response),
8045                        });
8046                    }
8047                    let response = {
8048                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8049                        let encoded = common::to_string(&bytes);
8050                        match serde_json::from_str(&encoded) {
8051                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8052                            Err(error) => {
8053                                dlg.response_json_decode_error(&encoded, &error);
8054                                return Err(common::Error::JsonDecodeError(
8055                                    encoded.to_string(),
8056                                    error,
8057                                ));
8058                            }
8059                        }
8060                    };
8061
8062                    dlg.finished(true);
8063                    return Ok(response);
8064                }
8065            }
8066        }
8067    }
8068
8069    /// Part of `name`. Name of the application to get. Example: apps/myapp.
8070    ///
8071    /// Sets the *apps id* path property to the given value.
8072    ///
8073    /// Even though the property as already been set when instantiating this call,
8074    /// we provide this method for API completeness.
8075    pub fn apps_id(mut self, new_value: &str) -> AppGetCall<'a, C> {
8076        self._apps_id = new_value.to_string();
8077        self
8078    }
8079    /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the GET operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete.
8080    ///
8081    /// Sets the *ensure resources exist* query property to the given value.
8082    pub fn ensure_resources_exist(mut self, new_value: bool) -> AppGetCall<'a, C> {
8083        self._ensure_resources_exist = Some(new_value);
8084        self
8085    }
8086    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8087    /// while executing the actual API request.
8088    ///
8089    /// ````text
8090    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8091    /// ````
8092    ///
8093    /// Sets the *delegate* property to the given value.
8094    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppGetCall<'a, C> {
8095        self._delegate = Some(new_value);
8096        self
8097    }
8098
8099    /// Set any additional parameter of the query string used in the request.
8100    /// It should be used to set parameters which are not yet available through their own
8101    /// setters.
8102    ///
8103    /// Please note that this method must not be used to set any of the known parameters
8104    /// which have their own setter method. If done anyway, the request will fail.
8105    ///
8106    /// # Additional Parameters
8107    ///
8108    /// * *$.xgafv* (query-string) - V1 error format.
8109    /// * *access_token* (query-string) - OAuth access token.
8110    /// * *alt* (query-string) - Data format for response.
8111    /// * *callback* (query-string) - JSONP
8112    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8113    /// * *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.
8114    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8115    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8116    /// * *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.
8117    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8118    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8119    pub fn param<T>(mut self, name: T, value: T) -> AppGetCall<'a, C>
8120    where
8121        T: AsRef<str>,
8122    {
8123        self._additional_params
8124            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8125        self
8126    }
8127
8128    /// Identifies the authorization scope for the method you are building.
8129    ///
8130    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8131    /// [`Scope::CloudPlatform`].
8132    ///
8133    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8134    /// tokens for more than one scope.
8135    ///
8136    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8137    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8138    /// sufficient, a read-write scope will do as well.
8139    pub fn add_scope<St>(mut self, scope: St) -> AppGetCall<'a, C>
8140    where
8141        St: AsRef<str>,
8142    {
8143        self._scopes.insert(String::from(scope.as_ref()));
8144        self
8145    }
8146    /// Identifies the authorization scope(s) for the method you are building.
8147    ///
8148    /// See [`Self::add_scope()`] for details.
8149    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppGetCall<'a, C>
8150    where
8151        I: IntoIterator<Item = St>,
8152        St: AsRef<str>,
8153    {
8154        self._scopes
8155            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8156        self
8157    }
8158
8159    /// Removes all scopes, and no default scope will be used either.
8160    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8161    /// for details).
8162    pub fn clear_scopes(mut self) -> AppGetCall<'a, C> {
8163        self._scopes.clear();
8164        self
8165    }
8166}
8167
8168/// Updates the specified Application resource. You can update the following fields:
8169/// auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.auth_domain)
8170/// default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.default_cookie_expiration)
8171///
8172/// A builder for the *patch* method supported by a *app* resource.
8173/// It is not used directly, but through a [`AppMethods`] instance.
8174///
8175/// # Example
8176///
8177/// Instantiate a resource method builder
8178///
8179/// ```test_harness,no_run
8180/// # extern crate hyper;
8181/// # extern crate hyper_rustls;
8182/// # extern crate google_appengine1_beta4 as appengine1_beta4;
8183/// use appengine1_beta4::api::Application;
8184/// # async fn dox() {
8185/// # use appengine1_beta4::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8186///
8187/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8188/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8189/// #     .with_native_roots()
8190/// #     .unwrap()
8191/// #     .https_only()
8192/// #     .enable_http2()
8193/// #     .build();
8194///
8195/// # let executor = hyper_util::rt::TokioExecutor::new();
8196/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8197/// #     secret,
8198/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8199/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8200/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8201/// #     ),
8202/// # ).build().await.unwrap();
8203///
8204/// # let client = hyper_util::client::legacy::Client::builder(
8205/// #     hyper_util::rt::TokioExecutor::new()
8206/// # )
8207/// # .build(
8208/// #     hyper_rustls::HttpsConnectorBuilder::new()
8209/// #         .with_native_roots()
8210/// #         .unwrap()
8211/// #         .https_or_http()
8212/// #         .enable_http2()
8213/// #         .build()
8214/// # );
8215/// # let mut hub = Appengine::new(client, auth);
8216/// // As the method needs a request, you would usually fill it with the desired information
8217/// // into the respective structure. Some of the parts shown here might not be applicable !
8218/// // Values shown here are possibly random and not representative !
8219/// let mut req = Application::default();
8220///
8221/// // You can configure optional parameters by calling the respective setters at will, and
8222/// // execute the final call using `doit()`.
8223/// // Values shown here are possibly random and not representative !
8224/// let result = hub.apps().patch(req, "appsId")
8225///              .mask(FieldMask::new::<&str>(&[]))
8226///              .doit().await;
8227/// # }
8228/// ```
8229pub struct AppPatchCall<'a, C>
8230where
8231    C: 'a,
8232{
8233    hub: &'a Appengine<C>,
8234    _request: Application,
8235    _apps_id: String,
8236    _mask: Option<common::FieldMask>,
8237    _delegate: Option<&'a mut dyn common::Delegate>,
8238    _additional_params: HashMap<String, String>,
8239    _scopes: BTreeSet<String>,
8240}
8241
8242impl<'a, C> common::CallBuilder for AppPatchCall<'a, C> {}
8243
8244impl<'a, C> AppPatchCall<'a, C>
8245where
8246    C: common::Connector,
8247{
8248    /// Perform the operation you have build so far.
8249    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8250        use std::borrow::Cow;
8251        use std::io::{Read, Seek};
8252
8253        use common::{url::Params, ToParts};
8254        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8255
8256        let mut dd = common::DefaultDelegate;
8257        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8258        dlg.begin(common::MethodInfo {
8259            id: "appengine.apps.patch",
8260            http_method: hyper::Method::PATCH,
8261        });
8262
8263        for &field in ["alt", "appsId", "mask"].iter() {
8264            if self._additional_params.contains_key(field) {
8265                dlg.finished(false);
8266                return Err(common::Error::FieldClash(field));
8267            }
8268        }
8269
8270        let mut params = Params::with_capacity(5 + self._additional_params.len());
8271        params.push("appsId", self._apps_id);
8272        if let Some(value) = self._mask.as_ref() {
8273            params.push("mask", value.to_string());
8274        }
8275
8276        params.extend(self._additional_params.iter());
8277
8278        params.push("alt", "json");
8279        let mut url = self.hub._base_url.clone() + "v1beta4/apps/{appsId}";
8280        if self._scopes.is_empty() {
8281            self._scopes
8282                .insert(Scope::CloudPlatform.as_ref().to_string());
8283        }
8284
8285        #[allow(clippy::single_element_loop)]
8286        for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
8287            url = params.uri_replacement(url, param_name, find_this, false);
8288        }
8289        {
8290            let to_remove = ["appsId"];
8291            params.remove_params(&to_remove);
8292        }
8293
8294        let url = params.parse_with_url(&url);
8295
8296        let mut json_mime_type = mime::APPLICATION_JSON;
8297        let mut request_value_reader = {
8298            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8299            common::remove_json_null_values(&mut value);
8300            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8301            serde_json::to_writer(&mut dst, &value).unwrap();
8302            dst
8303        };
8304        let request_size = request_value_reader
8305            .seek(std::io::SeekFrom::End(0))
8306            .unwrap();
8307        request_value_reader
8308            .seek(std::io::SeekFrom::Start(0))
8309            .unwrap();
8310
8311        loop {
8312            let token = match self
8313                .hub
8314                .auth
8315                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8316                .await
8317            {
8318                Ok(token) => token,
8319                Err(e) => match dlg.token(e) {
8320                    Ok(token) => token,
8321                    Err(e) => {
8322                        dlg.finished(false);
8323                        return Err(common::Error::MissingToken(e));
8324                    }
8325                },
8326            };
8327            request_value_reader
8328                .seek(std::io::SeekFrom::Start(0))
8329                .unwrap();
8330            let mut req_result = {
8331                let client = &self.hub.client;
8332                dlg.pre_request();
8333                let mut req_builder = hyper::Request::builder()
8334                    .method(hyper::Method::PATCH)
8335                    .uri(url.as_str())
8336                    .header(USER_AGENT, self.hub._user_agent.clone());
8337
8338                if let Some(token) = token.as_ref() {
8339                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8340                }
8341
8342                let request = req_builder
8343                    .header(CONTENT_TYPE, json_mime_type.to_string())
8344                    .header(CONTENT_LENGTH, request_size as u64)
8345                    .body(common::to_body(
8346                        request_value_reader.get_ref().clone().into(),
8347                    ));
8348
8349                client.request(request.unwrap()).await
8350            };
8351
8352            match req_result {
8353                Err(err) => {
8354                    if let common::Retry::After(d) = dlg.http_error(&err) {
8355                        sleep(d).await;
8356                        continue;
8357                    }
8358                    dlg.finished(false);
8359                    return Err(common::Error::HttpError(err));
8360                }
8361                Ok(res) => {
8362                    let (mut parts, body) = res.into_parts();
8363                    let mut body = common::Body::new(body);
8364                    if !parts.status.is_success() {
8365                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8366                        let error = serde_json::from_str(&common::to_string(&bytes));
8367                        let response = common::to_response(parts, bytes.into());
8368
8369                        if let common::Retry::After(d) =
8370                            dlg.http_failure(&response, error.as_ref().ok())
8371                        {
8372                            sleep(d).await;
8373                            continue;
8374                        }
8375
8376                        dlg.finished(false);
8377
8378                        return Err(match error {
8379                            Ok(value) => common::Error::BadRequest(value),
8380                            _ => common::Error::Failure(response),
8381                        });
8382                    }
8383                    let response = {
8384                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8385                        let encoded = common::to_string(&bytes);
8386                        match serde_json::from_str(&encoded) {
8387                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8388                            Err(error) => {
8389                                dlg.response_json_decode_error(&encoded, &error);
8390                                return Err(common::Error::JsonDecodeError(
8391                                    encoded.to_string(),
8392                                    error,
8393                                ));
8394                            }
8395                        }
8396                    };
8397
8398                    dlg.finished(true);
8399                    return Ok(response);
8400                }
8401            }
8402        }
8403    }
8404
8405    ///
8406    /// Sets the *request* property to the given value.
8407    ///
8408    /// Even though the property as already been set when instantiating this call,
8409    /// we provide this method for API completeness.
8410    pub fn request(mut self, new_value: Application) -> AppPatchCall<'a, C> {
8411        self._request = new_value;
8412        self
8413    }
8414    /// Part of `name`. Name of the Application resource to update. Example: apps/myapp.
8415    ///
8416    /// Sets the *apps id* path property to the given value.
8417    ///
8418    /// Even though the property as already been set when instantiating this call,
8419    /// we provide this method for API completeness.
8420    pub fn apps_id(mut self, new_value: &str) -> AppPatchCall<'a, C> {
8421        self._apps_id = new_value.to_string();
8422        self
8423    }
8424    /// Standard field mask for the set of fields to be updated.
8425    ///
8426    /// Sets the *mask* query property to the given value.
8427    pub fn mask(mut self, new_value: common::FieldMask) -> AppPatchCall<'a, C> {
8428        self._mask = Some(new_value);
8429        self
8430    }
8431    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8432    /// while executing the actual API request.
8433    ///
8434    /// ````text
8435    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8436    /// ````
8437    ///
8438    /// Sets the *delegate* property to the given value.
8439    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppPatchCall<'a, C> {
8440        self._delegate = Some(new_value);
8441        self
8442    }
8443
8444    /// Set any additional parameter of the query string used in the request.
8445    /// It should be used to set parameters which are not yet available through their own
8446    /// setters.
8447    ///
8448    /// Please note that this method must not be used to set any of the known parameters
8449    /// which have their own setter method. If done anyway, the request will fail.
8450    ///
8451    /// # Additional Parameters
8452    ///
8453    /// * *$.xgafv* (query-string) - V1 error format.
8454    /// * *access_token* (query-string) - OAuth access token.
8455    /// * *alt* (query-string) - Data format for response.
8456    /// * *callback* (query-string) - JSONP
8457    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8458    /// * *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.
8459    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8460    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8461    /// * *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.
8462    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8463    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8464    pub fn param<T>(mut self, name: T, value: T) -> AppPatchCall<'a, C>
8465    where
8466        T: AsRef<str>,
8467    {
8468        self._additional_params
8469            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8470        self
8471    }
8472
8473    /// Identifies the authorization scope for the method you are building.
8474    ///
8475    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8476    /// [`Scope::CloudPlatform`].
8477    ///
8478    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8479    /// tokens for more than one scope.
8480    ///
8481    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8482    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8483    /// sufficient, a read-write scope will do as well.
8484    pub fn add_scope<St>(mut self, scope: St) -> AppPatchCall<'a, C>
8485    where
8486        St: AsRef<str>,
8487    {
8488        self._scopes.insert(String::from(scope.as_ref()));
8489        self
8490    }
8491    /// Identifies the authorization scope(s) for the method you are building.
8492    ///
8493    /// See [`Self::add_scope()`] for details.
8494    pub fn add_scopes<I, St>(mut self, scopes: I) -> AppPatchCall<'a, C>
8495    where
8496        I: IntoIterator<Item = St>,
8497        St: AsRef<str>,
8498    {
8499        self._scopes
8500            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8501        self
8502    }
8503
8504    /// Removes all scopes, and no default scope will be used either.
8505    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8506    /// for details).
8507    pub fn clear_scopes(mut self) -> AppPatchCall<'a, C> {
8508        self._scopes.clear();
8509        self
8510    }
8511}