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