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