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