google_appengine1/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 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
20 CloudPlatform,
21
22 /// View your data across Google Cloud services and see the email address of your Google Account
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 as appengine1;
59/// use appengine1::api::Version;
60/// use appengine1::{Result, Error};
61/// # async fn dox() {
62/// use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
63///
64/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
65/// // `client_secret`, among other things.
66/// let secret: yup_oauth2::ApplicationSecret = Default::default();
67/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
68/// // unless you replace `None` with the desired Flow.
69/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
70/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
71/// // retrieve them from storage.
72/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
73/// .with_native_roots()
74/// .unwrap()
75/// .https_only()
76/// .enable_http2()
77/// .build();
78///
79/// let executor = hyper_util::rt::TokioExecutor::new();
80/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
81/// secret,
82/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
83/// yup_oauth2::client::CustomHyperClientBuilder::from(
84/// hyper_util::client::legacy::Client::builder(executor).build(connector),
85/// ),
86/// ).build().await.unwrap();
87///
88/// let client = hyper_util::client::legacy::Client::builder(
89/// hyper_util::rt::TokioExecutor::new()
90/// )
91/// .build(
92/// hyper_rustls::HttpsConnectorBuilder::new()
93/// .with_native_roots()
94/// .unwrap()
95/// .https_or_http()
96/// .enable_http2()
97/// .build()
98/// );
99/// let mut hub = Appengine::new(client, auth);
100/// // As the method needs a request, you would usually fill it with the desired information
101/// // into the respective structure. Some of the parts shown here might not be applicable !
102/// // Values shown here are possibly random and not representative !
103/// let mut req = Version::default();
104///
105/// // You can configure optional parameters by calling the respective setters at will, and
106/// // execute the final call using `doit()`.
107/// // Values shown here are possibly random and not representative !
108/// let result = hub.projects().locations_applications_services_versions_patch(req, "projectsId", "locationsId", "applicationsId", "servicesId", "versionsId")
109/// .update_mask(FieldMask::new::<&str>(&[]))
110/// .doit().await;
111///
112/// match result {
113/// Err(e) => match e {
114/// // The Error enum provides details about what exactly happened.
115/// // You can also just use its `Debug`, `Display` or `Error` traits
116/// Error::HttpError(_)
117/// |Error::Io(_)
118/// |Error::MissingAPIKey
119/// |Error::MissingToken(_)
120/// |Error::Cancelled
121/// |Error::UploadSizeLimitExceeded(_, _)
122/// |Error::Failure(_)
123/// |Error::BadRequest(_)
124/// |Error::FieldClash(_)
125/// |Error::JsonDecodeError(_, _) => println!("{}", e),
126/// },
127/// Ok(res) => println!("Success: {:?}", res),
128/// }
129/// # }
130/// ```
131#[derive(Clone)]
132pub struct Appengine<C> {
133 pub client: common::Client<C>,
134 pub auth: Box<dyn common::GetToken>,
135 _user_agent: String,
136 _base_url: String,
137 _root_url: String,
138}
139
140impl<C> common::Hub for Appengine<C> {}
141
142impl<'a, C> Appengine<C> {
143 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Appengine<C> {
144 Appengine {
145 client,
146 auth: Box::new(auth),
147 _user_agent: "google-api-rust-client/7.0.0".to_string(),
148 _base_url: "https://appengine.googleapis.com/".to_string(),
149 _root_url: "https://appengine.googleapis.com/".to_string(),
150 }
151 }
152
153 pub fn apps(&'a self) -> AppMethods<'a, C> {
154 AppMethods { hub: self }
155 }
156 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
157 ProjectMethods { hub: self }
158 }
159
160 /// Set the user-agent header field to use in all requests to the server.
161 /// It defaults to `google-api-rust-client/7.0.0`.
162 ///
163 /// Returns the previously set user-agent.
164 pub fn user_agent(&mut self, agent_name: String) -> String {
165 std::mem::replace(&mut self._user_agent, agent_name)
166 }
167
168 /// Set the base url to use in all requests to the server.
169 /// It defaults to `https://appengine.googleapis.com/`.
170 ///
171 /// Returns the previously set base url.
172 pub fn base_url(&mut self, new_base_url: String) -> String {
173 std::mem::replace(&mut self._base_url, new_base_url)
174 }
175
176 /// Set the root url to use in all requests to the server.
177 /// It defaults to `https://appengine.googleapis.com/`.
178 ///
179 /// Returns the previously set root url.
180 pub fn root_url(&mut self, new_root_url: String) -> String {
181 std::mem::replace(&mut self._root_url, new_root_url)
182 }
183}
184
185// ############
186// SCHEMAS ###
187// ##########
188/// Google Cloud Endpoints (https://cloud.google.com/endpoints) configuration for API handlers.
189///
190/// This type is not used in any activity, and only used as *part* of another schema.
191///
192#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
193#[serde_with::serde_as]
194#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
195pub struct ApiConfigHandler {
196 /// Action to take when users access resources that require authentication. Defaults to redirect.
197 #[serde(rename = "authFailAction")]
198 pub auth_fail_action: Option<String>,
199 /// Level of login required to access this resource. Defaults to optional.
200 pub login: Option<String>,
201 /// Path to the script from the application root directory.
202 pub script: Option<String>,
203 /// Security (HTTPS) enforcement for this URL.
204 #[serde(rename = "securityLevel")]
205 pub security_level: Option<String>,
206 /// URL to serve the endpoint at.
207 pub url: Option<String>,
208}
209
210impl common::Part for ApiConfigHandler {}
211
212/// Uses Google Cloud Endpoints to handle requests.
213///
214/// This type is not used in any activity, and only used as *part* of another schema.
215///
216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
217#[serde_with::serde_as]
218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
219pub struct ApiEndpointHandler {
220 /// Path to the script from the application root directory.
221 #[serde(rename = "scriptPath")]
222 pub script_path: Option<String>,
223}
224
225impl common::Part for ApiEndpointHandler {}
226
227/// An Application resource contains the top-level configuration of an App Engine application.
228///
229/// # Activities
230///
231/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
232/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
233///
234/// * [create apps](AppCreateCall) (request)
235/// * [get apps](AppGetCall) (response)
236/// * [patch apps](AppPatchCall) (request)
237/// * [locations applications patch projects](ProjectLocationApplicationPatchCall) (request)
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct Application {
242 /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account.
243 #[serde(rename = "authDomain")]
244 pub auth_domain: Option<String>,
245 /// Output only. 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
246 #[serde(rename = "codeBucket")]
247 pub code_bucket: Option<String>,
248 /// The type of the Cloud Firestore or Cloud Datastore database associated with this application.
249 #[serde(rename = "databaseType")]
250 pub database_type: Option<String>,
251 /// Output only. Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly
252 #[serde(rename = "defaultBucket")]
253 pub default_bucket: Option<String>,
254 /// Cookie expiration policy for this application.
255 #[serde(rename = "defaultCookieExpiration")]
256 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
257 pub default_cookie_expiration: Option<chrono::Duration>,
258 /// Output only. Hostname used to reach this application, as resolved by App Engine.@OutputOnly
259 #[serde(rename = "defaultHostname")]
260 pub default_hostname: Option<String>,
261 /// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent. Up to 20 dispatch rules can be supported.
262 #[serde(rename = "dispatchRules")]
263 pub dispatch_rules: Option<Vec<UrlDispatchRule>>,
264 /// The feature specific settings to be used in the application.
265 #[serde(rename = "featureSettings")]
266 pub feature_settings: Option<FeatureSettings>,
267 /// Output only. The Google Container Registry domain used for storing managed build docker images for this application.
268 #[serde(rename = "gcrDomain")]
269 pub gcr_domain: Option<String>,
270 /// Additional Google Generated Customer Metadata, this field won't be provided by default and can be requested by setting the IncludeExtraData field in GetApplicationRequest
271 #[serde(rename = "generatedCustomerMetadata")]
272 pub generated_customer_metadata: Option<HashMap<String, serde_json::Value>>,
273 /// no description provided
274 pub iap: Option<IdentityAwareProxy>,
275 /// 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.
276 pub id: Option<String>,
277 /// Location from which this application runs. Application instances run out of the data centers in the specified location, which is also where all of the application's end user content is stored.Defaults to us-central.View the list of supported locations (https://cloud.google.com/appengine/docs/locations).
278 #[serde(rename = "locationId")]
279 pub location_id: Option<String>,
280 /// no description provided
281 pub name: Option<String>,
282 /// The service account associated with the application. This is the app-level default identity. If no identity provided during create version, Admin API will fallback to this one.
283 #[serde(rename = "serviceAccount")]
284 pub service_account: Option<String>,
285 /// Serving status of this application.
286 #[serde(rename = "servingStatus")]
287 pub serving_status: Option<String>,
288 /// The SSL policy that will be applied to the application. If set to Modern it will restrict traffic with TLS < 1.2 and allow only Modern Ciphers suite
289 #[serde(rename = "sslPolicy")]
290 pub ssl_policy: Option<String>,
291}
292
293impl common::RequestValue for Application {}
294impl common::ResponseResult for Application {}
295
296/// An SSL certificate that a user has been authorized to administer. A user is authorized to administer any certificate that applies to one of their authorized domains.
297///
298/// # Activities
299///
300/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
301/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
302///
303/// * [authorized certificates create apps](AppAuthorizedCertificateCreateCall) (request|response)
304/// * [authorized certificates get apps](AppAuthorizedCertificateGetCall) (response)
305/// * [authorized certificates patch apps](AppAuthorizedCertificatePatchCall) (request|response)
306/// * [locations applications authorized certificates create projects](ProjectLocationApplicationAuthorizedCertificateCreateCall) (request|response)
307/// * [locations applications authorized certificates get projects](ProjectLocationApplicationAuthorizedCertificateGetCall) (response)
308/// * [locations applications authorized certificates patch projects](ProjectLocationApplicationAuthorizedCertificatePatchCall) (request|response)
309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
310#[serde_with::serde_as]
311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
312pub struct AuthorizedCertificate {
313 /// The SSL certificate serving the AuthorizedCertificate resource. This must be obtained independently from a certificate authority.
314 #[serde(rename = "certificateRawData")]
315 pub certificate_raw_data: Option<CertificateRawData>,
316 /// The user-specified display name of the certificate. This is not guaranteed to be unique. Example: My Certificate.
317 #[serde(rename = "displayName")]
318 pub display_name: Option<String>,
319 /// Aggregate count of the domain mappings with this certificate mapped. This count includes domain mappings on applications for which the user does not have VIEWER permissions.Only returned by GET or LIST requests when specifically requested by the view=FULL_CERTIFICATE option.@OutputOnly
320 #[serde(rename = "domainMappingsCount")]
321 pub domain_mappings_count: Option<i32>,
322 /// Output only. Topmost applicable domains of this certificate. This certificate applies to these domains and their subdomains. Example: example.com.@OutputOnly
323 #[serde(rename = "domainNames")]
324 pub domain_names: Option<Vec<String>>,
325 /// The time when this certificate expires. To update the renewal time on this certificate, upload an SSL certificate with a different expiration time using AuthorizedCertificates.UpdateAuthorizedCertificate.@OutputOnly
326 #[serde(rename = "expireTime")]
327 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
328 /// Output only. Relative name of the certificate. This is a unique value autogenerated on AuthorizedCertificate resource creation. Example: 12345.@OutputOnly
329 pub id: Option<String>,
330 /// Only applicable if this certificate is managed by App Engine. Managed certificates are tied to the lifecycle of a DomainMapping and cannot be updated or deleted via the AuthorizedCertificates API. If this certificate is manually administered by the user, this field will be empty.@OutputOnly
331 #[serde(rename = "managedCertificate")]
332 pub managed_certificate: Option<ManagedCertificate>,
333 /// Output only. Full path to the AuthorizedCertificate resource in the API. Example: apps/myapp/authorizedCertificates/12345.@OutputOnly
334 pub name: Option<String>,
335 /// Output only. The full paths to user visible Domain Mapping resources that have this certificate mapped. Example: apps/myapp/domainMappings/example.com.This may not represent the full list of mapped domain mappings if the user does not have VIEWER permissions on all of the applications that have this certificate mapped. See domain_mappings_count for a complete count.Only returned by GET or LIST requests when specifically requested by the view=FULL_CERTIFICATE option.@OutputOnly
336 #[serde(rename = "visibleDomainMappings")]
337 pub visible_domain_mappings: Option<Vec<String>>,
338}
339
340impl common::RequestValue for AuthorizedCertificate {}
341impl common::ResponseResult for AuthorizedCertificate {}
342
343/// A domain that a user has been authorized to administer. To authorize use of a domain, verify ownership via Search Console (https://search.google.com/search-console/welcome).
344///
345/// This type is not used in any activity, and only used as *part* of another schema.
346///
347#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
348#[serde_with::serde_as]
349#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
350pub struct AuthorizedDomain {
351 /// Fully qualified domain name of the domain authorized for use. Example: example.com.
352 pub id: Option<String>,
353 /// Full path to the AuthorizedDomain resource in the API. Example: apps/myapp/authorizedDomains/example.com.@OutputOnly
354 pub name: Option<String>,
355}
356
357impl common::Part for AuthorizedDomain {}
358
359/// Automatic scaling is based on request rate, response latencies, and other application metrics.
360///
361/// This type is not used in any activity, and only used as *part* of another schema.
362///
363#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
364#[serde_with::serde_as]
365#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
366pub struct AutomaticScaling {
367 /// 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.
368 #[serde(rename = "coolDownPeriod")]
369 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
370 pub cool_down_period: Option<chrono::Duration>,
371 /// Target scaling by CPU usage.
372 #[serde(rename = "cpuUtilization")]
373 pub cpu_utilization: Option<CpuUtilization>,
374 /// Target scaling by disk usage.
375 #[serde(rename = "diskUtilization")]
376 pub disk_utilization: Option<DiskUtilization>,
377 /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value.
378 #[serde(rename = "maxConcurrentRequests")]
379 pub max_concurrent_requests: Option<i32>,
380 /// Maximum number of idle instances that should be maintained for this version.
381 #[serde(rename = "maxIdleInstances")]
382 pub max_idle_instances: Option<i32>,
383 /// Maximum amount of time that a request should wait in the pending queue before starting a new instance to handle it.
384 #[serde(rename = "maxPendingLatency")]
385 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
386 pub max_pending_latency: Option<chrono::Duration>,
387 /// Maximum number of instances that should be started to handle requests for this version.
388 #[serde(rename = "maxTotalInstances")]
389 pub max_total_instances: Option<i32>,
390 /// Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a service.
391 #[serde(rename = "minIdleInstances")]
392 pub min_idle_instances: Option<i32>,
393 /// Minimum amount of time a request should wait in the pending queue before starting a new instance to handle it.
394 #[serde(rename = "minPendingLatency")]
395 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
396 pub min_pending_latency: Option<chrono::Duration>,
397 /// Minimum number of running instances that should be maintained for this version.
398 #[serde(rename = "minTotalInstances")]
399 pub min_total_instances: Option<i32>,
400 /// Target scaling by network usage.
401 #[serde(rename = "networkUtilization")]
402 pub network_utilization: Option<NetworkUtilization>,
403 /// Target scaling by request utilization.
404 #[serde(rename = "requestUtilization")]
405 pub request_utilization: Option<RequestUtilization>,
406 /// Scheduler settings for standard environment.
407 #[serde(rename = "standardSchedulerSettings")]
408 pub standard_scheduler_settings: Option<StandardSchedulerSettings>,
409}
410
411impl common::Part for AutomaticScaling {}
412
413/// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity.
414///
415/// This type is not used in any activity, and only used as *part* of another schema.
416///
417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
418#[serde_with::serde_as]
419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
420pub struct BasicScaling {
421 /// Duration of time after the last request that an instance must wait before the instance is shut down.
422 #[serde(rename = "idleTimeout")]
423 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
424 pub idle_timeout: Option<chrono::Duration>,
425 /// Maximum number of instances to create for this version.
426 #[serde(rename = "maxInstances")]
427 pub max_instances: Option<i32>,
428}
429
430impl common::Part for BasicScaling {}
431
432/// Request message for Firewall.BatchUpdateIngressRules.
433///
434/// # Activities
435///
436/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
437/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
438///
439/// * [firewall ingress rules batch update apps](AppFirewallIngressRuleBatchUpdateCall) (request)
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct BatchUpdateIngressRulesRequest {
444 /// A list of FirewallRules to replace the existing set.
445 #[serde(rename = "ingressRules")]
446 pub ingress_rules: Option<Vec<FirewallRule>>,
447}
448
449impl common::RequestValue for BatchUpdateIngressRulesRequest {}
450
451/// Response message for Firewall.UpdateAllIngressRules.
452///
453/// # Activities
454///
455/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
456/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
457///
458/// * [firewall ingress rules batch update apps](AppFirewallIngressRuleBatchUpdateCall) (response)
459#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
460#[serde_with::serde_as]
461#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
462pub struct BatchUpdateIngressRulesResponse {
463 /// The full list of ingress FirewallRules for this application.
464 #[serde(rename = "ingressRules")]
465 pub ingress_rules: Option<Vec<FirewallRule>>,
466}
467
468impl common::ResponseResult for BatchUpdateIngressRulesResponse {}
469
470/// An SSL certificate obtained from a certificate authority.
471///
472/// This type is not used in any activity, and only used as *part* of another schema.
473///
474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
475#[serde_with::serde_as]
476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
477pub struct CertificateRawData {
478 /// Unencrypted PEM encoded RSA private key. This field is set once on certificate creation and then encrypted. The key size must be 2048 bits or fewer. Must include the header and footer. Example: -----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE KEY----- @InputOnly
479 #[serde(rename = "privateKey")]
480 pub private_key: Option<String>,
481 /// PEM encoded x.509 public key certificate. This field is set once on certificate creation. Must include the header and footer. Example: -----BEGIN CERTIFICATE----- -----END CERTIFICATE-----
482 #[serde(rename = "publicCertificate")]
483 pub public_certificate: Option<String>,
484}
485
486impl common::Part for CertificateRawData {}
487
488/// Options for the build operations performed as a part of the version deployment. Only applicable for App Engine flexible environment when creating a version using source code directly.
489///
490/// This type is not used in any activity, and only used as *part* of another schema.
491///
492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
493#[serde_with::serde_as]
494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
495pub struct CloudBuildOptions {
496 /// Path to the yaml file used in deployment, used to determine runtime configuration details.Required for flexible environment builds.See https://cloud.google.com/appengine/docs/standard/python/config/appref for more details.
497 #[serde(rename = "appYamlPath")]
498 pub app_yaml_path: Option<String>,
499 /// The Cloud Build timeout used as part of any dependent builds performed by version creation. Defaults to 10 minutes.
500 #[serde(rename = "cloudBuildTimeout")]
501 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
502 pub cloud_build_timeout: Option<chrono::Duration>,
503}
504
505impl common::Part for CloudBuildOptions {}
506
507/// 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.
508///
509/// This type is not used in any activity, and only used as *part* of another schema.
510///
511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
512#[serde_with::serde_as]
513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
514pub struct ContainerInfo {
515 /// 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"
516 pub image: Option<String>,
517}
518
519impl common::Part for ContainerInfo {}
520
521/// Target scaling by CPU usage.
522///
523/// This type is not used in any activity, and only used as *part* of another schema.
524///
525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
526#[serde_with::serde_as]
527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
528pub struct CpuUtilization {
529 /// Period of time over which CPU utilization is calculated.
530 #[serde(rename = "aggregationWindowLength")]
531 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
532 pub aggregation_window_length: Option<chrono::Duration>,
533 /// Target CPU utilization ratio to maintain when scaling. Must be between 0 and 1.
534 #[serde(rename = "targetUtilization")]
535 pub target_utilization: Option<f64>,
536}
537
538impl common::Part for CpuUtilization {}
539
540/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: A full date, with non-zero year, month, and day values. A month and day, with a zero year (for example, an anniversary). A year on its own, with a zero month and a zero day. A year and month, with a zero day (for example, a credit card expiration date).Related types: google.type.TimeOfDay google.type.DateTime google.protobuf.Timestamp
541///
542/// This type is not used in any activity, and only used as *part* of another schema.
543///
544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
545#[serde_with::serde_as]
546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
547pub struct Date {
548 /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
549 pub day: Option<i32>,
550 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
551 pub month: Option<i32>,
552 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
553 pub year: Option<i32>,
554}
555
556impl common::Part for Date {}
557
558/// Request message for Instances.DebugInstance.
559///
560/// # Activities
561///
562/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
563/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
564///
565/// * [services versions instances debug apps](AppServiceVersionInstanceDebugCall) (request)
566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
567#[serde_with::serde_as]
568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
569pub struct DebugInstanceRequest {
570 /// Public SSH key to add to the instance. Examples: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] [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).
571 #[serde(rename = "sshKey")]
572 pub ssh_key: Option<String>,
573}
574
575impl common::RequestValue for DebugInstanceRequest {}
576
577/// Code and application artifacts used to deploy a version to App Engine.
578///
579/// This type is not used in any activity, and only used as *part* of another schema.
580///
581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
582#[serde_with::serde_as]
583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
584pub struct Deployment {
585 /// Options for any Google Cloud Build builds created as a part of this deployment.These options will only be used if a new build is created, such as when deploying to the App Engine flexible environment using files or zip.
586 #[serde(rename = "cloudBuildOptions")]
587 pub cloud_build_options: Option<CloudBuildOptions>,
588 /// The Docker image for the container that runs the version. Only applicable for instances running in the App Engine flexible environment.
589 pub container: Option<ContainerInfo>,
590 /// 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.
591 pub files: Option<HashMap<String, FileInfo>>,
592 /// The zip file for this deployment, if this is a zip deployment.
593 pub zip: Option<ZipInfo>,
594}
595
596impl common::Part for Deployment {}
597
598/// Target scaling by disk usage. Only applicable in the App Engine flexible environment.
599///
600/// This type is not used in any activity, and only used as *part* of another schema.
601///
602#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
603#[serde_with::serde_as]
604#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
605pub struct DiskUtilization {
606 /// Target bytes read per second.
607 #[serde(rename = "targetReadBytesPerSecond")]
608 pub target_read_bytes_per_second: Option<i32>,
609 /// Target ops read per seconds.
610 #[serde(rename = "targetReadOpsPerSecond")]
611 pub target_read_ops_per_second: Option<i32>,
612 /// Target bytes written per second.
613 #[serde(rename = "targetWriteBytesPerSecond")]
614 pub target_write_bytes_per_second: Option<i32>,
615 /// Target ops written per second.
616 #[serde(rename = "targetWriteOpsPerSecond")]
617 pub target_write_ops_per_second: Option<i32>,
618}
619
620impl common::Part for DiskUtilization {}
621
622/// A domain serving an App Engine application.
623///
624/// # Activities
625///
626/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
627/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
628///
629/// * [domain mappings create apps](AppDomainMappingCreateCall) (request)
630/// * [domain mappings get apps](AppDomainMappingGetCall) (response)
631/// * [domain mappings patch apps](AppDomainMappingPatchCall) (request)
632/// * [locations applications domain mappings create projects](ProjectLocationApplicationDomainMappingCreateCall) (request)
633/// * [locations applications domain mappings get projects](ProjectLocationApplicationDomainMappingGetCall) (response)
634/// * [locations applications domain mappings patch projects](ProjectLocationApplicationDomainMappingPatchCall) (request)
635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
636#[serde_with::serde_as]
637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
638pub struct DomainMapping {
639 /// Relative name of the domain serving the application. Example: example.com.
640 pub id: Option<String>,
641 /// Output only. Full path to the DomainMapping resource in the API. Example: apps/myapp/domainMapping/example.com.@OutputOnly
642 pub name: Option<String>,
643 /// Output only. The resource records required to configure this domain mapping. These records must be added to the domain's DNS configuration in order to serve the application via this domain mapping.@OutputOnly
644 #[serde(rename = "resourceRecords")]
645 pub resource_records: Option<Vec<ResourceRecord>>,
646 /// SSL configuration for this domain. If unconfigured, this domain will not serve with SSL.
647 #[serde(rename = "sslSettings")]
648 pub ssl_settings: Option<SslSettings>,
649}
650
651impl common::RequestValue for DomainMapping {}
652impl common::ResponseResult for DomainMapping {}
653
654/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
655///
656/// # Activities
657///
658/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
659/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
660///
661/// * [authorized certificates delete apps](AppAuthorizedCertificateDeleteCall) (response)
662/// * [firewall ingress rules delete apps](AppFirewallIngressRuleDeleteCall) (response)
663/// * [locations applications authorized certificates delete projects](ProjectLocationApplicationAuthorizedCertificateDeleteCall) (response)
664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
665#[serde_with::serde_as]
666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
667pub struct Empty {
668 _never_set: Option<bool>,
669}
670
671impl common::ResponseResult for Empty {}
672
673/// Google 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).
674///
675/// This type is not used in any activity, and only used as *part* of another schema.
676///
677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
678#[serde_with::serde_as]
679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
680pub struct EndpointsApiService {
681 /// Endpoints service configuration ID as specified by the Service Management API. For example "2016-09-19r1".By default, the rollout strategy for Endpoints is RolloutStrategy.FIXED. This means that Endpoints starts up with a particular configuration ID. When a new configuration is rolled out, Endpoints must be given the new configuration ID. The config_id field is used to give the configuration ID and is required in this case.Endpoints also has a rollout strategy called RolloutStrategy.MANAGED. When using this, Endpoints fetches the latest configuration and does not need the configuration ID. In this case, config_id must be omitted.
682 #[serde(rename = "configId")]
683 pub config_id: Option<String>,
684 /// Enable or disable trace sampling. By default, this is set to false for enabled.
685 #[serde(rename = "disableTraceSampling")]
686 pub disable_trace_sampling: Option<bool>,
687 /// Endpoints service name which is the name of the "service" resource in the Service Management API. For example "myapi.endpoints.myproject.cloud.goog"
688 pub name: Option<String>,
689 /// Endpoints rollout strategy. If FIXED, config_id must be specified. If MANAGED, config_id must be omitted.
690 #[serde(rename = "rolloutStrategy")]
691 pub rollout_strategy: Option<String>,
692}
693
694impl common::Part for EndpointsApiService {}
695
696/// The entrypoint for the application.
697///
698/// This type is not used in any activity, and only used as *part* of another schema.
699///
700#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
701#[serde_with::serde_as]
702#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
703pub struct Entrypoint {
704 /// The format should be a shell command that can be fed to bash -c.
705 pub shell: Option<String>,
706}
707
708impl common::Part for Entrypoint {}
709
710/// Custom static error page to be served when an error occurs.
711///
712/// This type is not used in any activity, and only used as *part* of another schema.
713///
714#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
715#[serde_with::serde_as]
716#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
717pub struct ErrorHandler {
718 /// Error condition this handler applies to.
719 #[serde(rename = "errorCode")]
720 pub error_code: Option<String>,
721 /// MIME type of file. Defaults to text/html.
722 #[serde(rename = "mimeType")]
723 pub mime_type: Option<String>,
724 /// Static file content to be served for this error.
725 #[serde(rename = "staticFile")]
726 pub static_file: Option<String>,
727}
728
729impl common::Part for ErrorHandler {}
730
731/// Request message for Versions.ExportAppImage.
732///
733/// # Activities
734///
735/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
736/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
737///
738/// * [services versions export app image apps](AppServiceVersionExportAppImageCall) (request)
739/// * [locations applications services versions export app image projects](ProjectLocationApplicationServiceVersionExportAppImageCall) (request)
740#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
741#[serde_with::serde_as]
742#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
743pub struct ExportAppImageRequest {
744 /// Optional. The full resource name of the AR repository to export to. Format: projects/{project}/locations/{location}/repositories/{repository} If not specified, defaults to projects/{project}/locations/{location}/repositories/gae-standard in the same region as the app. The default repository will be created if it does not exist.
745 #[serde(rename = "destinationRepository")]
746 pub destination_repository: Option<String>,
747 /// Optional. Optional: A service account to use for authenticating to Artifact Registry.
748 #[serde(rename = "serviceAccount")]
749 pub service_account: Option<String>,
750}
751
752impl common::RequestValue for ExportAppImageRequest {}
753
754/// The feature specific settings to be used in the application. These define behaviors that are user configurable.
755///
756/// This type is not used in any activity, and only used as *part* of another schema.
757///
758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
759#[serde_with::serde_as]
760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
761pub struct FeatureSettings {
762 /// Boolean value indicating if split health checks should be used instead of the legacy health checks. At an app.yaml level, this means defaulting to 'readiness_check' and 'liveness_check' values instead of 'health_check' ones. Once the legacy 'health_check' behavior is deprecated, and this value is always true, this setting can be removed.
763 #[serde(rename = "splitHealthChecks")]
764 pub split_health_checks: Option<bool>,
765 /// If true, use Container-Optimized OS (https://cloud.google.com/container-optimized-os/) base image for VMs, rather than a base Debian image.
766 #[serde(rename = "useContainerOptimizedOs")]
767 pub use_container_optimized_os: Option<bool>,
768}
769
770impl common::Part for FeatureSettings {}
771
772/// Single source file that is part of the version to be deployed. Each source file that is deployed must be specified separately.
773///
774/// This type is not used in any activity, and only used as *part* of another schema.
775///
776#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
777#[serde_with::serde_as]
778#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
779pub struct FileInfo {
780 /// The MIME type of the file.Defaults to the value from Google Cloud Storage.
781 #[serde(rename = "mimeType")]
782 pub mime_type: Option<String>,
783 /// The SHA1 hash of the file, in hex.
784 #[serde(rename = "sha1Sum")]
785 pub sha1_sum: Option<String>,
786 /// 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//'.
787 #[serde(rename = "sourceUrl")]
788 pub source_url: Option<String>,
789}
790
791impl common::Part for FileInfo {}
792
793/// A single firewall rule that is evaluated against incoming traffic and provides an action to take on matched requests. A positive integer between 1, Int32.MaxValue-1 that defines the order of rule evaluation. Rules with the lowest priority are evaluated first.A default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action of this rule can be modified by the user.
794///
795/// # Activities
796///
797/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
798/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
799///
800/// * [firewall ingress rules create apps](AppFirewallIngressRuleCreateCall) (request|response)
801/// * [firewall ingress rules get apps](AppFirewallIngressRuleGetCall) (response)
802/// * [firewall ingress rules patch apps](AppFirewallIngressRulePatchCall) (request|response)
803#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
804#[serde_with::serde_as]
805#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
806pub struct FirewallRule {
807 /// The action to take on matched requests.
808 pub action: Option<String>,
809 /// An optional string description of this rule. This field has a maximum length of 400 characters.
810 pub description: Option<String>,
811 /// no description provided
812 pub priority: Option<i32>,
813 /// IP address or range, defined using CIDR notation, of requests that this rule applies to. You can use the wildcard character "*" to match all IPs equivalent to "0/0" and "::/0" together. Examples: 192.168.1.1 or 192.168.0.0/16 or 2001:db8::/32 or 2001:0db8:0000:0042:0000:8a2e:0370:7334. Truncation will be silently performed on addresses which are not properly truncated. For example, 1.2.3.4/24 is accepted as the same address as 1.2.3.0/24. Similarly, for IPv6, 2001:db8::1/32 is accepted as the same address as 2001:db8::/32.
814 #[serde(rename = "sourceRange")]
815 pub source_range: Option<String>,
816}
817
818impl common::RequestValue for FirewallRule {}
819impl common::ResponseResult for FirewallRule {}
820
821/// Runtime settings for the App Engine flexible environment.
822///
823/// This type is not used in any activity, and only used as *part* of another schema.
824///
825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
826#[serde_with::serde_as]
827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
828pub struct FlexibleRuntimeSettings {
829 /// The operating system of the application runtime.
830 #[serde(rename = "operatingSystem")]
831 pub operating_system: Option<String>,
832 /// The runtime version of an App Engine flexible application.
833 #[serde(rename = "runtimeVersion")]
834 pub runtime_version: Option<String>,
835}
836
837impl common::Part for FlexibleRuntimeSettings {}
838
839/// Health checking configuration for VM instances. Unhealthy instances are killed and replaced with new instances. Only applicable for instances in App Engine flexible environment.
840///
841/// This type is not used in any activity, and only used as *part* of another schema.
842///
843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
844#[serde_with::serde_as]
845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
846pub struct HealthCheck {
847 /// Interval between health checks.
848 #[serde(rename = "checkInterval")]
849 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
850 pub check_interval: Option<chrono::Duration>,
851 /// Whether to explicitly disable health checks for this instance.
852 #[serde(rename = "disableHealthCheck")]
853 pub disable_health_check: Option<bool>,
854 /// Number of consecutive successful health checks required before receiving traffic.
855 #[serde(rename = "healthyThreshold")]
856 pub healthy_threshold: Option<u32>,
857 /// Host header to send when performing an HTTP health check. Example: "myapp.appspot.com"
858 pub host: Option<String>,
859 /// Number of consecutive failed health checks required before an instance is restarted.
860 #[serde(rename = "restartThreshold")]
861 pub restart_threshold: Option<u32>,
862 /// Time before the health check is considered failed.
863 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
864 pub timeout: Option<chrono::Duration>,
865 /// Number of consecutive failed health checks required before removing traffic.
866 #[serde(rename = "unhealthyThreshold")]
867 pub unhealthy_threshold: Option<u32>,
868}
869
870impl common::Part for HealthCheck {}
871
872/// Identity-Aware Proxy
873///
874/// This type is not used in any activity, and only used as *part* of another schema.
875///
876#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
877#[serde_with::serde_as]
878#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
879pub struct IdentityAwareProxy {
880 /// 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.
881 pub enabled: Option<bool>,
882 /// OAuth2 client ID to use for the authentication flow.
883 #[serde(rename = "oauth2ClientId")]
884 pub oauth2_client_id: Option<String>,
885 /// OAuth2 client secret to use for the authentication flow.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
886 #[serde(rename = "oauth2ClientSecret")]
887 pub oauth2_client_secret: Option<String>,
888 /// Output only. Hex-encoded SHA-256 hash of the client secret.@OutputOnly
889 #[serde(rename = "oauth2ClientSecretSha256")]
890 pub oauth2_client_secret_sha256: Option<String>,
891}
892
893impl common::Part for IdentityAwareProxy {}
894
895/// An Instance resource is the computing unit that App Engine uses to automatically scale an application.
896///
897/// # Activities
898///
899/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
900/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
901///
902/// * [services versions instances get apps](AppServiceVersionInstanceGetCall) (response)
903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
904#[serde_with::serde_as]
905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
906pub struct Instance {
907 /// Output only. App Engine release this instance is running on.
908 #[serde(rename = "appEngineRelease")]
909 pub app_engine_release: Option<String>,
910 /// Output only. Availability of the instance.
911 pub availability: Option<String>,
912 /// Output only. Average latency (ms) over the last minute.
913 #[serde(rename = "averageLatency")]
914 pub average_latency: Option<i32>,
915 /// Output only. Number of errors since this instance was started.
916 pub errors: Option<i32>,
917 /// Output only. Relative name of the instance within the version. Example: instance-1.
918 pub id: Option<String>,
919 /// Output only. Total memory in use (bytes).
920 #[serde(rename = "memoryUsage")]
921 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
922 pub memory_usage: Option<i64>,
923 /// Output only. Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
924 pub name: Option<String>,
925 /// Output only. Average queries per second (QPS) over the last minute.
926 pub qps: Option<f32>,
927 /// Output only. Number of requests since this instance was started.
928 pub requests: Option<i32>,
929 /// Output only. Time that this instance was started.@OutputOnly
930 #[serde(rename = "startTime")]
931 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
932 /// Output only. Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.
933 #[serde(rename = "vmDebugEnabled")]
934 pub vm_debug_enabled: Option<bool>,
935 /// Output only. Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.
936 #[serde(rename = "vmId")]
937 pub vm_id: Option<String>,
938 /// Output only. The IP address of this instance. Only applicable for instances in App Engine flexible environment.
939 #[serde(rename = "vmIp")]
940 pub vm_ip: Option<String>,
941 /// Output only. The liveness health check of this instance. Only applicable for instances in App Engine flexible environment.
942 #[serde(rename = "vmLiveness")]
943 pub vm_liveness: Option<String>,
944 /// Output only. Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.
945 #[serde(rename = "vmName")]
946 pub vm_name: Option<String>,
947 /// Output only. Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.
948 #[serde(rename = "vmStatus")]
949 pub vm_status: Option<String>,
950 /// Output only. Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.
951 #[serde(rename = "vmZoneName")]
952 pub vm_zone_name: Option<String>,
953}
954
955impl common::ResponseResult for Instance {}
956
957/// Third-party Python runtime library that is required by the application.
958///
959/// This type is not used in any activity, and only used as *part* of another schema.
960///
961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
962#[serde_with::serde_as]
963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
964pub struct Library {
965 /// Name of the library. Example: "django".
966 pub name: Option<String>,
967 /// Version of the library to select, or "latest".
968 pub version: Option<String>,
969}
970
971impl common::Part for Library {}
972
973/// Response message for AuthorizedCertificates.ListAuthorizedCertificates.
974///
975/// # Activities
976///
977/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
978/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
979///
980/// * [authorized certificates list apps](AppAuthorizedCertificateListCall) (response)
981/// * [locations applications authorized certificates list projects](ProjectLocationApplicationAuthorizedCertificateListCall) (response)
982#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
983#[serde_with::serde_as]
984#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
985pub struct ListAuthorizedCertificatesResponse {
986 /// The SSL certificates the user is authorized to administer.
987 pub certificates: Option<Vec<AuthorizedCertificate>>,
988 /// Continuation token for fetching the next page of results.
989 #[serde(rename = "nextPageToken")]
990 pub next_page_token: Option<String>,
991}
992
993impl common::ResponseResult for ListAuthorizedCertificatesResponse {}
994
995/// Response message for AuthorizedDomains.ListAuthorizedDomains.
996///
997/// # Activities
998///
999/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1000/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1001///
1002/// * [authorized domains list apps](AppAuthorizedDomainListCall) (response)
1003/// * [locations applications authorized domains list projects](ProjectLocationApplicationAuthorizedDomainListCall) (response)
1004#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1005#[serde_with::serde_as]
1006#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1007pub struct ListAuthorizedDomainsResponse {
1008 /// The authorized domains belonging to the user.
1009 pub domains: Option<Vec<AuthorizedDomain>>,
1010 /// Continuation token for fetching the next page of results.
1011 #[serde(rename = "nextPageToken")]
1012 pub next_page_token: Option<String>,
1013}
1014
1015impl common::ResponseResult for ListAuthorizedDomainsResponse {}
1016
1017/// Response message for DomainMappings.ListDomainMappings.
1018///
1019/// # Activities
1020///
1021/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1022/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1023///
1024/// * [domain mappings list apps](AppDomainMappingListCall) (response)
1025/// * [locations applications domain mappings list projects](ProjectLocationApplicationDomainMappingListCall) (response)
1026#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1027#[serde_with::serde_as]
1028#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1029pub struct ListDomainMappingsResponse {
1030 /// The domain mappings for the application.
1031 #[serde(rename = "domainMappings")]
1032 pub domain_mappings: Option<Vec<DomainMapping>>,
1033 /// Continuation token for fetching the next page of results.
1034 #[serde(rename = "nextPageToken")]
1035 pub next_page_token: Option<String>,
1036}
1037
1038impl common::ResponseResult for ListDomainMappingsResponse {}
1039
1040/// Response message for Firewall.ListIngressRules.
1041///
1042/// # Activities
1043///
1044/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1045/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1046///
1047/// * [firewall ingress rules list apps](AppFirewallIngressRuleListCall) (response)
1048#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1049#[serde_with::serde_as]
1050#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1051pub struct ListIngressRulesResponse {
1052 /// The ingress FirewallRules for this application.
1053 #[serde(rename = "ingressRules")]
1054 pub ingress_rules: Option<Vec<FirewallRule>>,
1055 /// Continuation token for fetching the next page of results.
1056 #[serde(rename = "nextPageToken")]
1057 pub next_page_token: Option<String>,
1058}
1059
1060impl common::ResponseResult for ListIngressRulesResponse {}
1061
1062/// Response message for Instances.ListInstances.
1063///
1064/// # Activities
1065///
1066/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1067/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1068///
1069/// * [services versions instances list apps](AppServiceVersionInstanceListCall) (response)
1070#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1071#[serde_with::serde_as]
1072#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1073pub struct ListInstancesResponse {
1074 /// The instances belonging to the requested version.
1075 pub instances: Option<Vec<Instance>>,
1076 /// Continuation token for fetching the next page of results.
1077 #[serde(rename = "nextPageToken")]
1078 pub next_page_token: Option<String>,
1079}
1080
1081impl common::ResponseResult for ListInstancesResponse {}
1082
1083/// The response message for Locations.ListLocations.
1084///
1085/// # Activities
1086///
1087/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1088/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1089///
1090/// * [locations list apps](AppLocationListCall) (response)
1091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1092#[serde_with::serde_as]
1093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1094pub struct ListLocationsResponse {
1095 /// A list of locations that matches the specified filter in the request.
1096 pub locations: Option<Vec<Location>>,
1097 /// The standard List next-page token.
1098 #[serde(rename = "nextPageToken")]
1099 pub next_page_token: Option<String>,
1100}
1101
1102impl common::ResponseResult for ListLocationsResponse {}
1103
1104/// The response message for Operations.ListOperations.
1105///
1106/// # Activities
1107///
1108/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1109/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1110///
1111/// * [operations list apps](AppOperationListCall) (response)
1112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1113#[serde_with::serde_as]
1114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1115pub struct ListOperationsResponse {
1116 /// The standard List next-page token.
1117 #[serde(rename = "nextPageToken")]
1118 pub next_page_token: Option<String>,
1119 /// A list of operations that matches the specified filter in the request.
1120 pub operations: Option<Vec<Operation>>,
1121 /// Unordered list. Unreachable resources. Populated when the request sets ListOperationsRequest.return_partial_success and reads across collections. For example, when attempting to list all resources across all supported locations.
1122 pub unreachable: Option<Vec<String>>,
1123}
1124
1125impl common::ResponseResult for ListOperationsResponse {}
1126
1127/// Response message for Applications.ListRuntimes.
1128///
1129/// # Activities
1130///
1131/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1132/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1133///
1134/// * [list runtimes apps](AppListRuntimeCall) (response)
1135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1136#[serde_with::serde_as]
1137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1138pub struct ListRuntimesResponse {
1139 /// Continuation token for fetching the next page of results.
1140 #[serde(rename = "nextPageToken")]
1141 pub next_page_token: Option<String>,
1142 /// The runtimes available to the requested application.
1143 pub runtimes: Option<Vec<Runtime>>,
1144}
1145
1146impl common::ResponseResult for ListRuntimesResponse {}
1147
1148/// Response message for Services.ListServices.
1149///
1150/// # Activities
1151///
1152/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1153/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1154///
1155/// * [services list apps](AppServiceListCall) (response)
1156#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1157#[serde_with::serde_as]
1158#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1159pub struct ListServicesResponse {
1160 /// Continuation token for fetching the next page of results.
1161 #[serde(rename = "nextPageToken")]
1162 pub next_page_token: Option<String>,
1163 /// The services belonging to the requested application.
1164 pub services: Option<Vec<Service>>,
1165}
1166
1167impl common::ResponseResult for ListServicesResponse {}
1168
1169/// Response message for Versions.ListVersions.
1170///
1171/// # Activities
1172///
1173/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1174/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1175///
1176/// * [services versions list apps](AppServiceVersionListCall) (response)
1177#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1178#[serde_with::serde_as]
1179#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1180pub struct ListVersionsResponse {
1181 /// Continuation token for fetching the next page of results.
1182 #[serde(rename = "nextPageToken")]
1183 pub next_page_token: Option<String>,
1184 /// The versions belonging to the requested service.
1185 pub versions: Option<Vec<Version>>,
1186}
1187
1188impl common::ResponseResult for ListVersionsResponse {}
1189
1190/// Health checking configuration for VM instances. Unhealthy instances are killed and replaced with new instances.
1191///
1192/// This type is not used in any activity, and only used as *part* of another schema.
1193///
1194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1195#[serde_with::serde_as]
1196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1197pub struct LivenessCheck {
1198 /// Interval between health checks.
1199 #[serde(rename = "checkInterval")]
1200 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1201 pub check_interval: Option<chrono::Duration>,
1202 /// Number of consecutive failed checks required before considering the VM unhealthy.
1203 #[serde(rename = "failureThreshold")]
1204 pub failure_threshold: Option<u32>,
1205 /// Host header to send when performing a HTTP Liveness check. Example: "myapp.appspot.com"
1206 pub host: Option<String>,
1207 /// The initial delay before starting to execute the checks.
1208 #[serde(rename = "initialDelay")]
1209 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1210 pub initial_delay: Option<chrono::Duration>,
1211 /// The request path.
1212 pub path: Option<String>,
1213 /// Number of consecutive successful checks required before considering the VM healthy.
1214 #[serde(rename = "successThreshold")]
1215 pub success_threshold: Option<u32>,
1216 /// Time before the check is considered failed.
1217 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1218 pub timeout: Option<chrono::Duration>,
1219}
1220
1221impl common::Part for LivenessCheck {}
1222
1223/// A resource that represents a Google Cloud location.
1224///
1225/// # Activities
1226///
1227/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1228/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1229///
1230/// * [locations get apps](AppLocationGetCall) (response)
1231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1232#[serde_with::serde_as]
1233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1234pub struct Location {
1235 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1236 #[serde(rename = "displayName")]
1237 pub display_name: Option<String>,
1238 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1239 pub labels: Option<HashMap<String, String>>,
1240 /// The canonical id for this location. For example: "us-east1".
1241 #[serde(rename = "locationId")]
1242 pub location_id: Option<String>,
1243 /// Service-specific metadata. For example the available capacity at the given location.
1244 pub metadata: Option<HashMap<String, serde_json::Value>>,
1245 /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1"
1246 pub name: Option<String>,
1247}
1248
1249impl common::ResponseResult for Location {}
1250
1251/// A certificate managed by App Engine.
1252///
1253/// This type is not used in any activity, and only used as *part* of another schema.
1254///
1255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1256#[serde_with::serde_as]
1257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1258pub struct ManagedCertificate {
1259 /// Time at which the certificate was last renewed. The renewal process is fully managed. Certificate renewal will automatically occur before the certificate expires. Renewal errors can be tracked via ManagementStatus.@OutputOnly
1260 #[serde(rename = "lastRenewalTime")]
1261 pub last_renewal_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1262 /// Status of certificate management. Refers to the most recent certificate acquisition or renewal attempt.@OutputOnly
1263 pub status: Option<String>,
1264}
1265
1266impl common::Part for ManagedCertificate {}
1267
1268/// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time.
1269///
1270/// This type is not used in any activity, and only used as *part* of another schema.
1271///
1272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1273#[serde_with::serde_as]
1274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1275pub struct ManualScaling {
1276 /// Number of instances to assign to the service at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function.
1277 pub instances: Option<i32>,
1278}
1279
1280impl common::Part for ManualScaling {}
1281
1282/// Extra network settings. Only applicable in the App Engine flexible environment.
1283///
1284/// This type is not used in any activity, and only used as *part* of another schema.
1285///
1286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1287#[serde_with::serde_as]
1288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1289pub struct Network {
1290 /// List of ports, or port pairs, to forward from the virtual machine to the application container. Only applicable in the App Engine flexible environment.
1291 #[serde(rename = "forwardedPorts")]
1292 pub forwarded_ports: Option<Vec<String>>,
1293 /// The IP mode for instances. Only applicable in the App Engine flexible environment.
1294 #[serde(rename = "instanceIpMode")]
1295 pub instance_ip_mode: Option<String>,
1296 /// Tag to apply to the instance during creation. Only applicable in the App Engine flexible environment.
1297 #[serde(rename = "instanceTag")]
1298 pub instance_tag: Option<String>,
1299 /// Google Compute Engine network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default.
1300 pub name: Option<String>,
1301 /// Enable session affinity. Only applicable in the App Engine flexible environment.
1302 #[serde(rename = "sessionAffinity")]
1303 pub session_affinity: Option<bool>,
1304 /// Google Cloud Platform sub-network where the virtual machines are created. Specify the short name, not the resource path.If a subnetwork name is specified, a network name will also be required unless it is for the default network. If the network that the instance is being created in is a Legacy network, then the IP address is allocated from the IPv4Range. If the network that the instance is being created in is an auto Subnet Mode Network, then only network name should be specified (not the subnetwork_name) and the IP address is created from the IPCidrRange of the subnetwork that exists in that zone for that network. If the network that the instance is being created in is a custom Subnet Mode Network, then the subnetwork_name must be specified and the IP address is created from the IPCidrRange of the subnetwork.If specified, the subnetwork must exist in the same region as the App Engine flexible environment application.
1305 #[serde(rename = "subnetworkName")]
1306 pub subnetwork_name: Option<String>,
1307}
1308
1309impl common::Part for Network {}
1310
1311/// A NetworkSettings resource is a container for ingress settings for a version or service.
1312///
1313/// This type is not used in any activity, and only used as *part* of another schema.
1314///
1315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1316#[serde_with::serde_as]
1317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1318pub struct NetworkSettings {
1319 /// The ingress settings for version or service.
1320 #[serde(rename = "ingressTrafficAllowed")]
1321 pub ingress_traffic_allowed: Option<String>,
1322}
1323
1324impl common::Part for NetworkSettings {}
1325
1326/// Target scaling by network usage. Only applicable in the App Engine flexible environment.
1327///
1328/// This type is not used in any activity, and only used as *part* of another schema.
1329///
1330#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1331#[serde_with::serde_as]
1332#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1333pub struct NetworkUtilization {
1334 /// Target bytes received per second.
1335 #[serde(rename = "targetReceivedBytesPerSecond")]
1336 pub target_received_bytes_per_second: Option<i32>,
1337 /// Target packets received per second.
1338 #[serde(rename = "targetReceivedPacketsPerSecond")]
1339 pub target_received_packets_per_second: Option<i32>,
1340 /// Target bytes sent per second.
1341 #[serde(rename = "targetSentBytesPerSecond")]
1342 pub target_sent_bytes_per_second: Option<i32>,
1343 /// Target packets sent per second.
1344 #[serde(rename = "targetSentPacketsPerSecond")]
1345 pub target_sent_packets_per_second: Option<i32>,
1346}
1347
1348impl common::Part for NetworkUtilization {}
1349
1350/// This resource represents a long-running operation that is the result of a network API call.
1351///
1352/// # Activities
1353///
1354/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1355/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1356///
1357/// * [domain mappings create apps](AppDomainMappingCreateCall) (response)
1358/// * [domain mappings delete apps](AppDomainMappingDeleteCall) (response)
1359/// * [domain mappings patch apps](AppDomainMappingPatchCall) (response)
1360/// * [operations get apps](AppOperationGetCall) (response)
1361/// * [services versions instances debug apps](AppServiceVersionInstanceDebugCall) (response)
1362/// * [services versions instances delete apps](AppServiceVersionInstanceDeleteCall) (response)
1363/// * [services versions create apps](AppServiceVersionCreateCall) (response)
1364/// * [services versions delete apps](AppServiceVersionDeleteCall) (response)
1365/// * [services versions export app image apps](AppServiceVersionExportAppImageCall) (response)
1366/// * [services versions patch apps](AppServiceVersionPatchCall) (response)
1367/// * [services delete apps](AppServiceDeleteCall) (response)
1368/// * [services patch apps](AppServicePatchCall) (response)
1369/// * [create apps](AppCreateCall) (response)
1370/// * [patch apps](AppPatchCall) (response)
1371/// * [repair apps](AppRepairCall) (response)
1372/// * [locations applications domain mappings create projects](ProjectLocationApplicationDomainMappingCreateCall) (response)
1373/// * [locations applications domain mappings delete projects](ProjectLocationApplicationDomainMappingDeleteCall) (response)
1374/// * [locations applications domain mappings patch projects](ProjectLocationApplicationDomainMappingPatchCall) (response)
1375/// * [locations applications services versions delete projects](ProjectLocationApplicationServiceVersionDeleteCall) (response)
1376/// * [locations applications services versions export app image projects](ProjectLocationApplicationServiceVersionExportAppImageCall) (response)
1377/// * [locations applications services versions patch projects](ProjectLocationApplicationServiceVersionPatchCall) (response)
1378/// * [locations applications services delete projects](ProjectLocationApplicationServiceDeleteCall) (response)
1379/// * [locations applications services patch projects](ProjectLocationApplicationServicePatchCall) (response)
1380/// * [locations applications patch projects](ProjectLocationApplicationPatchCall) (response)
1381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1382#[serde_with::serde_as]
1383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1384pub struct Operation {
1385 /// 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.
1386 pub done: Option<bool>,
1387 /// The error result of the operation in case of failure or cancellation.
1388 pub error: Option<Status>,
1389 /// 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.
1390 pub metadata: Option<HashMap<String, serde_json::Value>>,
1391 /// 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 be a resource name ending with operations/{unique_id}.
1392 pub name: Option<String>,
1393 /// The normal, successful response of the operation. 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.
1394 pub response: Option<HashMap<String, serde_json::Value>>,
1395}
1396
1397impl common::ResponseResult for Operation {}
1398
1399/// Readiness checking configuration for VM instances. Unhealthy instances are removed from traffic rotation.
1400///
1401/// This type is not used in any activity, and only used as *part* of another schema.
1402///
1403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1404#[serde_with::serde_as]
1405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1406pub struct ReadinessCheck {
1407 /// A maximum time limit on application initialization, measured from moment the application successfully replies to a healthcheck until it is ready to serve traffic.
1408 #[serde(rename = "appStartTimeout")]
1409 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1410 pub app_start_timeout: Option<chrono::Duration>,
1411 /// Interval between health checks.
1412 #[serde(rename = "checkInterval")]
1413 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1414 pub check_interval: Option<chrono::Duration>,
1415 /// Number of consecutive failed checks required before removing traffic.
1416 #[serde(rename = "failureThreshold")]
1417 pub failure_threshold: Option<u32>,
1418 /// Host header to send when performing a HTTP Readiness check. Example: "myapp.appspot.com"
1419 pub host: Option<String>,
1420 /// The request path.
1421 pub path: Option<String>,
1422 /// Number of consecutive successful checks required before receiving traffic.
1423 #[serde(rename = "successThreshold")]
1424 pub success_threshold: Option<u32>,
1425 /// Time before the check is considered failed.
1426 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1427 pub timeout: Option<chrono::Duration>,
1428}
1429
1430impl common::Part for ReadinessCheck {}
1431
1432/// Request message for ‘Applications.RepairApplication’.
1433///
1434/// # Activities
1435///
1436/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1437/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1438///
1439/// * [repair apps](AppRepairCall) (request)
1440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1441#[serde_with::serde_as]
1442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1443pub struct RepairApplicationRequest {
1444 _never_set: Option<bool>,
1445}
1446
1447impl common::RequestValue for RepairApplicationRequest {}
1448
1449/// Target scaling by request utilization. Only applicable in the App Engine flexible environment.
1450///
1451/// This type is not used in any activity, and only used as *part* of another schema.
1452///
1453#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1454#[serde_with::serde_as]
1455#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1456pub struct RequestUtilization {
1457 /// Target number of concurrent requests.
1458 #[serde(rename = "targetConcurrentRequests")]
1459 pub target_concurrent_requests: Option<i32>,
1460 /// Target requests per second.
1461 #[serde(rename = "targetRequestCountPerSecond")]
1462 pub target_request_count_per_second: Option<i32>,
1463}
1464
1465impl common::Part for RequestUtilization {}
1466
1467/// A DNS resource record.
1468///
1469/// This type is not used in any activity, and only used as *part* of another schema.
1470///
1471#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1472#[serde_with::serde_as]
1473#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1474pub struct ResourceRecord {
1475 /// Relative name of the object affected by this record. Only applicable for CNAME records. Example: 'www'.
1476 pub name: Option<String>,
1477 /// Data for this record. Values vary by record type, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).
1478 pub rrdata: Option<String>,
1479 /// Resource record type. Example: AAAA.
1480 #[serde(rename = "type")]
1481 pub type_: Option<String>,
1482}
1483
1484impl common::Part for ResourceRecord {}
1485
1486/// Machine resources for a version.
1487///
1488/// This type is not used in any activity, and only used as *part* of another schema.
1489///
1490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1491#[serde_with::serde_as]
1492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1493pub struct Resources {
1494 /// Number of CPU cores needed.
1495 pub cpu: Option<f64>,
1496 /// Disk size (GB) needed.
1497 #[serde(rename = "diskGb")]
1498 pub disk_gb: Option<f64>,
1499 /// The name of the encryption key that is stored in Google Cloud KMS. Only should be used by Cloud Composer to encrypt the vm disk
1500 #[serde(rename = "kmsKeyReference")]
1501 pub kms_key_reference: Option<String>,
1502 /// Memory (GB) needed.
1503 #[serde(rename = "memoryGb")]
1504 pub memory_gb: Option<f64>,
1505 /// User specified volumes.
1506 pub volumes: Option<Vec<Volume>>,
1507}
1508
1509impl common::Part for Resources {}
1510
1511/// Runtime versions for App Engine.
1512///
1513/// This type is not used in any activity, and only used as *part* of another schema.
1514///
1515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1516#[serde_with::serde_as]
1517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1518pub struct Runtime {
1519 /// Date when Runtime is decommissioned.
1520 #[serde(rename = "decommissionedDate")]
1521 pub decommissioned_date: Option<Date>,
1522 /// Date when Runtime is deprecated.
1523 #[serde(rename = "deprecationDate")]
1524 pub deprecation_date: Option<Date>,
1525 /// User-friendly display name, e.g. 'Node.js 12', etc.
1526 #[serde(rename = "displayName")]
1527 pub display_name: Option<String>,
1528 /// Date when Runtime is end of support.
1529 #[serde(rename = "endOfSupportDate")]
1530 pub end_of_support_date: Option<Date>,
1531 /// The environment of the runtime.
1532 pub environment: Option<String>,
1533 /// The name of the runtime, e.g., 'go113', 'nodejs12', etc.
1534 pub name: Option<String>,
1535 /// The stage of life this runtime is in, e.g., BETA, GA, etc.
1536 pub stage: Option<String>,
1537 /// Supported operating systems for the runtime, e.g., 'ubuntu22', etc.
1538 #[serde(rename = "supportedOperatingSystems")]
1539 pub supported_operating_systems: Option<Vec<String>>,
1540 /// Warning messages, e.g., a deprecation warning.
1541 pub warnings: Option<Vec<String>>,
1542}
1543
1544impl common::Part for Runtime {}
1545
1546/// Executes a script to handle the request that matches the URL pattern.
1547///
1548/// This type is not used in any activity, and only used as *part* of another schema.
1549///
1550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1551#[serde_with::serde_as]
1552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1553pub struct ScriptHandler {
1554 /// Path to the script from the application root directory.
1555 #[serde(rename = "scriptPath")]
1556 pub script_path: Option<String>,
1557}
1558
1559impl common::Part for ScriptHandler {}
1560
1561/// A Service resource is a logical component of an application that can share state and communicate in a secure fashion with other services. For example, an application that handles customer requests might include separate services to handle tasks such as backend data analysis or API requests from mobile devices. Each service has a collection of versions that define a specific set of code used to implement the functionality of that service.
1562///
1563/// # Activities
1564///
1565/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1566/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1567///
1568/// * [services get apps](AppServiceGetCall) (response)
1569/// * [services patch apps](AppServicePatchCall) (request)
1570/// * [locations applications services patch projects](ProjectLocationApplicationServicePatchCall) (request)
1571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1572#[serde_with::serde_as]
1573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1574pub struct Service {
1575 /// Additional Google Generated Customer Metadata, this field won't be provided by default and can be requested by setting the IncludeExtraData field in GetServiceRequest
1576 #[serde(rename = "generatedCustomerMetadata")]
1577 pub generated_customer_metadata: Option<HashMap<String, serde_json::Value>>,
1578 /// Output only. Relative name of the service within the application. Example: default.@OutputOnly
1579 pub id: Option<String>,
1580 /// A set of labels to apply to this service. Labels are key/value pairs that describe the service and all resources that belong to it (e.g., versions). The labels can be used to search and group resources, and are propagated to the usage and billing reports, enabling fine-grain analysis of costs. An example of using labels is to tag resources belonging to different environments (e.g., "env=prod", "env=qa"). Label keys and values can be no longer than 63 characters and can only contain lowercase letters, numeric characters, underscores, dashes, and international characters. Label keys must start with a lowercase letter or an international character. Each service can have at most 32 labels.
1581 pub labels: Option<HashMap<String, String>>,
1582 /// Output only. Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly
1583 pub name: Option<String>,
1584 /// Ingress settings for this service. Will apply to all versions.
1585 #[serde(rename = "networkSettings")]
1586 pub network_settings: Option<NetworkSettings>,
1587 /// Mapping that defines fractional HTTP traffic diversion to different versions within the service.
1588 pub split: Option<TrafficSplit>,
1589}
1590
1591impl common::RequestValue for Service {}
1592impl common::ResponseResult for Service {}
1593
1594/// SSL configuration for a DomainMapping resource.
1595///
1596/// This type is not used in any activity, and only used as *part* of another schema.
1597///
1598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1599#[serde_with::serde_as]
1600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1601pub struct SslSettings {
1602 /// ID of the AuthorizedCertificate resource configuring SSL for the application. Clearing this field will remove SSL support.By default, a managed certificate is automatically created for every domain mapping. To omit SSL support or to configure SSL manually, specify SslManagementType.MANUAL on a CREATE or UPDATE request. You must be authorized to administer the AuthorizedCertificate resource to manually map it to a DomainMapping resource. Example: 12345.
1603 #[serde(rename = "certificateId")]
1604 pub certificate_id: Option<String>,
1605 /// Output only. ID of the managed AuthorizedCertificate resource currently being provisioned, if applicable. Until the new managed certificate has been successfully provisioned, the previous SSL state will be preserved. Once the provisioning process completes, the certificate_id field will reflect the new managed certificate and this field will be left empty. To remove SSL support while there is still a pending managed certificate, clear the certificate_id field with an UpdateDomainMappingRequest.@OutputOnly
1606 #[serde(rename = "pendingManagedCertificateId")]
1607 pub pending_managed_certificate_id: Option<String>,
1608 /// SSL management type for this domain. If AUTOMATIC, a managed certificate is automatically provisioned. If MANUAL, certificate_id must be manually specified in order to configure SSL for this domain.
1609 #[serde(rename = "sslManagementType")]
1610 pub ssl_management_type: Option<String>,
1611}
1612
1613impl common::Part for SslSettings {}
1614
1615/// Scheduler settings for standard environment.
1616///
1617/// This type is not used in any activity, and only used as *part* of another schema.
1618///
1619#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1620#[serde_with::serde_as]
1621#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1622pub struct StandardSchedulerSettings {
1623 /// Maximum number of instances to run for this version. Set to 2147483647 to disable max_instances configuration.
1624 #[serde(rename = "maxInstances")]
1625 pub max_instances: Option<i32>,
1626 /// Minimum number of instances to run for this version. Set to zero to disable min_instances configuration.
1627 #[serde(rename = "minInstances")]
1628 pub min_instances: Option<i32>,
1629 /// Target CPU utilization ratio to maintain when scaling.
1630 #[serde(rename = "targetCpuUtilization")]
1631 pub target_cpu_utilization: Option<f64>,
1632 /// Target throughput utilization ratio to maintain when scaling
1633 #[serde(rename = "targetThroughputUtilization")]
1634 pub target_throughput_utilization: Option<f64>,
1635}
1636
1637impl common::Part for StandardSchedulerSettings {}
1638
1639/// 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.
1640///
1641/// This type is not used in any activity, and only used as *part* of another schema.
1642///
1643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1644#[serde_with::serde_as]
1645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1646pub struct StaticFilesHandler {
1647 /// 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.
1648 #[serde(rename = "applicationReadable")]
1649 pub application_readable: Option<bool>,
1650 /// Time a static file served by this handler should be cached by web proxies and browsers.
1651 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1652 pub expiration: Option<chrono::Duration>,
1653 /// HTTP headers to use for all responses from these URLs.
1654 #[serde(rename = "httpHeaders")]
1655 pub http_headers: Option<HashMap<String, String>>,
1656 /// 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.
1657 #[serde(rename = "mimeType")]
1658 pub mime_type: Option<String>,
1659 /// 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.
1660 pub path: Option<String>,
1661 /// Whether this handler should match the request if the file referenced by the handler does not exist.
1662 #[serde(rename = "requireMatchingFile")]
1663 pub require_matching_file: Option<bool>,
1664 /// Regular expression that matches the file paths for all files that should be referenced by this handler.
1665 #[serde(rename = "uploadPathRegex")]
1666 pub upload_path_regex: Option<String>,
1667}
1668
1669impl common::Part for StaticFilesHandler {}
1670
1671/// 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). Each Status message contains three pieces of data: error code, error message, and error details.You can find out more about this error model and how to work with it in the API Design Guide (https://cloud.google.com/apis/design/errors).
1672///
1673/// This type is not used in any activity, and only used as *part* of another schema.
1674///
1675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1676#[serde_with::serde_as]
1677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1678pub struct Status {
1679 /// The status code, which should be an enum value of google.rpc.Code.
1680 pub code: Option<i32>,
1681 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1682 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1683 /// 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.
1684 pub message: Option<String>,
1685}
1686
1687impl common::Part for Status {}
1688
1689/// Traffic routing configuration for versions within a single service. Traffic splits define how traffic directed to the service is assigned to versions.
1690///
1691/// This type is not used in any activity, and only used as *part* of another schema.
1692///
1693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1694#[serde_with::serde_as]
1695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1696pub struct TrafficSplit {
1697 /// Mapping from version IDs within the service to fractional (0.000, 1] allocations of traffic for that version. Each version can be specified only once, but some versions in the service may not have any traffic allocation. Services that have traffic allocated cannot be deleted until either the service is deleted or their traffic allocation is removed. Allocations must sum to 1. Up to two decimal place precision is supported for IP-based splits and up to three decimal places is supported for cookie-based splits.
1698 pub allocations: Option<HashMap<String, f64>>,
1699 /// 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.
1700 #[serde(rename = "shardBy")]
1701 pub shard_by: Option<String>,
1702}
1703
1704impl common::Part for TrafficSplit {}
1705
1706/// Rules to match an HTTP request and dispatch that request to a service.
1707///
1708/// This type is not used in any activity, and only used as *part* of another schema.
1709///
1710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1711#[serde_with::serde_as]
1712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1713pub struct UrlDispatchRule {
1714 /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*".
1715 pub domain: Option<String>,
1716 /// 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.
1717 pub path: Option<String>,
1718 /// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default.
1719 pub service: Option<String>,
1720}
1721
1722impl common::Part for UrlDispatchRule {}
1723
1724/// 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.
1725///
1726/// This type is not used in any activity, and only used as *part* of another schema.
1727///
1728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1729#[serde_with::serde_as]
1730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1731pub struct UrlMap {
1732 /// Uses API Endpoints to handle requests.
1733 #[serde(rename = "apiEndpoint")]
1734 pub api_endpoint: Option<ApiEndpointHandler>,
1735 /// Action to take when users access resources that require authentication. Defaults to redirect.
1736 #[serde(rename = "authFailAction")]
1737 pub auth_fail_action: Option<String>,
1738 /// Level of login required to access this resource. Not supported for Node.js in the App Engine standard environment.
1739 pub login: Option<String>,
1740 /// 30x code to use when performing redirects for the secure field. Defaults to 302.
1741 #[serde(rename = "redirectHttpResponseCode")]
1742 pub redirect_http_response_code: Option<String>,
1743 /// Executes a script to handle the requests that match this URL pattern. Only the auto value is supported for Node.js in the App Engine standard environment, for example "script": "auto".
1744 pub script: Option<ScriptHandler>,
1745 /// Security (HTTPS) enforcement for this URL.
1746 #[serde(rename = "securityLevel")]
1747 pub security_level: Option<String>,
1748 /// Returns the contents of a file, such as an image, as the response.
1749 #[serde(rename = "staticFiles")]
1750 pub static_files: Option<StaticFilesHandler>,
1751 /// 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.
1752 #[serde(rename = "urlRegex")]
1753 pub url_regex: Option<String>,
1754}
1755
1756impl common::Part for UrlMap {}
1757
1758/// A Version resource is a specific set of source code and configuration files that are deployed into a service.
1759///
1760/// # Activities
1761///
1762/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1763/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1764///
1765/// * [services versions create apps](AppServiceVersionCreateCall) (request)
1766/// * [services versions get apps](AppServiceVersionGetCall) (response)
1767/// * [services versions patch apps](AppServiceVersionPatchCall) (request)
1768/// * [locations applications services versions patch projects](ProjectLocationApplicationServiceVersionPatchCall) (request)
1769#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1770#[serde_with::serde_as]
1771#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1772pub struct Version {
1773 /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/endpoints).Only returned in GET requests if view=FULL is set.
1774 #[serde(rename = "apiConfig")]
1775 pub api_config: Option<ApiConfigHandler>,
1776 /// Allows App Engine second generation runtimes to access the legacy bundled services.
1777 #[serde(rename = "appEngineApis")]
1778 pub app_engine_apis: Option<bool>,
1779 /// Automatic scaling is based on request rate, response latencies, and other application metrics. Instances are dynamically created and destroyed as needed in order to handle traffic.
1780 #[serde(rename = "automaticScaling")]
1781 pub automatic_scaling: Option<AutomaticScaling>,
1782 /// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity.
1783 #[serde(rename = "basicScaling")]
1784 pub basic_scaling: Option<BasicScaling>,
1785 /// Metadata settings that are supplied to this version to enable beta runtime features.
1786 #[serde(rename = "betaSettings")]
1787 pub beta_settings: Option<HashMap<String, String>>,
1788 /// Environment variables available to the build environment.Only returned in GET requests if view=FULL is set.
1789 #[serde(rename = "buildEnvVariables")]
1790 pub build_env_variables: Option<HashMap<String, String>>,
1791 /// Time that this version was created.@OutputOnly
1792 #[serde(rename = "createTime")]
1793 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1794 /// Output only. Email address of the user who created this version.@OutputOnly
1795 #[serde(rename = "createdBy")]
1796 pub created_by: Option<String>,
1797 /// 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.
1798 #[serde(rename = "defaultExpiration")]
1799 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1800 pub default_expiration: Option<chrono::Duration>,
1801 /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set.
1802 pub deployment: Option<Deployment>,
1803 /// Output only. Total size in bytes of all the files that are included in this version and currently hosted on the App Engine disk.@OutputOnly
1804 #[serde(rename = "diskUsageBytes")]
1805 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1806 pub disk_usage_bytes: Option<i64>,
1807 /// 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.
1808 #[serde(rename = "endpointsApiService")]
1809 pub endpoints_api_service: Option<EndpointsApiService>,
1810 /// The entrypoint for the application.
1811 pub entrypoint: Option<Entrypoint>,
1812 /// App Engine execution environment for this version.Defaults to standard.
1813 pub env: Option<String>,
1814 /// Environment variables available to the application.Only returned in GET requests if view=FULL is set.
1815 #[serde(rename = "envVariables")]
1816 pub env_variables: Option<HashMap<String, String>>,
1817 /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set.
1818 #[serde(rename = "errorHandlers")]
1819 pub error_handlers: Option<Vec<ErrorHandler>>,
1820 /// Settings for App Engine flexible runtimes.
1821 #[serde(rename = "flexibleRuntimeSettings")]
1822 pub flexible_runtime_settings: Option<FlexibleRuntimeSettings>,
1823 /// Additional Google Generated Customer Metadata, this field won't be provided by default and can be requested by setting the IncludeExtraData field in GetVersionRequest
1824 #[serde(rename = "generatedCustomerMetadata")]
1825 pub generated_customer_metadata: Option<HashMap<String, serde_json::Value>>,
1826 /// 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.
1827 pub handlers: Option<Vec<UrlMap>>,
1828 /// Configures health checking for instances. Unhealthy instances are stopped and replaced with new instances. Only applicable in the App Engine flexible environment.
1829 #[serde(rename = "healthCheck")]
1830 pub health_check: Option<HealthCheck>,
1831 /// Relative name of the version within the service. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-".
1832 pub id: Option<String>,
1833 /// Before an application can receive email or XMPP messages, the application must be configured to enable the service.
1834 #[serde(rename = "inboundServices")]
1835 pub inbound_services: Option<Vec<String>>,
1836 /// Instance class that is used to run this version. Valid values are: AutomaticScaling: F1, F2, F4, F4_1G ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling.
1837 #[serde(rename = "instanceClass")]
1838 pub instance_class: Option<String>,
1839 /// Configuration for third-party Python runtime libraries that are required by the application.Only returned in GET requests if view=FULL is set.
1840 pub libraries: Option<Vec<Library>>,
1841 /// Configures liveness health checking for instances. Unhealthy instances are stopped and replaced with new instances
1842 #[serde(rename = "livenessCheck")]
1843 pub liveness_check: Option<LivenessCheck>,
1844 /// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. Manually scaled versions are sometimes referred to as "backends".
1845 #[serde(rename = "manualScaling")]
1846 pub manual_scaling: Option<ManualScaling>,
1847 /// Output only. Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly
1848 pub name: Option<String>,
1849 /// Extra network settings. Only applicable in the App Engine flexible environment.
1850 pub network: Option<Network>,
1851 /// 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.
1852 #[serde(rename = "nobuildFilesRegex")]
1853 pub nobuild_files_regex: Option<String>,
1854 /// Configures readiness health checking for instances. Unhealthy instances are not put into the backend traffic rotation.
1855 #[serde(rename = "readinessCheck")]
1856 pub readiness_check: Option<ReadinessCheck>,
1857 /// Machine resources for this version. Only applicable in the App Engine flexible environment.
1858 pub resources: Option<Resources>,
1859 /// Desired runtime. Example: python27.
1860 pub runtime: Option<String>,
1861 /// 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//config/appref
1862 #[serde(rename = "runtimeApiVersion")]
1863 pub runtime_api_version: Option<String>,
1864 /// The channel of the runtime to use. Only available for some runtimes. Defaults to the default channel.
1865 #[serde(rename = "runtimeChannel")]
1866 pub runtime_channel: Option<String>,
1867 /// The path or name of the app's main executable.
1868 #[serde(rename = "runtimeMainExecutablePath")]
1869 pub runtime_main_executable_path: Option<String>,
1870 /// The identity that the deployed version will run as. Admin API will use the App Engine Appspot service account as default if this field is neither provided in app.yaml file nor through CLI flag.
1871 #[serde(rename = "serviceAccount")]
1872 pub service_account: Option<String>,
1873 /// 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.
1874 #[serde(rename = "servingStatus")]
1875 pub serving_status: Option<String>,
1876 /// Whether multiple requests can be dispatched to this version at once.
1877 pub threadsafe: Option<bool>,
1878 /// Output only. Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com"@OutputOnly
1879 #[serde(rename = "versionUrl")]
1880 pub version_url: Option<String>,
1881 /// Whether to deploy this version in a container on a virtual machine.
1882 pub vm: Option<bool>,
1883 /// Enables VPC connectivity for standard apps.
1884 #[serde(rename = "vpcAccessConnector")]
1885 pub vpc_access_connector: Option<VpcAccessConnector>,
1886 /// The Google Compute Engine zones that are supported by this version in the App Engine flexible environment. Deprecated.
1887 pub zones: Option<Vec<String>>,
1888}
1889
1890impl common::RequestValue for Version {}
1891impl common::ResponseResult for Version {}
1892
1893/// Volumes mounted within the app container. Only applicable in the App Engine flexible environment.
1894///
1895/// This type is not used in any activity, and only used as *part* of another schema.
1896///
1897#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1898#[serde_with::serde_as]
1899#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1900pub struct Volume {
1901 /// Unique name for the volume.
1902 pub name: Option<String>,
1903 /// Volume size in gigabytes.
1904 #[serde(rename = "sizeGb")]
1905 pub size_gb: Option<f64>,
1906 /// Underlying volume type, e.g. 'tmpfs'.
1907 #[serde(rename = "volumeType")]
1908 pub volume_type: Option<String>,
1909}
1910
1911impl common::Part for Volume {}
1912
1913/// VPC access connector specification.
1914///
1915/// This type is not used in any activity, and only used as *part* of another schema.
1916///
1917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1918#[serde_with::serde_as]
1919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1920pub struct VpcAccessConnector {
1921 /// The egress setting for the connector, controlling what traffic is diverted through it.
1922 #[serde(rename = "egressSetting")]
1923 pub egress_setting: Option<String>,
1924 /// Full Serverless VPC Access Connector name e.g. projects/my-project/locations/us-central1/connectors/c1.
1925 pub name: Option<String>,
1926}
1927
1928impl common::Part for VpcAccessConnector {}
1929
1930/// The zip file information for a zip deployment.
1931///
1932/// This type is not used in any activity, and only used as *part* of another schema.
1933///
1934#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1935#[serde_with::serde_as]
1936#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1937pub struct ZipInfo {
1938 /// An estimate of the number of files in a zip for a zip deployment. If set, must be greater than or equal to the actual number of files. Used for optimizing performance; if not provided, deployment may be slow.
1939 #[serde(rename = "filesCount")]
1940 pub files_count: Option<i32>,
1941 /// URL of the zip file to deploy from. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'.
1942 #[serde(rename = "sourceUrl")]
1943 pub source_url: Option<String>,
1944}
1945
1946impl common::Part for ZipInfo {}
1947
1948// ###################
1949// MethodBuilders ###
1950// #################
1951
1952/// A builder providing access to all methods supported on *app* resources.
1953/// It is not used directly, but through the [`Appengine`] hub.
1954///
1955/// # Example
1956///
1957/// Instantiate a resource builder
1958///
1959/// ```test_harness,no_run
1960/// extern crate hyper;
1961/// extern crate hyper_rustls;
1962/// extern crate google_appengine1 as appengine1;
1963///
1964/// # async fn dox() {
1965/// use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1966///
1967/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1968/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1969/// .with_native_roots()
1970/// .unwrap()
1971/// .https_only()
1972/// .enable_http2()
1973/// .build();
1974///
1975/// let executor = hyper_util::rt::TokioExecutor::new();
1976/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1977/// secret,
1978/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1979/// yup_oauth2::client::CustomHyperClientBuilder::from(
1980/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1981/// ),
1982/// ).build().await.unwrap();
1983///
1984/// let client = hyper_util::client::legacy::Client::builder(
1985/// hyper_util::rt::TokioExecutor::new()
1986/// )
1987/// .build(
1988/// hyper_rustls::HttpsConnectorBuilder::new()
1989/// .with_native_roots()
1990/// .unwrap()
1991/// .https_or_http()
1992/// .enable_http2()
1993/// .build()
1994/// );
1995/// let mut hub = Appengine::new(client, auth);
1996/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1997/// // like `authorized_certificates_create(...)`, `authorized_certificates_delete(...)`, `authorized_certificates_get(...)`, `authorized_certificates_list(...)`, `authorized_certificates_patch(...)`, `authorized_domains_list(...)`, `create(...)`, `domain_mappings_create(...)`, `domain_mappings_delete(...)`, `domain_mappings_get(...)`, `domain_mappings_list(...)`, `domain_mappings_patch(...)`, `firewall_ingress_rules_batch_update(...)`, `firewall_ingress_rules_create(...)`, `firewall_ingress_rules_delete(...)`, `firewall_ingress_rules_get(...)`, `firewall_ingress_rules_list(...)`, `firewall_ingress_rules_patch(...)`, `get(...)`, `list_runtimes(...)`, `locations_get(...)`, `locations_list(...)`, `operations_get(...)`, `operations_list(...)`, `patch(...)`, `repair(...)`, `services_delete(...)`, `services_get(...)`, `services_list(...)`, `services_patch(...)`, `services_versions_create(...)`, `services_versions_delete(...)`, `services_versions_export_app_image(...)`, `services_versions_get(...)`, `services_versions_instances_debug(...)`, `services_versions_instances_delete(...)`, `services_versions_instances_get(...)`, `services_versions_instances_list(...)`, `services_versions_list(...)` and `services_versions_patch(...)`
1998/// // to build up your call.
1999/// let rb = hub.apps();
2000/// # }
2001/// ```
2002pub struct AppMethods<'a, C>
2003where
2004 C: 'a,
2005{
2006 hub: &'a Appengine<C>,
2007}
2008
2009impl<'a, C> common::MethodsBuilder for AppMethods<'a, C> {}
2010
2011impl<'a, C> AppMethods<'a, C> {
2012 /// Create a builder to help you perform the following task:
2013 ///
2014 /// Uploads the specified SSL certificate.
2015 ///
2016 /// # Arguments
2017 ///
2018 /// * `request` - No description provided.
2019 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2020 pub fn authorized_certificates_create(
2021 &self,
2022 request: AuthorizedCertificate,
2023 apps_id: &str,
2024 ) -> AppAuthorizedCertificateCreateCall<'a, C> {
2025 AppAuthorizedCertificateCreateCall {
2026 hub: self.hub,
2027 _request: request,
2028 _apps_id: apps_id.to_string(),
2029 _delegate: Default::default(),
2030 _additional_params: Default::default(),
2031 _scopes: Default::default(),
2032 }
2033 }
2034
2035 /// Create a builder to help you perform the following task:
2036 ///
2037 /// Deletes the specified SSL certificate.
2038 ///
2039 /// # Arguments
2040 ///
2041 /// * `appsId` - Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345.
2042 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`.
2043 pub fn authorized_certificates_delete(
2044 &self,
2045 apps_id: &str,
2046 authorized_certificates_id: &str,
2047 ) -> AppAuthorizedCertificateDeleteCall<'a, C> {
2048 AppAuthorizedCertificateDeleteCall {
2049 hub: self.hub,
2050 _apps_id: apps_id.to_string(),
2051 _authorized_certificates_id: authorized_certificates_id.to_string(),
2052 _delegate: Default::default(),
2053 _additional_params: Default::default(),
2054 _scopes: Default::default(),
2055 }
2056 }
2057
2058 /// Create a builder to help you perform the following task:
2059 ///
2060 /// Gets the specified SSL certificate.
2061 ///
2062 /// # Arguments
2063 ///
2064 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345.
2065 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`.
2066 pub fn authorized_certificates_get(
2067 &self,
2068 apps_id: &str,
2069 authorized_certificates_id: &str,
2070 ) -> AppAuthorizedCertificateGetCall<'a, C> {
2071 AppAuthorizedCertificateGetCall {
2072 hub: self.hub,
2073 _apps_id: apps_id.to_string(),
2074 _authorized_certificates_id: authorized_certificates_id.to_string(),
2075 _view: Default::default(),
2076 _delegate: Default::default(),
2077 _additional_params: Default::default(),
2078 _scopes: Default::default(),
2079 }
2080 }
2081
2082 /// Create a builder to help you perform the following task:
2083 ///
2084 /// Lists all SSL certificates the user is authorized to administer.
2085 ///
2086 /// # Arguments
2087 ///
2088 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2089 pub fn authorized_certificates_list(
2090 &self,
2091 apps_id: &str,
2092 ) -> AppAuthorizedCertificateListCall<'a, C> {
2093 AppAuthorizedCertificateListCall {
2094 hub: self.hub,
2095 _apps_id: apps_id.to_string(),
2096 _view: Default::default(),
2097 _page_token: Default::default(),
2098 _page_size: Default::default(),
2099 _delegate: Default::default(),
2100 _additional_params: Default::default(),
2101 _scopes: Default::default(),
2102 }
2103 }
2104
2105 /// Create a builder to help you perform the following task:
2106 ///
2107 /// Updates the specified SSL certificate. To renew a certificate and maintain its existing domain mappings, update certificate_data with a new certificate. The new certificate must be applicable to the same domains as the original certificate. The certificate display_name may also be updated.
2108 ///
2109 /// # Arguments
2110 ///
2111 /// * `request` - No description provided.
2112 /// * `appsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345.
2113 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`.
2114 pub fn authorized_certificates_patch(
2115 &self,
2116 request: AuthorizedCertificate,
2117 apps_id: &str,
2118 authorized_certificates_id: &str,
2119 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
2120 AppAuthorizedCertificatePatchCall {
2121 hub: self.hub,
2122 _request: request,
2123 _apps_id: apps_id.to_string(),
2124 _authorized_certificates_id: authorized_certificates_id.to_string(),
2125 _update_mask: Default::default(),
2126 _delegate: Default::default(),
2127 _additional_params: Default::default(),
2128 _scopes: Default::default(),
2129 }
2130 }
2131
2132 /// Create a builder to help you perform the following task:
2133 ///
2134 /// Lists all domains the user is authorized to administer.
2135 ///
2136 /// # Arguments
2137 ///
2138 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2139 pub fn authorized_domains_list(&self, apps_id: &str) -> AppAuthorizedDomainListCall<'a, C> {
2140 AppAuthorizedDomainListCall {
2141 hub: self.hub,
2142 _apps_id: apps_id.to_string(),
2143 _page_token: Default::default(),
2144 _page_size: Default::default(),
2145 _delegate: Default::default(),
2146 _additional_params: Default::default(),
2147 _scopes: Default::default(),
2148 }
2149 }
2150
2151 /// Create a builder to help you perform the following task:
2152 ///
2153 /// Maps a domain to an application. A user must be authorized to administer a domain in order to map it to an application. For a list of available authorized domains, see AuthorizedDomains.ListAuthorizedDomains.
2154 ///
2155 /// # Arguments
2156 ///
2157 /// * `request` - No description provided.
2158 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2159 pub fn domain_mappings_create(
2160 &self,
2161 request: DomainMapping,
2162 apps_id: &str,
2163 ) -> AppDomainMappingCreateCall<'a, C> {
2164 AppDomainMappingCreateCall {
2165 hub: self.hub,
2166 _request: request,
2167 _apps_id: apps_id.to_string(),
2168 _override_strategy: Default::default(),
2169 _delegate: Default::default(),
2170 _additional_params: Default::default(),
2171 _scopes: Default::default(),
2172 }
2173 }
2174
2175 /// Create a builder to help you perform the following task:
2176 ///
2177 /// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource.
2178 ///
2179 /// # Arguments
2180 ///
2181 /// * `appsId` - Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com.
2182 /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`.
2183 pub fn domain_mappings_delete(
2184 &self,
2185 apps_id: &str,
2186 domain_mappings_id: &str,
2187 ) -> AppDomainMappingDeleteCall<'a, C> {
2188 AppDomainMappingDeleteCall {
2189 hub: self.hub,
2190 _apps_id: apps_id.to_string(),
2191 _domain_mappings_id: domain_mappings_id.to_string(),
2192 _delegate: Default::default(),
2193 _additional_params: Default::default(),
2194 _scopes: Default::default(),
2195 }
2196 }
2197
2198 /// Create a builder to help you perform the following task:
2199 ///
2200 /// Gets the specified domain mapping.
2201 ///
2202 /// # Arguments
2203 ///
2204 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/domainMappings/example.com.
2205 /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`.
2206 pub fn domain_mappings_get(
2207 &self,
2208 apps_id: &str,
2209 domain_mappings_id: &str,
2210 ) -> AppDomainMappingGetCall<'a, C> {
2211 AppDomainMappingGetCall {
2212 hub: self.hub,
2213 _apps_id: apps_id.to_string(),
2214 _domain_mappings_id: domain_mappings_id.to_string(),
2215 _delegate: Default::default(),
2216 _additional_params: Default::default(),
2217 _scopes: Default::default(),
2218 }
2219 }
2220
2221 /// Create a builder to help you perform the following task:
2222 ///
2223 /// Lists the domain mappings on an application.
2224 ///
2225 /// # Arguments
2226 ///
2227 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2228 pub fn domain_mappings_list(&self, apps_id: &str) -> AppDomainMappingListCall<'a, C> {
2229 AppDomainMappingListCall {
2230 hub: self.hub,
2231 _apps_id: apps_id.to_string(),
2232 _page_token: Default::default(),
2233 _page_size: Default::default(),
2234 _delegate: Default::default(),
2235 _additional_params: Default::default(),
2236 _scopes: Default::default(),
2237 }
2238 }
2239
2240 /// Create a builder to help you perform the following task:
2241 ///
2242 /// Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update certificate_id to point to an AuthorizedCertificate resource. A user must be authorized to administer the associated domain in order to update a DomainMapping resource.
2243 ///
2244 /// # Arguments
2245 ///
2246 /// * `request` - No description provided.
2247 /// * `appsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/domainMappings/example.com.
2248 /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`.
2249 pub fn domain_mappings_patch(
2250 &self,
2251 request: DomainMapping,
2252 apps_id: &str,
2253 domain_mappings_id: &str,
2254 ) -> AppDomainMappingPatchCall<'a, C> {
2255 AppDomainMappingPatchCall {
2256 hub: self.hub,
2257 _request: request,
2258 _apps_id: apps_id.to_string(),
2259 _domain_mappings_id: domain_mappings_id.to_string(),
2260 _update_mask: Default::default(),
2261 _delegate: Default::default(),
2262 _additional_params: Default::default(),
2263 _scopes: Default::default(),
2264 }
2265 }
2266
2267 /// Create a builder to help you perform the following task:
2268 ///
2269 /// Replaces the entire firewall ruleset in one bulk operation. This overrides and replaces the rules of an existing firewall with the new rules.If the final rule does not match traffic with the '*' wildcard IP range, then an "allow all" rule is explicitly added to the end of the list.
2270 ///
2271 /// # Arguments
2272 ///
2273 /// * `request` - No description provided.
2274 /// * `appsId` - Part of `name`. Name of the Firewall collection to set. Example: apps/myapp/firewall/ingressRules.
2275 pub fn firewall_ingress_rules_batch_update(
2276 &self,
2277 request: BatchUpdateIngressRulesRequest,
2278 apps_id: &str,
2279 ) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
2280 AppFirewallIngressRuleBatchUpdateCall {
2281 hub: self.hub,
2282 _request: request,
2283 _apps_id: apps_id.to_string(),
2284 _delegate: Default::default(),
2285 _additional_params: Default::default(),
2286 _scopes: Default::default(),
2287 }
2288 }
2289
2290 /// Create a builder to help you perform the following task:
2291 ///
2292 /// Creates a firewall rule for the application.
2293 ///
2294 /// # Arguments
2295 ///
2296 /// * `request` - No description provided.
2297 /// * `appsId` - Part of `parent`. Required. Name of the parent Firewall collection in which to create a new rule. Example: apps/myapp/firewall/ingressRules.
2298 pub fn firewall_ingress_rules_create(
2299 &self,
2300 request: FirewallRule,
2301 apps_id: &str,
2302 ) -> AppFirewallIngressRuleCreateCall<'a, C> {
2303 AppFirewallIngressRuleCreateCall {
2304 hub: self.hub,
2305 _request: request,
2306 _apps_id: apps_id.to_string(),
2307 _delegate: Default::default(),
2308 _additional_params: Default::default(),
2309 _scopes: Default::default(),
2310 }
2311 }
2312
2313 /// Create a builder to help you perform the following task:
2314 ///
2315 /// Deletes the specified firewall rule.
2316 ///
2317 /// # Arguments
2318 ///
2319 /// * `appsId` - Part of `name`. Name of the Firewall resource to delete. Example: apps/myapp/firewall/ingressRules/100.
2320 /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`.
2321 pub fn firewall_ingress_rules_delete(
2322 &self,
2323 apps_id: &str,
2324 ingress_rules_id: &str,
2325 ) -> AppFirewallIngressRuleDeleteCall<'a, C> {
2326 AppFirewallIngressRuleDeleteCall {
2327 hub: self.hub,
2328 _apps_id: apps_id.to_string(),
2329 _ingress_rules_id: ingress_rules_id.to_string(),
2330 _delegate: Default::default(),
2331 _additional_params: Default::default(),
2332 _scopes: Default::default(),
2333 }
2334 }
2335
2336 /// Create a builder to help you perform the following task:
2337 ///
2338 /// Gets the specified firewall rule.
2339 ///
2340 /// # Arguments
2341 ///
2342 /// * `appsId` - Part of `name`. Name of the Firewall resource to retrieve. Example: apps/myapp/firewall/ingressRules/100.
2343 /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`.
2344 pub fn firewall_ingress_rules_get(
2345 &self,
2346 apps_id: &str,
2347 ingress_rules_id: &str,
2348 ) -> AppFirewallIngressRuleGetCall<'a, C> {
2349 AppFirewallIngressRuleGetCall {
2350 hub: self.hub,
2351 _apps_id: apps_id.to_string(),
2352 _ingress_rules_id: ingress_rules_id.to_string(),
2353 _delegate: Default::default(),
2354 _additional_params: Default::default(),
2355 _scopes: Default::default(),
2356 }
2357 }
2358
2359 /// Create a builder to help you perform the following task:
2360 ///
2361 /// Lists the firewall rules of an application.
2362 ///
2363 /// # Arguments
2364 ///
2365 /// * `appsId` - Part of `parent`. Name of the Firewall collection to retrieve. Example: apps/myapp/firewall/ingressRules.
2366 pub fn firewall_ingress_rules_list(
2367 &self,
2368 apps_id: &str,
2369 ) -> AppFirewallIngressRuleListCall<'a, C> {
2370 AppFirewallIngressRuleListCall {
2371 hub: self.hub,
2372 _apps_id: apps_id.to_string(),
2373 _page_token: Default::default(),
2374 _page_size: Default::default(),
2375 _matching_address: Default::default(),
2376 _delegate: Default::default(),
2377 _additional_params: Default::default(),
2378 _scopes: Default::default(),
2379 }
2380 }
2381
2382 /// Create a builder to help you perform the following task:
2383 ///
2384 /// Updates the specified firewall rule.
2385 ///
2386 /// # Arguments
2387 ///
2388 /// * `request` - No description provided.
2389 /// * `appsId` - Part of `name`. Name of the Firewall resource to update. Example: apps/myapp/firewall/ingressRules/100.
2390 /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`.
2391 pub fn firewall_ingress_rules_patch(
2392 &self,
2393 request: FirewallRule,
2394 apps_id: &str,
2395 ingress_rules_id: &str,
2396 ) -> AppFirewallIngressRulePatchCall<'a, C> {
2397 AppFirewallIngressRulePatchCall {
2398 hub: self.hub,
2399 _request: request,
2400 _apps_id: apps_id.to_string(),
2401 _ingress_rules_id: ingress_rules_id.to_string(),
2402 _update_mask: Default::default(),
2403 _delegate: Default::default(),
2404 _additional_params: Default::default(),
2405 _scopes: Default::default(),
2406 }
2407 }
2408
2409 /// Create a builder to help you perform the following task:
2410 ///
2411 /// Gets information about a location.
2412 ///
2413 /// # Arguments
2414 ///
2415 /// * `appsId` - Part of `name`. Resource name for the location.
2416 /// * `locationsId` - Part of `name`. See documentation of `appsId`.
2417 pub fn locations_get(&self, apps_id: &str, locations_id: &str) -> AppLocationGetCall<'a, C> {
2418 AppLocationGetCall {
2419 hub: self.hub,
2420 _apps_id: apps_id.to_string(),
2421 _locations_id: locations_id.to_string(),
2422 _delegate: Default::default(),
2423 _additional_params: Default::default(),
2424 _scopes: Default::default(),
2425 }
2426 }
2427
2428 /// Create a builder to help you perform the following task:
2429 ///
2430 /// Lists information about the supported locations for this service.
2431 ///
2432 /// # Arguments
2433 ///
2434 /// * `appsId` - Part of `name`. The resource that owns the locations collection, if applicable.
2435 pub fn locations_list(&self, apps_id: &str) -> AppLocationListCall<'a, C> {
2436 AppLocationListCall {
2437 hub: self.hub,
2438 _apps_id: apps_id.to_string(),
2439 _page_token: Default::default(),
2440 _page_size: Default::default(),
2441 _filter: Default::default(),
2442 _extra_location_types: Default::default(),
2443 _delegate: Default::default(),
2444 _additional_params: Default::default(),
2445 _scopes: Default::default(),
2446 }
2447 }
2448
2449 /// Create a builder to help you perform the following task:
2450 ///
2451 /// 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.
2452 ///
2453 /// # Arguments
2454 ///
2455 /// * `appsId` - Part of `name`. The name of the operation resource.
2456 /// * `operationsId` - Part of `name`. See documentation of `appsId`.
2457 pub fn operations_get(&self, apps_id: &str, operations_id: &str) -> AppOperationGetCall<'a, C> {
2458 AppOperationGetCall {
2459 hub: self.hub,
2460 _apps_id: apps_id.to_string(),
2461 _operations_id: operations_id.to_string(),
2462 _delegate: Default::default(),
2463 _additional_params: Default::default(),
2464 _scopes: Default::default(),
2465 }
2466 }
2467
2468 /// Create a builder to help you perform the following task:
2469 ///
2470 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
2471 ///
2472 /// # Arguments
2473 ///
2474 /// * `appsId` - Part of `name`. The name of the operation's parent resource.
2475 pub fn operations_list(&self, apps_id: &str) -> AppOperationListCall<'a, C> {
2476 AppOperationListCall {
2477 hub: self.hub,
2478 _apps_id: apps_id.to_string(),
2479 _return_partial_success: Default::default(),
2480 _page_token: Default::default(),
2481 _page_size: Default::default(),
2482 _filter: Default::default(),
2483 _delegate: Default::default(),
2484 _additional_params: Default::default(),
2485 _scopes: Default::default(),
2486 }
2487 }
2488
2489 /// Create a builder to help you perform the following task:
2490 ///
2491 /// 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.
2492 ///
2493 /// # Arguments
2494 ///
2495 /// * `request` - No description provided.
2496 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
2497 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2498 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2499 /// * `instancesId` - Part of `name`. See documentation of `appsId`.
2500 pub fn services_versions_instances_debug(
2501 &self,
2502 request: DebugInstanceRequest,
2503 apps_id: &str,
2504 services_id: &str,
2505 versions_id: &str,
2506 instances_id: &str,
2507 ) -> AppServiceVersionInstanceDebugCall<'a, C> {
2508 AppServiceVersionInstanceDebugCall {
2509 hub: self.hub,
2510 _request: request,
2511 _apps_id: apps_id.to_string(),
2512 _services_id: services_id.to_string(),
2513 _versions_id: versions_id.to_string(),
2514 _instances_id: instances_id.to_string(),
2515 _delegate: Default::default(),
2516 _additional_params: Default::default(),
2517 _scopes: Default::default(),
2518 }
2519 }
2520
2521 /// Create a builder to help you perform the following task:
2522 ///
2523 /// Stops a running instance.The instance might be automatically recreated based on the scaling settings of the version. For more information, see "How Instances are Managed" (standard environment (https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed) | flexible environment (https://cloud.google.com/appengine/docs/flexible/python/how-instances-are-managed)).To ensure that instances are not re-created and avoid getting billed, you can stop all instances within the target version by changing the serving status of the version to STOPPED with the apps.services.versions.patch (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions/patch) method.
2524 ///
2525 /// # Arguments
2526 ///
2527 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
2528 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2529 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2530 /// * `instancesId` - Part of `name`. See documentation of `appsId`.
2531 pub fn services_versions_instances_delete(
2532 &self,
2533 apps_id: &str,
2534 services_id: &str,
2535 versions_id: &str,
2536 instances_id: &str,
2537 ) -> AppServiceVersionInstanceDeleteCall<'a, C> {
2538 AppServiceVersionInstanceDeleteCall {
2539 hub: self.hub,
2540 _apps_id: apps_id.to_string(),
2541 _services_id: services_id.to_string(),
2542 _versions_id: versions_id.to_string(),
2543 _instances_id: instances_id.to_string(),
2544 _delegate: Default::default(),
2545 _additional_params: Default::default(),
2546 _scopes: Default::default(),
2547 }
2548 }
2549
2550 /// Create a builder to help you perform the following task:
2551 ///
2552 /// Gets instance information.
2553 ///
2554 /// # Arguments
2555 ///
2556 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
2557 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2558 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2559 /// * `instancesId` - Part of `name`. See documentation of `appsId`.
2560 pub fn services_versions_instances_get(
2561 &self,
2562 apps_id: &str,
2563 services_id: &str,
2564 versions_id: &str,
2565 instances_id: &str,
2566 ) -> AppServiceVersionInstanceGetCall<'a, C> {
2567 AppServiceVersionInstanceGetCall {
2568 hub: self.hub,
2569 _apps_id: apps_id.to_string(),
2570 _services_id: services_id.to_string(),
2571 _versions_id: versions_id.to_string(),
2572 _instances_id: instances_id.to_string(),
2573 _delegate: Default::default(),
2574 _additional_params: Default::default(),
2575 _scopes: Default::default(),
2576 }
2577 }
2578
2579 /// Create a builder to help you perform the following task:
2580 ///
2581 /// 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).
2582 ///
2583 /// # Arguments
2584 ///
2585 /// * `appsId` - Part of `parent`. Required. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1.
2586 /// * `servicesId` - Part of `parent`. See documentation of `appsId`.
2587 /// * `versionsId` - Part of `parent`. See documentation of `appsId`.
2588 pub fn services_versions_instances_list(
2589 &self,
2590 apps_id: &str,
2591 services_id: &str,
2592 versions_id: &str,
2593 ) -> AppServiceVersionInstanceListCall<'a, C> {
2594 AppServiceVersionInstanceListCall {
2595 hub: self.hub,
2596 _apps_id: apps_id.to_string(),
2597 _services_id: services_id.to_string(),
2598 _versions_id: versions_id.to_string(),
2599 _page_token: Default::default(),
2600 _page_size: Default::default(),
2601 _delegate: Default::default(),
2602 _additional_params: Default::default(),
2603 _scopes: Default::default(),
2604 }
2605 }
2606
2607 /// Create a builder to help you perform the following task:
2608 ///
2609 /// Deploys code and resource files to a new version.
2610 ///
2611 /// # Arguments
2612 ///
2613 /// * `request` - No description provided.
2614 /// * `appsId` - Part of `parent`. Required. Name of the parent resource to create this version under. Example: apps/myapp/services/default.
2615 /// * `servicesId` - Part of `parent`. See documentation of `appsId`.
2616 pub fn services_versions_create(
2617 &self,
2618 request: Version,
2619 apps_id: &str,
2620 services_id: &str,
2621 ) -> AppServiceVersionCreateCall<'a, C> {
2622 AppServiceVersionCreateCall {
2623 hub: self.hub,
2624 _request: request,
2625 _apps_id: apps_id.to_string(),
2626 _services_id: services_id.to_string(),
2627 _delegate: Default::default(),
2628 _additional_params: Default::default(),
2629 _scopes: Default::default(),
2630 }
2631 }
2632
2633 /// Create a builder to help you perform the following task:
2634 ///
2635 /// Deletes an existing Version resource.
2636 ///
2637 /// # Arguments
2638 ///
2639 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
2640 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2641 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2642 pub fn services_versions_delete(
2643 &self,
2644 apps_id: &str,
2645 services_id: &str,
2646 versions_id: &str,
2647 ) -> AppServiceVersionDeleteCall<'a, C> {
2648 AppServiceVersionDeleteCall {
2649 hub: self.hub,
2650 _apps_id: apps_id.to_string(),
2651 _services_id: services_id.to_string(),
2652 _versions_id: versions_id.to_string(),
2653 _delegate: Default::default(),
2654 _additional_params: Default::default(),
2655 _scopes: Default::default(),
2656 }
2657 }
2658
2659 /// Create a builder to help you perform the following task:
2660 ///
2661 /// Exports a user image to Artifact Registry.
2662 ///
2663 /// # Arguments
2664 ///
2665 /// * `request` - No description provided.
2666 /// * `appsId` - Part of `name`. Required. Name of the App Engine version resource. Format: apps/{app}/services/{service}/versions/{version}
2667 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2668 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2669 pub fn services_versions_export_app_image(
2670 &self,
2671 request: ExportAppImageRequest,
2672 apps_id: &str,
2673 services_id: &str,
2674 versions_id: &str,
2675 ) -> AppServiceVersionExportAppImageCall<'a, C> {
2676 AppServiceVersionExportAppImageCall {
2677 hub: self.hub,
2678 _request: request,
2679 _apps_id: apps_id.to_string(),
2680 _services_id: services_id.to_string(),
2681 _versions_id: versions_id.to_string(),
2682 _delegate: Default::default(),
2683 _additional_params: Default::default(),
2684 _scopes: Default::default(),
2685 }
2686 }
2687
2688 /// Create a builder to help you perform the following task:
2689 ///
2690 /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.
2691 ///
2692 /// # Arguments
2693 ///
2694 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
2695 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2696 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2697 pub fn services_versions_get(
2698 &self,
2699 apps_id: &str,
2700 services_id: &str,
2701 versions_id: &str,
2702 ) -> AppServiceVersionGetCall<'a, C> {
2703 AppServiceVersionGetCall {
2704 hub: self.hub,
2705 _apps_id: apps_id.to_string(),
2706 _services_id: services_id.to_string(),
2707 _versions_id: versions_id.to_string(),
2708 _view: Default::default(),
2709 _delegate: Default::default(),
2710 _additional_params: Default::default(),
2711 _scopes: Default::default(),
2712 }
2713 }
2714
2715 /// Create a builder to help you perform the following task:
2716 ///
2717 /// Lists the versions of a service.
2718 ///
2719 /// # Arguments
2720 ///
2721 /// * `appsId` - Part of `parent`. Required. Name of the parent Service resource. Example: apps/myapp/services/default.
2722 /// * `servicesId` - Part of `parent`. See documentation of `appsId`.
2723 pub fn services_versions_list(
2724 &self,
2725 apps_id: &str,
2726 services_id: &str,
2727 ) -> AppServiceVersionListCall<'a, C> {
2728 AppServiceVersionListCall {
2729 hub: self.hub,
2730 _apps_id: apps_id.to_string(),
2731 _services_id: services_id.to_string(),
2732 _view: Default::default(),
2733 _page_token: Default::default(),
2734 _page_size: Default::default(),
2735 _delegate: Default::default(),
2736 _additional_params: Default::default(),
2737 _scopes: Default::default(),
2738 }
2739 }
2740
2741 /// Create a builder to help you perform the following task:
2742 ///
2743 /// 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:Standard environment instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class)automatic scaling in the standard environment: automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automaticScaling.standard_scheduler_settings.max_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.min_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_cpu_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_throughput_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings)basic scaling or manual scaling in the standard environment: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)Flexible environment serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status)automatic scaling in the flexible environment: automatic_scaling.min_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cool_down_period_sec (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cpu_utilization.target_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling)manual scaling in the flexible environment: manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)
2744 ///
2745 /// # Arguments
2746 ///
2747 /// * `request` - No description provided.
2748 /// * `appsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default/versions/1.
2749 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2750 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2751 pub fn services_versions_patch(
2752 &self,
2753 request: Version,
2754 apps_id: &str,
2755 services_id: &str,
2756 versions_id: &str,
2757 ) -> AppServiceVersionPatchCall<'a, C> {
2758 AppServiceVersionPatchCall {
2759 hub: self.hub,
2760 _request: request,
2761 _apps_id: apps_id.to_string(),
2762 _services_id: services_id.to_string(),
2763 _versions_id: versions_id.to_string(),
2764 _update_mask: Default::default(),
2765 _delegate: Default::default(),
2766 _additional_params: Default::default(),
2767 _scopes: Default::default(),
2768 }
2769 }
2770
2771 /// Create a builder to help you perform the following task:
2772 ///
2773 /// Deletes the specified service and all enclosed versions.
2774 ///
2775 /// # Arguments
2776 ///
2777 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default.
2778 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2779 pub fn services_delete(&self, apps_id: &str, services_id: &str) -> AppServiceDeleteCall<'a, C> {
2780 AppServiceDeleteCall {
2781 hub: self.hub,
2782 _apps_id: apps_id.to_string(),
2783 _services_id: services_id.to_string(),
2784 _delegate: Default::default(),
2785 _additional_params: Default::default(),
2786 _scopes: Default::default(),
2787 }
2788 }
2789
2790 /// Create a builder to help you perform the following task:
2791 ///
2792 /// Gets the current configuration of the specified service.
2793 ///
2794 /// # Arguments
2795 ///
2796 /// * `appsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default.
2797 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2798 pub fn services_get(&self, apps_id: &str, services_id: &str) -> AppServiceGetCall<'a, C> {
2799 AppServiceGetCall {
2800 hub: self.hub,
2801 _apps_id: apps_id.to_string(),
2802 _services_id: services_id.to_string(),
2803 _delegate: Default::default(),
2804 _additional_params: Default::default(),
2805 _scopes: Default::default(),
2806 }
2807 }
2808
2809 /// Create a builder to help you perform the following task:
2810 ///
2811 /// Lists all the services in the application.
2812 ///
2813 /// # Arguments
2814 ///
2815 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2816 pub fn services_list(&self, apps_id: &str) -> AppServiceListCall<'a, C> {
2817 AppServiceListCall {
2818 hub: self.hub,
2819 _apps_id: apps_id.to_string(),
2820 _page_token: Default::default(),
2821 _page_size: Default::default(),
2822 _delegate: Default::default(),
2823 _additional_params: Default::default(),
2824 _scopes: Default::default(),
2825 }
2826 }
2827
2828 /// Create a builder to help you perform the following task:
2829 ///
2830 /// Updates the configuration of the specified service.
2831 ///
2832 /// # Arguments
2833 ///
2834 /// * `request` - No description provided.
2835 /// * `appsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default.
2836 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2837 pub fn services_patch(
2838 &self,
2839 request: Service,
2840 apps_id: &str,
2841 services_id: &str,
2842 ) -> AppServicePatchCall<'a, C> {
2843 AppServicePatchCall {
2844 hub: self.hub,
2845 _request: request,
2846 _apps_id: apps_id.to_string(),
2847 _services_id: services_id.to_string(),
2848 _update_mask: Default::default(),
2849 _migrate_traffic: Default::default(),
2850 _delegate: Default::default(),
2851 _additional_params: Default::default(),
2852 _scopes: Default::default(),
2853 }
2854 }
2855
2856 /// Create a builder to help you perform the following task:
2857 ///
2858 /// Creates an App Engine application for a Google Cloud Platform project. Required fields: id - The ID of the target Cloud Platform project. 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/standard/python/console/).
2859 ///
2860 /// # Arguments
2861 ///
2862 /// * `request` - No description provided.
2863 pub fn create(&self, request: Application) -> AppCreateCall<'a, C> {
2864 AppCreateCall {
2865 hub: self.hub,
2866 _request: request,
2867 _delegate: Default::default(),
2868 _additional_params: Default::default(),
2869 _scopes: Default::default(),
2870 }
2871 }
2872
2873 /// Create a builder to help you perform the following task:
2874 ///
2875 /// Gets information about an application.
2876 ///
2877 /// # Arguments
2878 ///
2879 /// * `appsId` - Part of `name`. Required. Name of the Application resource to get. Example: apps/myapp.
2880 pub fn get(&self, apps_id: &str) -> AppGetCall<'a, C> {
2881 AppGetCall {
2882 hub: self.hub,
2883 _apps_id: apps_id.to_string(),
2884 _include_extra_data: Default::default(),
2885 _delegate: Default::default(),
2886 _additional_params: Default::default(),
2887 _scopes: Default::default(),
2888 }
2889 }
2890
2891 /// Create a builder to help you perform the following task:
2892 ///
2893 /// Lists all the available runtimes for the application.
2894 ///
2895 /// # Arguments
2896 ///
2897 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2898 pub fn list_runtimes(&self, apps_id: &str) -> AppListRuntimeCall<'a, C> {
2899 AppListRuntimeCall {
2900 hub: self.hub,
2901 _apps_id: apps_id.to_string(),
2902 _environment: Default::default(),
2903 _delegate: Default::default(),
2904 _additional_params: Default::default(),
2905 _scopes: Default::default(),
2906 }
2907 }
2908
2909 /// Create a builder to help you perform the following task:
2910 ///
2911 /// Updates the specified Application resource. You can update the following fields: auth_domain - Google authentication domain for controlling user access to the application. default_cookie_expiration - Cookie expiration policy for the application. iap - Identity-Aware Proxy properties for the application.
2912 ///
2913 /// # Arguments
2914 ///
2915 /// * `request` - No description provided.
2916 /// * `appsId` - Part of `name`. Required. Name of the Application resource to update. Example: apps/myapp.
2917 pub fn patch(&self, request: Application, apps_id: &str) -> AppPatchCall<'a, C> {
2918 AppPatchCall {
2919 hub: self.hub,
2920 _request: request,
2921 _apps_id: apps_id.to_string(),
2922 _update_mask: Default::default(),
2923 _delegate: Default::default(),
2924 _additional_params: Default::default(),
2925 _scopes: Default::default(),
2926 }
2927 }
2928
2929 /// Create a builder to help you perform the following task:
2930 ///
2931 /// Recreates the required App Engine features for the specified App Engine application, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example, Error retrieving the App Engine service account. If you have deleted your App Engine service account, this will not be able to recreate it. Instead, you should attempt to use the IAM undelete API if possible at https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete?apix_params=%7B"name"%3A"projects%2F-%2FserviceAccounts%2Funique_id"%2C"resource"%3A%7B%7D%7D . If the deletion was recent, the numeric ID can be found in the Cloud Console Activity Log.
2932 ///
2933 /// # Arguments
2934 ///
2935 /// * `request` - No description provided.
2936 /// * `appsId` - Part of `name`. Required. Name of the application to repair. Example: apps/myapp
2937 pub fn repair(&self, request: RepairApplicationRequest, apps_id: &str) -> AppRepairCall<'a, C> {
2938 AppRepairCall {
2939 hub: self.hub,
2940 _request: request,
2941 _apps_id: apps_id.to_string(),
2942 _delegate: Default::default(),
2943 _additional_params: Default::default(),
2944 _scopes: Default::default(),
2945 }
2946 }
2947}
2948
2949/// A builder providing access to all methods supported on *project* resources.
2950/// It is not used directly, but through the [`Appengine`] hub.
2951///
2952/// # Example
2953///
2954/// Instantiate a resource builder
2955///
2956/// ```test_harness,no_run
2957/// extern crate hyper;
2958/// extern crate hyper_rustls;
2959/// extern crate google_appengine1 as appengine1;
2960///
2961/// # async fn dox() {
2962/// use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2963///
2964/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2965/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2966/// .with_native_roots()
2967/// .unwrap()
2968/// .https_only()
2969/// .enable_http2()
2970/// .build();
2971///
2972/// let executor = hyper_util::rt::TokioExecutor::new();
2973/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2974/// secret,
2975/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2976/// yup_oauth2::client::CustomHyperClientBuilder::from(
2977/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2978/// ),
2979/// ).build().await.unwrap();
2980///
2981/// let client = hyper_util::client::legacy::Client::builder(
2982/// hyper_util::rt::TokioExecutor::new()
2983/// )
2984/// .build(
2985/// hyper_rustls::HttpsConnectorBuilder::new()
2986/// .with_native_roots()
2987/// .unwrap()
2988/// .https_or_http()
2989/// .enable_http2()
2990/// .build()
2991/// );
2992/// let mut hub = Appengine::new(client, auth);
2993/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2994/// // like `locations_applications_authorized_certificates_create(...)`, `locations_applications_authorized_certificates_delete(...)`, `locations_applications_authorized_certificates_get(...)`, `locations_applications_authorized_certificates_list(...)`, `locations_applications_authorized_certificates_patch(...)`, `locations_applications_authorized_domains_list(...)`, `locations_applications_domain_mappings_create(...)`, `locations_applications_domain_mappings_delete(...)`, `locations_applications_domain_mappings_get(...)`, `locations_applications_domain_mappings_list(...)`, `locations_applications_domain_mappings_patch(...)`, `locations_applications_patch(...)`, `locations_applications_services_delete(...)`, `locations_applications_services_patch(...)`, `locations_applications_services_versions_delete(...)`, `locations_applications_services_versions_export_app_image(...)` and `locations_applications_services_versions_patch(...)`
2995/// // to build up your call.
2996/// let rb = hub.projects();
2997/// # }
2998/// ```
2999pub struct ProjectMethods<'a, C>
3000where
3001 C: 'a,
3002{
3003 hub: &'a Appengine<C>,
3004}
3005
3006impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3007
3008impl<'a, C> ProjectMethods<'a, C> {
3009 /// Create a builder to help you perform the following task:
3010 ///
3011 /// Uploads the specified SSL certificate.
3012 ///
3013 /// # Arguments
3014 ///
3015 /// * `request` - No description provided.
3016 /// * `projectsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
3017 /// * `locationsId` - Part of `parent`. See documentation of `projectsId`.
3018 /// * `applicationsId` - Part of `parent`. See documentation of `projectsId`.
3019 pub fn locations_applications_authorized_certificates_create(
3020 &self,
3021 request: AuthorizedCertificate,
3022 projects_id: &str,
3023 locations_id: &str,
3024 applications_id: &str,
3025 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C> {
3026 ProjectLocationApplicationAuthorizedCertificateCreateCall {
3027 hub: self.hub,
3028 _request: request,
3029 _projects_id: projects_id.to_string(),
3030 _locations_id: locations_id.to_string(),
3031 _applications_id: applications_id.to_string(),
3032 _delegate: Default::default(),
3033 _additional_params: Default::default(),
3034 _scopes: Default::default(),
3035 }
3036 }
3037
3038 /// Create a builder to help you perform the following task:
3039 ///
3040 /// Deletes the specified SSL certificate.
3041 ///
3042 /// # Arguments
3043 ///
3044 /// * `projectsId` - Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345.
3045 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3046 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3047 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `projectsId`.
3048 pub fn locations_applications_authorized_certificates_delete(
3049 &self,
3050 projects_id: &str,
3051 locations_id: &str,
3052 applications_id: &str,
3053 authorized_certificates_id: &str,
3054 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C> {
3055 ProjectLocationApplicationAuthorizedCertificateDeleteCall {
3056 hub: self.hub,
3057 _projects_id: projects_id.to_string(),
3058 _locations_id: locations_id.to_string(),
3059 _applications_id: applications_id.to_string(),
3060 _authorized_certificates_id: authorized_certificates_id.to_string(),
3061 _delegate: Default::default(),
3062 _additional_params: Default::default(),
3063 _scopes: Default::default(),
3064 }
3065 }
3066
3067 /// Create a builder to help you perform the following task:
3068 ///
3069 /// Gets the specified SSL certificate.
3070 ///
3071 /// # Arguments
3072 ///
3073 /// * `projectsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345.
3074 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3075 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3076 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `projectsId`.
3077 pub fn locations_applications_authorized_certificates_get(
3078 &self,
3079 projects_id: &str,
3080 locations_id: &str,
3081 applications_id: &str,
3082 authorized_certificates_id: &str,
3083 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
3084 ProjectLocationApplicationAuthorizedCertificateGetCall {
3085 hub: self.hub,
3086 _projects_id: projects_id.to_string(),
3087 _locations_id: locations_id.to_string(),
3088 _applications_id: applications_id.to_string(),
3089 _authorized_certificates_id: authorized_certificates_id.to_string(),
3090 _view: Default::default(),
3091 _delegate: Default::default(),
3092 _additional_params: Default::default(),
3093 _scopes: Default::default(),
3094 }
3095 }
3096
3097 /// Create a builder to help you perform the following task:
3098 ///
3099 /// Lists all SSL certificates the user is authorized to administer.
3100 ///
3101 /// # Arguments
3102 ///
3103 /// * `projectsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
3104 /// * `locationsId` - Part of `parent`. See documentation of `projectsId`.
3105 /// * `applicationsId` - Part of `parent`. See documentation of `projectsId`.
3106 pub fn locations_applications_authorized_certificates_list(
3107 &self,
3108 projects_id: &str,
3109 locations_id: &str,
3110 applications_id: &str,
3111 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
3112 ProjectLocationApplicationAuthorizedCertificateListCall {
3113 hub: self.hub,
3114 _projects_id: projects_id.to_string(),
3115 _locations_id: locations_id.to_string(),
3116 _applications_id: applications_id.to_string(),
3117 _view: Default::default(),
3118 _page_token: Default::default(),
3119 _page_size: Default::default(),
3120 _delegate: Default::default(),
3121 _additional_params: Default::default(),
3122 _scopes: Default::default(),
3123 }
3124 }
3125
3126 /// Create a builder to help you perform the following task:
3127 ///
3128 /// Updates the specified SSL certificate. To renew a certificate and maintain its existing domain mappings, update certificate_data with a new certificate. The new certificate must be applicable to the same domains as the original certificate. The certificate display_name may also be updated.
3129 ///
3130 /// # Arguments
3131 ///
3132 /// * `request` - No description provided.
3133 /// * `projectsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345.
3134 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3135 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3136 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `projectsId`.
3137 pub fn locations_applications_authorized_certificates_patch(
3138 &self,
3139 request: AuthorizedCertificate,
3140 projects_id: &str,
3141 locations_id: &str,
3142 applications_id: &str,
3143 authorized_certificates_id: &str,
3144 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
3145 ProjectLocationApplicationAuthorizedCertificatePatchCall {
3146 hub: self.hub,
3147 _request: request,
3148 _projects_id: projects_id.to_string(),
3149 _locations_id: locations_id.to_string(),
3150 _applications_id: applications_id.to_string(),
3151 _authorized_certificates_id: authorized_certificates_id.to_string(),
3152 _update_mask: Default::default(),
3153 _delegate: Default::default(),
3154 _additional_params: Default::default(),
3155 _scopes: Default::default(),
3156 }
3157 }
3158
3159 /// Create a builder to help you perform the following task:
3160 ///
3161 /// Lists all domains the user is authorized to administer.
3162 ///
3163 /// # Arguments
3164 ///
3165 /// * `projectsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
3166 /// * `locationsId` - Part of `parent`. See documentation of `projectsId`.
3167 /// * `applicationsId` - Part of `parent`. See documentation of `projectsId`.
3168 pub fn locations_applications_authorized_domains_list(
3169 &self,
3170 projects_id: &str,
3171 locations_id: &str,
3172 applications_id: &str,
3173 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
3174 ProjectLocationApplicationAuthorizedDomainListCall {
3175 hub: self.hub,
3176 _projects_id: projects_id.to_string(),
3177 _locations_id: locations_id.to_string(),
3178 _applications_id: applications_id.to_string(),
3179 _page_token: Default::default(),
3180 _page_size: Default::default(),
3181 _delegate: Default::default(),
3182 _additional_params: Default::default(),
3183 _scopes: Default::default(),
3184 }
3185 }
3186
3187 /// Create a builder to help you perform the following task:
3188 ///
3189 /// Maps a domain to an application. A user must be authorized to administer a domain in order to map it to an application. For a list of available authorized domains, see AuthorizedDomains.ListAuthorizedDomains.
3190 ///
3191 /// # Arguments
3192 ///
3193 /// * `request` - No description provided.
3194 /// * `projectsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
3195 /// * `locationsId` - Part of `parent`. See documentation of `projectsId`.
3196 /// * `applicationsId` - Part of `parent`. See documentation of `projectsId`.
3197 pub fn locations_applications_domain_mappings_create(
3198 &self,
3199 request: DomainMapping,
3200 projects_id: &str,
3201 locations_id: &str,
3202 applications_id: &str,
3203 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
3204 ProjectLocationApplicationDomainMappingCreateCall {
3205 hub: self.hub,
3206 _request: request,
3207 _projects_id: projects_id.to_string(),
3208 _locations_id: locations_id.to_string(),
3209 _applications_id: applications_id.to_string(),
3210 _override_strategy: Default::default(),
3211 _delegate: Default::default(),
3212 _additional_params: Default::default(),
3213 _scopes: Default::default(),
3214 }
3215 }
3216
3217 /// Create a builder to help you perform the following task:
3218 ///
3219 /// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource.
3220 ///
3221 /// # Arguments
3222 ///
3223 /// * `projectsId` - Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com.
3224 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3225 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3226 /// * `domainMappingsId` - Part of `name`. See documentation of `projectsId`.
3227 pub fn locations_applications_domain_mappings_delete(
3228 &self,
3229 projects_id: &str,
3230 locations_id: &str,
3231 applications_id: &str,
3232 domain_mappings_id: &str,
3233 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {
3234 ProjectLocationApplicationDomainMappingDeleteCall {
3235 hub: self.hub,
3236 _projects_id: projects_id.to_string(),
3237 _locations_id: locations_id.to_string(),
3238 _applications_id: applications_id.to_string(),
3239 _domain_mappings_id: domain_mappings_id.to_string(),
3240 _delegate: Default::default(),
3241 _additional_params: Default::default(),
3242 _scopes: Default::default(),
3243 }
3244 }
3245
3246 /// Create a builder to help you perform the following task:
3247 ///
3248 /// Gets the specified domain mapping.
3249 ///
3250 /// # Arguments
3251 ///
3252 /// * `projectsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/domainMappings/example.com.
3253 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3254 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3255 /// * `domainMappingsId` - Part of `name`. See documentation of `projectsId`.
3256 pub fn locations_applications_domain_mappings_get(
3257 &self,
3258 projects_id: &str,
3259 locations_id: &str,
3260 applications_id: &str,
3261 domain_mappings_id: &str,
3262 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C> {
3263 ProjectLocationApplicationDomainMappingGetCall {
3264 hub: self.hub,
3265 _projects_id: projects_id.to_string(),
3266 _locations_id: locations_id.to_string(),
3267 _applications_id: applications_id.to_string(),
3268 _domain_mappings_id: domain_mappings_id.to_string(),
3269 _delegate: Default::default(),
3270 _additional_params: Default::default(),
3271 _scopes: Default::default(),
3272 }
3273 }
3274
3275 /// Create a builder to help you perform the following task:
3276 ///
3277 /// Lists the domain mappings on an application.
3278 ///
3279 /// # Arguments
3280 ///
3281 /// * `projectsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
3282 /// * `locationsId` - Part of `parent`. See documentation of `projectsId`.
3283 /// * `applicationsId` - Part of `parent`. See documentation of `projectsId`.
3284 pub fn locations_applications_domain_mappings_list(
3285 &self,
3286 projects_id: &str,
3287 locations_id: &str,
3288 applications_id: &str,
3289 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
3290 ProjectLocationApplicationDomainMappingListCall {
3291 hub: self.hub,
3292 _projects_id: projects_id.to_string(),
3293 _locations_id: locations_id.to_string(),
3294 _applications_id: applications_id.to_string(),
3295 _page_token: Default::default(),
3296 _page_size: Default::default(),
3297 _delegate: Default::default(),
3298 _additional_params: Default::default(),
3299 _scopes: Default::default(),
3300 }
3301 }
3302
3303 /// Create a builder to help you perform the following task:
3304 ///
3305 /// Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update certificate_id to point to an AuthorizedCertificate resource. A user must be authorized to administer the associated domain in order to update a DomainMapping resource.
3306 ///
3307 /// # Arguments
3308 ///
3309 /// * `request` - No description provided.
3310 /// * `projectsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/domainMappings/example.com.
3311 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3312 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3313 /// * `domainMappingsId` - Part of `name`. See documentation of `projectsId`.
3314 pub fn locations_applications_domain_mappings_patch(
3315 &self,
3316 request: DomainMapping,
3317 projects_id: &str,
3318 locations_id: &str,
3319 applications_id: &str,
3320 domain_mappings_id: &str,
3321 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
3322 ProjectLocationApplicationDomainMappingPatchCall {
3323 hub: self.hub,
3324 _request: request,
3325 _projects_id: projects_id.to_string(),
3326 _locations_id: locations_id.to_string(),
3327 _applications_id: applications_id.to_string(),
3328 _domain_mappings_id: domain_mappings_id.to_string(),
3329 _update_mask: Default::default(),
3330 _delegate: Default::default(),
3331 _additional_params: Default::default(),
3332 _scopes: Default::default(),
3333 }
3334 }
3335
3336 /// Create a builder to help you perform the following task:
3337 ///
3338 /// Deletes an existing Version resource.
3339 ///
3340 /// # Arguments
3341 ///
3342 /// * `projectsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
3343 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3344 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3345 /// * `servicesId` - Part of `name`. See documentation of `projectsId`.
3346 /// * `versionsId` - Part of `name`. See documentation of `projectsId`.
3347 pub fn locations_applications_services_versions_delete(
3348 &self,
3349 projects_id: &str,
3350 locations_id: &str,
3351 applications_id: &str,
3352 services_id: &str,
3353 versions_id: &str,
3354 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
3355 ProjectLocationApplicationServiceVersionDeleteCall {
3356 hub: self.hub,
3357 _projects_id: projects_id.to_string(),
3358 _locations_id: locations_id.to_string(),
3359 _applications_id: applications_id.to_string(),
3360 _services_id: services_id.to_string(),
3361 _versions_id: versions_id.to_string(),
3362 _delegate: Default::default(),
3363 _additional_params: Default::default(),
3364 _scopes: Default::default(),
3365 }
3366 }
3367
3368 /// Create a builder to help you perform the following task:
3369 ///
3370 /// Exports a user image to Artifact Registry.
3371 ///
3372 /// # Arguments
3373 ///
3374 /// * `request` - No description provided.
3375 /// * `projectsId` - Part of `name`. Required. Name of the App Engine version resource. Format: apps/{app}/services/{service}/versions/{version}
3376 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3377 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3378 /// * `servicesId` - Part of `name`. See documentation of `projectsId`.
3379 /// * `versionsId` - Part of `name`. See documentation of `projectsId`.
3380 pub fn locations_applications_services_versions_export_app_image(
3381 &self,
3382 request: ExportAppImageRequest,
3383 projects_id: &str,
3384 locations_id: &str,
3385 applications_id: &str,
3386 services_id: &str,
3387 versions_id: &str,
3388 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
3389 ProjectLocationApplicationServiceVersionExportAppImageCall {
3390 hub: self.hub,
3391 _request: request,
3392 _projects_id: projects_id.to_string(),
3393 _locations_id: locations_id.to_string(),
3394 _applications_id: applications_id.to_string(),
3395 _services_id: services_id.to_string(),
3396 _versions_id: versions_id.to_string(),
3397 _delegate: Default::default(),
3398 _additional_params: Default::default(),
3399 _scopes: Default::default(),
3400 }
3401 }
3402
3403 /// Create a builder to help you perform the following task:
3404 ///
3405 /// 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:Standard environment instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class)automatic scaling in the standard environment: automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automaticScaling.standard_scheduler_settings.max_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.min_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_cpu_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_throughput_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings)basic scaling or manual scaling in the standard environment: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)Flexible environment serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status)automatic scaling in the flexible environment: automatic_scaling.min_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cool_down_period_sec (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cpu_utilization.target_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling)manual scaling in the flexible environment: manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)
3406 ///
3407 /// # Arguments
3408 ///
3409 /// * `request` - No description provided.
3410 /// * `projectsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default/versions/1.
3411 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3412 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3413 /// * `servicesId` - Part of `name`. See documentation of `projectsId`.
3414 /// * `versionsId` - Part of `name`. See documentation of `projectsId`.
3415 pub fn locations_applications_services_versions_patch(
3416 &self,
3417 request: Version,
3418 projects_id: &str,
3419 locations_id: &str,
3420 applications_id: &str,
3421 services_id: &str,
3422 versions_id: &str,
3423 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
3424 ProjectLocationApplicationServiceVersionPatchCall {
3425 hub: self.hub,
3426 _request: request,
3427 _projects_id: projects_id.to_string(),
3428 _locations_id: locations_id.to_string(),
3429 _applications_id: applications_id.to_string(),
3430 _services_id: services_id.to_string(),
3431 _versions_id: versions_id.to_string(),
3432 _update_mask: Default::default(),
3433 _delegate: Default::default(),
3434 _additional_params: Default::default(),
3435 _scopes: Default::default(),
3436 }
3437 }
3438
3439 /// Create a builder to help you perform the following task:
3440 ///
3441 /// Deletes the specified service and all enclosed versions.
3442 ///
3443 /// # Arguments
3444 ///
3445 /// * `projectsId` - Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default.
3446 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3447 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3448 /// * `servicesId` - Part of `name`. See documentation of `projectsId`.
3449 pub fn locations_applications_services_delete(
3450 &self,
3451 projects_id: &str,
3452 locations_id: &str,
3453 applications_id: &str,
3454 services_id: &str,
3455 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C> {
3456 ProjectLocationApplicationServiceDeleteCall {
3457 hub: self.hub,
3458 _projects_id: projects_id.to_string(),
3459 _locations_id: locations_id.to_string(),
3460 _applications_id: applications_id.to_string(),
3461 _services_id: services_id.to_string(),
3462 _delegate: Default::default(),
3463 _additional_params: Default::default(),
3464 _scopes: Default::default(),
3465 }
3466 }
3467
3468 /// Create a builder to help you perform the following task:
3469 ///
3470 /// Updates the configuration of the specified service.
3471 ///
3472 /// # Arguments
3473 ///
3474 /// * `request` - No description provided.
3475 /// * `projectsId` - Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default.
3476 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3477 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3478 /// * `servicesId` - Part of `name`. See documentation of `projectsId`.
3479 pub fn locations_applications_services_patch(
3480 &self,
3481 request: Service,
3482 projects_id: &str,
3483 locations_id: &str,
3484 applications_id: &str,
3485 services_id: &str,
3486 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
3487 ProjectLocationApplicationServicePatchCall {
3488 hub: self.hub,
3489 _request: request,
3490 _projects_id: projects_id.to_string(),
3491 _locations_id: locations_id.to_string(),
3492 _applications_id: applications_id.to_string(),
3493 _services_id: services_id.to_string(),
3494 _update_mask: Default::default(),
3495 _migrate_traffic: Default::default(),
3496 _delegate: Default::default(),
3497 _additional_params: Default::default(),
3498 _scopes: Default::default(),
3499 }
3500 }
3501
3502 /// Create a builder to help you perform the following task:
3503 ///
3504 /// Updates the specified Application resource. You can update the following fields: auth_domain - Google authentication domain for controlling user access to the application. default_cookie_expiration - Cookie expiration policy for the application. iap - Identity-Aware Proxy properties for the application.
3505 ///
3506 /// # Arguments
3507 ///
3508 /// * `request` - No description provided.
3509 /// * `projectsId` - Part of `name`. Required. Name of the Application resource to update. Example: apps/myapp.
3510 /// * `locationsId` - Part of `name`. See documentation of `projectsId`.
3511 /// * `applicationsId` - Part of `name`. See documentation of `projectsId`.
3512 pub fn locations_applications_patch(
3513 &self,
3514 request: Application,
3515 projects_id: &str,
3516 locations_id: &str,
3517 applications_id: &str,
3518 ) -> ProjectLocationApplicationPatchCall<'a, C> {
3519 ProjectLocationApplicationPatchCall {
3520 hub: self.hub,
3521 _request: request,
3522 _projects_id: projects_id.to_string(),
3523 _locations_id: locations_id.to_string(),
3524 _applications_id: applications_id.to_string(),
3525 _update_mask: Default::default(),
3526 _delegate: Default::default(),
3527 _additional_params: Default::default(),
3528 _scopes: Default::default(),
3529 }
3530 }
3531}
3532
3533// ###################
3534// CallBuilders ###
3535// #################
3536
3537/// Uploads the specified SSL certificate.
3538///
3539/// A builder for the *authorizedCertificates.create* method supported by a *app* resource.
3540/// It is not used directly, but through a [`AppMethods`] instance.
3541///
3542/// # Example
3543///
3544/// Instantiate a resource method builder
3545///
3546/// ```test_harness,no_run
3547/// # extern crate hyper;
3548/// # extern crate hyper_rustls;
3549/// # extern crate google_appengine1 as appengine1;
3550/// use appengine1::api::AuthorizedCertificate;
3551/// # async fn dox() {
3552/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3553///
3554/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3555/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3556/// # .with_native_roots()
3557/// # .unwrap()
3558/// # .https_only()
3559/// # .enable_http2()
3560/// # .build();
3561///
3562/// # let executor = hyper_util::rt::TokioExecutor::new();
3563/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3564/// # secret,
3565/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3566/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3567/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3568/// # ),
3569/// # ).build().await.unwrap();
3570///
3571/// # let client = hyper_util::client::legacy::Client::builder(
3572/// # hyper_util::rt::TokioExecutor::new()
3573/// # )
3574/// # .build(
3575/// # hyper_rustls::HttpsConnectorBuilder::new()
3576/// # .with_native_roots()
3577/// # .unwrap()
3578/// # .https_or_http()
3579/// # .enable_http2()
3580/// # .build()
3581/// # );
3582/// # let mut hub = Appengine::new(client, auth);
3583/// // As the method needs a request, you would usually fill it with the desired information
3584/// // into the respective structure. Some of the parts shown here might not be applicable !
3585/// // Values shown here are possibly random and not representative !
3586/// let mut req = AuthorizedCertificate::default();
3587///
3588/// // You can configure optional parameters by calling the respective setters at will, and
3589/// // execute the final call using `doit()`.
3590/// // Values shown here are possibly random and not representative !
3591/// let result = hub.apps().authorized_certificates_create(req, "appsId")
3592/// .doit().await;
3593/// # }
3594/// ```
3595pub struct AppAuthorizedCertificateCreateCall<'a, C>
3596where
3597 C: 'a,
3598{
3599 hub: &'a Appengine<C>,
3600 _request: AuthorizedCertificate,
3601 _apps_id: String,
3602 _delegate: Option<&'a mut dyn common::Delegate>,
3603 _additional_params: HashMap<String, String>,
3604 _scopes: BTreeSet<String>,
3605}
3606
3607impl<'a, C> common::CallBuilder for AppAuthorizedCertificateCreateCall<'a, C> {}
3608
3609impl<'a, C> AppAuthorizedCertificateCreateCall<'a, C>
3610where
3611 C: common::Connector,
3612{
3613 /// Perform the operation you have build so far.
3614 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
3615 use std::borrow::Cow;
3616 use std::io::{Read, Seek};
3617
3618 use common::{url::Params, ToParts};
3619 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3620
3621 let mut dd = common::DefaultDelegate;
3622 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3623 dlg.begin(common::MethodInfo {
3624 id: "appengine.apps.authorizedCertificates.create",
3625 http_method: hyper::Method::POST,
3626 });
3627
3628 for &field in ["alt", "appsId"].iter() {
3629 if self._additional_params.contains_key(field) {
3630 dlg.finished(false);
3631 return Err(common::Error::FieldClash(field));
3632 }
3633 }
3634
3635 let mut params = Params::with_capacity(4 + self._additional_params.len());
3636 params.push("appsId", self._apps_id);
3637
3638 params.extend(self._additional_params.iter());
3639
3640 params.push("alt", "json");
3641 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates";
3642 if self._scopes.is_empty() {
3643 self._scopes
3644 .insert(Scope::CloudPlatform.as_ref().to_string());
3645 }
3646
3647 #[allow(clippy::single_element_loop)]
3648 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
3649 url = params.uri_replacement(url, param_name, find_this, false);
3650 }
3651 {
3652 let to_remove = ["appsId"];
3653 params.remove_params(&to_remove);
3654 }
3655
3656 let url = params.parse_with_url(&url);
3657
3658 let mut json_mime_type = mime::APPLICATION_JSON;
3659 let mut request_value_reader = {
3660 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3661 common::remove_json_null_values(&mut value);
3662 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3663 serde_json::to_writer(&mut dst, &value).unwrap();
3664 dst
3665 };
3666 let request_size = request_value_reader
3667 .seek(std::io::SeekFrom::End(0))
3668 .unwrap();
3669 request_value_reader
3670 .seek(std::io::SeekFrom::Start(0))
3671 .unwrap();
3672
3673 loop {
3674 let token = match self
3675 .hub
3676 .auth
3677 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3678 .await
3679 {
3680 Ok(token) => token,
3681 Err(e) => match dlg.token(e) {
3682 Ok(token) => token,
3683 Err(e) => {
3684 dlg.finished(false);
3685 return Err(common::Error::MissingToken(e));
3686 }
3687 },
3688 };
3689 request_value_reader
3690 .seek(std::io::SeekFrom::Start(0))
3691 .unwrap();
3692 let mut req_result = {
3693 let client = &self.hub.client;
3694 dlg.pre_request();
3695 let mut req_builder = hyper::Request::builder()
3696 .method(hyper::Method::POST)
3697 .uri(url.as_str())
3698 .header(USER_AGENT, self.hub._user_agent.clone());
3699
3700 if let Some(token) = token.as_ref() {
3701 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3702 }
3703
3704 let request = req_builder
3705 .header(CONTENT_TYPE, json_mime_type.to_string())
3706 .header(CONTENT_LENGTH, request_size as u64)
3707 .body(common::to_body(
3708 request_value_reader.get_ref().clone().into(),
3709 ));
3710
3711 client.request(request.unwrap()).await
3712 };
3713
3714 match req_result {
3715 Err(err) => {
3716 if let common::Retry::After(d) = dlg.http_error(&err) {
3717 sleep(d).await;
3718 continue;
3719 }
3720 dlg.finished(false);
3721 return Err(common::Error::HttpError(err));
3722 }
3723 Ok(res) => {
3724 let (mut parts, body) = res.into_parts();
3725 let mut body = common::Body::new(body);
3726 if !parts.status.is_success() {
3727 let bytes = common::to_bytes(body).await.unwrap_or_default();
3728 let error = serde_json::from_str(&common::to_string(&bytes));
3729 let response = common::to_response(parts, bytes.into());
3730
3731 if let common::Retry::After(d) =
3732 dlg.http_failure(&response, error.as_ref().ok())
3733 {
3734 sleep(d).await;
3735 continue;
3736 }
3737
3738 dlg.finished(false);
3739
3740 return Err(match error {
3741 Ok(value) => common::Error::BadRequest(value),
3742 _ => common::Error::Failure(response),
3743 });
3744 }
3745 let response = {
3746 let bytes = common::to_bytes(body).await.unwrap_or_default();
3747 let encoded = common::to_string(&bytes);
3748 match serde_json::from_str(&encoded) {
3749 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3750 Err(error) => {
3751 dlg.response_json_decode_error(&encoded, &error);
3752 return Err(common::Error::JsonDecodeError(
3753 encoded.to_string(),
3754 error,
3755 ));
3756 }
3757 }
3758 };
3759
3760 dlg.finished(true);
3761 return Ok(response);
3762 }
3763 }
3764 }
3765 }
3766
3767 ///
3768 /// Sets the *request* property to the given value.
3769 ///
3770 /// Even though the property as already been set when instantiating this call,
3771 /// we provide this method for API completeness.
3772 pub fn request(
3773 mut self,
3774 new_value: AuthorizedCertificate,
3775 ) -> AppAuthorizedCertificateCreateCall<'a, C> {
3776 self._request = new_value;
3777 self
3778 }
3779 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
3780 ///
3781 /// Sets the *apps id* path property to the given value.
3782 ///
3783 /// Even though the property as already been set when instantiating this call,
3784 /// we provide this method for API completeness.
3785 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateCreateCall<'a, C> {
3786 self._apps_id = new_value.to_string();
3787 self
3788 }
3789 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3790 /// while executing the actual API request.
3791 ///
3792 /// ````text
3793 /// It should be used to handle progress information, and to implement a certain level of resilience.
3794 /// ````
3795 ///
3796 /// Sets the *delegate* property to the given value.
3797 pub fn delegate(
3798 mut self,
3799 new_value: &'a mut dyn common::Delegate,
3800 ) -> AppAuthorizedCertificateCreateCall<'a, C> {
3801 self._delegate = Some(new_value);
3802 self
3803 }
3804
3805 /// Set any additional parameter of the query string used in the request.
3806 /// It should be used to set parameters which are not yet available through their own
3807 /// setters.
3808 ///
3809 /// Please note that this method must not be used to set any of the known parameters
3810 /// which have their own setter method. If done anyway, the request will fail.
3811 ///
3812 /// # Additional Parameters
3813 ///
3814 /// * *$.xgafv* (query-string) - V1 error format.
3815 /// * *access_token* (query-string) - OAuth access token.
3816 /// * *alt* (query-string) - Data format for response.
3817 /// * *callback* (query-string) - JSONP
3818 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3819 /// * *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.
3820 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3821 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3822 /// * *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.
3823 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3824 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3825 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateCreateCall<'a, C>
3826 where
3827 T: AsRef<str>,
3828 {
3829 self._additional_params
3830 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3831 self
3832 }
3833
3834 /// Identifies the authorization scope for the method you are building.
3835 ///
3836 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3837 /// [`Scope::CloudPlatform`].
3838 ///
3839 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3840 /// tokens for more than one scope.
3841 ///
3842 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3843 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3844 /// sufficient, a read-write scope will do as well.
3845 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateCreateCall<'a, C>
3846 where
3847 St: AsRef<str>,
3848 {
3849 self._scopes.insert(String::from(scope.as_ref()));
3850 self
3851 }
3852 /// Identifies the authorization scope(s) for the method you are building.
3853 ///
3854 /// See [`Self::add_scope()`] for details.
3855 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateCreateCall<'a, C>
3856 where
3857 I: IntoIterator<Item = St>,
3858 St: AsRef<str>,
3859 {
3860 self._scopes
3861 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3862 self
3863 }
3864
3865 /// Removes all scopes, and no default scope will be used either.
3866 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3867 /// for details).
3868 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateCreateCall<'a, C> {
3869 self._scopes.clear();
3870 self
3871 }
3872}
3873
3874/// Deletes the specified SSL certificate.
3875///
3876/// A builder for the *authorizedCertificates.delete* method supported by a *app* resource.
3877/// It is not used directly, but through a [`AppMethods`] instance.
3878///
3879/// # Example
3880///
3881/// Instantiate a resource method builder
3882///
3883/// ```test_harness,no_run
3884/// # extern crate hyper;
3885/// # extern crate hyper_rustls;
3886/// # extern crate google_appengine1 as appengine1;
3887/// # async fn dox() {
3888/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3889///
3890/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3891/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3892/// # .with_native_roots()
3893/// # .unwrap()
3894/// # .https_only()
3895/// # .enable_http2()
3896/// # .build();
3897///
3898/// # let executor = hyper_util::rt::TokioExecutor::new();
3899/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3900/// # secret,
3901/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3902/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3903/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3904/// # ),
3905/// # ).build().await.unwrap();
3906///
3907/// # let client = hyper_util::client::legacy::Client::builder(
3908/// # hyper_util::rt::TokioExecutor::new()
3909/// # )
3910/// # .build(
3911/// # hyper_rustls::HttpsConnectorBuilder::new()
3912/// # .with_native_roots()
3913/// # .unwrap()
3914/// # .https_or_http()
3915/// # .enable_http2()
3916/// # .build()
3917/// # );
3918/// # let mut hub = Appengine::new(client, auth);
3919/// // You can configure optional parameters by calling the respective setters at will, and
3920/// // execute the final call using `doit()`.
3921/// // Values shown here are possibly random and not representative !
3922/// let result = hub.apps().authorized_certificates_delete("appsId", "authorizedCertificatesId")
3923/// .doit().await;
3924/// # }
3925/// ```
3926pub struct AppAuthorizedCertificateDeleteCall<'a, C>
3927where
3928 C: 'a,
3929{
3930 hub: &'a Appengine<C>,
3931 _apps_id: String,
3932 _authorized_certificates_id: String,
3933 _delegate: Option<&'a mut dyn common::Delegate>,
3934 _additional_params: HashMap<String, String>,
3935 _scopes: BTreeSet<String>,
3936}
3937
3938impl<'a, C> common::CallBuilder for AppAuthorizedCertificateDeleteCall<'a, C> {}
3939
3940impl<'a, C> AppAuthorizedCertificateDeleteCall<'a, C>
3941where
3942 C: common::Connector,
3943{
3944 /// Perform the operation you have build so far.
3945 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3946 use std::borrow::Cow;
3947 use std::io::{Read, Seek};
3948
3949 use common::{url::Params, ToParts};
3950 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3951
3952 let mut dd = common::DefaultDelegate;
3953 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3954 dlg.begin(common::MethodInfo {
3955 id: "appengine.apps.authorizedCertificates.delete",
3956 http_method: hyper::Method::DELETE,
3957 });
3958
3959 for &field in ["alt", "appsId", "authorizedCertificatesId"].iter() {
3960 if self._additional_params.contains_key(field) {
3961 dlg.finished(false);
3962 return Err(common::Error::FieldClash(field));
3963 }
3964 }
3965
3966 let mut params = Params::with_capacity(4 + self._additional_params.len());
3967 params.push("appsId", self._apps_id);
3968 params.push("authorizedCertificatesId", self._authorized_certificates_id);
3969
3970 params.extend(self._additional_params.iter());
3971
3972 params.push("alt", "json");
3973 let mut url = self.hub._base_url.clone()
3974 + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}";
3975 if self._scopes.is_empty() {
3976 self._scopes
3977 .insert(Scope::CloudPlatform.as_ref().to_string());
3978 }
3979
3980 #[allow(clippy::single_element_loop)]
3981 for &(find_this, param_name) in [
3982 ("{appsId}", "appsId"),
3983 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
3984 ]
3985 .iter()
3986 {
3987 url = params.uri_replacement(url, param_name, find_this, false);
3988 }
3989 {
3990 let to_remove = ["authorizedCertificatesId", "appsId"];
3991 params.remove_params(&to_remove);
3992 }
3993
3994 let url = params.parse_with_url(&url);
3995
3996 loop {
3997 let token = match self
3998 .hub
3999 .auth
4000 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4001 .await
4002 {
4003 Ok(token) => token,
4004 Err(e) => match dlg.token(e) {
4005 Ok(token) => token,
4006 Err(e) => {
4007 dlg.finished(false);
4008 return Err(common::Error::MissingToken(e));
4009 }
4010 },
4011 };
4012 let mut req_result = {
4013 let client = &self.hub.client;
4014 dlg.pre_request();
4015 let mut req_builder = hyper::Request::builder()
4016 .method(hyper::Method::DELETE)
4017 .uri(url.as_str())
4018 .header(USER_AGENT, self.hub._user_agent.clone());
4019
4020 if let Some(token) = token.as_ref() {
4021 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4022 }
4023
4024 let request = req_builder
4025 .header(CONTENT_LENGTH, 0_u64)
4026 .body(common::to_body::<String>(None));
4027
4028 client.request(request.unwrap()).await
4029 };
4030
4031 match req_result {
4032 Err(err) => {
4033 if let common::Retry::After(d) = dlg.http_error(&err) {
4034 sleep(d).await;
4035 continue;
4036 }
4037 dlg.finished(false);
4038 return Err(common::Error::HttpError(err));
4039 }
4040 Ok(res) => {
4041 let (mut parts, body) = res.into_parts();
4042 let mut body = common::Body::new(body);
4043 if !parts.status.is_success() {
4044 let bytes = common::to_bytes(body).await.unwrap_or_default();
4045 let error = serde_json::from_str(&common::to_string(&bytes));
4046 let response = common::to_response(parts, bytes.into());
4047
4048 if let common::Retry::After(d) =
4049 dlg.http_failure(&response, error.as_ref().ok())
4050 {
4051 sleep(d).await;
4052 continue;
4053 }
4054
4055 dlg.finished(false);
4056
4057 return Err(match error {
4058 Ok(value) => common::Error::BadRequest(value),
4059 _ => common::Error::Failure(response),
4060 });
4061 }
4062 let response = {
4063 let bytes = common::to_bytes(body).await.unwrap_or_default();
4064 let encoded = common::to_string(&bytes);
4065 match serde_json::from_str(&encoded) {
4066 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4067 Err(error) => {
4068 dlg.response_json_decode_error(&encoded, &error);
4069 return Err(common::Error::JsonDecodeError(
4070 encoded.to_string(),
4071 error,
4072 ));
4073 }
4074 }
4075 };
4076
4077 dlg.finished(true);
4078 return Ok(response);
4079 }
4080 }
4081 }
4082 }
4083
4084 /// Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345.
4085 ///
4086 /// Sets the *apps id* path property to the given value.
4087 ///
4088 /// Even though the property as already been set when instantiating this call,
4089 /// we provide this method for API completeness.
4090 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateDeleteCall<'a, C> {
4091 self._apps_id = new_value.to_string();
4092 self
4093 }
4094 /// Part of `name`. See documentation of `appsId`.
4095 ///
4096 /// Sets the *authorized certificates id* path property to the given value.
4097 ///
4098 /// Even though the property as already been set when instantiating this call,
4099 /// we provide this method for API completeness.
4100 pub fn authorized_certificates_id(
4101 mut self,
4102 new_value: &str,
4103 ) -> AppAuthorizedCertificateDeleteCall<'a, C> {
4104 self._authorized_certificates_id = new_value.to_string();
4105 self
4106 }
4107 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4108 /// while executing the actual API request.
4109 ///
4110 /// ````text
4111 /// It should be used to handle progress information, and to implement a certain level of resilience.
4112 /// ````
4113 ///
4114 /// Sets the *delegate* property to the given value.
4115 pub fn delegate(
4116 mut self,
4117 new_value: &'a mut dyn common::Delegate,
4118 ) -> AppAuthorizedCertificateDeleteCall<'a, C> {
4119 self._delegate = Some(new_value);
4120 self
4121 }
4122
4123 /// Set any additional parameter of the query string used in the request.
4124 /// It should be used to set parameters which are not yet available through their own
4125 /// setters.
4126 ///
4127 /// Please note that this method must not be used to set any of the known parameters
4128 /// which have their own setter method. If done anyway, the request will fail.
4129 ///
4130 /// # Additional Parameters
4131 ///
4132 /// * *$.xgafv* (query-string) - V1 error format.
4133 /// * *access_token* (query-string) - OAuth access token.
4134 /// * *alt* (query-string) - Data format for response.
4135 /// * *callback* (query-string) - JSONP
4136 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4137 /// * *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.
4138 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4139 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4140 /// * *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.
4141 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4142 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4143 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateDeleteCall<'a, C>
4144 where
4145 T: AsRef<str>,
4146 {
4147 self._additional_params
4148 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4149 self
4150 }
4151
4152 /// Identifies the authorization scope for the method you are building.
4153 ///
4154 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4155 /// [`Scope::CloudPlatform`].
4156 ///
4157 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4158 /// tokens for more than one scope.
4159 ///
4160 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4161 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4162 /// sufficient, a read-write scope will do as well.
4163 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateDeleteCall<'a, C>
4164 where
4165 St: AsRef<str>,
4166 {
4167 self._scopes.insert(String::from(scope.as_ref()));
4168 self
4169 }
4170 /// Identifies the authorization scope(s) for the method you are building.
4171 ///
4172 /// See [`Self::add_scope()`] for details.
4173 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateDeleteCall<'a, C>
4174 where
4175 I: IntoIterator<Item = St>,
4176 St: AsRef<str>,
4177 {
4178 self._scopes
4179 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4180 self
4181 }
4182
4183 /// Removes all scopes, and no default scope will be used either.
4184 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4185 /// for details).
4186 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateDeleteCall<'a, C> {
4187 self._scopes.clear();
4188 self
4189 }
4190}
4191
4192/// Gets the specified SSL certificate.
4193///
4194/// A builder for the *authorizedCertificates.get* method supported by a *app* resource.
4195/// It is not used directly, but through a [`AppMethods`] instance.
4196///
4197/// # Example
4198///
4199/// Instantiate a resource method builder
4200///
4201/// ```test_harness,no_run
4202/// # extern crate hyper;
4203/// # extern crate hyper_rustls;
4204/// # extern crate google_appengine1 as appengine1;
4205/// # async fn dox() {
4206/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4207///
4208/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4209/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4210/// # .with_native_roots()
4211/// # .unwrap()
4212/// # .https_only()
4213/// # .enable_http2()
4214/// # .build();
4215///
4216/// # let executor = hyper_util::rt::TokioExecutor::new();
4217/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4218/// # secret,
4219/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4220/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4221/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4222/// # ),
4223/// # ).build().await.unwrap();
4224///
4225/// # let client = hyper_util::client::legacy::Client::builder(
4226/// # hyper_util::rt::TokioExecutor::new()
4227/// # )
4228/// # .build(
4229/// # hyper_rustls::HttpsConnectorBuilder::new()
4230/// # .with_native_roots()
4231/// # .unwrap()
4232/// # .https_or_http()
4233/// # .enable_http2()
4234/// # .build()
4235/// # );
4236/// # let mut hub = Appengine::new(client, auth);
4237/// // You can configure optional parameters by calling the respective setters at will, and
4238/// // execute the final call using `doit()`.
4239/// // Values shown here are possibly random and not representative !
4240/// let result = hub.apps().authorized_certificates_get("appsId", "authorizedCertificatesId")
4241/// .view("invidunt")
4242/// .doit().await;
4243/// # }
4244/// ```
4245pub struct AppAuthorizedCertificateGetCall<'a, C>
4246where
4247 C: 'a,
4248{
4249 hub: &'a Appengine<C>,
4250 _apps_id: String,
4251 _authorized_certificates_id: String,
4252 _view: Option<String>,
4253 _delegate: Option<&'a mut dyn common::Delegate>,
4254 _additional_params: HashMap<String, String>,
4255 _scopes: BTreeSet<String>,
4256}
4257
4258impl<'a, C> common::CallBuilder for AppAuthorizedCertificateGetCall<'a, C> {}
4259
4260impl<'a, C> AppAuthorizedCertificateGetCall<'a, C>
4261where
4262 C: common::Connector,
4263{
4264 /// Perform the operation you have build so far.
4265 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
4266 use std::borrow::Cow;
4267 use std::io::{Read, Seek};
4268
4269 use common::{url::Params, ToParts};
4270 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4271
4272 let mut dd = common::DefaultDelegate;
4273 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4274 dlg.begin(common::MethodInfo {
4275 id: "appengine.apps.authorizedCertificates.get",
4276 http_method: hyper::Method::GET,
4277 });
4278
4279 for &field in ["alt", "appsId", "authorizedCertificatesId", "view"].iter() {
4280 if self._additional_params.contains_key(field) {
4281 dlg.finished(false);
4282 return Err(common::Error::FieldClash(field));
4283 }
4284 }
4285
4286 let mut params = Params::with_capacity(5 + self._additional_params.len());
4287 params.push("appsId", self._apps_id);
4288 params.push("authorizedCertificatesId", self._authorized_certificates_id);
4289 if let Some(value) = self._view.as_ref() {
4290 params.push("view", value);
4291 }
4292
4293 params.extend(self._additional_params.iter());
4294
4295 params.push("alt", "json");
4296 let mut url = self.hub._base_url.clone()
4297 + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}";
4298 if self._scopes.is_empty() {
4299 self._scopes
4300 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4301 }
4302
4303 #[allow(clippy::single_element_loop)]
4304 for &(find_this, param_name) in [
4305 ("{appsId}", "appsId"),
4306 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
4307 ]
4308 .iter()
4309 {
4310 url = params.uri_replacement(url, param_name, find_this, false);
4311 }
4312 {
4313 let to_remove = ["authorizedCertificatesId", "appsId"];
4314 params.remove_params(&to_remove);
4315 }
4316
4317 let url = params.parse_with_url(&url);
4318
4319 loop {
4320 let token = match self
4321 .hub
4322 .auth
4323 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4324 .await
4325 {
4326 Ok(token) => token,
4327 Err(e) => match dlg.token(e) {
4328 Ok(token) => token,
4329 Err(e) => {
4330 dlg.finished(false);
4331 return Err(common::Error::MissingToken(e));
4332 }
4333 },
4334 };
4335 let mut req_result = {
4336 let client = &self.hub.client;
4337 dlg.pre_request();
4338 let mut req_builder = hyper::Request::builder()
4339 .method(hyper::Method::GET)
4340 .uri(url.as_str())
4341 .header(USER_AGENT, self.hub._user_agent.clone());
4342
4343 if let Some(token) = token.as_ref() {
4344 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4345 }
4346
4347 let request = req_builder
4348 .header(CONTENT_LENGTH, 0_u64)
4349 .body(common::to_body::<String>(None));
4350
4351 client.request(request.unwrap()).await
4352 };
4353
4354 match req_result {
4355 Err(err) => {
4356 if let common::Retry::After(d) = dlg.http_error(&err) {
4357 sleep(d).await;
4358 continue;
4359 }
4360 dlg.finished(false);
4361 return Err(common::Error::HttpError(err));
4362 }
4363 Ok(res) => {
4364 let (mut parts, body) = res.into_parts();
4365 let mut body = common::Body::new(body);
4366 if !parts.status.is_success() {
4367 let bytes = common::to_bytes(body).await.unwrap_or_default();
4368 let error = serde_json::from_str(&common::to_string(&bytes));
4369 let response = common::to_response(parts, bytes.into());
4370
4371 if let common::Retry::After(d) =
4372 dlg.http_failure(&response, error.as_ref().ok())
4373 {
4374 sleep(d).await;
4375 continue;
4376 }
4377
4378 dlg.finished(false);
4379
4380 return Err(match error {
4381 Ok(value) => common::Error::BadRequest(value),
4382 _ => common::Error::Failure(response),
4383 });
4384 }
4385 let response = {
4386 let bytes = common::to_bytes(body).await.unwrap_or_default();
4387 let encoded = common::to_string(&bytes);
4388 match serde_json::from_str(&encoded) {
4389 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4390 Err(error) => {
4391 dlg.response_json_decode_error(&encoded, &error);
4392 return Err(common::Error::JsonDecodeError(
4393 encoded.to_string(),
4394 error,
4395 ));
4396 }
4397 }
4398 };
4399
4400 dlg.finished(true);
4401 return Ok(response);
4402 }
4403 }
4404 }
4405 }
4406
4407 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345.
4408 ///
4409 /// Sets the *apps id* path property to the given value.
4410 ///
4411 /// Even though the property as already been set when instantiating this call,
4412 /// we provide this method for API completeness.
4413 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateGetCall<'a, C> {
4414 self._apps_id = new_value.to_string();
4415 self
4416 }
4417 /// Part of `name`. See documentation of `appsId`.
4418 ///
4419 /// Sets the *authorized certificates id* path property to the given value.
4420 ///
4421 /// Even though the property as already been set when instantiating this call,
4422 /// we provide this method for API completeness.
4423 pub fn authorized_certificates_id(
4424 mut self,
4425 new_value: &str,
4426 ) -> AppAuthorizedCertificateGetCall<'a, C> {
4427 self._authorized_certificates_id = new_value.to_string();
4428 self
4429 }
4430 /// Controls the set of fields returned in the GET response.
4431 ///
4432 /// Sets the *view* query property to the given value.
4433 pub fn view(mut self, new_value: &str) -> AppAuthorizedCertificateGetCall<'a, C> {
4434 self._view = Some(new_value.to_string());
4435 self
4436 }
4437 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4438 /// while executing the actual API request.
4439 ///
4440 /// ````text
4441 /// It should be used to handle progress information, and to implement a certain level of resilience.
4442 /// ````
4443 ///
4444 /// Sets the *delegate* property to the given value.
4445 pub fn delegate(
4446 mut self,
4447 new_value: &'a mut dyn common::Delegate,
4448 ) -> AppAuthorizedCertificateGetCall<'a, C> {
4449 self._delegate = Some(new_value);
4450 self
4451 }
4452
4453 /// Set any additional parameter of the query string used in the request.
4454 /// It should be used to set parameters which are not yet available through their own
4455 /// setters.
4456 ///
4457 /// Please note that this method must not be used to set any of the known parameters
4458 /// which have their own setter method. If done anyway, the request will fail.
4459 ///
4460 /// # Additional Parameters
4461 ///
4462 /// * *$.xgafv* (query-string) - V1 error format.
4463 /// * *access_token* (query-string) - OAuth access token.
4464 /// * *alt* (query-string) - Data format for response.
4465 /// * *callback* (query-string) - JSONP
4466 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4467 /// * *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.
4468 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4469 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4470 /// * *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.
4471 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4472 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4473 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateGetCall<'a, C>
4474 where
4475 T: AsRef<str>,
4476 {
4477 self._additional_params
4478 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4479 self
4480 }
4481
4482 /// Identifies the authorization scope for the method you are building.
4483 ///
4484 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4485 /// [`Scope::CloudPlatformReadOnly`].
4486 ///
4487 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4488 /// tokens for more than one scope.
4489 ///
4490 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4491 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4492 /// sufficient, a read-write scope will do as well.
4493 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateGetCall<'a, C>
4494 where
4495 St: AsRef<str>,
4496 {
4497 self._scopes.insert(String::from(scope.as_ref()));
4498 self
4499 }
4500 /// Identifies the authorization scope(s) for the method you are building.
4501 ///
4502 /// See [`Self::add_scope()`] for details.
4503 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateGetCall<'a, C>
4504 where
4505 I: IntoIterator<Item = St>,
4506 St: AsRef<str>,
4507 {
4508 self._scopes
4509 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4510 self
4511 }
4512
4513 /// Removes all scopes, and no default scope will be used either.
4514 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4515 /// for details).
4516 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateGetCall<'a, C> {
4517 self._scopes.clear();
4518 self
4519 }
4520}
4521
4522/// Lists all SSL certificates the user is authorized to administer.
4523///
4524/// A builder for the *authorizedCertificates.list* method supported by a *app* resource.
4525/// It is not used directly, but through a [`AppMethods`] instance.
4526///
4527/// # Example
4528///
4529/// Instantiate a resource method builder
4530///
4531/// ```test_harness,no_run
4532/// # extern crate hyper;
4533/// # extern crate hyper_rustls;
4534/// # extern crate google_appengine1 as appengine1;
4535/// # async fn dox() {
4536/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4537///
4538/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4539/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4540/// # .with_native_roots()
4541/// # .unwrap()
4542/// # .https_only()
4543/// # .enable_http2()
4544/// # .build();
4545///
4546/// # let executor = hyper_util::rt::TokioExecutor::new();
4547/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4548/// # secret,
4549/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4550/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4551/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4552/// # ),
4553/// # ).build().await.unwrap();
4554///
4555/// # let client = hyper_util::client::legacy::Client::builder(
4556/// # hyper_util::rt::TokioExecutor::new()
4557/// # )
4558/// # .build(
4559/// # hyper_rustls::HttpsConnectorBuilder::new()
4560/// # .with_native_roots()
4561/// # .unwrap()
4562/// # .https_or_http()
4563/// # .enable_http2()
4564/// # .build()
4565/// # );
4566/// # let mut hub = Appengine::new(client, auth);
4567/// // You can configure optional parameters by calling the respective setters at will, and
4568/// // execute the final call using `doit()`.
4569/// // Values shown here are possibly random and not representative !
4570/// let result = hub.apps().authorized_certificates_list("appsId")
4571/// .view("duo")
4572/// .page_token("ipsum")
4573/// .page_size(-93)
4574/// .doit().await;
4575/// # }
4576/// ```
4577pub struct AppAuthorizedCertificateListCall<'a, C>
4578where
4579 C: 'a,
4580{
4581 hub: &'a Appengine<C>,
4582 _apps_id: String,
4583 _view: Option<String>,
4584 _page_token: Option<String>,
4585 _page_size: Option<i32>,
4586 _delegate: Option<&'a mut dyn common::Delegate>,
4587 _additional_params: HashMap<String, String>,
4588 _scopes: BTreeSet<String>,
4589}
4590
4591impl<'a, C> common::CallBuilder for AppAuthorizedCertificateListCall<'a, C> {}
4592
4593impl<'a, C> AppAuthorizedCertificateListCall<'a, C>
4594where
4595 C: common::Connector,
4596{
4597 /// Perform the operation you have build so far.
4598 pub async fn doit(
4599 mut self,
4600 ) -> common::Result<(common::Response, ListAuthorizedCertificatesResponse)> {
4601 use std::borrow::Cow;
4602 use std::io::{Read, Seek};
4603
4604 use common::{url::Params, ToParts};
4605 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4606
4607 let mut dd = common::DefaultDelegate;
4608 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4609 dlg.begin(common::MethodInfo {
4610 id: "appengine.apps.authorizedCertificates.list",
4611 http_method: hyper::Method::GET,
4612 });
4613
4614 for &field in ["alt", "appsId", "view", "pageToken", "pageSize"].iter() {
4615 if self._additional_params.contains_key(field) {
4616 dlg.finished(false);
4617 return Err(common::Error::FieldClash(field));
4618 }
4619 }
4620
4621 let mut params = Params::with_capacity(6 + self._additional_params.len());
4622 params.push("appsId", self._apps_id);
4623 if let Some(value) = self._view.as_ref() {
4624 params.push("view", value);
4625 }
4626 if let Some(value) = self._page_token.as_ref() {
4627 params.push("pageToken", value);
4628 }
4629 if let Some(value) = self._page_size.as_ref() {
4630 params.push("pageSize", value.to_string());
4631 }
4632
4633 params.extend(self._additional_params.iter());
4634
4635 params.push("alt", "json");
4636 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates";
4637 if self._scopes.is_empty() {
4638 self._scopes
4639 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4640 }
4641
4642 #[allow(clippy::single_element_loop)]
4643 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
4644 url = params.uri_replacement(url, param_name, find_this, false);
4645 }
4646 {
4647 let to_remove = ["appsId"];
4648 params.remove_params(&to_remove);
4649 }
4650
4651 let url = params.parse_with_url(&url);
4652
4653 loop {
4654 let token = match self
4655 .hub
4656 .auth
4657 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4658 .await
4659 {
4660 Ok(token) => token,
4661 Err(e) => match dlg.token(e) {
4662 Ok(token) => token,
4663 Err(e) => {
4664 dlg.finished(false);
4665 return Err(common::Error::MissingToken(e));
4666 }
4667 },
4668 };
4669 let mut req_result = {
4670 let client = &self.hub.client;
4671 dlg.pre_request();
4672 let mut req_builder = hyper::Request::builder()
4673 .method(hyper::Method::GET)
4674 .uri(url.as_str())
4675 .header(USER_AGENT, self.hub._user_agent.clone());
4676
4677 if let Some(token) = token.as_ref() {
4678 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4679 }
4680
4681 let request = req_builder
4682 .header(CONTENT_LENGTH, 0_u64)
4683 .body(common::to_body::<String>(None));
4684
4685 client.request(request.unwrap()).await
4686 };
4687
4688 match req_result {
4689 Err(err) => {
4690 if let common::Retry::After(d) = dlg.http_error(&err) {
4691 sleep(d).await;
4692 continue;
4693 }
4694 dlg.finished(false);
4695 return Err(common::Error::HttpError(err));
4696 }
4697 Ok(res) => {
4698 let (mut parts, body) = res.into_parts();
4699 let mut body = common::Body::new(body);
4700 if !parts.status.is_success() {
4701 let bytes = common::to_bytes(body).await.unwrap_or_default();
4702 let error = serde_json::from_str(&common::to_string(&bytes));
4703 let response = common::to_response(parts, bytes.into());
4704
4705 if let common::Retry::After(d) =
4706 dlg.http_failure(&response, error.as_ref().ok())
4707 {
4708 sleep(d).await;
4709 continue;
4710 }
4711
4712 dlg.finished(false);
4713
4714 return Err(match error {
4715 Ok(value) => common::Error::BadRequest(value),
4716 _ => common::Error::Failure(response),
4717 });
4718 }
4719 let response = {
4720 let bytes = common::to_bytes(body).await.unwrap_or_default();
4721 let encoded = common::to_string(&bytes);
4722 match serde_json::from_str(&encoded) {
4723 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4724 Err(error) => {
4725 dlg.response_json_decode_error(&encoded, &error);
4726 return Err(common::Error::JsonDecodeError(
4727 encoded.to_string(),
4728 error,
4729 ));
4730 }
4731 }
4732 };
4733
4734 dlg.finished(true);
4735 return Ok(response);
4736 }
4737 }
4738 }
4739 }
4740
4741 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
4742 ///
4743 /// Sets the *apps id* path property to the given value.
4744 ///
4745 /// Even though the property as already been set when instantiating this call,
4746 /// we provide this method for API completeness.
4747 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, C> {
4748 self._apps_id = new_value.to_string();
4749 self
4750 }
4751 /// Controls the set of fields returned in the LIST response.
4752 ///
4753 /// Sets the *view* query property to the given value.
4754 pub fn view(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, C> {
4755 self._view = Some(new_value.to_string());
4756 self
4757 }
4758 /// Continuation token for fetching the next page of results.
4759 ///
4760 /// Sets the *page token* query property to the given value.
4761 pub fn page_token(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, C> {
4762 self._page_token = Some(new_value.to_string());
4763 self
4764 }
4765 /// Maximum results to return per page.
4766 ///
4767 /// Sets the *page size* query property to the given value.
4768 pub fn page_size(mut self, new_value: i32) -> AppAuthorizedCertificateListCall<'a, C> {
4769 self._page_size = Some(new_value);
4770 self
4771 }
4772 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4773 /// while executing the actual API request.
4774 ///
4775 /// ````text
4776 /// It should be used to handle progress information, and to implement a certain level of resilience.
4777 /// ````
4778 ///
4779 /// Sets the *delegate* property to the given value.
4780 pub fn delegate(
4781 mut self,
4782 new_value: &'a mut dyn common::Delegate,
4783 ) -> AppAuthorizedCertificateListCall<'a, C> {
4784 self._delegate = Some(new_value);
4785 self
4786 }
4787
4788 /// Set any additional parameter of the query string used in the request.
4789 /// It should be used to set parameters which are not yet available through their own
4790 /// setters.
4791 ///
4792 /// Please note that this method must not be used to set any of the known parameters
4793 /// which have their own setter method. If done anyway, the request will fail.
4794 ///
4795 /// # Additional Parameters
4796 ///
4797 /// * *$.xgafv* (query-string) - V1 error format.
4798 /// * *access_token* (query-string) - OAuth access token.
4799 /// * *alt* (query-string) - Data format for response.
4800 /// * *callback* (query-string) - JSONP
4801 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4802 /// * *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.
4803 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4804 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4805 /// * *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.
4806 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4807 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4808 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateListCall<'a, C>
4809 where
4810 T: AsRef<str>,
4811 {
4812 self._additional_params
4813 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4814 self
4815 }
4816
4817 /// Identifies the authorization scope for the method you are building.
4818 ///
4819 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4820 /// [`Scope::CloudPlatformReadOnly`].
4821 ///
4822 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4823 /// tokens for more than one scope.
4824 ///
4825 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4826 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4827 /// sufficient, a read-write scope will do as well.
4828 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateListCall<'a, C>
4829 where
4830 St: AsRef<str>,
4831 {
4832 self._scopes.insert(String::from(scope.as_ref()));
4833 self
4834 }
4835 /// Identifies the authorization scope(s) for the method you are building.
4836 ///
4837 /// See [`Self::add_scope()`] for details.
4838 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateListCall<'a, C>
4839 where
4840 I: IntoIterator<Item = St>,
4841 St: AsRef<str>,
4842 {
4843 self._scopes
4844 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4845 self
4846 }
4847
4848 /// Removes all scopes, and no default scope will be used either.
4849 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4850 /// for details).
4851 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateListCall<'a, C> {
4852 self._scopes.clear();
4853 self
4854 }
4855}
4856
4857/// Updates the specified SSL certificate. To renew a certificate and maintain its existing domain mappings, update certificate_data with a new certificate. The new certificate must be applicable to the same domains as the original certificate. The certificate display_name may also be updated.
4858///
4859/// A builder for the *authorizedCertificates.patch* method supported by a *app* resource.
4860/// It is not used directly, but through a [`AppMethods`] instance.
4861///
4862/// # Example
4863///
4864/// Instantiate a resource method builder
4865///
4866/// ```test_harness,no_run
4867/// # extern crate hyper;
4868/// # extern crate hyper_rustls;
4869/// # extern crate google_appengine1 as appengine1;
4870/// use appengine1::api::AuthorizedCertificate;
4871/// # async fn dox() {
4872/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4873///
4874/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4875/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4876/// # .with_native_roots()
4877/// # .unwrap()
4878/// # .https_only()
4879/// # .enable_http2()
4880/// # .build();
4881///
4882/// # let executor = hyper_util::rt::TokioExecutor::new();
4883/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4884/// # secret,
4885/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4886/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4887/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4888/// # ),
4889/// # ).build().await.unwrap();
4890///
4891/// # let client = hyper_util::client::legacy::Client::builder(
4892/// # hyper_util::rt::TokioExecutor::new()
4893/// # )
4894/// # .build(
4895/// # hyper_rustls::HttpsConnectorBuilder::new()
4896/// # .with_native_roots()
4897/// # .unwrap()
4898/// # .https_or_http()
4899/// # .enable_http2()
4900/// # .build()
4901/// # );
4902/// # let mut hub = Appengine::new(client, auth);
4903/// // As the method needs a request, you would usually fill it with the desired information
4904/// // into the respective structure. Some of the parts shown here might not be applicable !
4905/// // Values shown here are possibly random and not representative !
4906/// let mut req = AuthorizedCertificate::default();
4907///
4908/// // You can configure optional parameters by calling the respective setters at will, and
4909/// // execute the final call using `doit()`.
4910/// // Values shown here are possibly random and not representative !
4911/// let result = hub.apps().authorized_certificates_patch(req, "appsId", "authorizedCertificatesId")
4912/// .update_mask(FieldMask::new::<&str>(&[]))
4913/// .doit().await;
4914/// # }
4915/// ```
4916pub struct AppAuthorizedCertificatePatchCall<'a, C>
4917where
4918 C: 'a,
4919{
4920 hub: &'a Appengine<C>,
4921 _request: AuthorizedCertificate,
4922 _apps_id: String,
4923 _authorized_certificates_id: String,
4924 _update_mask: Option<common::FieldMask>,
4925 _delegate: Option<&'a mut dyn common::Delegate>,
4926 _additional_params: HashMap<String, String>,
4927 _scopes: BTreeSet<String>,
4928}
4929
4930impl<'a, C> common::CallBuilder for AppAuthorizedCertificatePatchCall<'a, C> {}
4931
4932impl<'a, C> AppAuthorizedCertificatePatchCall<'a, C>
4933where
4934 C: common::Connector,
4935{
4936 /// Perform the operation you have build so far.
4937 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
4938 use std::borrow::Cow;
4939 use std::io::{Read, Seek};
4940
4941 use common::{url::Params, ToParts};
4942 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4943
4944 let mut dd = common::DefaultDelegate;
4945 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4946 dlg.begin(common::MethodInfo {
4947 id: "appengine.apps.authorizedCertificates.patch",
4948 http_method: hyper::Method::PATCH,
4949 });
4950
4951 for &field in ["alt", "appsId", "authorizedCertificatesId", "updateMask"].iter() {
4952 if self._additional_params.contains_key(field) {
4953 dlg.finished(false);
4954 return Err(common::Error::FieldClash(field));
4955 }
4956 }
4957
4958 let mut params = Params::with_capacity(6 + self._additional_params.len());
4959 params.push("appsId", self._apps_id);
4960 params.push("authorizedCertificatesId", self._authorized_certificates_id);
4961 if let Some(value) = self._update_mask.as_ref() {
4962 params.push("updateMask", value.to_string());
4963 }
4964
4965 params.extend(self._additional_params.iter());
4966
4967 params.push("alt", "json");
4968 let mut url = self.hub._base_url.clone()
4969 + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}";
4970 if self._scopes.is_empty() {
4971 self._scopes
4972 .insert(Scope::CloudPlatform.as_ref().to_string());
4973 }
4974
4975 #[allow(clippy::single_element_loop)]
4976 for &(find_this, param_name) in [
4977 ("{appsId}", "appsId"),
4978 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
4979 ]
4980 .iter()
4981 {
4982 url = params.uri_replacement(url, param_name, find_this, false);
4983 }
4984 {
4985 let to_remove = ["authorizedCertificatesId", "appsId"];
4986 params.remove_params(&to_remove);
4987 }
4988
4989 let url = params.parse_with_url(&url);
4990
4991 let mut json_mime_type = mime::APPLICATION_JSON;
4992 let mut request_value_reader = {
4993 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4994 common::remove_json_null_values(&mut value);
4995 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4996 serde_json::to_writer(&mut dst, &value).unwrap();
4997 dst
4998 };
4999 let request_size = request_value_reader
5000 .seek(std::io::SeekFrom::End(0))
5001 .unwrap();
5002 request_value_reader
5003 .seek(std::io::SeekFrom::Start(0))
5004 .unwrap();
5005
5006 loop {
5007 let token = match self
5008 .hub
5009 .auth
5010 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5011 .await
5012 {
5013 Ok(token) => token,
5014 Err(e) => match dlg.token(e) {
5015 Ok(token) => token,
5016 Err(e) => {
5017 dlg.finished(false);
5018 return Err(common::Error::MissingToken(e));
5019 }
5020 },
5021 };
5022 request_value_reader
5023 .seek(std::io::SeekFrom::Start(0))
5024 .unwrap();
5025 let mut req_result = {
5026 let client = &self.hub.client;
5027 dlg.pre_request();
5028 let mut req_builder = hyper::Request::builder()
5029 .method(hyper::Method::PATCH)
5030 .uri(url.as_str())
5031 .header(USER_AGENT, self.hub._user_agent.clone());
5032
5033 if let Some(token) = token.as_ref() {
5034 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5035 }
5036
5037 let request = req_builder
5038 .header(CONTENT_TYPE, json_mime_type.to_string())
5039 .header(CONTENT_LENGTH, request_size as u64)
5040 .body(common::to_body(
5041 request_value_reader.get_ref().clone().into(),
5042 ));
5043
5044 client.request(request.unwrap()).await
5045 };
5046
5047 match req_result {
5048 Err(err) => {
5049 if let common::Retry::After(d) = dlg.http_error(&err) {
5050 sleep(d).await;
5051 continue;
5052 }
5053 dlg.finished(false);
5054 return Err(common::Error::HttpError(err));
5055 }
5056 Ok(res) => {
5057 let (mut parts, body) = res.into_parts();
5058 let mut body = common::Body::new(body);
5059 if !parts.status.is_success() {
5060 let bytes = common::to_bytes(body).await.unwrap_or_default();
5061 let error = serde_json::from_str(&common::to_string(&bytes));
5062 let response = common::to_response(parts, bytes.into());
5063
5064 if let common::Retry::After(d) =
5065 dlg.http_failure(&response, error.as_ref().ok())
5066 {
5067 sleep(d).await;
5068 continue;
5069 }
5070
5071 dlg.finished(false);
5072
5073 return Err(match error {
5074 Ok(value) => common::Error::BadRequest(value),
5075 _ => common::Error::Failure(response),
5076 });
5077 }
5078 let response = {
5079 let bytes = common::to_bytes(body).await.unwrap_or_default();
5080 let encoded = common::to_string(&bytes);
5081 match serde_json::from_str(&encoded) {
5082 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5083 Err(error) => {
5084 dlg.response_json_decode_error(&encoded, &error);
5085 return Err(common::Error::JsonDecodeError(
5086 encoded.to_string(),
5087 error,
5088 ));
5089 }
5090 }
5091 };
5092
5093 dlg.finished(true);
5094 return Ok(response);
5095 }
5096 }
5097 }
5098 }
5099
5100 ///
5101 /// Sets the *request* property to the given value.
5102 ///
5103 /// Even though the property as already been set when instantiating this call,
5104 /// we provide this method for API completeness.
5105 pub fn request(
5106 mut self,
5107 new_value: AuthorizedCertificate,
5108 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
5109 self._request = new_value;
5110 self
5111 }
5112 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345.
5113 ///
5114 /// Sets the *apps id* path property to the given value.
5115 ///
5116 /// Even though the property as already been set when instantiating this call,
5117 /// we provide this method for API completeness.
5118 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificatePatchCall<'a, C> {
5119 self._apps_id = new_value.to_string();
5120 self
5121 }
5122 /// Part of `name`. See documentation of `appsId`.
5123 ///
5124 /// Sets the *authorized certificates id* path property to the given value.
5125 ///
5126 /// Even though the property as already been set when instantiating this call,
5127 /// we provide this method for API completeness.
5128 pub fn authorized_certificates_id(
5129 mut self,
5130 new_value: &str,
5131 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
5132 self._authorized_certificates_id = new_value.to_string();
5133 self
5134 }
5135 /// Standard field mask for the set of fields to be updated. Updates are only supported on the certificate_raw_data and display_name fields.
5136 ///
5137 /// Sets the *update mask* query property to the given value.
5138 pub fn update_mask(
5139 mut self,
5140 new_value: common::FieldMask,
5141 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
5142 self._update_mask = Some(new_value);
5143 self
5144 }
5145 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5146 /// while executing the actual API request.
5147 ///
5148 /// ````text
5149 /// It should be used to handle progress information, and to implement a certain level of resilience.
5150 /// ````
5151 ///
5152 /// Sets the *delegate* property to the given value.
5153 pub fn delegate(
5154 mut self,
5155 new_value: &'a mut dyn common::Delegate,
5156 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
5157 self._delegate = Some(new_value);
5158 self
5159 }
5160
5161 /// Set any additional parameter of the query string used in the request.
5162 /// It should be used to set parameters which are not yet available through their own
5163 /// setters.
5164 ///
5165 /// Please note that this method must not be used to set any of the known parameters
5166 /// which have their own setter method. If done anyway, the request will fail.
5167 ///
5168 /// # Additional Parameters
5169 ///
5170 /// * *$.xgafv* (query-string) - V1 error format.
5171 /// * *access_token* (query-string) - OAuth access token.
5172 /// * *alt* (query-string) - Data format for response.
5173 /// * *callback* (query-string) - JSONP
5174 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5175 /// * *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.
5176 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5177 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5178 /// * *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.
5179 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5180 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5181 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificatePatchCall<'a, C>
5182 where
5183 T: AsRef<str>,
5184 {
5185 self._additional_params
5186 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5187 self
5188 }
5189
5190 /// Identifies the authorization scope for the method you are building.
5191 ///
5192 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5193 /// [`Scope::CloudPlatform`].
5194 ///
5195 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5196 /// tokens for more than one scope.
5197 ///
5198 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5199 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5200 /// sufficient, a read-write scope will do as well.
5201 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificatePatchCall<'a, C>
5202 where
5203 St: AsRef<str>,
5204 {
5205 self._scopes.insert(String::from(scope.as_ref()));
5206 self
5207 }
5208 /// Identifies the authorization scope(s) for the method you are building.
5209 ///
5210 /// See [`Self::add_scope()`] for details.
5211 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificatePatchCall<'a, C>
5212 where
5213 I: IntoIterator<Item = St>,
5214 St: AsRef<str>,
5215 {
5216 self._scopes
5217 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5218 self
5219 }
5220
5221 /// Removes all scopes, and no default scope will be used either.
5222 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5223 /// for details).
5224 pub fn clear_scopes(mut self) -> AppAuthorizedCertificatePatchCall<'a, C> {
5225 self._scopes.clear();
5226 self
5227 }
5228}
5229
5230/// Lists all domains the user is authorized to administer.
5231///
5232/// A builder for the *authorizedDomains.list* method supported by a *app* resource.
5233/// It is not used directly, but through a [`AppMethods`] instance.
5234///
5235/// # Example
5236///
5237/// Instantiate a resource method builder
5238///
5239/// ```test_harness,no_run
5240/// # extern crate hyper;
5241/// # extern crate hyper_rustls;
5242/// # extern crate google_appengine1 as appengine1;
5243/// # async fn dox() {
5244/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5245///
5246/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5247/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5248/// # .with_native_roots()
5249/// # .unwrap()
5250/// # .https_only()
5251/// # .enable_http2()
5252/// # .build();
5253///
5254/// # let executor = hyper_util::rt::TokioExecutor::new();
5255/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5256/// # secret,
5257/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5258/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5259/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5260/// # ),
5261/// # ).build().await.unwrap();
5262///
5263/// # let client = hyper_util::client::legacy::Client::builder(
5264/// # hyper_util::rt::TokioExecutor::new()
5265/// # )
5266/// # .build(
5267/// # hyper_rustls::HttpsConnectorBuilder::new()
5268/// # .with_native_roots()
5269/// # .unwrap()
5270/// # .https_or_http()
5271/// # .enable_http2()
5272/// # .build()
5273/// # );
5274/// # let mut hub = Appengine::new(client, auth);
5275/// // You can configure optional parameters by calling the respective setters at will, and
5276/// // execute the final call using `doit()`.
5277/// // Values shown here are possibly random and not representative !
5278/// let result = hub.apps().authorized_domains_list("appsId")
5279/// .page_token("est")
5280/// .page_size(-50)
5281/// .doit().await;
5282/// # }
5283/// ```
5284pub struct AppAuthorizedDomainListCall<'a, C>
5285where
5286 C: 'a,
5287{
5288 hub: &'a Appengine<C>,
5289 _apps_id: String,
5290 _page_token: Option<String>,
5291 _page_size: Option<i32>,
5292 _delegate: Option<&'a mut dyn common::Delegate>,
5293 _additional_params: HashMap<String, String>,
5294 _scopes: BTreeSet<String>,
5295}
5296
5297impl<'a, C> common::CallBuilder for AppAuthorizedDomainListCall<'a, C> {}
5298
5299impl<'a, C> AppAuthorizedDomainListCall<'a, C>
5300where
5301 C: common::Connector,
5302{
5303 /// Perform the operation you have build so far.
5304 pub async fn doit(
5305 mut self,
5306 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
5307 use std::borrow::Cow;
5308 use std::io::{Read, Seek};
5309
5310 use common::{url::Params, ToParts};
5311 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5312
5313 let mut dd = common::DefaultDelegate;
5314 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5315 dlg.begin(common::MethodInfo {
5316 id: "appengine.apps.authorizedDomains.list",
5317 http_method: hyper::Method::GET,
5318 });
5319
5320 for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
5321 if self._additional_params.contains_key(field) {
5322 dlg.finished(false);
5323 return Err(common::Error::FieldClash(field));
5324 }
5325 }
5326
5327 let mut params = Params::with_capacity(5 + self._additional_params.len());
5328 params.push("appsId", self._apps_id);
5329 if let Some(value) = self._page_token.as_ref() {
5330 params.push("pageToken", value);
5331 }
5332 if let Some(value) = self._page_size.as_ref() {
5333 params.push("pageSize", value.to_string());
5334 }
5335
5336 params.extend(self._additional_params.iter());
5337
5338 params.push("alt", "json");
5339 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedDomains";
5340 if self._scopes.is_empty() {
5341 self._scopes
5342 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5343 }
5344
5345 #[allow(clippy::single_element_loop)]
5346 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
5347 url = params.uri_replacement(url, param_name, find_this, false);
5348 }
5349 {
5350 let to_remove = ["appsId"];
5351 params.remove_params(&to_remove);
5352 }
5353
5354 let url = params.parse_with_url(&url);
5355
5356 loop {
5357 let token = match self
5358 .hub
5359 .auth
5360 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5361 .await
5362 {
5363 Ok(token) => token,
5364 Err(e) => match dlg.token(e) {
5365 Ok(token) => token,
5366 Err(e) => {
5367 dlg.finished(false);
5368 return Err(common::Error::MissingToken(e));
5369 }
5370 },
5371 };
5372 let mut req_result = {
5373 let client = &self.hub.client;
5374 dlg.pre_request();
5375 let mut req_builder = hyper::Request::builder()
5376 .method(hyper::Method::GET)
5377 .uri(url.as_str())
5378 .header(USER_AGENT, self.hub._user_agent.clone());
5379
5380 if let Some(token) = token.as_ref() {
5381 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5382 }
5383
5384 let request = req_builder
5385 .header(CONTENT_LENGTH, 0_u64)
5386 .body(common::to_body::<String>(None));
5387
5388 client.request(request.unwrap()).await
5389 };
5390
5391 match req_result {
5392 Err(err) => {
5393 if let common::Retry::After(d) = dlg.http_error(&err) {
5394 sleep(d).await;
5395 continue;
5396 }
5397 dlg.finished(false);
5398 return Err(common::Error::HttpError(err));
5399 }
5400 Ok(res) => {
5401 let (mut parts, body) = res.into_parts();
5402 let mut body = common::Body::new(body);
5403 if !parts.status.is_success() {
5404 let bytes = common::to_bytes(body).await.unwrap_or_default();
5405 let error = serde_json::from_str(&common::to_string(&bytes));
5406 let response = common::to_response(parts, bytes.into());
5407
5408 if let common::Retry::After(d) =
5409 dlg.http_failure(&response, error.as_ref().ok())
5410 {
5411 sleep(d).await;
5412 continue;
5413 }
5414
5415 dlg.finished(false);
5416
5417 return Err(match error {
5418 Ok(value) => common::Error::BadRequest(value),
5419 _ => common::Error::Failure(response),
5420 });
5421 }
5422 let response = {
5423 let bytes = common::to_bytes(body).await.unwrap_or_default();
5424 let encoded = common::to_string(&bytes);
5425 match serde_json::from_str(&encoded) {
5426 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5427 Err(error) => {
5428 dlg.response_json_decode_error(&encoded, &error);
5429 return Err(common::Error::JsonDecodeError(
5430 encoded.to_string(),
5431 error,
5432 ));
5433 }
5434 }
5435 };
5436
5437 dlg.finished(true);
5438 return Ok(response);
5439 }
5440 }
5441 }
5442 }
5443
5444 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
5445 ///
5446 /// Sets the *apps id* path property to the given value.
5447 ///
5448 /// Even though the property as already been set when instantiating this call,
5449 /// we provide this method for API completeness.
5450 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedDomainListCall<'a, C> {
5451 self._apps_id = new_value.to_string();
5452 self
5453 }
5454 /// Continuation token for fetching the next page of results.
5455 ///
5456 /// Sets the *page token* query property to the given value.
5457 pub fn page_token(mut self, new_value: &str) -> AppAuthorizedDomainListCall<'a, C> {
5458 self._page_token = Some(new_value.to_string());
5459 self
5460 }
5461 /// Maximum results to return per page.
5462 ///
5463 /// Sets the *page size* query property to the given value.
5464 pub fn page_size(mut self, new_value: i32) -> AppAuthorizedDomainListCall<'a, C> {
5465 self._page_size = Some(new_value);
5466 self
5467 }
5468 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5469 /// while executing the actual API request.
5470 ///
5471 /// ````text
5472 /// It should be used to handle progress information, and to implement a certain level of resilience.
5473 /// ````
5474 ///
5475 /// Sets the *delegate* property to the given value.
5476 pub fn delegate(
5477 mut self,
5478 new_value: &'a mut dyn common::Delegate,
5479 ) -> AppAuthorizedDomainListCall<'a, C> {
5480 self._delegate = Some(new_value);
5481 self
5482 }
5483
5484 /// Set any additional parameter of the query string used in the request.
5485 /// It should be used to set parameters which are not yet available through their own
5486 /// setters.
5487 ///
5488 /// Please note that this method must not be used to set any of the known parameters
5489 /// which have their own setter method. If done anyway, the request will fail.
5490 ///
5491 /// # Additional Parameters
5492 ///
5493 /// * *$.xgafv* (query-string) - V1 error format.
5494 /// * *access_token* (query-string) - OAuth access token.
5495 /// * *alt* (query-string) - Data format for response.
5496 /// * *callback* (query-string) - JSONP
5497 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5498 /// * *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.
5499 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5500 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5501 /// * *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.
5502 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5503 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5504 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedDomainListCall<'a, C>
5505 where
5506 T: AsRef<str>,
5507 {
5508 self._additional_params
5509 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5510 self
5511 }
5512
5513 /// Identifies the authorization scope for the method you are building.
5514 ///
5515 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5516 /// [`Scope::CloudPlatformReadOnly`].
5517 ///
5518 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5519 /// tokens for more than one scope.
5520 ///
5521 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5522 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5523 /// sufficient, a read-write scope will do as well.
5524 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedDomainListCall<'a, C>
5525 where
5526 St: AsRef<str>,
5527 {
5528 self._scopes.insert(String::from(scope.as_ref()));
5529 self
5530 }
5531 /// Identifies the authorization scope(s) for the method you are building.
5532 ///
5533 /// See [`Self::add_scope()`] for details.
5534 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedDomainListCall<'a, C>
5535 where
5536 I: IntoIterator<Item = St>,
5537 St: AsRef<str>,
5538 {
5539 self._scopes
5540 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5541 self
5542 }
5543
5544 /// Removes all scopes, and no default scope will be used either.
5545 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5546 /// for details).
5547 pub fn clear_scopes(mut self) -> AppAuthorizedDomainListCall<'a, C> {
5548 self._scopes.clear();
5549 self
5550 }
5551}
5552
5553/// Maps a domain to an application. A user must be authorized to administer a domain in order to map it to an application. For a list of available authorized domains, see AuthorizedDomains.ListAuthorizedDomains.
5554///
5555/// A builder for the *domainMappings.create* method supported by a *app* resource.
5556/// It is not used directly, but through a [`AppMethods`] instance.
5557///
5558/// # Example
5559///
5560/// Instantiate a resource method builder
5561///
5562/// ```test_harness,no_run
5563/// # extern crate hyper;
5564/// # extern crate hyper_rustls;
5565/// # extern crate google_appengine1 as appengine1;
5566/// use appengine1::api::DomainMapping;
5567/// # async fn dox() {
5568/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5569///
5570/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5571/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5572/// # .with_native_roots()
5573/// # .unwrap()
5574/// # .https_only()
5575/// # .enable_http2()
5576/// # .build();
5577///
5578/// # let executor = hyper_util::rt::TokioExecutor::new();
5579/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5580/// # secret,
5581/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5582/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5583/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5584/// # ),
5585/// # ).build().await.unwrap();
5586///
5587/// # let client = hyper_util::client::legacy::Client::builder(
5588/// # hyper_util::rt::TokioExecutor::new()
5589/// # )
5590/// # .build(
5591/// # hyper_rustls::HttpsConnectorBuilder::new()
5592/// # .with_native_roots()
5593/// # .unwrap()
5594/// # .https_or_http()
5595/// # .enable_http2()
5596/// # .build()
5597/// # );
5598/// # let mut hub = Appengine::new(client, auth);
5599/// // As the method needs a request, you would usually fill it with the desired information
5600/// // into the respective structure. Some of the parts shown here might not be applicable !
5601/// // Values shown here are possibly random and not representative !
5602/// let mut req = DomainMapping::default();
5603///
5604/// // You can configure optional parameters by calling the respective setters at will, and
5605/// // execute the final call using `doit()`.
5606/// // Values shown here are possibly random and not representative !
5607/// let result = hub.apps().domain_mappings_create(req, "appsId")
5608/// .override_strategy("est")
5609/// .doit().await;
5610/// # }
5611/// ```
5612pub struct AppDomainMappingCreateCall<'a, C>
5613where
5614 C: 'a,
5615{
5616 hub: &'a Appengine<C>,
5617 _request: DomainMapping,
5618 _apps_id: String,
5619 _override_strategy: Option<String>,
5620 _delegate: Option<&'a mut dyn common::Delegate>,
5621 _additional_params: HashMap<String, String>,
5622 _scopes: BTreeSet<String>,
5623}
5624
5625impl<'a, C> common::CallBuilder for AppDomainMappingCreateCall<'a, C> {}
5626
5627impl<'a, C> AppDomainMappingCreateCall<'a, C>
5628where
5629 C: common::Connector,
5630{
5631 /// Perform the operation you have build so far.
5632 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5633 use std::borrow::Cow;
5634 use std::io::{Read, Seek};
5635
5636 use common::{url::Params, ToParts};
5637 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5638
5639 let mut dd = common::DefaultDelegate;
5640 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5641 dlg.begin(common::MethodInfo {
5642 id: "appengine.apps.domainMappings.create",
5643 http_method: hyper::Method::POST,
5644 });
5645
5646 for &field in ["alt", "appsId", "overrideStrategy"].iter() {
5647 if self._additional_params.contains_key(field) {
5648 dlg.finished(false);
5649 return Err(common::Error::FieldClash(field));
5650 }
5651 }
5652
5653 let mut params = Params::with_capacity(5 + self._additional_params.len());
5654 params.push("appsId", self._apps_id);
5655 if let Some(value) = self._override_strategy.as_ref() {
5656 params.push("overrideStrategy", value);
5657 }
5658
5659 params.extend(self._additional_params.iter());
5660
5661 params.push("alt", "json");
5662 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings";
5663 if self._scopes.is_empty() {
5664 self._scopes
5665 .insert(Scope::CloudPlatform.as_ref().to_string());
5666 }
5667
5668 #[allow(clippy::single_element_loop)]
5669 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
5670 url = params.uri_replacement(url, param_name, find_this, false);
5671 }
5672 {
5673 let to_remove = ["appsId"];
5674 params.remove_params(&to_remove);
5675 }
5676
5677 let url = params.parse_with_url(&url);
5678
5679 let mut json_mime_type = mime::APPLICATION_JSON;
5680 let mut request_value_reader = {
5681 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5682 common::remove_json_null_values(&mut value);
5683 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5684 serde_json::to_writer(&mut dst, &value).unwrap();
5685 dst
5686 };
5687 let request_size = request_value_reader
5688 .seek(std::io::SeekFrom::End(0))
5689 .unwrap();
5690 request_value_reader
5691 .seek(std::io::SeekFrom::Start(0))
5692 .unwrap();
5693
5694 loop {
5695 let token = match self
5696 .hub
5697 .auth
5698 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5699 .await
5700 {
5701 Ok(token) => token,
5702 Err(e) => match dlg.token(e) {
5703 Ok(token) => token,
5704 Err(e) => {
5705 dlg.finished(false);
5706 return Err(common::Error::MissingToken(e));
5707 }
5708 },
5709 };
5710 request_value_reader
5711 .seek(std::io::SeekFrom::Start(0))
5712 .unwrap();
5713 let mut req_result = {
5714 let client = &self.hub.client;
5715 dlg.pre_request();
5716 let mut req_builder = hyper::Request::builder()
5717 .method(hyper::Method::POST)
5718 .uri(url.as_str())
5719 .header(USER_AGENT, self.hub._user_agent.clone());
5720
5721 if let Some(token) = token.as_ref() {
5722 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5723 }
5724
5725 let request = req_builder
5726 .header(CONTENT_TYPE, json_mime_type.to_string())
5727 .header(CONTENT_LENGTH, request_size as u64)
5728 .body(common::to_body(
5729 request_value_reader.get_ref().clone().into(),
5730 ));
5731
5732 client.request(request.unwrap()).await
5733 };
5734
5735 match req_result {
5736 Err(err) => {
5737 if let common::Retry::After(d) = dlg.http_error(&err) {
5738 sleep(d).await;
5739 continue;
5740 }
5741 dlg.finished(false);
5742 return Err(common::Error::HttpError(err));
5743 }
5744 Ok(res) => {
5745 let (mut parts, body) = res.into_parts();
5746 let mut body = common::Body::new(body);
5747 if !parts.status.is_success() {
5748 let bytes = common::to_bytes(body).await.unwrap_or_default();
5749 let error = serde_json::from_str(&common::to_string(&bytes));
5750 let response = common::to_response(parts, bytes.into());
5751
5752 if let common::Retry::After(d) =
5753 dlg.http_failure(&response, error.as_ref().ok())
5754 {
5755 sleep(d).await;
5756 continue;
5757 }
5758
5759 dlg.finished(false);
5760
5761 return Err(match error {
5762 Ok(value) => common::Error::BadRequest(value),
5763 _ => common::Error::Failure(response),
5764 });
5765 }
5766 let response = {
5767 let bytes = common::to_bytes(body).await.unwrap_or_default();
5768 let encoded = common::to_string(&bytes);
5769 match serde_json::from_str(&encoded) {
5770 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5771 Err(error) => {
5772 dlg.response_json_decode_error(&encoded, &error);
5773 return Err(common::Error::JsonDecodeError(
5774 encoded.to_string(),
5775 error,
5776 ));
5777 }
5778 }
5779 };
5780
5781 dlg.finished(true);
5782 return Ok(response);
5783 }
5784 }
5785 }
5786 }
5787
5788 ///
5789 /// Sets the *request* property to the given value.
5790 ///
5791 /// Even though the property as already been set when instantiating this call,
5792 /// we provide this method for API completeness.
5793 pub fn request(mut self, new_value: DomainMapping) -> AppDomainMappingCreateCall<'a, C> {
5794 self._request = new_value;
5795 self
5796 }
5797 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
5798 ///
5799 /// Sets the *apps id* path property to the given value.
5800 ///
5801 /// Even though the property as already been set when instantiating this call,
5802 /// we provide this method for API completeness.
5803 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingCreateCall<'a, C> {
5804 self._apps_id = new_value.to_string();
5805 self
5806 }
5807 /// Whether the domain creation should override any existing mappings for this domain. By default, overrides are rejected.
5808 ///
5809 /// Sets the *override strategy* query property to the given value.
5810 pub fn override_strategy(mut self, new_value: &str) -> AppDomainMappingCreateCall<'a, C> {
5811 self._override_strategy = Some(new_value.to_string());
5812 self
5813 }
5814 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5815 /// while executing the actual API request.
5816 ///
5817 /// ````text
5818 /// It should be used to handle progress information, and to implement a certain level of resilience.
5819 /// ````
5820 ///
5821 /// Sets the *delegate* property to the given value.
5822 pub fn delegate(
5823 mut self,
5824 new_value: &'a mut dyn common::Delegate,
5825 ) -> AppDomainMappingCreateCall<'a, C> {
5826 self._delegate = Some(new_value);
5827 self
5828 }
5829
5830 /// Set any additional parameter of the query string used in the request.
5831 /// It should be used to set parameters which are not yet available through their own
5832 /// setters.
5833 ///
5834 /// Please note that this method must not be used to set any of the known parameters
5835 /// which have their own setter method. If done anyway, the request will fail.
5836 ///
5837 /// # Additional Parameters
5838 ///
5839 /// * *$.xgafv* (query-string) - V1 error format.
5840 /// * *access_token* (query-string) - OAuth access token.
5841 /// * *alt* (query-string) - Data format for response.
5842 /// * *callback* (query-string) - JSONP
5843 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5844 /// * *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.
5845 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5846 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5847 /// * *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.
5848 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5849 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5850 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingCreateCall<'a, C>
5851 where
5852 T: AsRef<str>,
5853 {
5854 self._additional_params
5855 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5856 self
5857 }
5858
5859 /// Identifies the authorization scope for the method you are building.
5860 ///
5861 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5862 /// [`Scope::CloudPlatform`].
5863 ///
5864 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5865 /// tokens for more than one scope.
5866 ///
5867 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5868 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5869 /// sufficient, a read-write scope will do as well.
5870 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingCreateCall<'a, C>
5871 where
5872 St: AsRef<str>,
5873 {
5874 self._scopes.insert(String::from(scope.as_ref()));
5875 self
5876 }
5877 /// Identifies the authorization scope(s) for the method you are building.
5878 ///
5879 /// See [`Self::add_scope()`] for details.
5880 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingCreateCall<'a, C>
5881 where
5882 I: IntoIterator<Item = St>,
5883 St: AsRef<str>,
5884 {
5885 self._scopes
5886 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5887 self
5888 }
5889
5890 /// Removes all scopes, and no default scope will be used either.
5891 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5892 /// for details).
5893 pub fn clear_scopes(mut self) -> AppDomainMappingCreateCall<'a, C> {
5894 self._scopes.clear();
5895 self
5896 }
5897}
5898
5899/// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource.
5900///
5901/// A builder for the *domainMappings.delete* method supported by a *app* resource.
5902/// It is not used directly, but through a [`AppMethods`] instance.
5903///
5904/// # Example
5905///
5906/// Instantiate a resource method builder
5907///
5908/// ```test_harness,no_run
5909/// # extern crate hyper;
5910/// # extern crate hyper_rustls;
5911/// # extern crate google_appengine1 as appengine1;
5912/// # async fn dox() {
5913/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5914///
5915/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5916/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5917/// # .with_native_roots()
5918/// # .unwrap()
5919/// # .https_only()
5920/// # .enable_http2()
5921/// # .build();
5922///
5923/// # let executor = hyper_util::rt::TokioExecutor::new();
5924/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5925/// # secret,
5926/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5927/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5928/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5929/// # ),
5930/// # ).build().await.unwrap();
5931///
5932/// # let client = hyper_util::client::legacy::Client::builder(
5933/// # hyper_util::rt::TokioExecutor::new()
5934/// # )
5935/// # .build(
5936/// # hyper_rustls::HttpsConnectorBuilder::new()
5937/// # .with_native_roots()
5938/// # .unwrap()
5939/// # .https_or_http()
5940/// # .enable_http2()
5941/// # .build()
5942/// # );
5943/// # let mut hub = Appengine::new(client, auth);
5944/// // You can configure optional parameters by calling the respective setters at will, and
5945/// // execute the final call using `doit()`.
5946/// // Values shown here are possibly random and not representative !
5947/// let result = hub.apps().domain_mappings_delete("appsId", "domainMappingsId")
5948/// .doit().await;
5949/// # }
5950/// ```
5951pub struct AppDomainMappingDeleteCall<'a, C>
5952where
5953 C: 'a,
5954{
5955 hub: &'a Appengine<C>,
5956 _apps_id: String,
5957 _domain_mappings_id: String,
5958 _delegate: Option<&'a mut dyn common::Delegate>,
5959 _additional_params: HashMap<String, String>,
5960 _scopes: BTreeSet<String>,
5961}
5962
5963impl<'a, C> common::CallBuilder for AppDomainMappingDeleteCall<'a, C> {}
5964
5965impl<'a, C> AppDomainMappingDeleteCall<'a, C>
5966where
5967 C: common::Connector,
5968{
5969 /// Perform the operation you have build so far.
5970 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5971 use std::borrow::Cow;
5972 use std::io::{Read, Seek};
5973
5974 use common::{url::Params, ToParts};
5975 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5976
5977 let mut dd = common::DefaultDelegate;
5978 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5979 dlg.begin(common::MethodInfo {
5980 id: "appengine.apps.domainMappings.delete",
5981 http_method: hyper::Method::DELETE,
5982 });
5983
5984 for &field in ["alt", "appsId", "domainMappingsId"].iter() {
5985 if self._additional_params.contains_key(field) {
5986 dlg.finished(false);
5987 return Err(common::Error::FieldClash(field));
5988 }
5989 }
5990
5991 let mut params = Params::with_capacity(4 + self._additional_params.len());
5992 params.push("appsId", self._apps_id);
5993 params.push("domainMappingsId", self._domain_mappings_id);
5994
5995 params.extend(self._additional_params.iter());
5996
5997 params.push("alt", "json");
5998 let mut url =
5999 self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}";
6000 if self._scopes.is_empty() {
6001 self._scopes
6002 .insert(Scope::CloudPlatform.as_ref().to_string());
6003 }
6004
6005 #[allow(clippy::single_element_loop)]
6006 for &(find_this, param_name) in [
6007 ("{appsId}", "appsId"),
6008 ("{domainMappingsId}", "domainMappingsId"),
6009 ]
6010 .iter()
6011 {
6012 url = params.uri_replacement(url, param_name, find_this, false);
6013 }
6014 {
6015 let to_remove = ["domainMappingsId", "appsId"];
6016 params.remove_params(&to_remove);
6017 }
6018
6019 let url = params.parse_with_url(&url);
6020
6021 loop {
6022 let token = match self
6023 .hub
6024 .auth
6025 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6026 .await
6027 {
6028 Ok(token) => token,
6029 Err(e) => match dlg.token(e) {
6030 Ok(token) => token,
6031 Err(e) => {
6032 dlg.finished(false);
6033 return Err(common::Error::MissingToken(e));
6034 }
6035 },
6036 };
6037 let mut req_result = {
6038 let client = &self.hub.client;
6039 dlg.pre_request();
6040 let mut req_builder = hyper::Request::builder()
6041 .method(hyper::Method::DELETE)
6042 .uri(url.as_str())
6043 .header(USER_AGENT, self.hub._user_agent.clone());
6044
6045 if let Some(token) = token.as_ref() {
6046 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6047 }
6048
6049 let request = req_builder
6050 .header(CONTENT_LENGTH, 0_u64)
6051 .body(common::to_body::<String>(None));
6052
6053 client.request(request.unwrap()).await
6054 };
6055
6056 match req_result {
6057 Err(err) => {
6058 if let common::Retry::After(d) = dlg.http_error(&err) {
6059 sleep(d).await;
6060 continue;
6061 }
6062 dlg.finished(false);
6063 return Err(common::Error::HttpError(err));
6064 }
6065 Ok(res) => {
6066 let (mut parts, body) = res.into_parts();
6067 let mut body = common::Body::new(body);
6068 if !parts.status.is_success() {
6069 let bytes = common::to_bytes(body).await.unwrap_or_default();
6070 let error = serde_json::from_str(&common::to_string(&bytes));
6071 let response = common::to_response(parts, bytes.into());
6072
6073 if let common::Retry::After(d) =
6074 dlg.http_failure(&response, error.as_ref().ok())
6075 {
6076 sleep(d).await;
6077 continue;
6078 }
6079
6080 dlg.finished(false);
6081
6082 return Err(match error {
6083 Ok(value) => common::Error::BadRequest(value),
6084 _ => common::Error::Failure(response),
6085 });
6086 }
6087 let response = {
6088 let bytes = common::to_bytes(body).await.unwrap_or_default();
6089 let encoded = common::to_string(&bytes);
6090 match serde_json::from_str(&encoded) {
6091 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6092 Err(error) => {
6093 dlg.response_json_decode_error(&encoded, &error);
6094 return Err(common::Error::JsonDecodeError(
6095 encoded.to_string(),
6096 error,
6097 ));
6098 }
6099 }
6100 };
6101
6102 dlg.finished(true);
6103 return Ok(response);
6104 }
6105 }
6106 }
6107 }
6108
6109 /// Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com.
6110 ///
6111 /// Sets the *apps id* path property to the given value.
6112 ///
6113 /// Even though the property as already been set when instantiating this call,
6114 /// we provide this method for API completeness.
6115 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingDeleteCall<'a, C> {
6116 self._apps_id = new_value.to_string();
6117 self
6118 }
6119 /// Part of `name`. See documentation of `appsId`.
6120 ///
6121 /// Sets the *domain mappings id* path property to the given value.
6122 ///
6123 /// Even though the property as already been set when instantiating this call,
6124 /// we provide this method for API completeness.
6125 pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingDeleteCall<'a, C> {
6126 self._domain_mappings_id = new_value.to_string();
6127 self
6128 }
6129 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6130 /// while executing the actual API request.
6131 ///
6132 /// ````text
6133 /// It should be used to handle progress information, and to implement a certain level of resilience.
6134 /// ````
6135 ///
6136 /// Sets the *delegate* property to the given value.
6137 pub fn delegate(
6138 mut self,
6139 new_value: &'a mut dyn common::Delegate,
6140 ) -> AppDomainMappingDeleteCall<'a, C> {
6141 self._delegate = Some(new_value);
6142 self
6143 }
6144
6145 /// Set any additional parameter of the query string used in the request.
6146 /// It should be used to set parameters which are not yet available through their own
6147 /// setters.
6148 ///
6149 /// Please note that this method must not be used to set any of the known parameters
6150 /// which have their own setter method. If done anyway, the request will fail.
6151 ///
6152 /// # Additional Parameters
6153 ///
6154 /// * *$.xgafv* (query-string) - V1 error format.
6155 /// * *access_token* (query-string) - OAuth access token.
6156 /// * *alt* (query-string) - Data format for response.
6157 /// * *callback* (query-string) - JSONP
6158 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6159 /// * *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.
6160 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6161 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6162 /// * *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.
6163 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6164 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6165 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingDeleteCall<'a, C>
6166 where
6167 T: AsRef<str>,
6168 {
6169 self._additional_params
6170 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6171 self
6172 }
6173
6174 /// Identifies the authorization scope for the method you are building.
6175 ///
6176 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6177 /// [`Scope::CloudPlatform`].
6178 ///
6179 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6180 /// tokens for more than one scope.
6181 ///
6182 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6183 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6184 /// sufficient, a read-write scope will do as well.
6185 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingDeleteCall<'a, C>
6186 where
6187 St: AsRef<str>,
6188 {
6189 self._scopes.insert(String::from(scope.as_ref()));
6190 self
6191 }
6192 /// Identifies the authorization scope(s) for the method you are building.
6193 ///
6194 /// See [`Self::add_scope()`] for details.
6195 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingDeleteCall<'a, C>
6196 where
6197 I: IntoIterator<Item = St>,
6198 St: AsRef<str>,
6199 {
6200 self._scopes
6201 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6202 self
6203 }
6204
6205 /// Removes all scopes, and no default scope will be used either.
6206 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6207 /// for details).
6208 pub fn clear_scopes(mut self) -> AppDomainMappingDeleteCall<'a, C> {
6209 self._scopes.clear();
6210 self
6211 }
6212}
6213
6214/// Gets the specified domain mapping.
6215///
6216/// A builder for the *domainMappings.get* method supported by a *app* resource.
6217/// It is not used directly, but through a [`AppMethods`] instance.
6218///
6219/// # Example
6220///
6221/// Instantiate a resource method builder
6222///
6223/// ```test_harness,no_run
6224/// # extern crate hyper;
6225/// # extern crate hyper_rustls;
6226/// # extern crate google_appengine1 as appengine1;
6227/// # async fn dox() {
6228/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6229///
6230/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6231/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6232/// # .with_native_roots()
6233/// # .unwrap()
6234/// # .https_only()
6235/// # .enable_http2()
6236/// # .build();
6237///
6238/// # let executor = hyper_util::rt::TokioExecutor::new();
6239/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6240/// # secret,
6241/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6242/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6243/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6244/// # ),
6245/// # ).build().await.unwrap();
6246///
6247/// # let client = hyper_util::client::legacy::Client::builder(
6248/// # hyper_util::rt::TokioExecutor::new()
6249/// # )
6250/// # .build(
6251/// # hyper_rustls::HttpsConnectorBuilder::new()
6252/// # .with_native_roots()
6253/// # .unwrap()
6254/// # .https_or_http()
6255/// # .enable_http2()
6256/// # .build()
6257/// # );
6258/// # let mut hub = Appengine::new(client, auth);
6259/// // You can configure optional parameters by calling the respective setters at will, and
6260/// // execute the final call using `doit()`.
6261/// // Values shown here are possibly random and not representative !
6262/// let result = hub.apps().domain_mappings_get("appsId", "domainMappingsId")
6263/// .doit().await;
6264/// # }
6265/// ```
6266pub struct AppDomainMappingGetCall<'a, C>
6267where
6268 C: 'a,
6269{
6270 hub: &'a Appengine<C>,
6271 _apps_id: String,
6272 _domain_mappings_id: String,
6273 _delegate: Option<&'a mut dyn common::Delegate>,
6274 _additional_params: HashMap<String, String>,
6275 _scopes: BTreeSet<String>,
6276}
6277
6278impl<'a, C> common::CallBuilder for AppDomainMappingGetCall<'a, C> {}
6279
6280impl<'a, C> AppDomainMappingGetCall<'a, C>
6281where
6282 C: common::Connector,
6283{
6284 /// Perform the operation you have build so far.
6285 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
6286 use std::borrow::Cow;
6287 use std::io::{Read, Seek};
6288
6289 use common::{url::Params, ToParts};
6290 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6291
6292 let mut dd = common::DefaultDelegate;
6293 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6294 dlg.begin(common::MethodInfo {
6295 id: "appengine.apps.domainMappings.get",
6296 http_method: hyper::Method::GET,
6297 });
6298
6299 for &field in ["alt", "appsId", "domainMappingsId"].iter() {
6300 if self._additional_params.contains_key(field) {
6301 dlg.finished(false);
6302 return Err(common::Error::FieldClash(field));
6303 }
6304 }
6305
6306 let mut params = Params::with_capacity(4 + self._additional_params.len());
6307 params.push("appsId", self._apps_id);
6308 params.push("domainMappingsId", self._domain_mappings_id);
6309
6310 params.extend(self._additional_params.iter());
6311
6312 params.push("alt", "json");
6313 let mut url =
6314 self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}";
6315 if self._scopes.is_empty() {
6316 self._scopes
6317 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6318 }
6319
6320 #[allow(clippy::single_element_loop)]
6321 for &(find_this, param_name) in [
6322 ("{appsId}", "appsId"),
6323 ("{domainMappingsId}", "domainMappingsId"),
6324 ]
6325 .iter()
6326 {
6327 url = params.uri_replacement(url, param_name, find_this, false);
6328 }
6329 {
6330 let to_remove = ["domainMappingsId", "appsId"];
6331 params.remove_params(&to_remove);
6332 }
6333
6334 let url = params.parse_with_url(&url);
6335
6336 loop {
6337 let token = match self
6338 .hub
6339 .auth
6340 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6341 .await
6342 {
6343 Ok(token) => token,
6344 Err(e) => match dlg.token(e) {
6345 Ok(token) => token,
6346 Err(e) => {
6347 dlg.finished(false);
6348 return Err(common::Error::MissingToken(e));
6349 }
6350 },
6351 };
6352 let mut req_result = {
6353 let client = &self.hub.client;
6354 dlg.pre_request();
6355 let mut req_builder = hyper::Request::builder()
6356 .method(hyper::Method::GET)
6357 .uri(url.as_str())
6358 .header(USER_AGENT, self.hub._user_agent.clone());
6359
6360 if let Some(token) = token.as_ref() {
6361 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6362 }
6363
6364 let request = req_builder
6365 .header(CONTENT_LENGTH, 0_u64)
6366 .body(common::to_body::<String>(None));
6367
6368 client.request(request.unwrap()).await
6369 };
6370
6371 match req_result {
6372 Err(err) => {
6373 if let common::Retry::After(d) = dlg.http_error(&err) {
6374 sleep(d).await;
6375 continue;
6376 }
6377 dlg.finished(false);
6378 return Err(common::Error::HttpError(err));
6379 }
6380 Ok(res) => {
6381 let (mut parts, body) = res.into_parts();
6382 let mut body = common::Body::new(body);
6383 if !parts.status.is_success() {
6384 let bytes = common::to_bytes(body).await.unwrap_or_default();
6385 let error = serde_json::from_str(&common::to_string(&bytes));
6386 let response = common::to_response(parts, bytes.into());
6387
6388 if let common::Retry::After(d) =
6389 dlg.http_failure(&response, error.as_ref().ok())
6390 {
6391 sleep(d).await;
6392 continue;
6393 }
6394
6395 dlg.finished(false);
6396
6397 return Err(match error {
6398 Ok(value) => common::Error::BadRequest(value),
6399 _ => common::Error::Failure(response),
6400 });
6401 }
6402 let response = {
6403 let bytes = common::to_bytes(body).await.unwrap_or_default();
6404 let encoded = common::to_string(&bytes);
6405 match serde_json::from_str(&encoded) {
6406 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6407 Err(error) => {
6408 dlg.response_json_decode_error(&encoded, &error);
6409 return Err(common::Error::JsonDecodeError(
6410 encoded.to_string(),
6411 error,
6412 ));
6413 }
6414 }
6415 };
6416
6417 dlg.finished(true);
6418 return Ok(response);
6419 }
6420 }
6421 }
6422 }
6423
6424 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/domainMappings/example.com.
6425 ///
6426 /// Sets the *apps id* path property to the given value.
6427 ///
6428 /// Even though the property as already been set when instantiating this call,
6429 /// we provide this method for API completeness.
6430 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingGetCall<'a, C> {
6431 self._apps_id = new_value.to_string();
6432 self
6433 }
6434 /// Part of `name`. See documentation of `appsId`.
6435 ///
6436 /// Sets the *domain mappings id* path property to the given value.
6437 ///
6438 /// Even though the property as already been set when instantiating this call,
6439 /// we provide this method for API completeness.
6440 pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingGetCall<'a, C> {
6441 self._domain_mappings_id = new_value.to_string();
6442 self
6443 }
6444 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6445 /// while executing the actual API request.
6446 ///
6447 /// ````text
6448 /// It should be used to handle progress information, and to implement a certain level of resilience.
6449 /// ````
6450 ///
6451 /// Sets the *delegate* property to the given value.
6452 pub fn delegate(
6453 mut self,
6454 new_value: &'a mut dyn common::Delegate,
6455 ) -> AppDomainMappingGetCall<'a, C> {
6456 self._delegate = Some(new_value);
6457 self
6458 }
6459
6460 /// Set any additional parameter of the query string used in the request.
6461 /// It should be used to set parameters which are not yet available through their own
6462 /// setters.
6463 ///
6464 /// Please note that this method must not be used to set any of the known parameters
6465 /// which have their own setter method. If done anyway, the request will fail.
6466 ///
6467 /// # Additional Parameters
6468 ///
6469 /// * *$.xgafv* (query-string) - V1 error format.
6470 /// * *access_token* (query-string) - OAuth access token.
6471 /// * *alt* (query-string) - Data format for response.
6472 /// * *callback* (query-string) - JSONP
6473 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6474 /// * *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.
6475 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6476 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6477 /// * *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.
6478 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6479 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6480 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingGetCall<'a, C>
6481 where
6482 T: AsRef<str>,
6483 {
6484 self._additional_params
6485 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6486 self
6487 }
6488
6489 /// Identifies the authorization scope for the method you are building.
6490 ///
6491 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6492 /// [`Scope::CloudPlatformReadOnly`].
6493 ///
6494 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6495 /// tokens for more than one scope.
6496 ///
6497 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6498 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6499 /// sufficient, a read-write scope will do as well.
6500 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingGetCall<'a, C>
6501 where
6502 St: AsRef<str>,
6503 {
6504 self._scopes.insert(String::from(scope.as_ref()));
6505 self
6506 }
6507 /// Identifies the authorization scope(s) for the method you are building.
6508 ///
6509 /// See [`Self::add_scope()`] for details.
6510 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingGetCall<'a, C>
6511 where
6512 I: IntoIterator<Item = St>,
6513 St: AsRef<str>,
6514 {
6515 self._scopes
6516 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6517 self
6518 }
6519
6520 /// Removes all scopes, and no default scope will be used either.
6521 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6522 /// for details).
6523 pub fn clear_scopes(mut self) -> AppDomainMappingGetCall<'a, C> {
6524 self._scopes.clear();
6525 self
6526 }
6527}
6528
6529/// Lists the domain mappings on an application.
6530///
6531/// A builder for the *domainMappings.list* method supported by a *app* resource.
6532/// It is not used directly, but through a [`AppMethods`] instance.
6533///
6534/// # Example
6535///
6536/// Instantiate a resource method builder
6537///
6538/// ```test_harness,no_run
6539/// # extern crate hyper;
6540/// # extern crate hyper_rustls;
6541/// # extern crate google_appengine1 as appengine1;
6542/// # async fn dox() {
6543/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6544///
6545/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6546/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6547/// # .with_native_roots()
6548/// # .unwrap()
6549/// # .https_only()
6550/// # .enable_http2()
6551/// # .build();
6552///
6553/// # let executor = hyper_util::rt::TokioExecutor::new();
6554/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6555/// # secret,
6556/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6557/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6558/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6559/// # ),
6560/// # ).build().await.unwrap();
6561///
6562/// # let client = hyper_util::client::legacy::Client::builder(
6563/// # hyper_util::rt::TokioExecutor::new()
6564/// # )
6565/// # .build(
6566/// # hyper_rustls::HttpsConnectorBuilder::new()
6567/// # .with_native_roots()
6568/// # .unwrap()
6569/// # .https_or_http()
6570/// # .enable_http2()
6571/// # .build()
6572/// # );
6573/// # let mut hub = Appengine::new(client, auth);
6574/// // You can configure optional parameters by calling the respective setters at will, and
6575/// // execute the final call using `doit()`.
6576/// // Values shown here are possibly random and not representative !
6577/// let result = hub.apps().domain_mappings_list("appsId")
6578/// .page_token("labore")
6579/// .page_size(-43)
6580/// .doit().await;
6581/// # }
6582/// ```
6583pub struct AppDomainMappingListCall<'a, C>
6584where
6585 C: 'a,
6586{
6587 hub: &'a Appengine<C>,
6588 _apps_id: String,
6589 _page_token: Option<String>,
6590 _page_size: Option<i32>,
6591 _delegate: Option<&'a mut dyn common::Delegate>,
6592 _additional_params: HashMap<String, String>,
6593 _scopes: BTreeSet<String>,
6594}
6595
6596impl<'a, C> common::CallBuilder for AppDomainMappingListCall<'a, C> {}
6597
6598impl<'a, C> AppDomainMappingListCall<'a, C>
6599where
6600 C: common::Connector,
6601{
6602 /// Perform the operation you have build so far.
6603 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainMappingsResponse)> {
6604 use std::borrow::Cow;
6605 use std::io::{Read, Seek};
6606
6607 use common::{url::Params, ToParts};
6608 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6609
6610 let mut dd = common::DefaultDelegate;
6611 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6612 dlg.begin(common::MethodInfo {
6613 id: "appengine.apps.domainMappings.list",
6614 http_method: hyper::Method::GET,
6615 });
6616
6617 for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
6618 if self._additional_params.contains_key(field) {
6619 dlg.finished(false);
6620 return Err(common::Error::FieldClash(field));
6621 }
6622 }
6623
6624 let mut params = Params::with_capacity(5 + self._additional_params.len());
6625 params.push("appsId", self._apps_id);
6626 if let Some(value) = self._page_token.as_ref() {
6627 params.push("pageToken", value);
6628 }
6629 if let Some(value) = self._page_size.as_ref() {
6630 params.push("pageSize", value.to_string());
6631 }
6632
6633 params.extend(self._additional_params.iter());
6634
6635 params.push("alt", "json");
6636 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings";
6637 if self._scopes.is_empty() {
6638 self._scopes
6639 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6640 }
6641
6642 #[allow(clippy::single_element_loop)]
6643 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
6644 url = params.uri_replacement(url, param_name, find_this, false);
6645 }
6646 {
6647 let to_remove = ["appsId"];
6648 params.remove_params(&to_remove);
6649 }
6650
6651 let url = params.parse_with_url(&url);
6652
6653 loop {
6654 let token = match self
6655 .hub
6656 .auth
6657 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6658 .await
6659 {
6660 Ok(token) => token,
6661 Err(e) => match dlg.token(e) {
6662 Ok(token) => token,
6663 Err(e) => {
6664 dlg.finished(false);
6665 return Err(common::Error::MissingToken(e));
6666 }
6667 },
6668 };
6669 let mut req_result = {
6670 let client = &self.hub.client;
6671 dlg.pre_request();
6672 let mut req_builder = hyper::Request::builder()
6673 .method(hyper::Method::GET)
6674 .uri(url.as_str())
6675 .header(USER_AGENT, self.hub._user_agent.clone());
6676
6677 if let Some(token) = token.as_ref() {
6678 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6679 }
6680
6681 let request = req_builder
6682 .header(CONTENT_LENGTH, 0_u64)
6683 .body(common::to_body::<String>(None));
6684
6685 client.request(request.unwrap()).await
6686 };
6687
6688 match req_result {
6689 Err(err) => {
6690 if let common::Retry::After(d) = dlg.http_error(&err) {
6691 sleep(d).await;
6692 continue;
6693 }
6694 dlg.finished(false);
6695 return Err(common::Error::HttpError(err));
6696 }
6697 Ok(res) => {
6698 let (mut parts, body) = res.into_parts();
6699 let mut body = common::Body::new(body);
6700 if !parts.status.is_success() {
6701 let bytes = common::to_bytes(body).await.unwrap_or_default();
6702 let error = serde_json::from_str(&common::to_string(&bytes));
6703 let response = common::to_response(parts, bytes.into());
6704
6705 if let common::Retry::After(d) =
6706 dlg.http_failure(&response, error.as_ref().ok())
6707 {
6708 sleep(d).await;
6709 continue;
6710 }
6711
6712 dlg.finished(false);
6713
6714 return Err(match error {
6715 Ok(value) => common::Error::BadRequest(value),
6716 _ => common::Error::Failure(response),
6717 });
6718 }
6719 let response = {
6720 let bytes = common::to_bytes(body).await.unwrap_or_default();
6721 let encoded = common::to_string(&bytes);
6722 match serde_json::from_str(&encoded) {
6723 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6724 Err(error) => {
6725 dlg.response_json_decode_error(&encoded, &error);
6726 return Err(common::Error::JsonDecodeError(
6727 encoded.to_string(),
6728 error,
6729 ));
6730 }
6731 }
6732 };
6733
6734 dlg.finished(true);
6735 return Ok(response);
6736 }
6737 }
6738 }
6739 }
6740
6741 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
6742 ///
6743 /// Sets the *apps id* path property to the given value.
6744 ///
6745 /// Even though the property as already been set when instantiating this call,
6746 /// we provide this method for API completeness.
6747 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingListCall<'a, C> {
6748 self._apps_id = new_value.to_string();
6749 self
6750 }
6751 /// Continuation token for fetching the next page of results.
6752 ///
6753 /// Sets the *page token* query property to the given value.
6754 pub fn page_token(mut self, new_value: &str) -> AppDomainMappingListCall<'a, C> {
6755 self._page_token = Some(new_value.to_string());
6756 self
6757 }
6758 /// Maximum results to return per page.
6759 ///
6760 /// Sets the *page size* query property to the given value.
6761 pub fn page_size(mut self, new_value: i32) -> AppDomainMappingListCall<'a, C> {
6762 self._page_size = Some(new_value);
6763 self
6764 }
6765 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6766 /// while executing the actual API request.
6767 ///
6768 /// ````text
6769 /// It should be used to handle progress information, and to implement a certain level of resilience.
6770 /// ````
6771 ///
6772 /// Sets the *delegate* property to the given value.
6773 pub fn delegate(
6774 mut self,
6775 new_value: &'a mut dyn common::Delegate,
6776 ) -> AppDomainMappingListCall<'a, C> {
6777 self._delegate = Some(new_value);
6778 self
6779 }
6780
6781 /// Set any additional parameter of the query string used in the request.
6782 /// It should be used to set parameters which are not yet available through their own
6783 /// setters.
6784 ///
6785 /// Please note that this method must not be used to set any of the known parameters
6786 /// which have their own setter method. If done anyway, the request will fail.
6787 ///
6788 /// # Additional Parameters
6789 ///
6790 /// * *$.xgafv* (query-string) - V1 error format.
6791 /// * *access_token* (query-string) - OAuth access token.
6792 /// * *alt* (query-string) - Data format for response.
6793 /// * *callback* (query-string) - JSONP
6794 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6795 /// * *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.
6796 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6797 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6798 /// * *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.
6799 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6800 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6801 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingListCall<'a, C>
6802 where
6803 T: AsRef<str>,
6804 {
6805 self._additional_params
6806 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6807 self
6808 }
6809
6810 /// Identifies the authorization scope for the method you are building.
6811 ///
6812 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6813 /// [`Scope::CloudPlatformReadOnly`].
6814 ///
6815 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6816 /// tokens for more than one scope.
6817 ///
6818 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6819 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6820 /// sufficient, a read-write scope will do as well.
6821 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingListCall<'a, C>
6822 where
6823 St: AsRef<str>,
6824 {
6825 self._scopes.insert(String::from(scope.as_ref()));
6826 self
6827 }
6828 /// Identifies the authorization scope(s) for the method you are building.
6829 ///
6830 /// See [`Self::add_scope()`] for details.
6831 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingListCall<'a, C>
6832 where
6833 I: IntoIterator<Item = St>,
6834 St: AsRef<str>,
6835 {
6836 self._scopes
6837 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6838 self
6839 }
6840
6841 /// Removes all scopes, and no default scope will be used either.
6842 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6843 /// for details).
6844 pub fn clear_scopes(mut self) -> AppDomainMappingListCall<'a, C> {
6845 self._scopes.clear();
6846 self
6847 }
6848}
6849
6850/// Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update certificate_id to point to an AuthorizedCertificate resource. A user must be authorized to administer the associated domain in order to update a DomainMapping resource.
6851///
6852/// A builder for the *domainMappings.patch* method supported by a *app* resource.
6853/// It is not used directly, but through a [`AppMethods`] instance.
6854///
6855/// # Example
6856///
6857/// Instantiate a resource method builder
6858///
6859/// ```test_harness,no_run
6860/// # extern crate hyper;
6861/// # extern crate hyper_rustls;
6862/// # extern crate google_appengine1 as appengine1;
6863/// use appengine1::api::DomainMapping;
6864/// # async fn dox() {
6865/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6866///
6867/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6868/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6869/// # .with_native_roots()
6870/// # .unwrap()
6871/// # .https_only()
6872/// # .enable_http2()
6873/// # .build();
6874///
6875/// # let executor = hyper_util::rt::TokioExecutor::new();
6876/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6877/// # secret,
6878/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6879/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6880/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6881/// # ),
6882/// # ).build().await.unwrap();
6883///
6884/// # let client = hyper_util::client::legacy::Client::builder(
6885/// # hyper_util::rt::TokioExecutor::new()
6886/// # )
6887/// # .build(
6888/// # hyper_rustls::HttpsConnectorBuilder::new()
6889/// # .with_native_roots()
6890/// # .unwrap()
6891/// # .https_or_http()
6892/// # .enable_http2()
6893/// # .build()
6894/// # );
6895/// # let mut hub = Appengine::new(client, auth);
6896/// // As the method needs a request, you would usually fill it with the desired information
6897/// // into the respective structure. Some of the parts shown here might not be applicable !
6898/// // Values shown here are possibly random and not representative !
6899/// let mut req = DomainMapping::default();
6900///
6901/// // You can configure optional parameters by calling the respective setters at will, and
6902/// // execute the final call using `doit()`.
6903/// // Values shown here are possibly random and not representative !
6904/// let result = hub.apps().domain_mappings_patch(req, "appsId", "domainMappingsId")
6905/// .update_mask(FieldMask::new::<&str>(&[]))
6906/// .doit().await;
6907/// # }
6908/// ```
6909pub struct AppDomainMappingPatchCall<'a, C>
6910where
6911 C: 'a,
6912{
6913 hub: &'a Appengine<C>,
6914 _request: DomainMapping,
6915 _apps_id: String,
6916 _domain_mappings_id: String,
6917 _update_mask: Option<common::FieldMask>,
6918 _delegate: Option<&'a mut dyn common::Delegate>,
6919 _additional_params: HashMap<String, String>,
6920 _scopes: BTreeSet<String>,
6921}
6922
6923impl<'a, C> common::CallBuilder for AppDomainMappingPatchCall<'a, C> {}
6924
6925impl<'a, C> AppDomainMappingPatchCall<'a, C>
6926where
6927 C: common::Connector,
6928{
6929 /// Perform the operation you have build so far.
6930 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6931 use std::borrow::Cow;
6932 use std::io::{Read, Seek};
6933
6934 use common::{url::Params, ToParts};
6935 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6936
6937 let mut dd = common::DefaultDelegate;
6938 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6939 dlg.begin(common::MethodInfo {
6940 id: "appengine.apps.domainMappings.patch",
6941 http_method: hyper::Method::PATCH,
6942 });
6943
6944 for &field in ["alt", "appsId", "domainMappingsId", "updateMask"].iter() {
6945 if self._additional_params.contains_key(field) {
6946 dlg.finished(false);
6947 return Err(common::Error::FieldClash(field));
6948 }
6949 }
6950
6951 let mut params = Params::with_capacity(6 + self._additional_params.len());
6952 params.push("appsId", self._apps_id);
6953 params.push("domainMappingsId", self._domain_mappings_id);
6954 if let Some(value) = self._update_mask.as_ref() {
6955 params.push("updateMask", value.to_string());
6956 }
6957
6958 params.extend(self._additional_params.iter());
6959
6960 params.push("alt", "json");
6961 let mut url =
6962 self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}";
6963 if self._scopes.is_empty() {
6964 self._scopes
6965 .insert(Scope::CloudPlatform.as_ref().to_string());
6966 }
6967
6968 #[allow(clippy::single_element_loop)]
6969 for &(find_this, param_name) in [
6970 ("{appsId}", "appsId"),
6971 ("{domainMappingsId}", "domainMappingsId"),
6972 ]
6973 .iter()
6974 {
6975 url = params.uri_replacement(url, param_name, find_this, false);
6976 }
6977 {
6978 let to_remove = ["domainMappingsId", "appsId"];
6979 params.remove_params(&to_remove);
6980 }
6981
6982 let url = params.parse_with_url(&url);
6983
6984 let mut json_mime_type = mime::APPLICATION_JSON;
6985 let mut request_value_reader = {
6986 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6987 common::remove_json_null_values(&mut value);
6988 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6989 serde_json::to_writer(&mut dst, &value).unwrap();
6990 dst
6991 };
6992 let request_size = request_value_reader
6993 .seek(std::io::SeekFrom::End(0))
6994 .unwrap();
6995 request_value_reader
6996 .seek(std::io::SeekFrom::Start(0))
6997 .unwrap();
6998
6999 loop {
7000 let token = match self
7001 .hub
7002 .auth
7003 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7004 .await
7005 {
7006 Ok(token) => token,
7007 Err(e) => match dlg.token(e) {
7008 Ok(token) => token,
7009 Err(e) => {
7010 dlg.finished(false);
7011 return Err(common::Error::MissingToken(e));
7012 }
7013 },
7014 };
7015 request_value_reader
7016 .seek(std::io::SeekFrom::Start(0))
7017 .unwrap();
7018 let mut req_result = {
7019 let client = &self.hub.client;
7020 dlg.pre_request();
7021 let mut req_builder = hyper::Request::builder()
7022 .method(hyper::Method::PATCH)
7023 .uri(url.as_str())
7024 .header(USER_AGENT, self.hub._user_agent.clone());
7025
7026 if let Some(token) = token.as_ref() {
7027 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7028 }
7029
7030 let request = req_builder
7031 .header(CONTENT_TYPE, json_mime_type.to_string())
7032 .header(CONTENT_LENGTH, request_size as u64)
7033 .body(common::to_body(
7034 request_value_reader.get_ref().clone().into(),
7035 ));
7036
7037 client.request(request.unwrap()).await
7038 };
7039
7040 match req_result {
7041 Err(err) => {
7042 if let common::Retry::After(d) = dlg.http_error(&err) {
7043 sleep(d).await;
7044 continue;
7045 }
7046 dlg.finished(false);
7047 return Err(common::Error::HttpError(err));
7048 }
7049 Ok(res) => {
7050 let (mut parts, body) = res.into_parts();
7051 let mut body = common::Body::new(body);
7052 if !parts.status.is_success() {
7053 let bytes = common::to_bytes(body).await.unwrap_or_default();
7054 let error = serde_json::from_str(&common::to_string(&bytes));
7055 let response = common::to_response(parts, bytes.into());
7056
7057 if let common::Retry::After(d) =
7058 dlg.http_failure(&response, error.as_ref().ok())
7059 {
7060 sleep(d).await;
7061 continue;
7062 }
7063
7064 dlg.finished(false);
7065
7066 return Err(match error {
7067 Ok(value) => common::Error::BadRequest(value),
7068 _ => common::Error::Failure(response),
7069 });
7070 }
7071 let response = {
7072 let bytes = common::to_bytes(body).await.unwrap_or_default();
7073 let encoded = common::to_string(&bytes);
7074 match serde_json::from_str(&encoded) {
7075 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7076 Err(error) => {
7077 dlg.response_json_decode_error(&encoded, &error);
7078 return Err(common::Error::JsonDecodeError(
7079 encoded.to_string(),
7080 error,
7081 ));
7082 }
7083 }
7084 };
7085
7086 dlg.finished(true);
7087 return Ok(response);
7088 }
7089 }
7090 }
7091 }
7092
7093 ///
7094 /// Sets the *request* property to the given value.
7095 ///
7096 /// Even though the property as already been set when instantiating this call,
7097 /// we provide this method for API completeness.
7098 pub fn request(mut self, new_value: DomainMapping) -> AppDomainMappingPatchCall<'a, C> {
7099 self._request = new_value;
7100 self
7101 }
7102 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/domainMappings/example.com.
7103 ///
7104 /// Sets the *apps id* path property to the given value.
7105 ///
7106 /// Even though the property as already been set when instantiating this call,
7107 /// we provide this method for API completeness.
7108 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingPatchCall<'a, C> {
7109 self._apps_id = new_value.to_string();
7110 self
7111 }
7112 /// Part of `name`. See documentation of `appsId`.
7113 ///
7114 /// Sets the *domain mappings id* path property to the given value.
7115 ///
7116 /// Even though the property as already been set when instantiating this call,
7117 /// we provide this method for API completeness.
7118 pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingPatchCall<'a, C> {
7119 self._domain_mappings_id = new_value.to_string();
7120 self
7121 }
7122 /// Required. Standard field mask for the set of fields to be updated.
7123 ///
7124 /// Sets the *update mask* query property to the given value.
7125 pub fn update_mask(mut self, new_value: common::FieldMask) -> AppDomainMappingPatchCall<'a, C> {
7126 self._update_mask = Some(new_value);
7127 self
7128 }
7129 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7130 /// while executing the actual API request.
7131 ///
7132 /// ````text
7133 /// It should be used to handle progress information, and to implement a certain level of resilience.
7134 /// ````
7135 ///
7136 /// Sets the *delegate* property to the given value.
7137 pub fn delegate(
7138 mut self,
7139 new_value: &'a mut dyn common::Delegate,
7140 ) -> AppDomainMappingPatchCall<'a, C> {
7141 self._delegate = Some(new_value);
7142 self
7143 }
7144
7145 /// Set any additional parameter of the query string used in the request.
7146 /// It should be used to set parameters which are not yet available through their own
7147 /// setters.
7148 ///
7149 /// Please note that this method must not be used to set any of the known parameters
7150 /// which have their own setter method. If done anyway, the request will fail.
7151 ///
7152 /// # Additional Parameters
7153 ///
7154 /// * *$.xgafv* (query-string) - V1 error format.
7155 /// * *access_token* (query-string) - OAuth access token.
7156 /// * *alt* (query-string) - Data format for response.
7157 /// * *callback* (query-string) - JSONP
7158 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7159 /// * *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.
7160 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7161 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7162 /// * *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.
7163 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7164 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7165 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingPatchCall<'a, C>
7166 where
7167 T: AsRef<str>,
7168 {
7169 self._additional_params
7170 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7171 self
7172 }
7173
7174 /// Identifies the authorization scope for the method you are building.
7175 ///
7176 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7177 /// [`Scope::CloudPlatform`].
7178 ///
7179 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7180 /// tokens for more than one scope.
7181 ///
7182 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7183 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7184 /// sufficient, a read-write scope will do as well.
7185 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingPatchCall<'a, C>
7186 where
7187 St: AsRef<str>,
7188 {
7189 self._scopes.insert(String::from(scope.as_ref()));
7190 self
7191 }
7192 /// Identifies the authorization scope(s) for the method you are building.
7193 ///
7194 /// See [`Self::add_scope()`] for details.
7195 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingPatchCall<'a, C>
7196 where
7197 I: IntoIterator<Item = St>,
7198 St: AsRef<str>,
7199 {
7200 self._scopes
7201 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7202 self
7203 }
7204
7205 /// Removes all scopes, and no default scope will be used either.
7206 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7207 /// for details).
7208 pub fn clear_scopes(mut self) -> AppDomainMappingPatchCall<'a, C> {
7209 self._scopes.clear();
7210 self
7211 }
7212}
7213
7214/// Replaces the entire firewall ruleset in one bulk operation. This overrides and replaces the rules of an existing firewall with the new rules.If the final rule does not match traffic with the '*' wildcard IP range, then an "allow all" rule is explicitly added to the end of the list.
7215///
7216/// A builder for the *firewall.ingressRules.batchUpdate* method supported by a *app* resource.
7217/// It is not used directly, but through a [`AppMethods`] instance.
7218///
7219/// # Example
7220///
7221/// Instantiate a resource method builder
7222///
7223/// ```test_harness,no_run
7224/// # extern crate hyper;
7225/// # extern crate hyper_rustls;
7226/// # extern crate google_appengine1 as appengine1;
7227/// use appengine1::api::BatchUpdateIngressRulesRequest;
7228/// # async fn dox() {
7229/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7230///
7231/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7232/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7233/// # .with_native_roots()
7234/// # .unwrap()
7235/// # .https_only()
7236/// # .enable_http2()
7237/// # .build();
7238///
7239/// # let executor = hyper_util::rt::TokioExecutor::new();
7240/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7241/// # secret,
7242/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7243/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7244/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7245/// # ),
7246/// # ).build().await.unwrap();
7247///
7248/// # let client = hyper_util::client::legacy::Client::builder(
7249/// # hyper_util::rt::TokioExecutor::new()
7250/// # )
7251/// # .build(
7252/// # hyper_rustls::HttpsConnectorBuilder::new()
7253/// # .with_native_roots()
7254/// # .unwrap()
7255/// # .https_or_http()
7256/// # .enable_http2()
7257/// # .build()
7258/// # );
7259/// # let mut hub = Appengine::new(client, auth);
7260/// // As the method needs a request, you would usually fill it with the desired information
7261/// // into the respective structure. Some of the parts shown here might not be applicable !
7262/// // Values shown here are possibly random and not representative !
7263/// let mut req = BatchUpdateIngressRulesRequest::default();
7264///
7265/// // You can configure optional parameters by calling the respective setters at will, and
7266/// // execute the final call using `doit()`.
7267/// // Values shown here are possibly random and not representative !
7268/// let result = hub.apps().firewall_ingress_rules_batch_update(req, "appsId")
7269/// .doit().await;
7270/// # }
7271/// ```
7272pub struct AppFirewallIngressRuleBatchUpdateCall<'a, C>
7273where
7274 C: 'a,
7275{
7276 hub: &'a Appengine<C>,
7277 _request: BatchUpdateIngressRulesRequest,
7278 _apps_id: String,
7279 _delegate: Option<&'a mut dyn common::Delegate>,
7280 _additional_params: HashMap<String, String>,
7281 _scopes: BTreeSet<String>,
7282}
7283
7284impl<'a, C> common::CallBuilder for AppFirewallIngressRuleBatchUpdateCall<'a, C> {}
7285
7286impl<'a, C> AppFirewallIngressRuleBatchUpdateCall<'a, C>
7287where
7288 C: common::Connector,
7289{
7290 /// Perform the operation you have build so far.
7291 pub async fn doit(
7292 mut self,
7293 ) -> common::Result<(common::Response, BatchUpdateIngressRulesResponse)> {
7294 use std::borrow::Cow;
7295 use std::io::{Read, Seek};
7296
7297 use common::{url::Params, ToParts};
7298 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7299
7300 let mut dd = common::DefaultDelegate;
7301 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7302 dlg.begin(common::MethodInfo {
7303 id: "appengine.apps.firewall.ingressRules.batchUpdate",
7304 http_method: hyper::Method::POST,
7305 });
7306
7307 for &field in ["alt", "appsId"].iter() {
7308 if self._additional_params.contains_key(field) {
7309 dlg.finished(false);
7310 return Err(common::Error::FieldClash(field));
7311 }
7312 }
7313
7314 let mut params = Params::with_capacity(4 + self._additional_params.len());
7315 params.push("appsId", self._apps_id);
7316
7317 params.extend(self._additional_params.iter());
7318
7319 params.push("alt", "json");
7320 let mut url =
7321 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules:batchUpdate";
7322 if self._scopes.is_empty() {
7323 self._scopes
7324 .insert(Scope::CloudPlatform.as_ref().to_string());
7325 }
7326
7327 #[allow(clippy::single_element_loop)]
7328 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
7329 url = params.uri_replacement(url, param_name, find_this, false);
7330 }
7331 {
7332 let to_remove = ["appsId"];
7333 params.remove_params(&to_remove);
7334 }
7335
7336 let url = params.parse_with_url(&url);
7337
7338 let mut json_mime_type = mime::APPLICATION_JSON;
7339 let mut request_value_reader = {
7340 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7341 common::remove_json_null_values(&mut value);
7342 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7343 serde_json::to_writer(&mut dst, &value).unwrap();
7344 dst
7345 };
7346 let request_size = request_value_reader
7347 .seek(std::io::SeekFrom::End(0))
7348 .unwrap();
7349 request_value_reader
7350 .seek(std::io::SeekFrom::Start(0))
7351 .unwrap();
7352
7353 loop {
7354 let token = match self
7355 .hub
7356 .auth
7357 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7358 .await
7359 {
7360 Ok(token) => token,
7361 Err(e) => match dlg.token(e) {
7362 Ok(token) => token,
7363 Err(e) => {
7364 dlg.finished(false);
7365 return Err(common::Error::MissingToken(e));
7366 }
7367 },
7368 };
7369 request_value_reader
7370 .seek(std::io::SeekFrom::Start(0))
7371 .unwrap();
7372 let mut req_result = {
7373 let client = &self.hub.client;
7374 dlg.pre_request();
7375 let mut req_builder = hyper::Request::builder()
7376 .method(hyper::Method::POST)
7377 .uri(url.as_str())
7378 .header(USER_AGENT, self.hub._user_agent.clone());
7379
7380 if let Some(token) = token.as_ref() {
7381 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7382 }
7383
7384 let request = req_builder
7385 .header(CONTENT_TYPE, json_mime_type.to_string())
7386 .header(CONTENT_LENGTH, request_size as u64)
7387 .body(common::to_body(
7388 request_value_reader.get_ref().clone().into(),
7389 ));
7390
7391 client.request(request.unwrap()).await
7392 };
7393
7394 match req_result {
7395 Err(err) => {
7396 if let common::Retry::After(d) = dlg.http_error(&err) {
7397 sleep(d).await;
7398 continue;
7399 }
7400 dlg.finished(false);
7401 return Err(common::Error::HttpError(err));
7402 }
7403 Ok(res) => {
7404 let (mut parts, body) = res.into_parts();
7405 let mut body = common::Body::new(body);
7406 if !parts.status.is_success() {
7407 let bytes = common::to_bytes(body).await.unwrap_or_default();
7408 let error = serde_json::from_str(&common::to_string(&bytes));
7409 let response = common::to_response(parts, bytes.into());
7410
7411 if let common::Retry::After(d) =
7412 dlg.http_failure(&response, error.as_ref().ok())
7413 {
7414 sleep(d).await;
7415 continue;
7416 }
7417
7418 dlg.finished(false);
7419
7420 return Err(match error {
7421 Ok(value) => common::Error::BadRequest(value),
7422 _ => common::Error::Failure(response),
7423 });
7424 }
7425 let response = {
7426 let bytes = common::to_bytes(body).await.unwrap_or_default();
7427 let encoded = common::to_string(&bytes);
7428 match serde_json::from_str(&encoded) {
7429 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7430 Err(error) => {
7431 dlg.response_json_decode_error(&encoded, &error);
7432 return Err(common::Error::JsonDecodeError(
7433 encoded.to_string(),
7434 error,
7435 ));
7436 }
7437 }
7438 };
7439
7440 dlg.finished(true);
7441 return Ok(response);
7442 }
7443 }
7444 }
7445 }
7446
7447 ///
7448 /// Sets the *request* property to the given value.
7449 ///
7450 /// Even though the property as already been set when instantiating this call,
7451 /// we provide this method for API completeness.
7452 pub fn request(
7453 mut self,
7454 new_value: BatchUpdateIngressRulesRequest,
7455 ) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
7456 self._request = new_value;
7457 self
7458 }
7459 /// Part of `name`. Name of the Firewall collection to set. Example: apps/myapp/firewall/ingressRules.
7460 ///
7461 /// Sets the *apps id* path property to the given value.
7462 ///
7463 /// Even though the property as already been set when instantiating this call,
7464 /// we provide this method for API completeness.
7465 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
7466 self._apps_id = new_value.to_string();
7467 self
7468 }
7469 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7470 /// while executing the actual API request.
7471 ///
7472 /// ````text
7473 /// It should be used to handle progress information, and to implement a certain level of resilience.
7474 /// ````
7475 ///
7476 /// Sets the *delegate* property to the given value.
7477 pub fn delegate(
7478 mut self,
7479 new_value: &'a mut dyn common::Delegate,
7480 ) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
7481 self._delegate = Some(new_value);
7482 self
7483 }
7484
7485 /// Set any additional parameter of the query string used in the request.
7486 /// It should be used to set parameters which are not yet available through their own
7487 /// setters.
7488 ///
7489 /// Please note that this method must not be used to set any of the known parameters
7490 /// which have their own setter method. If done anyway, the request will fail.
7491 ///
7492 /// # Additional Parameters
7493 ///
7494 /// * *$.xgafv* (query-string) - V1 error format.
7495 /// * *access_token* (query-string) - OAuth access token.
7496 /// * *alt* (query-string) - Data format for response.
7497 /// * *callback* (query-string) - JSONP
7498 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7499 /// * *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.
7500 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7501 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7502 /// * *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.
7503 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7504 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7505 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleBatchUpdateCall<'a, C>
7506 where
7507 T: AsRef<str>,
7508 {
7509 self._additional_params
7510 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7511 self
7512 }
7513
7514 /// Identifies the authorization scope for the method you are building.
7515 ///
7516 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7517 /// [`Scope::CloudPlatform`].
7518 ///
7519 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7520 /// tokens for more than one scope.
7521 ///
7522 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7523 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7524 /// sufficient, a read-write scope will do as well.
7525 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleBatchUpdateCall<'a, C>
7526 where
7527 St: AsRef<str>,
7528 {
7529 self._scopes.insert(String::from(scope.as_ref()));
7530 self
7531 }
7532 /// Identifies the authorization scope(s) for the method you are building.
7533 ///
7534 /// See [`Self::add_scope()`] for details.
7535 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleBatchUpdateCall<'a, C>
7536 where
7537 I: IntoIterator<Item = St>,
7538 St: AsRef<str>,
7539 {
7540 self._scopes
7541 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7542 self
7543 }
7544
7545 /// Removes all scopes, and no default scope will be used either.
7546 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7547 /// for details).
7548 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
7549 self._scopes.clear();
7550 self
7551 }
7552}
7553
7554/// Creates a firewall rule for the application.
7555///
7556/// A builder for the *firewall.ingressRules.create* method supported by a *app* resource.
7557/// It is not used directly, but through a [`AppMethods`] instance.
7558///
7559/// # Example
7560///
7561/// Instantiate a resource method builder
7562///
7563/// ```test_harness,no_run
7564/// # extern crate hyper;
7565/// # extern crate hyper_rustls;
7566/// # extern crate google_appengine1 as appengine1;
7567/// use appengine1::api::FirewallRule;
7568/// # async fn dox() {
7569/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7570///
7571/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7572/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7573/// # .with_native_roots()
7574/// # .unwrap()
7575/// # .https_only()
7576/// # .enable_http2()
7577/// # .build();
7578///
7579/// # let executor = hyper_util::rt::TokioExecutor::new();
7580/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7581/// # secret,
7582/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7583/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7584/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7585/// # ),
7586/// # ).build().await.unwrap();
7587///
7588/// # let client = hyper_util::client::legacy::Client::builder(
7589/// # hyper_util::rt::TokioExecutor::new()
7590/// # )
7591/// # .build(
7592/// # hyper_rustls::HttpsConnectorBuilder::new()
7593/// # .with_native_roots()
7594/// # .unwrap()
7595/// # .https_or_http()
7596/// # .enable_http2()
7597/// # .build()
7598/// # );
7599/// # let mut hub = Appengine::new(client, auth);
7600/// // As the method needs a request, you would usually fill it with the desired information
7601/// // into the respective structure. Some of the parts shown here might not be applicable !
7602/// // Values shown here are possibly random and not representative !
7603/// let mut req = FirewallRule::default();
7604///
7605/// // You can configure optional parameters by calling the respective setters at will, and
7606/// // execute the final call using `doit()`.
7607/// // Values shown here are possibly random and not representative !
7608/// let result = hub.apps().firewall_ingress_rules_create(req, "appsId")
7609/// .doit().await;
7610/// # }
7611/// ```
7612pub struct AppFirewallIngressRuleCreateCall<'a, C>
7613where
7614 C: 'a,
7615{
7616 hub: &'a Appengine<C>,
7617 _request: FirewallRule,
7618 _apps_id: String,
7619 _delegate: Option<&'a mut dyn common::Delegate>,
7620 _additional_params: HashMap<String, String>,
7621 _scopes: BTreeSet<String>,
7622}
7623
7624impl<'a, C> common::CallBuilder for AppFirewallIngressRuleCreateCall<'a, C> {}
7625
7626impl<'a, C> AppFirewallIngressRuleCreateCall<'a, C>
7627where
7628 C: common::Connector,
7629{
7630 /// Perform the operation you have build so far.
7631 pub async fn doit(mut self) -> common::Result<(common::Response, FirewallRule)> {
7632 use std::borrow::Cow;
7633 use std::io::{Read, Seek};
7634
7635 use common::{url::Params, ToParts};
7636 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7637
7638 let mut dd = common::DefaultDelegate;
7639 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7640 dlg.begin(common::MethodInfo {
7641 id: "appengine.apps.firewall.ingressRules.create",
7642 http_method: hyper::Method::POST,
7643 });
7644
7645 for &field in ["alt", "appsId"].iter() {
7646 if self._additional_params.contains_key(field) {
7647 dlg.finished(false);
7648 return Err(common::Error::FieldClash(field));
7649 }
7650 }
7651
7652 let mut params = Params::with_capacity(4 + self._additional_params.len());
7653 params.push("appsId", self._apps_id);
7654
7655 params.extend(self._additional_params.iter());
7656
7657 params.push("alt", "json");
7658 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules";
7659 if self._scopes.is_empty() {
7660 self._scopes
7661 .insert(Scope::CloudPlatform.as_ref().to_string());
7662 }
7663
7664 #[allow(clippy::single_element_loop)]
7665 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
7666 url = params.uri_replacement(url, param_name, find_this, false);
7667 }
7668 {
7669 let to_remove = ["appsId"];
7670 params.remove_params(&to_remove);
7671 }
7672
7673 let url = params.parse_with_url(&url);
7674
7675 let mut json_mime_type = mime::APPLICATION_JSON;
7676 let mut request_value_reader = {
7677 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7678 common::remove_json_null_values(&mut value);
7679 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7680 serde_json::to_writer(&mut dst, &value).unwrap();
7681 dst
7682 };
7683 let request_size = request_value_reader
7684 .seek(std::io::SeekFrom::End(0))
7685 .unwrap();
7686 request_value_reader
7687 .seek(std::io::SeekFrom::Start(0))
7688 .unwrap();
7689
7690 loop {
7691 let token = match self
7692 .hub
7693 .auth
7694 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7695 .await
7696 {
7697 Ok(token) => token,
7698 Err(e) => match dlg.token(e) {
7699 Ok(token) => token,
7700 Err(e) => {
7701 dlg.finished(false);
7702 return Err(common::Error::MissingToken(e));
7703 }
7704 },
7705 };
7706 request_value_reader
7707 .seek(std::io::SeekFrom::Start(0))
7708 .unwrap();
7709 let mut req_result = {
7710 let client = &self.hub.client;
7711 dlg.pre_request();
7712 let mut req_builder = hyper::Request::builder()
7713 .method(hyper::Method::POST)
7714 .uri(url.as_str())
7715 .header(USER_AGENT, self.hub._user_agent.clone());
7716
7717 if let Some(token) = token.as_ref() {
7718 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7719 }
7720
7721 let request = req_builder
7722 .header(CONTENT_TYPE, json_mime_type.to_string())
7723 .header(CONTENT_LENGTH, request_size as u64)
7724 .body(common::to_body(
7725 request_value_reader.get_ref().clone().into(),
7726 ));
7727
7728 client.request(request.unwrap()).await
7729 };
7730
7731 match req_result {
7732 Err(err) => {
7733 if let common::Retry::After(d) = dlg.http_error(&err) {
7734 sleep(d).await;
7735 continue;
7736 }
7737 dlg.finished(false);
7738 return Err(common::Error::HttpError(err));
7739 }
7740 Ok(res) => {
7741 let (mut parts, body) = res.into_parts();
7742 let mut body = common::Body::new(body);
7743 if !parts.status.is_success() {
7744 let bytes = common::to_bytes(body).await.unwrap_or_default();
7745 let error = serde_json::from_str(&common::to_string(&bytes));
7746 let response = common::to_response(parts, bytes.into());
7747
7748 if let common::Retry::After(d) =
7749 dlg.http_failure(&response, error.as_ref().ok())
7750 {
7751 sleep(d).await;
7752 continue;
7753 }
7754
7755 dlg.finished(false);
7756
7757 return Err(match error {
7758 Ok(value) => common::Error::BadRequest(value),
7759 _ => common::Error::Failure(response),
7760 });
7761 }
7762 let response = {
7763 let bytes = common::to_bytes(body).await.unwrap_or_default();
7764 let encoded = common::to_string(&bytes);
7765 match serde_json::from_str(&encoded) {
7766 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7767 Err(error) => {
7768 dlg.response_json_decode_error(&encoded, &error);
7769 return Err(common::Error::JsonDecodeError(
7770 encoded.to_string(),
7771 error,
7772 ));
7773 }
7774 }
7775 };
7776
7777 dlg.finished(true);
7778 return Ok(response);
7779 }
7780 }
7781 }
7782 }
7783
7784 ///
7785 /// Sets the *request* property to the given value.
7786 ///
7787 /// Even though the property as already been set when instantiating this call,
7788 /// we provide this method for API completeness.
7789 pub fn request(mut self, new_value: FirewallRule) -> AppFirewallIngressRuleCreateCall<'a, C> {
7790 self._request = new_value;
7791 self
7792 }
7793 /// Part of `parent`. Required. Name of the parent Firewall collection in which to create a new rule. Example: apps/myapp/firewall/ingressRules.
7794 ///
7795 /// Sets the *apps id* path property to the given value.
7796 ///
7797 /// Even though the property as already been set when instantiating this call,
7798 /// we provide this method for API completeness.
7799 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleCreateCall<'a, C> {
7800 self._apps_id = new_value.to_string();
7801 self
7802 }
7803 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7804 /// while executing the actual API request.
7805 ///
7806 /// ````text
7807 /// It should be used to handle progress information, and to implement a certain level of resilience.
7808 /// ````
7809 ///
7810 /// Sets the *delegate* property to the given value.
7811 pub fn delegate(
7812 mut self,
7813 new_value: &'a mut dyn common::Delegate,
7814 ) -> AppFirewallIngressRuleCreateCall<'a, C> {
7815 self._delegate = Some(new_value);
7816 self
7817 }
7818
7819 /// Set any additional parameter of the query string used in the request.
7820 /// It should be used to set parameters which are not yet available through their own
7821 /// setters.
7822 ///
7823 /// Please note that this method must not be used to set any of the known parameters
7824 /// which have their own setter method. If done anyway, the request will fail.
7825 ///
7826 /// # Additional Parameters
7827 ///
7828 /// * *$.xgafv* (query-string) - V1 error format.
7829 /// * *access_token* (query-string) - OAuth access token.
7830 /// * *alt* (query-string) - Data format for response.
7831 /// * *callback* (query-string) - JSONP
7832 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7833 /// * *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.
7834 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7835 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7836 /// * *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.
7837 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7838 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7839 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleCreateCall<'a, C>
7840 where
7841 T: AsRef<str>,
7842 {
7843 self._additional_params
7844 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7845 self
7846 }
7847
7848 /// Identifies the authorization scope for the method you are building.
7849 ///
7850 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7851 /// [`Scope::CloudPlatform`].
7852 ///
7853 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7854 /// tokens for more than one scope.
7855 ///
7856 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7857 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7858 /// sufficient, a read-write scope will do as well.
7859 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleCreateCall<'a, C>
7860 where
7861 St: AsRef<str>,
7862 {
7863 self._scopes.insert(String::from(scope.as_ref()));
7864 self
7865 }
7866 /// Identifies the authorization scope(s) for the method you are building.
7867 ///
7868 /// See [`Self::add_scope()`] for details.
7869 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleCreateCall<'a, C>
7870 where
7871 I: IntoIterator<Item = St>,
7872 St: AsRef<str>,
7873 {
7874 self._scopes
7875 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7876 self
7877 }
7878
7879 /// Removes all scopes, and no default scope will be used either.
7880 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7881 /// for details).
7882 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleCreateCall<'a, C> {
7883 self._scopes.clear();
7884 self
7885 }
7886}
7887
7888/// Deletes the specified firewall rule.
7889///
7890/// A builder for the *firewall.ingressRules.delete* method supported by a *app* resource.
7891/// It is not used directly, but through a [`AppMethods`] instance.
7892///
7893/// # Example
7894///
7895/// Instantiate a resource method builder
7896///
7897/// ```test_harness,no_run
7898/// # extern crate hyper;
7899/// # extern crate hyper_rustls;
7900/// # extern crate google_appengine1 as appengine1;
7901/// # async fn dox() {
7902/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7903///
7904/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7905/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7906/// # .with_native_roots()
7907/// # .unwrap()
7908/// # .https_only()
7909/// # .enable_http2()
7910/// # .build();
7911///
7912/// # let executor = hyper_util::rt::TokioExecutor::new();
7913/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7914/// # secret,
7915/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7916/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7917/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7918/// # ),
7919/// # ).build().await.unwrap();
7920///
7921/// # let client = hyper_util::client::legacy::Client::builder(
7922/// # hyper_util::rt::TokioExecutor::new()
7923/// # )
7924/// # .build(
7925/// # hyper_rustls::HttpsConnectorBuilder::new()
7926/// # .with_native_roots()
7927/// # .unwrap()
7928/// # .https_or_http()
7929/// # .enable_http2()
7930/// # .build()
7931/// # );
7932/// # let mut hub = Appengine::new(client, auth);
7933/// // You can configure optional parameters by calling the respective setters at will, and
7934/// // execute the final call using `doit()`.
7935/// // Values shown here are possibly random and not representative !
7936/// let result = hub.apps().firewall_ingress_rules_delete("appsId", "ingressRulesId")
7937/// .doit().await;
7938/// # }
7939/// ```
7940pub struct AppFirewallIngressRuleDeleteCall<'a, C>
7941where
7942 C: 'a,
7943{
7944 hub: &'a Appengine<C>,
7945 _apps_id: String,
7946 _ingress_rules_id: String,
7947 _delegate: Option<&'a mut dyn common::Delegate>,
7948 _additional_params: HashMap<String, String>,
7949 _scopes: BTreeSet<String>,
7950}
7951
7952impl<'a, C> common::CallBuilder for AppFirewallIngressRuleDeleteCall<'a, C> {}
7953
7954impl<'a, C> AppFirewallIngressRuleDeleteCall<'a, C>
7955where
7956 C: common::Connector,
7957{
7958 /// Perform the operation you have build so far.
7959 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7960 use std::borrow::Cow;
7961 use std::io::{Read, Seek};
7962
7963 use common::{url::Params, ToParts};
7964 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7965
7966 let mut dd = common::DefaultDelegate;
7967 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7968 dlg.begin(common::MethodInfo {
7969 id: "appengine.apps.firewall.ingressRules.delete",
7970 http_method: hyper::Method::DELETE,
7971 });
7972
7973 for &field in ["alt", "appsId", "ingressRulesId"].iter() {
7974 if self._additional_params.contains_key(field) {
7975 dlg.finished(false);
7976 return Err(common::Error::FieldClash(field));
7977 }
7978 }
7979
7980 let mut params = Params::with_capacity(4 + self._additional_params.len());
7981 params.push("appsId", self._apps_id);
7982 params.push("ingressRulesId", self._ingress_rules_id);
7983
7984 params.extend(self._additional_params.iter());
7985
7986 params.push("alt", "json");
7987 let mut url =
7988 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}";
7989 if self._scopes.is_empty() {
7990 self._scopes
7991 .insert(Scope::CloudPlatform.as_ref().to_string());
7992 }
7993
7994 #[allow(clippy::single_element_loop)]
7995 for &(find_this, param_name) in [
7996 ("{appsId}", "appsId"),
7997 ("{ingressRulesId}", "ingressRulesId"),
7998 ]
7999 .iter()
8000 {
8001 url = params.uri_replacement(url, param_name, find_this, false);
8002 }
8003 {
8004 let to_remove = ["ingressRulesId", "appsId"];
8005 params.remove_params(&to_remove);
8006 }
8007
8008 let url = params.parse_with_url(&url);
8009
8010 loop {
8011 let token = match self
8012 .hub
8013 .auth
8014 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8015 .await
8016 {
8017 Ok(token) => token,
8018 Err(e) => match dlg.token(e) {
8019 Ok(token) => token,
8020 Err(e) => {
8021 dlg.finished(false);
8022 return Err(common::Error::MissingToken(e));
8023 }
8024 },
8025 };
8026 let mut req_result = {
8027 let client = &self.hub.client;
8028 dlg.pre_request();
8029 let mut req_builder = hyper::Request::builder()
8030 .method(hyper::Method::DELETE)
8031 .uri(url.as_str())
8032 .header(USER_AGENT, self.hub._user_agent.clone());
8033
8034 if let Some(token) = token.as_ref() {
8035 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8036 }
8037
8038 let request = req_builder
8039 .header(CONTENT_LENGTH, 0_u64)
8040 .body(common::to_body::<String>(None));
8041
8042 client.request(request.unwrap()).await
8043 };
8044
8045 match req_result {
8046 Err(err) => {
8047 if let common::Retry::After(d) = dlg.http_error(&err) {
8048 sleep(d).await;
8049 continue;
8050 }
8051 dlg.finished(false);
8052 return Err(common::Error::HttpError(err));
8053 }
8054 Ok(res) => {
8055 let (mut parts, body) = res.into_parts();
8056 let mut body = common::Body::new(body);
8057 if !parts.status.is_success() {
8058 let bytes = common::to_bytes(body).await.unwrap_or_default();
8059 let error = serde_json::from_str(&common::to_string(&bytes));
8060 let response = common::to_response(parts, bytes.into());
8061
8062 if let common::Retry::After(d) =
8063 dlg.http_failure(&response, error.as_ref().ok())
8064 {
8065 sleep(d).await;
8066 continue;
8067 }
8068
8069 dlg.finished(false);
8070
8071 return Err(match error {
8072 Ok(value) => common::Error::BadRequest(value),
8073 _ => common::Error::Failure(response),
8074 });
8075 }
8076 let response = {
8077 let bytes = common::to_bytes(body).await.unwrap_or_default();
8078 let encoded = common::to_string(&bytes);
8079 match serde_json::from_str(&encoded) {
8080 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8081 Err(error) => {
8082 dlg.response_json_decode_error(&encoded, &error);
8083 return Err(common::Error::JsonDecodeError(
8084 encoded.to_string(),
8085 error,
8086 ));
8087 }
8088 }
8089 };
8090
8091 dlg.finished(true);
8092 return Ok(response);
8093 }
8094 }
8095 }
8096 }
8097
8098 /// Part of `name`. Name of the Firewall resource to delete. Example: apps/myapp/firewall/ingressRules/100.
8099 ///
8100 /// Sets the *apps id* path property to the given value.
8101 ///
8102 /// Even though the property as already been set when instantiating this call,
8103 /// we provide this method for API completeness.
8104 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleDeleteCall<'a, C> {
8105 self._apps_id = new_value.to_string();
8106 self
8107 }
8108 /// Part of `name`. See documentation of `appsId`.
8109 ///
8110 /// Sets the *ingress rules id* path property to the given value.
8111 ///
8112 /// Even though the property as already been set when instantiating this call,
8113 /// we provide this method for API completeness.
8114 pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRuleDeleteCall<'a, C> {
8115 self._ingress_rules_id = new_value.to_string();
8116 self
8117 }
8118 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8119 /// while executing the actual API request.
8120 ///
8121 /// ````text
8122 /// It should be used to handle progress information, and to implement a certain level of resilience.
8123 /// ````
8124 ///
8125 /// Sets the *delegate* property to the given value.
8126 pub fn delegate(
8127 mut self,
8128 new_value: &'a mut dyn common::Delegate,
8129 ) -> AppFirewallIngressRuleDeleteCall<'a, C> {
8130 self._delegate = Some(new_value);
8131 self
8132 }
8133
8134 /// Set any additional parameter of the query string used in the request.
8135 /// It should be used to set parameters which are not yet available through their own
8136 /// setters.
8137 ///
8138 /// Please note that this method must not be used to set any of the known parameters
8139 /// which have their own setter method. If done anyway, the request will fail.
8140 ///
8141 /// # Additional Parameters
8142 ///
8143 /// * *$.xgafv* (query-string) - V1 error format.
8144 /// * *access_token* (query-string) - OAuth access token.
8145 /// * *alt* (query-string) - Data format for response.
8146 /// * *callback* (query-string) - JSONP
8147 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8148 /// * *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.
8149 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8150 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8151 /// * *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.
8152 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8153 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8154 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleDeleteCall<'a, C>
8155 where
8156 T: AsRef<str>,
8157 {
8158 self._additional_params
8159 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8160 self
8161 }
8162
8163 /// Identifies the authorization scope for the method you are building.
8164 ///
8165 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8166 /// [`Scope::CloudPlatform`].
8167 ///
8168 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8169 /// tokens for more than one scope.
8170 ///
8171 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8172 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8173 /// sufficient, a read-write scope will do as well.
8174 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleDeleteCall<'a, C>
8175 where
8176 St: AsRef<str>,
8177 {
8178 self._scopes.insert(String::from(scope.as_ref()));
8179 self
8180 }
8181 /// Identifies the authorization scope(s) for the method you are building.
8182 ///
8183 /// See [`Self::add_scope()`] for details.
8184 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleDeleteCall<'a, C>
8185 where
8186 I: IntoIterator<Item = St>,
8187 St: AsRef<str>,
8188 {
8189 self._scopes
8190 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8191 self
8192 }
8193
8194 /// Removes all scopes, and no default scope will be used either.
8195 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8196 /// for details).
8197 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleDeleteCall<'a, C> {
8198 self._scopes.clear();
8199 self
8200 }
8201}
8202
8203/// Gets the specified firewall rule.
8204///
8205/// A builder for the *firewall.ingressRules.get* method supported by a *app* resource.
8206/// It is not used directly, but through a [`AppMethods`] instance.
8207///
8208/// # Example
8209///
8210/// Instantiate a resource method builder
8211///
8212/// ```test_harness,no_run
8213/// # extern crate hyper;
8214/// # extern crate hyper_rustls;
8215/// # extern crate google_appengine1 as appengine1;
8216/// # async fn dox() {
8217/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8218///
8219/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8220/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8221/// # .with_native_roots()
8222/// # .unwrap()
8223/// # .https_only()
8224/// # .enable_http2()
8225/// # .build();
8226///
8227/// # let executor = hyper_util::rt::TokioExecutor::new();
8228/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8229/// # secret,
8230/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8231/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8232/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8233/// # ),
8234/// # ).build().await.unwrap();
8235///
8236/// # let client = hyper_util::client::legacy::Client::builder(
8237/// # hyper_util::rt::TokioExecutor::new()
8238/// # )
8239/// # .build(
8240/// # hyper_rustls::HttpsConnectorBuilder::new()
8241/// # .with_native_roots()
8242/// # .unwrap()
8243/// # .https_or_http()
8244/// # .enable_http2()
8245/// # .build()
8246/// # );
8247/// # let mut hub = Appengine::new(client, auth);
8248/// // You can configure optional parameters by calling the respective setters at will, and
8249/// // execute the final call using `doit()`.
8250/// // Values shown here are possibly random and not representative !
8251/// let result = hub.apps().firewall_ingress_rules_get("appsId", "ingressRulesId")
8252/// .doit().await;
8253/// # }
8254/// ```
8255pub struct AppFirewallIngressRuleGetCall<'a, C>
8256where
8257 C: 'a,
8258{
8259 hub: &'a Appengine<C>,
8260 _apps_id: String,
8261 _ingress_rules_id: String,
8262 _delegate: Option<&'a mut dyn common::Delegate>,
8263 _additional_params: HashMap<String, String>,
8264 _scopes: BTreeSet<String>,
8265}
8266
8267impl<'a, C> common::CallBuilder for AppFirewallIngressRuleGetCall<'a, C> {}
8268
8269impl<'a, C> AppFirewallIngressRuleGetCall<'a, C>
8270where
8271 C: common::Connector,
8272{
8273 /// Perform the operation you have build so far.
8274 pub async fn doit(mut self) -> common::Result<(common::Response, FirewallRule)> {
8275 use std::borrow::Cow;
8276 use std::io::{Read, Seek};
8277
8278 use common::{url::Params, ToParts};
8279 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8280
8281 let mut dd = common::DefaultDelegate;
8282 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8283 dlg.begin(common::MethodInfo {
8284 id: "appengine.apps.firewall.ingressRules.get",
8285 http_method: hyper::Method::GET,
8286 });
8287
8288 for &field in ["alt", "appsId", "ingressRulesId"].iter() {
8289 if self._additional_params.contains_key(field) {
8290 dlg.finished(false);
8291 return Err(common::Error::FieldClash(field));
8292 }
8293 }
8294
8295 let mut params = Params::with_capacity(4 + self._additional_params.len());
8296 params.push("appsId", self._apps_id);
8297 params.push("ingressRulesId", self._ingress_rules_id);
8298
8299 params.extend(self._additional_params.iter());
8300
8301 params.push("alt", "json");
8302 let mut url =
8303 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}";
8304 if self._scopes.is_empty() {
8305 self._scopes
8306 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8307 }
8308
8309 #[allow(clippy::single_element_loop)]
8310 for &(find_this, param_name) in [
8311 ("{appsId}", "appsId"),
8312 ("{ingressRulesId}", "ingressRulesId"),
8313 ]
8314 .iter()
8315 {
8316 url = params.uri_replacement(url, param_name, find_this, false);
8317 }
8318 {
8319 let to_remove = ["ingressRulesId", "appsId"];
8320 params.remove_params(&to_remove);
8321 }
8322
8323 let url = params.parse_with_url(&url);
8324
8325 loop {
8326 let token = match self
8327 .hub
8328 .auth
8329 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8330 .await
8331 {
8332 Ok(token) => token,
8333 Err(e) => match dlg.token(e) {
8334 Ok(token) => token,
8335 Err(e) => {
8336 dlg.finished(false);
8337 return Err(common::Error::MissingToken(e));
8338 }
8339 },
8340 };
8341 let mut req_result = {
8342 let client = &self.hub.client;
8343 dlg.pre_request();
8344 let mut req_builder = hyper::Request::builder()
8345 .method(hyper::Method::GET)
8346 .uri(url.as_str())
8347 .header(USER_AGENT, self.hub._user_agent.clone());
8348
8349 if let Some(token) = token.as_ref() {
8350 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8351 }
8352
8353 let request = req_builder
8354 .header(CONTENT_LENGTH, 0_u64)
8355 .body(common::to_body::<String>(None));
8356
8357 client.request(request.unwrap()).await
8358 };
8359
8360 match req_result {
8361 Err(err) => {
8362 if let common::Retry::After(d) = dlg.http_error(&err) {
8363 sleep(d).await;
8364 continue;
8365 }
8366 dlg.finished(false);
8367 return Err(common::Error::HttpError(err));
8368 }
8369 Ok(res) => {
8370 let (mut parts, body) = res.into_parts();
8371 let mut body = common::Body::new(body);
8372 if !parts.status.is_success() {
8373 let bytes = common::to_bytes(body).await.unwrap_or_default();
8374 let error = serde_json::from_str(&common::to_string(&bytes));
8375 let response = common::to_response(parts, bytes.into());
8376
8377 if let common::Retry::After(d) =
8378 dlg.http_failure(&response, error.as_ref().ok())
8379 {
8380 sleep(d).await;
8381 continue;
8382 }
8383
8384 dlg.finished(false);
8385
8386 return Err(match error {
8387 Ok(value) => common::Error::BadRequest(value),
8388 _ => common::Error::Failure(response),
8389 });
8390 }
8391 let response = {
8392 let bytes = common::to_bytes(body).await.unwrap_or_default();
8393 let encoded = common::to_string(&bytes);
8394 match serde_json::from_str(&encoded) {
8395 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8396 Err(error) => {
8397 dlg.response_json_decode_error(&encoded, &error);
8398 return Err(common::Error::JsonDecodeError(
8399 encoded.to_string(),
8400 error,
8401 ));
8402 }
8403 }
8404 };
8405
8406 dlg.finished(true);
8407 return Ok(response);
8408 }
8409 }
8410 }
8411 }
8412
8413 /// Part of `name`. Name of the Firewall resource to retrieve. Example: apps/myapp/firewall/ingressRules/100.
8414 ///
8415 /// Sets the *apps id* path property to the given value.
8416 ///
8417 /// Even though the property as already been set when instantiating this call,
8418 /// we provide this method for API completeness.
8419 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleGetCall<'a, C> {
8420 self._apps_id = new_value.to_string();
8421 self
8422 }
8423 /// Part of `name`. See documentation of `appsId`.
8424 ///
8425 /// Sets the *ingress rules id* path property to the given value.
8426 ///
8427 /// Even though the property as already been set when instantiating this call,
8428 /// we provide this method for API completeness.
8429 pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRuleGetCall<'a, C> {
8430 self._ingress_rules_id = new_value.to_string();
8431 self
8432 }
8433 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8434 /// while executing the actual API request.
8435 ///
8436 /// ````text
8437 /// It should be used to handle progress information, and to implement a certain level of resilience.
8438 /// ````
8439 ///
8440 /// Sets the *delegate* property to the given value.
8441 pub fn delegate(
8442 mut self,
8443 new_value: &'a mut dyn common::Delegate,
8444 ) -> AppFirewallIngressRuleGetCall<'a, C> {
8445 self._delegate = Some(new_value);
8446 self
8447 }
8448
8449 /// Set any additional parameter of the query string used in the request.
8450 /// It should be used to set parameters which are not yet available through their own
8451 /// setters.
8452 ///
8453 /// Please note that this method must not be used to set any of the known parameters
8454 /// which have their own setter method. If done anyway, the request will fail.
8455 ///
8456 /// # Additional Parameters
8457 ///
8458 /// * *$.xgafv* (query-string) - V1 error format.
8459 /// * *access_token* (query-string) - OAuth access token.
8460 /// * *alt* (query-string) - Data format for response.
8461 /// * *callback* (query-string) - JSONP
8462 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8463 /// * *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.
8464 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8465 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8466 /// * *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.
8467 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8468 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8469 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleGetCall<'a, C>
8470 where
8471 T: AsRef<str>,
8472 {
8473 self._additional_params
8474 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8475 self
8476 }
8477
8478 /// Identifies the authorization scope for the method you are building.
8479 ///
8480 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8481 /// [`Scope::CloudPlatformReadOnly`].
8482 ///
8483 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8484 /// tokens for more than one scope.
8485 ///
8486 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8487 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8488 /// sufficient, a read-write scope will do as well.
8489 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleGetCall<'a, C>
8490 where
8491 St: AsRef<str>,
8492 {
8493 self._scopes.insert(String::from(scope.as_ref()));
8494 self
8495 }
8496 /// Identifies the authorization scope(s) for the method you are building.
8497 ///
8498 /// See [`Self::add_scope()`] for details.
8499 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleGetCall<'a, C>
8500 where
8501 I: IntoIterator<Item = St>,
8502 St: AsRef<str>,
8503 {
8504 self._scopes
8505 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8506 self
8507 }
8508
8509 /// Removes all scopes, and no default scope will be used either.
8510 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8511 /// for details).
8512 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleGetCall<'a, C> {
8513 self._scopes.clear();
8514 self
8515 }
8516}
8517
8518/// Lists the firewall rules of an application.
8519///
8520/// A builder for the *firewall.ingressRules.list* method supported by a *app* resource.
8521/// It is not used directly, but through a [`AppMethods`] instance.
8522///
8523/// # Example
8524///
8525/// Instantiate a resource method builder
8526///
8527/// ```test_harness,no_run
8528/// # extern crate hyper;
8529/// # extern crate hyper_rustls;
8530/// # extern crate google_appengine1 as appengine1;
8531/// # async fn dox() {
8532/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8533///
8534/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8535/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8536/// # .with_native_roots()
8537/// # .unwrap()
8538/// # .https_only()
8539/// # .enable_http2()
8540/// # .build();
8541///
8542/// # let executor = hyper_util::rt::TokioExecutor::new();
8543/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8544/// # secret,
8545/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8546/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8547/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8548/// # ),
8549/// # ).build().await.unwrap();
8550///
8551/// # let client = hyper_util::client::legacy::Client::builder(
8552/// # hyper_util::rt::TokioExecutor::new()
8553/// # )
8554/// # .build(
8555/// # hyper_rustls::HttpsConnectorBuilder::new()
8556/// # .with_native_roots()
8557/// # .unwrap()
8558/// # .https_or_http()
8559/// # .enable_http2()
8560/// # .build()
8561/// # );
8562/// # let mut hub = Appengine::new(client, auth);
8563/// // You can configure optional parameters by calling the respective setters at will, and
8564/// // execute the final call using `doit()`.
8565/// // Values shown here are possibly random and not representative !
8566/// let result = hub.apps().firewall_ingress_rules_list("appsId")
8567/// .page_token("vero")
8568/// .page_size(-31)
8569/// .matching_address("sed")
8570/// .doit().await;
8571/// # }
8572/// ```
8573pub struct AppFirewallIngressRuleListCall<'a, C>
8574where
8575 C: 'a,
8576{
8577 hub: &'a Appengine<C>,
8578 _apps_id: String,
8579 _page_token: Option<String>,
8580 _page_size: Option<i32>,
8581 _matching_address: Option<String>,
8582 _delegate: Option<&'a mut dyn common::Delegate>,
8583 _additional_params: HashMap<String, String>,
8584 _scopes: BTreeSet<String>,
8585}
8586
8587impl<'a, C> common::CallBuilder for AppFirewallIngressRuleListCall<'a, C> {}
8588
8589impl<'a, C> AppFirewallIngressRuleListCall<'a, C>
8590where
8591 C: common::Connector,
8592{
8593 /// Perform the operation you have build so far.
8594 pub async fn doit(mut self) -> common::Result<(common::Response, ListIngressRulesResponse)> {
8595 use std::borrow::Cow;
8596 use std::io::{Read, Seek};
8597
8598 use common::{url::Params, ToParts};
8599 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8600
8601 let mut dd = common::DefaultDelegate;
8602 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8603 dlg.begin(common::MethodInfo {
8604 id: "appengine.apps.firewall.ingressRules.list",
8605 http_method: hyper::Method::GET,
8606 });
8607
8608 for &field in ["alt", "appsId", "pageToken", "pageSize", "matchingAddress"].iter() {
8609 if self._additional_params.contains_key(field) {
8610 dlg.finished(false);
8611 return Err(common::Error::FieldClash(field));
8612 }
8613 }
8614
8615 let mut params = Params::with_capacity(6 + self._additional_params.len());
8616 params.push("appsId", self._apps_id);
8617 if let Some(value) = self._page_token.as_ref() {
8618 params.push("pageToken", value);
8619 }
8620 if let Some(value) = self._page_size.as_ref() {
8621 params.push("pageSize", value.to_string());
8622 }
8623 if let Some(value) = self._matching_address.as_ref() {
8624 params.push("matchingAddress", value);
8625 }
8626
8627 params.extend(self._additional_params.iter());
8628
8629 params.push("alt", "json");
8630 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules";
8631 if self._scopes.is_empty() {
8632 self._scopes
8633 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8634 }
8635
8636 #[allow(clippy::single_element_loop)]
8637 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
8638 url = params.uri_replacement(url, param_name, find_this, false);
8639 }
8640 {
8641 let to_remove = ["appsId"];
8642 params.remove_params(&to_remove);
8643 }
8644
8645 let url = params.parse_with_url(&url);
8646
8647 loop {
8648 let token = match self
8649 .hub
8650 .auth
8651 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8652 .await
8653 {
8654 Ok(token) => token,
8655 Err(e) => match dlg.token(e) {
8656 Ok(token) => token,
8657 Err(e) => {
8658 dlg.finished(false);
8659 return Err(common::Error::MissingToken(e));
8660 }
8661 },
8662 };
8663 let mut req_result = {
8664 let client = &self.hub.client;
8665 dlg.pre_request();
8666 let mut req_builder = hyper::Request::builder()
8667 .method(hyper::Method::GET)
8668 .uri(url.as_str())
8669 .header(USER_AGENT, self.hub._user_agent.clone());
8670
8671 if let Some(token) = token.as_ref() {
8672 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8673 }
8674
8675 let request = req_builder
8676 .header(CONTENT_LENGTH, 0_u64)
8677 .body(common::to_body::<String>(None));
8678
8679 client.request(request.unwrap()).await
8680 };
8681
8682 match req_result {
8683 Err(err) => {
8684 if let common::Retry::After(d) = dlg.http_error(&err) {
8685 sleep(d).await;
8686 continue;
8687 }
8688 dlg.finished(false);
8689 return Err(common::Error::HttpError(err));
8690 }
8691 Ok(res) => {
8692 let (mut parts, body) = res.into_parts();
8693 let mut body = common::Body::new(body);
8694 if !parts.status.is_success() {
8695 let bytes = common::to_bytes(body).await.unwrap_or_default();
8696 let error = serde_json::from_str(&common::to_string(&bytes));
8697 let response = common::to_response(parts, bytes.into());
8698
8699 if let common::Retry::After(d) =
8700 dlg.http_failure(&response, error.as_ref().ok())
8701 {
8702 sleep(d).await;
8703 continue;
8704 }
8705
8706 dlg.finished(false);
8707
8708 return Err(match error {
8709 Ok(value) => common::Error::BadRequest(value),
8710 _ => common::Error::Failure(response),
8711 });
8712 }
8713 let response = {
8714 let bytes = common::to_bytes(body).await.unwrap_or_default();
8715 let encoded = common::to_string(&bytes);
8716 match serde_json::from_str(&encoded) {
8717 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8718 Err(error) => {
8719 dlg.response_json_decode_error(&encoded, &error);
8720 return Err(common::Error::JsonDecodeError(
8721 encoded.to_string(),
8722 error,
8723 ));
8724 }
8725 }
8726 };
8727
8728 dlg.finished(true);
8729 return Ok(response);
8730 }
8731 }
8732 }
8733 }
8734
8735 /// Part of `parent`. Name of the Firewall collection to retrieve. Example: apps/myapp/firewall/ingressRules.
8736 ///
8737 /// Sets the *apps id* path property to the given value.
8738 ///
8739 /// Even though the property as already been set when instantiating this call,
8740 /// we provide this method for API completeness.
8741 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, C> {
8742 self._apps_id = new_value.to_string();
8743 self
8744 }
8745 /// Continuation token for fetching the next page of results.
8746 ///
8747 /// Sets the *page token* query property to the given value.
8748 pub fn page_token(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, C> {
8749 self._page_token = Some(new_value.to_string());
8750 self
8751 }
8752 /// Maximum results to return per page.
8753 ///
8754 /// Sets the *page size* query property to the given value.
8755 pub fn page_size(mut self, new_value: i32) -> AppFirewallIngressRuleListCall<'a, C> {
8756 self._page_size = Some(new_value);
8757 self
8758 }
8759 /// A valid IP Address. If set, only rules matching this address will be returned. The first returned rule will be the rule that fires on requests from this IP.
8760 ///
8761 /// Sets the *matching address* query property to the given value.
8762 pub fn matching_address(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, C> {
8763 self._matching_address = Some(new_value.to_string());
8764 self
8765 }
8766 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8767 /// while executing the actual API request.
8768 ///
8769 /// ````text
8770 /// It should be used to handle progress information, and to implement a certain level of resilience.
8771 /// ````
8772 ///
8773 /// Sets the *delegate* property to the given value.
8774 pub fn delegate(
8775 mut self,
8776 new_value: &'a mut dyn common::Delegate,
8777 ) -> AppFirewallIngressRuleListCall<'a, C> {
8778 self._delegate = Some(new_value);
8779 self
8780 }
8781
8782 /// Set any additional parameter of the query string used in the request.
8783 /// It should be used to set parameters which are not yet available through their own
8784 /// setters.
8785 ///
8786 /// Please note that this method must not be used to set any of the known parameters
8787 /// which have their own setter method. If done anyway, the request will fail.
8788 ///
8789 /// # Additional Parameters
8790 ///
8791 /// * *$.xgafv* (query-string) - V1 error format.
8792 /// * *access_token* (query-string) - OAuth access token.
8793 /// * *alt* (query-string) - Data format for response.
8794 /// * *callback* (query-string) - JSONP
8795 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8796 /// * *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.
8797 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8798 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8799 /// * *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.
8800 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8801 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8802 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleListCall<'a, C>
8803 where
8804 T: AsRef<str>,
8805 {
8806 self._additional_params
8807 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8808 self
8809 }
8810
8811 /// Identifies the authorization scope for the method you are building.
8812 ///
8813 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8814 /// [`Scope::CloudPlatformReadOnly`].
8815 ///
8816 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8817 /// tokens for more than one scope.
8818 ///
8819 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8820 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8821 /// sufficient, a read-write scope will do as well.
8822 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleListCall<'a, C>
8823 where
8824 St: AsRef<str>,
8825 {
8826 self._scopes.insert(String::from(scope.as_ref()));
8827 self
8828 }
8829 /// Identifies the authorization scope(s) for the method you are building.
8830 ///
8831 /// See [`Self::add_scope()`] for details.
8832 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleListCall<'a, C>
8833 where
8834 I: IntoIterator<Item = St>,
8835 St: AsRef<str>,
8836 {
8837 self._scopes
8838 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8839 self
8840 }
8841
8842 /// Removes all scopes, and no default scope will be used either.
8843 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8844 /// for details).
8845 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleListCall<'a, C> {
8846 self._scopes.clear();
8847 self
8848 }
8849}
8850
8851/// Updates the specified firewall rule.
8852///
8853/// A builder for the *firewall.ingressRules.patch* method supported by a *app* resource.
8854/// It is not used directly, but through a [`AppMethods`] instance.
8855///
8856/// # Example
8857///
8858/// Instantiate a resource method builder
8859///
8860/// ```test_harness,no_run
8861/// # extern crate hyper;
8862/// # extern crate hyper_rustls;
8863/// # extern crate google_appengine1 as appengine1;
8864/// use appengine1::api::FirewallRule;
8865/// # async fn dox() {
8866/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8867///
8868/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8869/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8870/// # .with_native_roots()
8871/// # .unwrap()
8872/// # .https_only()
8873/// # .enable_http2()
8874/// # .build();
8875///
8876/// # let executor = hyper_util::rt::TokioExecutor::new();
8877/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8878/// # secret,
8879/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8880/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8881/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8882/// # ),
8883/// # ).build().await.unwrap();
8884///
8885/// # let client = hyper_util::client::legacy::Client::builder(
8886/// # hyper_util::rt::TokioExecutor::new()
8887/// # )
8888/// # .build(
8889/// # hyper_rustls::HttpsConnectorBuilder::new()
8890/// # .with_native_roots()
8891/// # .unwrap()
8892/// # .https_or_http()
8893/// # .enable_http2()
8894/// # .build()
8895/// # );
8896/// # let mut hub = Appengine::new(client, auth);
8897/// // As the method needs a request, you would usually fill it with the desired information
8898/// // into the respective structure. Some of the parts shown here might not be applicable !
8899/// // Values shown here are possibly random and not representative !
8900/// let mut req = FirewallRule::default();
8901///
8902/// // You can configure optional parameters by calling the respective setters at will, and
8903/// // execute the final call using `doit()`.
8904/// // Values shown here are possibly random and not representative !
8905/// let result = hub.apps().firewall_ingress_rules_patch(req, "appsId", "ingressRulesId")
8906/// .update_mask(FieldMask::new::<&str>(&[]))
8907/// .doit().await;
8908/// # }
8909/// ```
8910pub struct AppFirewallIngressRulePatchCall<'a, C>
8911where
8912 C: 'a,
8913{
8914 hub: &'a Appengine<C>,
8915 _request: FirewallRule,
8916 _apps_id: String,
8917 _ingress_rules_id: String,
8918 _update_mask: Option<common::FieldMask>,
8919 _delegate: Option<&'a mut dyn common::Delegate>,
8920 _additional_params: HashMap<String, String>,
8921 _scopes: BTreeSet<String>,
8922}
8923
8924impl<'a, C> common::CallBuilder for AppFirewallIngressRulePatchCall<'a, C> {}
8925
8926impl<'a, C> AppFirewallIngressRulePatchCall<'a, C>
8927where
8928 C: common::Connector,
8929{
8930 /// Perform the operation you have build so far.
8931 pub async fn doit(mut self) -> common::Result<(common::Response, FirewallRule)> {
8932 use std::borrow::Cow;
8933 use std::io::{Read, Seek};
8934
8935 use common::{url::Params, ToParts};
8936 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8937
8938 let mut dd = common::DefaultDelegate;
8939 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8940 dlg.begin(common::MethodInfo {
8941 id: "appengine.apps.firewall.ingressRules.patch",
8942 http_method: hyper::Method::PATCH,
8943 });
8944
8945 for &field in ["alt", "appsId", "ingressRulesId", "updateMask"].iter() {
8946 if self._additional_params.contains_key(field) {
8947 dlg.finished(false);
8948 return Err(common::Error::FieldClash(field));
8949 }
8950 }
8951
8952 let mut params = Params::with_capacity(6 + self._additional_params.len());
8953 params.push("appsId", self._apps_id);
8954 params.push("ingressRulesId", self._ingress_rules_id);
8955 if let Some(value) = self._update_mask.as_ref() {
8956 params.push("updateMask", value.to_string());
8957 }
8958
8959 params.extend(self._additional_params.iter());
8960
8961 params.push("alt", "json");
8962 let mut url =
8963 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}";
8964 if self._scopes.is_empty() {
8965 self._scopes
8966 .insert(Scope::CloudPlatform.as_ref().to_string());
8967 }
8968
8969 #[allow(clippy::single_element_loop)]
8970 for &(find_this, param_name) in [
8971 ("{appsId}", "appsId"),
8972 ("{ingressRulesId}", "ingressRulesId"),
8973 ]
8974 .iter()
8975 {
8976 url = params.uri_replacement(url, param_name, find_this, false);
8977 }
8978 {
8979 let to_remove = ["ingressRulesId", "appsId"];
8980 params.remove_params(&to_remove);
8981 }
8982
8983 let url = params.parse_with_url(&url);
8984
8985 let mut json_mime_type = mime::APPLICATION_JSON;
8986 let mut request_value_reader = {
8987 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8988 common::remove_json_null_values(&mut value);
8989 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8990 serde_json::to_writer(&mut dst, &value).unwrap();
8991 dst
8992 };
8993 let request_size = request_value_reader
8994 .seek(std::io::SeekFrom::End(0))
8995 .unwrap();
8996 request_value_reader
8997 .seek(std::io::SeekFrom::Start(0))
8998 .unwrap();
8999
9000 loop {
9001 let token = match self
9002 .hub
9003 .auth
9004 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9005 .await
9006 {
9007 Ok(token) => token,
9008 Err(e) => match dlg.token(e) {
9009 Ok(token) => token,
9010 Err(e) => {
9011 dlg.finished(false);
9012 return Err(common::Error::MissingToken(e));
9013 }
9014 },
9015 };
9016 request_value_reader
9017 .seek(std::io::SeekFrom::Start(0))
9018 .unwrap();
9019 let mut req_result = {
9020 let client = &self.hub.client;
9021 dlg.pre_request();
9022 let mut req_builder = hyper::Request::builder()
9023 .method(hyper::Method::PATCH)
9024 .uri(url.as_str())
9025 .header(USER_AGENT, self.hub._user_agent.clone());
9026
9027 if let Some(token) = token.as_ref() {
9028 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9029 }
9030
9031 let request = req_builder
9032 .header(CONTENT_TYPE, json_mime_type.to_string())
9033 .header(CONTENT_LENGTH, request_size as u64)
9034 .body(common::to_body(
9035 request_value_reader.get_ref().clone().into(),
9036 ));
9037
9038 client.request(request.unwrap()).await
9039 };
9040
9041 match req_result {
9042 Err(err) => {
9043 if let common::Retry::After(d) = dlg.http_error(&err) {
9044 sleep(d).await;
9045 continue;
9046 }
9047 dlg.finished(false);
9048 return Err(common::Error::HttpError(err));
9049 }
9050 Ok(res) => {
9051 let (mut parts, body) = res.into_parts();
9052 let mut body = common::Body::new(body);
9053 if !parts.status.is_success() {
9054 let bytes = common::to_bytes(body).await.unwrap_or_default();
9055 let error = serde_json::from_str(&common::to_string(&bytes));
9056 let response = common::to_response(parts, bytes.into());
9057
9058 if let common::Retry::After(d) =
9059 dlg.http_failure(&response, error.as_ref().ok())
9060 {
9061 sleep(d).await;
9062 continue;
9063 }
9064
9065 dlg.finished(false);
9066
9067 return Err(match error {
9068 Ok(value) => common::Error::BadRequest(value),
9069 _ => common::Error::Failure(response),
9070 });
9071 }
9072 let response = {
9073 let bytes = common::to_bytes(body).await.unwrap_or_default();
9074 let encoded = common::to_string(&bytes);
9075 match serde_json::from_str(&encoded) {
9076 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9077 Err(error) => {
9078 dlg.response_json_decode_error(&encoded, &error);
9079 return Err(common::Error::JsonDecodeError(
9080 encoded.to_string(),
9081 error,
9082 ));
9083 }
9084 }
9085 };
9086
9087 dlg.finished(true);
9088 return Ok(response);
9089 }
9090 }
9091 }
9092 }
9093
9094 ///
9095 /// Sets the *request* property to the given value.
9096 ///
9097 /// Even though the property as already been set when instantiating this call,
9098 /// we provide this method for API completeness.
9099 pub fn request(mut self, new_value: FirewallRule) -> AppFirewallIngressRulePatchCall<'a, C> {
9100 self._request = new_value;
9101 self
9102 }
9103 /// Part of `name`. Name of the Firewall resource to update. Example: apps/myapp/firewall/ingressRules/100.
9104 ///
9105 /// Sets the *apps id* path property to the given value.
9106 ///
9107 /// Even though the property as already been set when instantiating this call,
9108 /// we provide this method for API completeness.
9109 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRulePatchCall<'a, C> {
9110 self._apps_id = new_value.to_string();
9111 self
9112 }
9113 /// Part of `name`. See documentation of `appsId`.
9114 ///
9115 /// Sets the *ingress rules id* path property to the given value.
9116 ///
9117 /// Even though the property as already been set when instantiating this call,
9118 /// we provide this method for API completeness.
9119 pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRulePatchCall<'a, C> {
9120 self._ingress_rules_id = new_value.to_string();
9121 self
9122 }
9123 /// Standard field mask for the set of fields to be updated.
9124 ///
9125 /// Sets the *update mask* query property to the given value.
9126 pub fn update_mask(
9127 mut self,
9128 new_value: common::FieldMask,
9129 ) -> AppFirewallIngressRulePatchCall<'a, C> {
9130 self._update_mask = Some(new_value);
9131 self
9132 }
9133 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9134 /// while executing the actual API request.
9135 ///
9136 /// ````text
9137 /// It should be used to handle progress information, and to implement a certain level of resilience.
9138 /// ````
9139 ///
9140 /// Sets the *delegate* property to the given value.
9141 pub fn delegate(
9142 mut self,
9143 new_value: &'a mut dyn common::Delegate,
9144 ) -> AppFirewallIngressRulePatchCall<'a, C> {
9145 self._delegate = Some(new_value);
9146 self
9147 }
9148
9149 /// Set any additional parameter of the query string used in the request.
9150 /// It should be used to set parameters which are not yet available through their own
9151 /// setters.
9152 ///
9153 /// Please note that this method must not be used to set any of the known parameters
9154 /// which have their own setter method. If done anyway, the request will fail.
9155 ///
9156 /// # Additional Parameters
9157 ///
9158 /// * *$.xgafv* (query-string) - V1 error format.
9159 /// * *access_token* (query-string) - OAuth access token.
9160 /// * *alt* (query-string) - Data format for response.
9161 /// * *callback* (query-string) - JSONP
9162 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9163 /// * *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.
9164 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9165 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9166 /// * *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.
9167 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9168 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9169 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRulePatchCall<'a, C>
9170 where
9171 T: AsRef<str>,
9172 {
9173 self._additional_params
9174 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9175 self
9176 }
9177
9178 /// Identifies the authorization scope for the method you are building.
9179 ///
9180 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9181 /// [`Scope::CloudPlatform`].
9182 ///
9183 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9184 /// tokens for more than one scope.
9185 ///
9186 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9187 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9188 /// sufficient, a read-write scope will do as well.
9189 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRulePatchCall<'a, C>
9190 where
9191 St: AsRef<str>,
9192 {
9193 self._scopes.insert(String::from(scope.as_ref()));
9194 self
9195 }
9196 /// Identifies the authorization scope(s) for the method you are building.
9197 ///
9198 /// See [`Self::add_scope()`] for details.
9199 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRulePatchCall<'a, C>
9200 where
9201 I: IntoIterator<Item = St>,
9202 St: AsRef<str>,
9203 {
9204 self._scopes
9205 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9206 self
9207 }
9208
9209 /// Removes all scopes, and no default scope will be used either.
9210 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9211 /// for details).
9212 pub fn clear_scopes(mut self) -> AppFirewallIngressRulePatchCall<'a, C> {
9213 self._scopes.clear();
9214 self
9215 }
9216}
9217
9218/// Gets information about a location.
9219///
9220/// A builder for the *locations.get* method supported by a *app* resource.
9221/// It is not used directly, but through a [`AppMethods`] instance.
9222///
9223/// # Example
9224///
9225/// Instantiate a resource method builder
9226///
9227/// ```test_harness,no_run
9228/// # extern crate hyper;
9229/// # extern crate hyper_rustls;
9230/// # extern crate google_appengine1 as appengine1;
9231/// # async fn dox() {
9232/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9233///
9234/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9235/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9236/// # .with_native_roots()
9237/// # .unwrap()
9238/// # .https_only()
9239/// # .enable_http2()
9240/// # .build();
9241///
9242/// # let executor = hyper_util::rt::TokioExecutor::new();
9243/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9244/// # secret,
9245/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9246/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9247/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9248/// # ),
9249/// # ).build().await.unwrap();
9250///
9251/// # let client = hyper_util::client::legacy::Client::builder(
9252/// # hyper_util::rt::TokioExecutor::new()
9253/// # )
9254/// # .build(
9255/// # hyper_rustls::HttpsConnectorBuilder::new()
9256/// # .with_native_roots()
9257/// # .unwrap()
9258/// # .https_or_http()
9259/// # .enable_http2()
9260/// # .build()
9261/// # );
9262/// # let mut hub = Appengine::new(client, auth);
9263/// // You can configure optional parameters by calling the respective setters at will, and
9264/// // execute the final call using `doit()`.
9265/// // Values shown here are possibly random and not representative !
9266/// let result = hub.apps().locations_get("appsId", "locationsId")
9267/// .doit().await;
9268/// # }
9269/// ```
9270pub struct AppLocationGetCall<'a, C>
9271where
9272 C: 'a,
9273{
9274 hub: &'a Appengine<C>,
9275 _apps_id: String,
9276 _locations_id: String,
9277 _delegate: Option<&'a mut dyn common::Delegate>,
9278 _additional_params: HashMap<String, String>,
9279 _scopes: BTreeSet<String>,
9280}
9281
9282impl<'a, C> common::CallBuilder for AppLocationGetCall<'a, C> {}
9283
9284impl<'a, C> AppLocationGetCall<'a, C>
9285where
9286 C: common::Connector,
9287{
9288 /// Perform the operation you have build so far.
9289 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
9290 use std::borrow::Cow;
9291 use std::io::{Read, Seek};
9292
9293 use common::{url::Params, ToParts};
9294 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9295
9296 let mut dd = common::DefaultDelegate;
9297 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9298 dlg.begin(common::MethodInfo {
9299 id: "appengine.apps.locations.get",
9300 http_method: hyper::Method::GET,
9301 });
9302
9303 for &field in ["alt", "appsId", "locationsId"].iter() {
9304 if self._additional_params.contains_key(field) {
9305 dlg.finished(false);
9306 return Err(common::Error::FieldClash(field));
9307 }
9308 }
9309
9310 let mut params = Params::with_capacity(4 + self._additional_params.len());
9311 params.push("appsId", self._apps_id);
9312 params.push("locationsId", self._locations_id);
9313
9314 params.extend(self._additional_params.iter());
9315
9316 params.push("alt", "json");
9317 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/locations/{locationsId}";
9318 if self._scopes.is_empty() {
9319 self._scopes
9320 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9321 }
9322
9323 #[allow(clippy::single_element_loop)]
9324 for &(find_this, param_name) in
9325 [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter()
9326 {
9327 url = params.uri_replacement(url, param_name, find_this, false);
9328 }
9329 {
9330 let to_remove = ["locationsId", "appsId"];
9331 params.remove_params(&to_remove);
9332 }
9333
9334 let url = params.parse_with_url(&url);
9335
9336 loop {
9337 let token = match self
9338 .hub
9339 .auth
9340 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9341 .await
9342 {
9343 Ok(token) => token,
9344 Err(e) => match dlg.token(e) {
9345 Ok(token) => token,
9346 Err(e) => {
9347 dlg.finished(false);
9348 return Err(common::Error::MissingToken(e));
9349 }
9350 },
9351 };
9352 let mut req_result = {
9353 let client = &self.hub.client;
9354 dlg.pre_request();
9355 let mut req_builder = hyper::Request::builder()
9356 .method(hyper::Method::GET)
9357 .uri(url.as_str())
9358 .header(USER_AGENT, self.hub._user_agent.clone());
9359
9360 if let Some(token) = token.as_ref() {
9361 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9362 }
9363
9364 let request = req_builder
9365 .header(CONTENT_LENGTH, 0_u64)
9366 .body(common::to_body::<String>(None));
9367
9368 client.request(request.unwrap()).await
9369 };
9370
9371 match req_result {
9372 Err(err) => {
9373 if let common::Retry::After(d) = dlg.http_error(&err) {
9374 sleep(d).await;
9375 continue;
9376 }
9377 dlg.finished(false);
9378 return Err(common::Error::HttpError(err));
9379 }
9380 Ok(res) => {
9381 let (mut parts, body) = res.into_parts();
9382 let mut body = common::Body::new(body);
9383 if !parts.status.is_success() {
9384 let bytes = common::to_bytes(body).await.unwrap_or_default();
9385 let error = serde_json::from_str(&common::to_string(&bytes));
9386 let response = common::to_response(parts, bytes.into());
9387
9388 if let common::Retry::After(d) =
9389 dlg.http_failure(&response, error.as_ref().ok())
9390 {
9391 sleep(d).await;
9392 continue;
9393 }
9394
9395 dlg.finished(false);
9396
9397 return Err(match error {
9398 Ok(value) => common::Error::BadRequest(value),
9399 _ => common::Error::Failure(response),
9400 });
9401 }
9402 let response = {
9403 let bytes = common::to_bytes(body).await.unwrap_or_default();
9404 let encoded = common::to_string(&bytes);
9405 match serde_json::from_str(&encoded) {
9406 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9407 Err(error) => {
9408 dlg.response_json_decode_error(&encoded, &error);
9409 return Err(common::Error::JsonDecodeError(
9410 encoded.to_string(),
9411 error,
9412 ));
9413 }
9414 }
9415 };
9416
9417 dlg.finished(true);
9418 return Ok(response);
9419 }
9420 }
9421 }
9422 }
9423
9424 /// Part of `name`. Resource name for the location.
9425 ///
9426 /// Sets the *apps id* path property to the given value.
9427 ///
9428 /// Even though the property as already been set when instantiating this call,
9429 /// we provide this method for API completeness.
9430 pub fn apps_id(mut self, new_value: &str) -> AppLocationGetCall<'a, C> {
9431 self._apps_id = new_value.to_string();
9432 self
9433 }
9434 /// Part of `name`. See documentation of `appsId`.
9435 ///
9436 /// Sets the *locations id* path property to the given value.
9437 ///
9438 /// Even though the property as already been set when instantiating this call,
9439 /// we provide this method for API completeness.
9440 pub fn locations_id(mut self, new_value: &str) -> AppLocationGetCall<'a, C> {
9441 self._locations_id = new_value.to_string();
9442 self
9443 }
9444 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9445 /// while executing the actual API request.
9446 ///
9447 /// ````text
9448 /// It should be used to handle progress information, and to implement a certain level of resilience.
9449 /// ````
9450 ///
9451 /// Sets the *delegate* property to the given value.
9452 pub fn delegate(
9453 mut self,
9454 new_value: &'a mut dyn common::Delegate,
9455 ) -> AppLocationGetCall<'a, C> {
9456 self._delegate = Some(new_value);
9457 self
9458 }
9459
9460 /// Set any additional parameter of the query string used in the request.
9461 /// It should be used to set parameters which are not yet available through their own
9462 /// setters.
9463 ///
9464 /// Please note that this method must not be used to set any of the known parameters
9465 /// which have their own setter method. If done anyway, the request will fail.
9466 ///
9467 /// # Additional Parameters
9468 ///
9469 /// * *$.xgafv* (query-string) - V1 error format.
9470 /// * *access_token* (query-string) - OAuth access token.
9471 /// * *alt* (query-string) - Data format for response.
9472 /// * *callback* (query-string) - JSONP
9473 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9474 /// * *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.
9475 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9476 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9477 /// * *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.
9478 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9479 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9480 pub fn param<T>(mut self, name: T, value: T) -> AppLocationGetCall<'a, C>
9481 where
9482 T: AsRef<str>,
9483 {
9484 self._additional_params
9485 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9486 self
9487 }
9488
9489 /// Identifies the authorization scope for the method you are building.
9490 ///
9491 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9492 /// [`Scope::CloudPlatformReadOnly`].
9493 ///
9494 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9495 /// tokens for more than one scope.
9496 ///
9497 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9498 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9499 /// sufficient, a read-write scope will do as well.
9500 pub fn add_scope<St>(mut self, scope: St) -> AppLocationGetCall<'a, C>
9501 where
9502 St: AsRef<str>,
9503 {
9504 self._scopes.insert(String::from(scope.as_ref()));
9505 self
9506 }
9507 /// Identifies the authorization scope(s) for the method you are building.
9508 ///
9509 /// See [`Self::add_scope()`] for details.
9510 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppLocationGetCall<'a, C>
9511 where
9512 I: IntoIterator<Item = St>,
9513 St: AsRef<str>,
9514 {
9515 self._scopes
9516 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9517 self
9518 }
9519
9520 /// Removes all scopes, and no default scope will be used either.
9521 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9522 /// for details).
9523 pub fn clear_scopes(mut self) -> AppLocationGetCall<'a, C> {
9524 self._scopes.clear();
9525 self
9526 }
9527}
9528
9529/// Lists information about the supported locations for this service.
9530///
9531/// A builder for the *locations.list* method supported by a *app* resource.
9532/// It is not used directly, but through a [`AppMethods`] instance.
9533///
9534/// # Example
9535///
9536/// Instantiate a resource method builder
9537///
9538/// ```test_harness,no_run
9539/// # extern crate hyper;
9540/// # extern crate hyper_rustls;
9541/// # extern crate google_appengine1 as appengine1;
9542/// # async fn dox() {
9543/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9544///
9545/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9546/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9547/// # .with_native_roots()
9548/// # .unwrap()
9549/// # .https_only()
9550/// # .enable_http2()
9551/// # .build();
9552///
9553/// # let executor = hyper_util::rt::TokioExecutor::new();
9554/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9555/// # secret,
9556/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9557/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9558/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9559/// # ),
9560/// # ).build().await.unwrap();
9561///
9562/// # let client = hyper_util::client::legacy::Client::builder(
9563/// # hyper_util::rt::TokioExecutor::new()
9564/// # )
9565/// # .build(
9566/// # hyper_rustls::HttpsConnectorBuilder::new()
9567/// # .with_native_roots()
9568/// # .unwrap()
9569/// # .https_or_http()
9570/// # .enable_http2()
9571/// # .build()
9572/// # );
9573/// # let mut hub = Appengine::new(client, auth);
9574/// // You can configure optional parameters by calling the respective setters at will, and
9575/// // execute the final call using `doit()`.
9576/// // Values shown here are possibly random and not representative !
9577/// let result = hub.apps().locations_list("appsId")
9578/// .page_token("consetetur")
9579/// .page_size(-92)
9580/// .filter("dolor")
9581/// .add_extra_location_types("et")
9582/// .doit().await;
9583/// # }
9584/// ```
9585pub struct AppLocationListCall<'a, C>
9586where
9587 C: 'a,
9588{
9589 hub: &'a Appengine<C>,
9590 _apps_id: String,
9591 _page_token: Option<String>,
9592 _page_size: Option<i32>,
9593 _filter: Option<String>,
9594 _extra_location_types: Vec<String>,
9595 _delegate: Option<&'a mut dyn common::Delegate>,
9596 _additional_params: HashMap<String, String>,
9597 _scopes: BTreeSet<String>,
9598}
9599
9600impl<'a, C> common::CallBuilder for AppLocationListCall<'a, C> {}
9601
9602impl<'a, C> AppLocationListCall<'a, C>
9603where
9604 C: common::Connector,
9605{
9606 /// Perform the operation you have build so far.
9607 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
9608 use std::borrow::Cow;
9609 use std::io::{Read, Seek};
9610
9611 use common::{url::Params, ToParts};
9612 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9613
9614 let mut dd = common::DefaultDelegate;
9615 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9616 dlg.begin(common::MethodInfo {
9617 id: "appengine.apps.locations.list",
9618 http_method: hyper::Method::GET,
9619 });
9620
9621 for &field in [
9622 "alt",
9623 "appsId",
9624 "pageToken",
9625 "pageSize",
9626 "filter",
9627 "extraLocationTypes",
9628 ]
9629 .iter()
9630 {
9631 if self._additional_params.contains_key(field) {
9632 dlg.finished(false);
9633 return Err(common::Error::FieldClash(field));
9634 }
9635 }
9636
9637 let mut params = Params::with_capacity(7 + self._additional_params.len());
9638 params.push("appsId", self._apps_id);
9639 if let Some(value) = self._page_token.as_ref() {
9640 params.push("pageToken", value);
9641 }
9642 if let Some(value) = self._page_size.as_ref() {
9643 params.push("pageSize", value.to_string());
9644 }
9645 if let Some(value) = self._filter.as_ref() {
9646 params.push("filter", value);
9647 }
9648 if !self._extra_location_types.is_empty() {
9649 for f in self._extra_location_types.iter() {
9650 params.push("extraLocationTypes", f);
9651 }
9652 }
9653
9654 params.extend(self._additional_params.iter());
9655
9656 params.push("alt", "json");
9657 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/locations";
9658 if self._scopes.is_empty() {
9659 self._scopes
9660 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9661 }
9662
9663 #[allow(clippy::single_element_loop)]
9664 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
9665 url = params.uri_replacement(url, param_name, find_this, false);
9666 }
9667 {
9668 let to_remove = ["appsId"];
9669 params.remove_params(&to_remove);
9670 }
9671
9672 let url = params.parse_with_url(&url);
9673
9674 loop {
9675 let token = match self
9676 .hub
9677 .auth
9678 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9679 .await
9680 {
9681 Ok(token) => token,
9682 Err(e) => match dlg.token(e) {
9683 Ok(token) => token,
9684 Err(e) => {
9685 dlg.finished(false);
9686 return Err(common::Error::MissingToken(e));
9687 }
9688 },
9689 };
9690 let mut req_result = {
9691 let client = &self.hub.client;
9692 dlg.pre_request();
9693 let mut req_builder = hyper::Request::builder()
9694 .method(hyper::Method::GET)
9695 .uri(url.as_str())
9696 .header(USER_AGENT, self.hub._user_agent.clone());
9697
9698 if let Some(token) = token.as_ref() {
9699 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9700 }
9701
9702 let request = req_builder
9703 .header(CONTENT_LENGTH, 0_u64)
9704 .body(common::to_body::<String>(None));
9705
9706 client.request(request.unwrap()).await
9707 };
9708
9709 match req_result {
9710 Err(err) => {
9711 if let common::Retry::After(d) = dlg.http_error(&err) {
9712 sleep(d).await;
9713 continue;
9714 }
9715 dlg.finished(false);
9716 return Err(common::Error::HttpError(err));
9717 }
9718 Ok(res) => {
9719 let (mut parts, body) = res.into_parts();
9720 let mut body = common::Body::new(body);
9721 if !parts.status.is_success() {
9722 let bytes = common::to_bytes(body).await.unwrap_or_default();
9723 let error = serde_json::from_str(&common::to_string(&bytes));
9724 let response = common::to_response(parts, bytes.into());
9725
9726 if let common::Retry::After(d) =
9727 dlg.http_failure(&response, error.as_ref().ok())
9728 {
9729 sleep(d).await;
9730 continue;
9731 }
9732
9733 dlg.finished(false);
9734
9735 return Err(match error {
9736 Ok(value) => common::Error::BadRequest(value),
9737 _ => common::Error::Failure(response),
9738 });
9739 }
9740 let response = {
9741 let bytes = common::to_bytes(body).await.unwrap_or_default();
9742 let encoded = common::to_string(&bytes);
9743 match serde_json::from_str(&encoded) {
9744 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9745 Err(error) => {
9746 dlg.response_json_decode_error(&encoded, &error);
9747 return Err(common::Error::JsonDecodeError(
9748 encoded.to_string(),
9749 error,
9750 ));
9751 }
9752 }
9753 };
9754
9755 dlg.finished(true);
9756 return Ok(response);
9757 }
9758 }
9759 }
9760 }
9761
9762 /// Part of `name`. The resource that owns the locations collection, if applicable.
9763 ///
9764 /// Sets the *apps id* path property to the given value.
9765 ///
9766 /// Even though the property as already been set when instantiating this call,
9767 /// we provide this method for API completeness.
9768 pub fn apps_id(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
9769 self._apps_id = new_value.to_string();
9770 self
9771 }
9772 /// A page token received from the next_page_token field in the response. Send that page token to receive the subsequent page.
9773 ///
9774 /// Sets the *page token* query property to the given value.
9775 pub fn page_token(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
9776 self._page_token = Some(new_value.to_string());
9777 self
9778 }
9779 /// The maximum number of results to return. If not set, the service selects a default.
9780 ///
9781 /// Sets the *page size* query property to the given value.
9782 pub fn page_size(mut self, new_value: i32) -> AppLocationListCall<'a, C> {
9783 self._page_size = Some(new_value);
9784 self
9785 }
9786 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like "displayName=tokyo", and is documented in more detail in AIP-160 (https://google.aip.dev/160).
9787 ///
9788 /// Sets the *filter* query property to the given value.
9789 pub fn filter(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
9790 self._filter = Some(new_value.to_string());
9791 self
9792 }
9793 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
9794 ///
9795 /// Append the given value to the *extra location types* query property.
9796 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9797 pub fn add_extra_location_types(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
9798 self._extra_location_types.push(new_value.to_string());
9799 self
9800 }
9801 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9802 /// while executing the actual API request.
9803 ///
9804 /// ````text
9805 /// It should be used to handle progress information, and to implement a certain level of resilience.
9806 /// ````
9807 ///
9808 /// Sets the *delegate* property to the given value.
9809 pub fn delegate(
9810 mut self,
9811 new_value: &'a mut dyn common::Delegate,
9812 ) -> AppLocationListCall<'a, C> {
9813 self._delegate = Some(new_value);
9814 self
9815 }
9816
9817 /// Set any additional parameter of the query string used in the request.
9818 /// It should be used to set parameters which are not yet available through their own
9819 /// setters.
9820 ///
9821 /// Please note that this method must not be used to set any of the known parameters
9822 /// which have their own setter method. If done anyway, the request will fail.
9823 ///
9824 /// # Additional Parameters
9825 ///
9826 /// * *$.xgafv* (query-string) - V1 error format.
9827 /// * *access_token* (query-string) - OAuth access token.
9828 /// * *alt* (query-string) - Data format for response.
9829 /// * *callback* (query-string) - JSONP
9830 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9831 /// * *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.
9832 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9833 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9834 /// * *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.
9835 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9836 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9837 pub fn param<T>(mut self, name: T, value: T) -> AppLocationListCall<'a, C>
9838 where
9839 T: AsRef<str>,
9840 {
9841 self._additional_params
9842 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9843 self
9844 }
9845
9846 /// Identifies the authorization scope for the method you are building.
9847 ///
9848 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9849 /// [`Scope::CloudPlatformReadOnly`].
9850 ///
9851 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9852 /// tokens for more than one scope.
9853 ///
9854 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9855 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9856 /// sufficient, a read-write scope will do as well.
9857 pub fn add_scope<St>(mut self, scope: St) -> AppLocationListCall<'a, C>
9858 where
9859 St: AsRef<str>,
9860 {
9861 self._scopes.insert(String::from(scope.as_ref()));
9862 self
9863 }
9864 /// Identifies the authorization scope(s) for the method you are building.
9865 ///
9866 /// See [`Self::add_scope()`] for details.
9867 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppLocationListCall<'a, C>
9868 where
9869 I: IntoIterator<Item = St>,
9870 St: AsRef<str>,
9871 {
9872 self._scopes
9873 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9874 self
9875 }
9876
9877 /// Removes all scopes, and no default scope will be used either.
9878 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9879 /// for details).
9880 pub fn clear_scopes(mut self) -> AppLocationListCall<'a, C> {
9881 self._scopes.clear();
9882 self
9883 }
9884}
9885
9886/// 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.
9887///
9888/// A builder for the *operations.get* method supported by a *app* resource.
9889/// It is not used directly, but through a [`AppMethods`] instance.
9890///
9891/// # Example
9892///
9893/// Instantiate a resource method builder
9894///
9895/// ```test_harness,no_run
9896/// # extern crate hyper;
9897/// # extern crate hyper_rustls;
9898/// # extern crate google_appengine1 as appengine1;
9899/// # async fn dox() {
9900/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9901///
9902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9903/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9904/// # .with_native_roots()
9905/// # .unwrap()
9906/// # .https_only()
9907/// # .enable_http2()
9908/// # .build();
9909///
9910/// # let executor = hyper_util::rt::TokioExecutor::new();
9911/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9912/// # secret,
9913/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9914/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9915/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9916/// # ),
9917/// # ).build().await.unwrap();
9918///
9919/// # let client = hyper_util::client::legacy::Client::builder(
9920/// # hyper_util::rt::TokioExecutor::new()
9921/// # )
9922/// # .build(
9923/// # hyper_rustls::HttpsConnectorBuilder::new()
9924/// # .with_native_roots()
9925/// # .unwrap()
9926/// # .https_or_http()
9927/// # .enable_http2()
9928/// # .build()
9929/// # );
9930/// # let mut hub = Appengine::new(client, auth);
9931/// // You can configure optional parameters by calling the respective setters at will, and
9932/// // execute the final call using `doit()`.
9933/// // Values shown here are possibly random and not representative !
9934/// let result = hub.apps().operations_get("appsId", "operationsId")
9935/// .doit().await;
9936/// # }
9937/// ```
9938pub struct AppOperationGetCall<'a, C>
9939where
9940 C: 'a,
9941{
9942 hub: &'a Appengine<C>,
9943 _apps_id: String,
9944 _operations_id: String,
9945 _delegate: Option<&'a mut dyn common::Delegate>,
9946 _additional_params: HashMap<String, String>,
9947 _scopes: BTreeSet<String>,
9948}
9949
9950impl<'a, C> common::CallBuilder for AppOperationGetCall<'a, C> {}
9951
9952impl<'a, C> AppOperationGetCall<'a, C>
9953where
9954 C: common::Connector,
9955{
9956 /// Perform the operation you have build so far.
9957 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9958 use std::borrow::Cow;
9959 use std::io::{Read, Seek};
9960
9961 use common::{url::Params, ToParts};
9962 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9963
9964 let mut dd = common::DefaultDelegate;
9965 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9966 dlg.begin(common::MethodInfo {
9967 id: "appengine.apps.operations.get",
9968 http_method: hyper::Method::GET,
9969 });
9970
9971 for &field in ["alt", "appsId", "operationsId"].iter() {
9972 if self._additional_params.contains_key(field) {
9973 dlg.finished(false);
9974 return Err(common::Error::FieldClash(field));
9975 }
9976 }
9977
9978 let mut params = Params::with_capacity(4 + self._additional_params.len());
9979 params.push("appsId", self._apps_id);
9980 params.push("operationsId", self._operations_id);
9981
9982 params.extend(self._additional_params.iter());
9983
9984 params.push("alt", "json");
9985 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/operations/{operationsId}";
9986 if self._scopes.is_empty() {
9987 self._scopes
9988 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9989 }
9990
9991 #[allow(clippy::single_element_loop)]
9992 for &(find_this, param_name) in
9993 [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter()
9994 {
9995 url = params.uri_replacement(url, param_name, find_this, false);
9996 }
9997 {
9998 let to_remove = ["operationsId", "appsId"];
9999 params.remove_params(&to_remove);
10000 }
10001
10002 let url = params.parse_with_url(&url);
10003
10004 loop {
10005 let token = match self
10006 .hub
10007 .auth
10008 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10009 .await
10010 {
10011 Ok(token) => token,
10012 Err(e) => match dlg.token(e) {
10013 Ok(token) => token,
10014 Err(e) => {
10015 dlg.finished(false);
10016 return Err(common::Error::MissingToken(e));
10017 }
10018 },
10019 };
10020 let mut req_result = {
10021 let client = &self.hub.client;
10022 dlg.pre_request();
10023 let mut req_builder = hyper::Request::builder()
10024 .method(hyper::Method::GET)
10025 .uri(url.as_str())
10026 .header(USER_AGENT, self.hub._user_agent.clone());
10027
10028 if let Some(token) = token.as_ref() {
10029 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10030 }
10031
10032 let request = req_builder
10033 .header(CONTENT_LENGTH, 0_u64)
10034 .body(common::to_body::<String>(None));
10035
10036 client.request(request.unwrap()).await
10037 };
10038
10039 match req_result {
10040 Err(err) => {
10041 if let common::Retry::After(d) = dlg.http_error(&err) {
10042 sleep(d).await;
10043 continue;
10044 }
10045 dlg.finished(false);
10046 return Err(common::Error::HttpError(err));
10047 }
10048 Ok(res) => {
10049 let (mut parts, body) = res.into_parts();
10050 let mut body = common::Body::new(body);
10051 if !parts.status.is_success() {
10052 let bytes = common::to_bytes(body).await.unwrap_or_default();
10053 let error = serde_json::from_str(&common::to_string(&bytes));
10054 let response = common::to_response(parts, bytes.into());
10055
10056 if let common::Retry::After(d) =
10057 dlg.http_failure(&response, error.as_ref().ok())
10058 {
10059 sleep(d).await;
10060 continue;
10061 }
10062
10063 dlg.finished(false);
10064
10065 return Err(match error {
10066 Ok(value) => common::Error::BadRequest(value),
10067 _ => common::Error::Failure(response),
10068 });
10069 }
10070 let response = {
10071 let bytes = common::to_bytes(body).await.unwrap_or_default();
10072 let encoded = common::to_string(&bytes);
10073 match serde_json::from_str(&encoded) {
10074 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10075 Err(error) => {
10076 dlg.response_json_decode_error(&encoded, &error);
10077 return Err(common::Error::JsonDecodeError(
10078 encoded.to_string(),
10079 error,
10080 ));
10081 }
10082 }
10083 };
10084
10085 dlg.finished(true);
10086 return Ok(response);
10087 }
10088 }
10089 }
10090 }
10091
10092 /// Part of `name`. The name of the operation resource.
10093 ///
10094 /// Sets the *apps id* path property to the given value.
10095 ///
10096 /// Even though the property as already been set when instantiating this call,
10097 /// we provide this method for API completeness.
10098 pub fn apps_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C> {
10099 self._apps_id = new_value.to_string();
10100 self
10101 }
10102 /// Part of `name`. See documentation of `appsId`.
10103 ///
10104 /// Sets the *operations id* path property to the given value.
10105 ///
10106 /// Even though the property as already been set when instantiating this call,
10107 /// we provide this method for API completeness.
10108 pub fn operations_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C> {
10109 self._operations_id = new_value.to_string();
10110 self
10111 }
10112 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10113 /// while executing the actual API request.
10114 ///
10115 /// ````text
10116 /// It should be used to handle progress information, and to implement a certain level of resilience.
10117 /// ````
10118 ///
10119 /// Sets the *delegate* property to the given value.
10120 pub fn delegate(
10121 mut self,
10122 new_value: &'a mut dyn common::Delegate,
10123 ) -> AppOperationGetCall<'a, C> {
10124 self._delegate = Some(new_value);
10125 self
10126 }
10127
10128 /// Set any additional parameter of the query string used in the request.
10129 /// It should be used to set parameters which are not yet available through their own
10130 /// setters.
10131 ///
10132 /// Please note that this method must not be used to set any of the known parameters
10133 /// which have their own setter method. If done anyway, the request will fail.
10134 ///
10135 /// # Additional Parameters
10136 ///
10137 /// * *$.xgafv* (query-string) - V1 error format.
10138 /// * *access_token* (query-string) - OAuth access token.
10139 /// * *alt* (query-string) - Data format for response.
10140 /// * *callback* (query-string) - JSONP
10141 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10142 /// * *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.
10143 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10144 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10145 /// * *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.
10146 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10147 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10148 pub fn param<T>(mut self, name: T, value: T) -> AppOperationGetCall<'a, C>
10149 where
10150 T: AsRef<str>,
10151 {
10152 self._additional_params
10153 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10154 self
10155 }
10156
10157 /// Identifies the authorization scope for the method you are building.
10158 ///
10159 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10160 /// [`Scope::CloudPlatformReadOnly`].
10161 ///
10162 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10163 /// tokens for more than one scope.
10164 ///
10165 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10166 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10167 /// sufficient, a read-write scope will do as well.
10168 pub fn add_scope<St>(mut self, scope: St) -> AppOperationGetCall<'a, C>
10169 where
10170 St: AsRef<str>,
10171 {
10172 self._scopes.insert(String::from(scope.as_ref()));
10173 self
10174 }
10175 /// Identifies the authorization scope(s) for the method you are building.
10176 ///
10177 /// See [`Self::add_scope()`] for details.
10178 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppOperationGetCall<'a, C>
10179 where
10180 I: IntoIterator<Item = St>,
10181 St: AsRef<str>,
10182 {
10183 self._scopes
10184 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10185 self
10186 }
10187
10188 /// Removes all scopes, and no default scope will be used either.
10189 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10190 /// for details).
10191 pub fn clear_scopes(mut self) -> AppOperationGetCall<'a, C> {
10192 self._scopes.clear();
10193 self
10194 }
10195}
10196
10197/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
10198///
10199/// A builder for the *operations.list* method supported by a *app* resource.
10200/// It is not used directly, but through a [`AppMethods`] instance.
10201///
10202/// # Example
10203///
10204/// Instantiate a resource method builder
10205///
10206/// ```test_harness,no_run
10207/// # extern crate hyper;
10208/// # extern crate hyper_rustls;
10209/// # extern crate google_appengine1 as appengine1;
10210/// # async fn dox() {
10211/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10212///
10213/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10214/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10215/// # .with_native_roots()
10216/// # .unwrap()
10217/// # .https_only()
10218/// # .enable_http2()
10219/// # .build();
10220///
10221/// # let executor = hyper_util::rt::TokioExecutor::new();
10222/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10223/// # secret,
10224/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10225/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10226/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10227/// # ),
10228/// # ).build().await.unwrap();
10229///
10230/// # let client = hyper_util::client::legacy::Client::builder(
10231/// # hyper_util::rt::TokioExecutor::new()
10232/// # )
10233/// # .build(
10234/// # hyper_rustls::HttpsConnectorBuilder::new()
10235/// # .with_native_roots()
10236/// # .unwrap()
10237/// # .https_or_http()
10238/// # .enable_http2()
10239/// # .build()
10240/// # );
10241/// # let mut hub = Appengine::new(client, auth);
10242/// // You can configure optional parameters by calling the respective setters at will, and
10243/// // execute the final call using `doit()`.
10244/// // Values shown here are possibly random and not representative !
10245/// let result = hub.apps().operations_list("appsId")
10246/// .return_partial_success(false)
10247/// .page_token("duo")
10248/// .page_size(-76)
10249/// .filter("vero")
10250/// .doit().await;
10251/// # }
10252/// ```
10253pub struct AppOperationListCall<'a, C>
10254where
10255 C: 'a,
10256{
10257 hub: &'a Appengine<C>,
10258 _apps_id: String,
10259 _return_partial_success: Option<bool>,
10260 _page_token: Option<String>,
10261 _page_size: Option<i32>,
10262 _filter: Option<String>,
10263 _delegate: Option<&'a mut dyn common::Delegate>,
10264 _additional_params: HashMap<String, String>,
10265 _scopes: BTreeSet<String>,
10266}
10267
10268impl<'a, C> common::CallBuilder for AppOperationListCall<'a, C> {}
10269
10270impl<'a, C> AppOperationListCall<'a, C>
10271where
10272 C: common::Connector,
10273{
10274 /// Perform the operation you have build so far.
10275 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
10276 use std::borrow::Cow;
10277 use std::io::{Read, Seek};
10278
10279 use common::{url::Params, ToParts};
10280 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10281
10282 let mut dd = common::DefaultDelegate;
10283 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10284 dlg.begin(common::MethodInfo {
10285 id: "appengine.apps.operations.list",
10286 http_method: hyper::Method::GET,
10287 });
10288
10289 for &field in [
10290 "alt",
10291 "appsId",
10292 "returnPartialSuccess",
10293 "pageToken",
10294 "pageSize",
10295 "filter",
10296 ]
10297 .iter()
10298 {
10299 if self._additional_params.contains_key(field) {
10300 dlg.finished(false);
10301 return Err(common::Error::FieldClash(field));
10302 }
10303 }
10304
10305 let mut params = Params::with_capacity(7 + self._additional_params.len());
10306 params.push("appsId", self._apps_id);
10307 if let Some(value) = self._return_partial_success.as_ref() {
10308 params.push("returnPartialSuccess", value.to_string());
10309 }
10310 if let Some(value) = self._page_token.as_ref() {
10311 params.push("pageToken", value);
10312 }
10313 if let Some(value) = self._page_size.as_ref() {
10314 params.push("pageSize", value.to_string());
10315 }
10316 if let Some(value) = self._filter.as_ref() {
10317 params.push("filter", value);
10318 }
10319
10320 params.extend(self._additional_params.iter());
10321
10322 params.push("alt", "json");
10323 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/operations";
10324 if self._scopes.is_empty() {
10325 self._scopes
10326 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
10327 }
10328
10329 #[allow(clippy::single_element_loop)]
10330 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
10331 url = params.uri_replacement(url, param_name, find_this, false);
10332 }
10333 {
10334 let to_remove = ["appsId"];
10335 params.remove_params(&to_remove);
10336 }
10337
10338 let url = params.parse_with_url(&url);
10339
10340 loop {
10341 let token = match self
10342 .hub
10343 .auth
10344 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10345 .await
10346 {
10347 Ok(token) => token,
10348 Err(e) => match dlg.token(e) {
10349 Ok(token) => token,
10350 Err(e) => {
10351 dlg.finished(false);
10352 return Err(common::Error::MissingToken(e));
10353 }
10354 },
10355 };
10356 let mut req_result = {
10357 let client = &self.hub.client;
10358 dlg.pre_request();
10359 let mut req_builder = hyper::Request::builder()
10360 .method(hyper::Method::GET)
10361 .uri(url.as_str())
10362 .header(USER_AGENT, self.hub._user_agent.clone());
10363
10364 if let Some(token) = token.as_ref() {
10365 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10366 }
10367
10368 let request = req_builder
10369 .header(CONTENT_LENGTH, 0_u64)
10370 .body(common::to_body::<String>(None));
10371
10372 client.request(request.unwrap()).await
10373 };
10374
10375 match req_result {
10376 Err(err) => {
10377 if let common::Retry::After(d) = dlg.http_error(&err) {
10378 sleep(d).await;
10379 continue;
10380 }
10381 dlg.finished(false);
10382 return Err(common::Error::HttpError(err));
10383 }
10384 Ok(res) => {
10385 let (mut parts, body) = res.into_parts();
10386 let mut body = common::Body::new(body);
10387 if !parts.status.is_success() {
10388 let bytes = common::to_bytes(body).await.unwrap_or_default();
10389 let error = serde_json::from_str(&common::to_string(&bytes));
10390 let response = common::to_response(parts, bytes.into());
10391
10392 if let common::Retry::After(d) =
10393 dlg.http_failure(&response, error.as_ref().ok())
10394 {
10395 sleep(d).await;
10396 continue;
10397 }
10398
10399 dlg.finished(false);
10400
10401 return Err(match error {
10402 Ok(value) => common::Error::BadRequest(value),
10403 _ => common::Error::Failure(response),
10404 });
10405 }
10406 let response = {
10407 let bytes = common::to_bytes(body).await.unwrap_or_default();
10408 let encoded = common::to_string(&bytes);
10409 match serde_json::from_str(&encoded) {
10410 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10411 Err(error) => {
10412 dlg.response_json_decode_error(&encoded, &error);
10413 return Err(common::Error::JsonDecodeError(
10414 encoded.to_string(),
10415 error,
10416 ));
10417 }
10418 }
10419 };
10420
10421 dlg.finished(true);
10422 return Ok(response);
10423 }
10424 }
10425 }
10426 }
10427
10428 /// Part of `name`. The name of the operation's parent resource.
10429 ///
10430 /// Sets the *apps id* path property to the given value.
10431 ///
10432 /// Even though the property as already been set when instantiating this call,
10433 /// we provide this method for API completeness.
10434 pub fn apps_id(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
10435 self._apps_id = new_value.to_string();
10436 self
10437 }
10438 /// When set to true, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field.This can only be true when reading across collections. For example, when parent is set to "projects/example/locations/-".This field is not supported by default and will result in an UNIMPLEMENTED error if set unless explicitly documented otherwise in service or product specific documentation.
10439 ///
10440 /// Sets the *return partial success* query property to the given value.
10441 pub fn return_partial_success(mut self, new_value: bool) -> AppOperationListCall<'a, C> {
10442 self._return_partial_success = Some(new_value);
10443 self
10444 }
10445 /// The standard list page token.
10446 ///
10447 /// Sets the *page token* query property to the given value.
10448 pub fn page_token(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
10449 self._page_token = Some(new_value.to_string());
10450 self
10451 }
10452 /// The standard list page size.
10453 ///
10454 /// Sets the *page size* query property to the given value.
10455 pub fn page_size(mut self, new_value: i32) -> AppOperationListCall<'a, C> {
10456 self._page_size = Some(new_value);
10457 self
10458 }
10459 /// The standard list filter.
10460 ///
10461 /// Sets the *filter* query property to the given value.
10462 pub fn filter(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
10463 self._filter = Some(new_value.to_string());
10464 self
10465 }
10466 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10467 /// while executing the actual API request.
10468 ///
10469 /// ````text
10470 /// It should be used to handle progress information, and to implement a certain level of resilience.
10471 /// ````
10472 ///
10473 /// Sets the *delegate* property to the given value.
10474 pub fn delegate(
10475 mut self,
10476 new_value: &'a mut dyn common::Delegate,
10477 ) -> AppOperationListCall<'a, C> {
10478 self._delegate = Some(new_value);
10479 self
10480 }
10481
10482 /// Set any additional parameter of the query string used in the request.
10483 /// It should be used to set parameters which are not yet available through their own
10484 /// setters.
10485 ///
10486 /// Please note that this method must not be used to set any of the known parameters
10487 /// which have their own setter method. If done anyway, the request will fail.
10488 ///
10489 /// # Additional Parameters
10490 ///
10491 /// * *$.xgafv* (query-string) - V1 error format.
10492 /// * *access_token* (query-string) - OAuth access token.
10493 /// * *alt* (query-string) - Data format for response.
10494 /// * *callback* (query-string) - JSONP
10495 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10496 /// * *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.
10497 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10498 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10499 /// * *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.
10500 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10501 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10502 pub fn param<T>(mut self, name: T, value: T) -> AppOperationListCall<'a, C>
10503 where
10504 T: AsRef<str>,
10505 {
10506 self._additional_params
10507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10508 self
10509 }
10510
10511 /// Identifies the authorization scope for the method you are building.
10512 ///
10513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10514 /// [`Scope::CloudPlatformReadOnly`].
10515 ///
10516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10517 /// tokens for more than one scope.
10518 ///
10519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10521 /// sufficient, a read-write scope will do as well.
10522 pub fn add_scope<St>(mut self, scope: St) -> AppOperationListCall<'a, C>
10523 where
10524 St: AsRef<str>,
10525 {
10526 self._scopes.insert(String::from(scope.as_ref()));
10527 self
10528 }
10529 /// Identifies the authorization scope(s) for the method you are building.
10530 ///
10531 /// See [`Self::add_scope()`] for details.
10532 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppOperationListCall<'a, C>
10533 where
10534 I: IntoIterator<Item = St>,
10535 St: AsRef<str>,
10536 {
10537 self._scopes
10538 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10539 self
10540 }
10541
10542 /// Removes all scopes, and no default scope will be used either.
10543 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10544 /// for details).
10545 pub fn clear_scopes(mut self) -> AppOperationListCall<'a, C> {
10546 self._scopes.clear();
10547 self
10548 }
10549}
10550
10551/// 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.
10552///
10553/// A builder for the *services.versions.instances.debug* method supported by a *app* resource.
10554/// It is not used directly, but through a [`AppMethods`] instance.
10555///
10556/// # Example
10557///
10558/// Instantiate a resource method builder
10559///
10560/// ```test_harness,no_run
10561/// # extern crate hyper;
10562/// # extern crate hyper_rustls;
10563/// # extern crate google_appengine1 as appengine1;
10564/// use appengine1::api::DebugInstanceRequest;
10565/// # async fn dox() {
10566/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10567///
10568/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10569/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10570/// # .with_native_roots()
10571/// # .unwrap()
10572/// # .https_only()
10573/// # .enable_http2()
10574/// # .build();
10575///
10576/// # let executor = hyper_util::rt::TokioExecutor::new();
10577/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10578/// # secret,
10579/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10580/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10581/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10582/// # ),
10583/// # ).build().await.unwrap();
10584///
10585/// # let client = hyper_util::client::legacy::Client::builder(
10586/// # hyper_util::rt::TokioExecutor::new()
10587/// # )
10588/// # .build(
10589/// # hyper_rustls::HttpsConnectorBuilder::new()
10590/// # .with_native_roots()
10591/// # .unwrap()
10592/// # .https_or_http()
10593/// # .enable_http2()
10594/// # .build()
10595/// # );
10596/// # let mut hub = Appengine::new(client, auth);
10597/// // As the method needs a request, you would usually fill it with the desired information
10598/// // into the respective structure. Some of the parts shown here might not be applicable !
10599/// // Values shown here are possibly random and not representative !
10600/// let mut req = DebugInstanceRequest::default();
10601///
10602/// // You can configure optional parameters by calling the respective setters at will, and
10603/// // execute the final call using `doit()`.
10604/// // Values shown here are possibly random and not representative !
10605/// let result = hub.apps().services_versions_instances_debug(req, "appsId", "servicesId", "versionsId", "instancesId")
10606/// .doit().await;
10607/// # }
10608/// ```
10609pub struct AppServiceVersionInstanceDebugCall<'a, C>
10610where
10611 C: 'a,
10612{
10613 hub: &'a Appengine<C>,
10614 _request: DebugInstanceRequest,
10615 _apps_id: String,
10616 _services_id: String,
10617 _versions_id: String,
10618 _instances_id: String,
10619 _delegate: Option<&'a mut dyn common::Delegate>,
10620 _additional_params: HashMap<String, String>,
10621 _scopes: BTreeSet<String>,
10622}
10623
10624impl<'a, C> common::CallBuilder for AppServiceVersionInstanceDebugCall<'a, C> {}
10625
10626impl<'a, C> AppServiceVersionInstanceDebugCall<'a, C>
10627where
10628 C: common::Connector,
10629{
10630 /// Perform the operation you have build so far.
10631 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10632 use std::borrow::Cow;
10633 use std::io::{Read, Seek};
10634
10635 use common::{url::Params, ToParts};
10636 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10637
10638 let mut dd = common::DefaultDelegate;
10639 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10640 dlg.begin(common::MethodInfo {
10641 id: "appengine.apps.services.versions.instances.debug",
10642 http_method: hyper::Method::POST,
10643 });
10644
10645 for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
10646 if self._additional_params.contains_key(field) {
10647 dlg.finished(false);
10648 return Err(common::Error::FieldClash(field));
10649 }
10650 }
10651
10652 let mut params = Params::with_capacity(7 + self._additional_params.len());
10653 params.push("appsId", self._apps_id);
10654 params.push("servicesId", self._services_id);
10655 params.push("versionsId", self._versions_id);
10656 params.push("instancesId", self._instances_id);
10657
10658 params.extend(self._additional_params.iter());
10659
10660 params.push("alt", "json");
10661 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}:debug";
10662 if self._scopes.is_empty() {
10663 self._scopes
10664 .insert(Scope::CloudPlatform.as_ref().to_string());
10665 }
10666
10667 #[allow(clippy::single_element_loop)]
10668 for &(find_this, param_name) in [
10669 ("{appsId}", "appsId"),
10670 ("{servicesId}", "servicesId"),
10671 ("{versionsId}", "versionsId"),
10672 ("{instancesId}", "instancesId"),
10673 ]
10674 .iter()
10675 {
10676 url = params.uri_replacement(url, param_name, find_this, false);
10677 }
10678 {
10679 let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"];
10680 params.remove_params(&to_remove);
10681 }
10682
10683 let url = params.parse_with_url(&url);
10684
10685 let mut json_mime_type = mime::APPLICATION_JSON;
10686 let mut request_value_reader = {
10687 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10688 common::remove_json_null_values(&mut value);
10689 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10690 serde_json::to_writer(&mut dst, &value).unwrap();
10691 dst
10692 };
10693 let request_size = request_value_reader
10694 .seek(std::io::SeekFrom::End(0))
10695 .unwrap();
10696 request_value_reader
10697 .seek(std::io::SeekFrom::Start(0))
10698 .unwrap();
10699
10700 loop {
10701 let token = match self
10702 .hub
10703 .auth
10704 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10705 .await
10706 {
10707 Ok(token) => token,
10708 Err(e) => match dlg.token(e) {
10709 Ok(token) => token,
10710 Err(e) => {
10711 dlg.finished(false);
10712 return Err(common::Error::MissingToken(e));
10713 }
10714 },
10715 };
10716 request_value_reader
10717 .seek(std::io::SeekFrom::Start(0))
10718 .unwrap();
10719 let mut req_result = {
10720 let client = &self.hub.client;
10721 dlg.pre_request();
10722 let mut req_builder = hyper::Request::builder()
10723 .method(hyper::Method::POST)
10724 .uri(url.as_str())
10725 .header(USER_AGENT, self.hub._user_agent.clone());
10726
10727 if let Some(token) = token.as_ref() {
10728 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10729 }
10730
10731 let request = req_builder
10732 .header(CONTENT_TYPE, json_mime_type.to_string())
10733 .header(CONTENT_LENGTH, request_size as u64)
10734 .body(common::to_body(
10735 request_value_reader.get_ref().clone().into(),
10736 ));
10737
10738 client.request(request.unwrap()).await
10739 };
10740
10741 match req_result {
10742 Err(err) => {
10743 if let common::Retry::After(d) = dlg.http_error(&err) {
10744 sleep(d).await;
10745 continue;
10746 }
10747 dlg.finished(false);
10748 return Err(common::Error::HttpError(err));
10749 }
10750 Ok(res) => {
10751 let (mut parts, body) = res.into_parts();
10752 let mut body = common::Body::new(body);
10753 if !parts.status.is_success() {
10754 let bytes = common::to_bytes(body).await.unwrap_or_default();
10755 let error = serde_json::from_str(&common::to_string(&bytes));
10756 let response = common::to_response(parts, bytes.into());
10757
10758 if let common::Retry::After(d) =
10759 dlg.http_failure(&response, error.as_ref().ok())
10760 {
10761 sleep(d).await;
10762 continue;
10763 }
10764
10765 dlg.finished(false);
10766
10767 return Err(match error {
10768 Ok(value) => common::Error::BadRequest(value),
10769 _ => common::Error::Failure(response),
10770 });
10771 }
10772 let response = {
10773 let bytes = common::to_bytes(body).await.unwrap_or_default();
10774 let encoded = common::to_string(&bytes);
10775 match serde_json::from_str(&encoded) {
10776 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10777 Err(error) => {
10778 dlg.response_json_decode_error(&encoded, &error);
10779 return Err(common::Error::JsonDecodeError(
10780 encoded.to_string(),
10781 error,
10782 ));
10783 }
10784 }
10785 };
10786
10787 dlg.finished(true);
10788 return Ok(response);
10789 }
10790 }
10791 }
10792 }
10793
10794 ///
10795 /// Sets the *request* property to the given value.
10796 ///
10797 /// Even though the property as already been set when instantiating this call,
10798 /// we provide this method for API completeness.
10799 pub fn request(
10800 mut self,
10801 new_value: DebugInstanceRequest,
10802 ) -> AppServiceVersionInstanceDebugCall<'a, C> {
10803 self._request = new_value;
10804 self
10805 }
10806 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
10807 ///
10808 /// Sets the *apps id* path property to the given value.
10809 ///
10810 /// Even though the property as already been set when instantiating this call,
10811 /// we provide this method for API completeness.
10812 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
10813 self._apps_id = new_value.to_string();
10814 self
10815 }
10816 /// Part of `name`. See documentation of `appsId`.
10817 ///
10818 /// Sets the *services id* path property to the given value.
10819 ///
10820 /// Even though the property as already been set when instantiating this call,
10821 /// we provide this method for API completeness.
10822 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
10823 self._services_id = new_value.to_string();
10824 self
10825 }
10826 /// Part of `name`. See documentation of `appsId`.
10827 ///
10828 /// Sets the *versions id* path property to the given value.
10829 ///
10830 /// Even though the property as already been set when instantiating this call,
10831 /// we provide this method for API completeness.
10832 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
10833 self._versions_id = new_value.to_string();
10834 self
10835 }
10836 /// Part of `name`. See documentation of `appsId`.
10837 ///
10838 /// Sets the *instances id* path property to the given value.
10839 ///
10840 /// Even though the property as already been set when instantiating this call,
10841 /// we provide this method for API completeness.
10842 pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
10843 self._instances_id = new_value.to_string();
10844 self
10845 }
10846 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10847 /// while executing the actual API request.
10848 ///
10849 /// ````text
10850 /// It should be used to handle progress information, and to implement a certain level of resilience.
10851 /// ````
10852 ///
10853 /// Sets the *delegate* property to the given value.
10854 pub fn delegate(
10855 mut self,
10856 new_value: &'a mut dyn common::Delegate,
10857 ) -> AppServiceVersionInstanceDebugCall<'a, C> {
10858 self._delegate = Some(new_value);
10859 self
10860 }
10861
10862 /// Set any additional parameter of the query string used in the request.
10863 /// It should be used to set parameters which are not yet available through their own
10864 /// setters.
10865 ///
10866 /// Please note that this method must not be used to set any of the known parameters
10867 /// which have their own setter method. If done anyway, the request will fail.
10868 ///
10869 /// # Additional Parameters
10870 ///
10871 /// * *$.xgafv* (query-string) - V1 error format.
10872 /// * *access_token* (query-string) - OAuth access token.
10873 /// * *alt* (query-string) - Data format for response.
10874 /// * *callback* (query-string) - JSONP
10875 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10876 /// * *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.
10877 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10878 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10879 /// * *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.
10880 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10881 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10882 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceDebugCall<'a, C>
10883 where
10884 T: AsRef<str>,
10885 {
10886 self._additional_params
10887 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10888 self
10889 }
10890
10891 /// Identifies the authorization scope for the method you are building.
10892 ///
10893 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10894 /// [`Scope::CloudPlatform`].
10895 ///
10896 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10897 /// tokens for more than one scope.
10898 ///
10899 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10900 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10901 /// sufficient, a read-write scope will do as well.
10902 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceDebugCall<'a, C>
10903 where
10904 St: AsRef<str>,
10905 {
10906 self._scopes.insert(String::from(scope.as_ref()));
10907 self
10908 }
10909 /// Identifies the authorization scope(s) for the method you are building.
10910 ///
10911 /// See [`Self::add_scope()`] for details.
10912 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceDebugCall<'a, C>
10913 where
10914 I: IntoIterator<Item = St>,
10915 St: AsRef<str>,
10916 {
10917 self._scopes
10918 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10919 self
10920 }
10921
10922 /// Removes all scopes, and no default scope will be used either.
10923 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10924 /// for details).
10925 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceDebugCall<'a, C> {
10926 self._scopes.clear();
10927 self
10928 }
10929}
10930
10931/// Stops a running instance.The instance might be automatically recreated based on the scaling settings of the version. For more information, see "How Instances are Managed" (standard environment (https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed) | flexible environment (https://cloud.google.com/appengine/docs/flexible/python/how-instances-are-managed)).To ensure that instances are not re-created and avoid getting billed, you can stop all instances within the target version by changing the serving status of the version to STOPPED with the apps.services.versions.patch (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions/patch) method.
10932///
10933/// A builder for the *services.versions.instances.delete* method supported by a *app* resource.
10934/// It is not used directly, but through a [`AppMethods`] instance.
10935///
10936/// # Example
10937///
10938/// Instantiate a resource method builder
10939///
10940/// ```test_harness,no_run
10941/// # extern crate hyper;
10942/// # extern crate hyper_rustls;
10943/// # extern crate google_appengine1 as appengine1;
10944/// # async fn dox() {
10945/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10946///
10947/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10948/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10949/// # .with_native_roots()
10950/// # .unwrap()
10951/// # .https_only()
10952/// # .enable_http2()
10953/// # .build();
10954///
10955/// # let executor = hyper_util::rt::TokioExecutor::new();
10956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10957/// # secret,
10958/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10959/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10960/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10961/// # ),
10962/// # ).build().await.unwrap();
10963///
10964/// # let client = hyper_util::client::legacy::Client::builder(
10965/// # hyper_util::rt::TokioExecutor::new()
10966/// # )
10967/// # .build(
10968/// # hyper_rustls::HttpsConnectorBuilder::new()
10969/// # .with_native_roots()
10970/// # .unwrap()
10971/// # .https_or_http()
10972/// # .enable_http2()
10973/// # .build()
10974/// # );
10975/// # let mut hub = Appengine::new(client, auth);
10976/// // You can configure optional parameters by calling the respective setters at will, and
10977/// // execute the final call using `doit()`.
10978/// // Values shown here are possibly random and not representative !
10979/// let result = hub.apps().services_versions_instances_delete("appsId", "servicesId", "versionsId", "instancesId")
10980/// .doit().await;
10981/// # }
10982/// ```
10983pub struct AppServiceVersionInstanceDeleteCall<'a, C>
10984where
10985 C: 'a,
10986{
10987 hub: &'a Appengine<C>,
10988 _apps_id: String,
10989 _services_id: String,
10990 _versions_id: String,
10991 _instances_id: String,
10992 _delegate: Option<&'a mut dyn common::Delegate>,
10993 _additional_params: HashMap<String, String>,
10994 _scopes: BTreeSet<String>,
10995}
10996
10997impl<'a, C> common::CallBuilder for AppServiceVersionInstanceDeleteCall<'a, C> {}
10998
10999impl<'a, C> AppServiceVersionInstanceDeleteCall<'a, C>
11000where
11001 C: common::Connector,
11002{
11003 /// Perform the operation you have build so far.
11004 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11005 use std::borrow::Cow;
11006 use std::io::{Read, Seek};
11007
11008 use common::{url::Params, ToParts};
11009 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11010
11011 let mut dd = common::DefaultDelegate;
11012 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11013 dlg.begin(common::MethodInfo {
11014 id: "appengine.apps.services.versions.instances.delete",
11015 http_method: hyper::Method::DELETE,
11016 });
11017
11018 for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
11019 if self._additional_params.contains_key(field) {
11020 dlg.finished(false);
11021 return Err(common::Error::FieldClash(field));
11022 }
11023 }
11024
11025 let mut params = Params::with_capacity(6 + self._additional_params.len());
11026 params.push("appsId", self._apps_id);
11027 params.push("servicesId", self._services_id);
11028 params.push("versionsId", self._versions_id);
11029 params.push("instancesId", self._instances_id);
11030
11031 params.extend(self._additional_params.iter());
11032
11033 params.push("alt", "json");
11034 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}";
11035 if self._scopes.is_empty() {
11036 self._scopes
11037 .insert(Scope::CloudPlatform.as_ref().to_string());
11038 }
11039
11040 #[allow(clippy::single_element_loop)]
11041 for &(find_this, param_name) in [
11042 ("{appsId}", "appsId"),
11043 ("{servicesId}", "servicesId"),
11044 ("{versionsId}", "versionsId"),
11045 ("{instancesId}", "instancesId"),
11046 ]
11047 .iter()
11048 {
11049 url = params.uri_replacement(url, param_name, find_this, false);
11050 }
11051 {
11052 let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"];
11053 params.remove_params(&to_remove);
11054 }
11055
11056 let url = params.parse_with_url(&url);
11057
11058 loop {
11059 let token = match self
11060 .hub
11061 .auth
11062 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11063 .await
11064 {
11065 Ok(token) => token,
11066 Err(e) => match dlg.token(e) {
11067 Ok(token) => token,
11068 Err(e) => {
11069 dlg.finished(false);
11070 return Err(common::Error::MissingToken(e));
11071 }
11072 },
11073 };
11074 let mut req_result = {
11075 let client = &self.hub.client;
11076 dlg.pre_request();
11077 let mut req_builder = hyper::Request::builder()
11078 .method(hyper::Method::DELETE)
11079 .uri(url.as_str())
11080 .header(USER_AGENT, self.hub._user_agent.clone());
11081
11082 if let Some(token) = token.as_ref() {
11083 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11084 }
11085
11086 let request = req_builder
11087 .header(CONTENT_LENGTH, 0_u64)
11088 .body(common::to_body::<String>(None));
11089
11090 client.request(request.unwrap()).await
11091 };
11092
11093 match req_result {
11094 Err(err) => {
11095 if let common::Retry::After(d) = dlg.http_error(&err) {
11096 sleep(d).await;
11097 continue;
11098 }
11099 dlg.finished(false);
11100 return Err(common::Error::HttpError(err));
11101 }
11102 Ok(res) => {
11103 let (mut parts, body) = res.into_parts();
11104 let mut body = common::Body::new(body);
11105 if !parts.status.is_success() {
11106 let bytes = common::to_bytes(body).await.unwrap_or_default();
11107 let error = serde_json::from_str(&common::to_string(&bytes));
11108 let response = common::to_response(parts, bytes.into());
11109
11110 if let common::Retry::After(d) =
11111 dlg.http_failure(&response, error.as_ref().ok())
11112 {
11113 sleep(d).await;
11114 continue;
11115 }
11116
11117 dlg.finished(false);
11118
11119 return Err(match error {
11120 Ok(value) => common::Error::BadRequest(value),
11121 _ => common::Error::Failure(response),
11122 });
11123 }
11124 let response = {
11125 let bytes = common::to_bytes(body).await.unwrap_or_default();
11126 let encoded = common::to_string(&bytes);
11127 match serde_json::from_str(&encoded) {
11128 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11129 Err(error) => {
11130 dlg.response_json_decode_error(&encoded, &error);
11131 return Err(common::Error::JsonDecodeError(
11132 encoded.to_string(),
11133 error,
11134 ));
11135 }
11136 }
11137 };
11138
11139 dlg.finished(true);
11140 return Ok(response);
11141 }
11142 }
11143 }
11144 }
11145
11146 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
11147 ///
11148 /// Sets the *apps id* path property to the given value.
11149 ///
11150 /// Even though the property as already been set when instantiating this call,
11151 /// we provide this method for API completeness.
11152 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
11153 self._apps_id = new_value.to_string();
11154 self
11155 }
11156 /// Part of `name`. See documentation of `appsId`.
11157 ///
11158 /// Sets the *services id* path property to the given value.
11159 ///
11160 /// Even though the property as already been set when instantiating this call,
11161 /// we provide this method for API completeness.
11162 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
11163 self._services_id = new_value.to_string();
11164 self
11165 }
11166 /// Part of `name`. See documentation of `appsId`.
11167 ///
11168 /// Sets the *versions id* path property to the given value.
11169 ///
11170 /// Even though the property as already been set when instantiating this call,
11171 /// we provide this method for API completeness.
11172 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
11173 self._versions_id = new_value.to_string();
11174 self
11175 }
11176 /// Part of `name`. See documentation of `appsId`.
11177 ///
11178 /// Sets the *instances id* path property to the given value.
11179 ///
11180 /// Even though the property as already been set when instantiating this call,
11181 /// we provide this method for API completeness.
11182 pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
11183 self._instances_id = new_value.to_string();
11184 self
11185 }
11186 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11187 /// while executing the actual API request.
11188 ///
11189 /// ````text
11190 /// It should be used to handle progress information, and to implement a certain level of resilience.
11191 /// ````
11192 ///
11193 /// Sets the *delegate* property to the given value.
11194 pub fn delegate(
11195 mut self,
11196 new_value: &'a mut dyn common::Delegate,
11197 ) -> AppServiceVersionInstanceDeleteCall<'a, C> {
11198 self._delegate = Some(new_value);
11199 self
11200 }
11201
11202 /// Set any additional parameter of the query string used in the request.
11203 /// It should be used to set parameters which are not yet available through their own
11204 /// setters.
11205 ///
11206 /// Please note that this method must not be used to set any of the known parameters
11207 /// which have their own setter method. If done anyway, the request will fail.
11208 ///
11209 /// # Additional Parameters
11210 ///
11211 /// * *$.xgafv* (query-string) - V1 error format.
11212 /// * *access_token* (query-string) - OAuth access token.
11213 /// * *alt* (query-string) - Data format for response.
11214 /// * *callback* (query-string) - JSONP
11215 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11216 /// * *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.
11217 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11218 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11219 /// * *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.
11220 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11221 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11222 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceDeleteCall<'a, C>
11223 where
11224 T: AsRef<str>,
11225 {
11226 self._additional_params
11227 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11228 self
11229 }
11230
11231 /// Identifies the authorization scope for the method you are building.
11232 ///
11233 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11234 /// [`Scope::CloudPlatform`].
11235 ///
11236 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11237 /// tokens for more than one scope.
11238 ///
11239 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11240 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11241 /// sufficient, a read-write scope will do as well.
11242 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceDeleteCall<'a, C>
11243 where
11244 St: AsRef<str>,
11245 {
11246 self._scopes.insert(String::from(scope.as_ref()));
11247 self
11248 }
11249 /// Identifies the authorization scope(s) for the method you are building.
11250 ///
11251 /// See [`Self::add_scope()`] for details.
11252 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceDeleteCall<'a, C>
11253 where
11254 I: IntoIterator<Item = St>,
11255 St: AsRef<str>,
11256 {
11257 self._scopes
11258 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11259 self
11260 }
11261
11262 /// Removes all scopes, and no default scope will be used either.
11263 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11264 /// for details).
11265 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceDeleteCall<'a, C> {
11266 self._scopes.clear();
11267 self
11268 }
11269}
11270
11271/// Gets instance information.
11272///
11273/// A builder for the *services.versions.instances.get* method supported by a *app* resource.
11274/// It is not used directly, but through a [`AppMethods`] instance.
11275///
11276/// # Example
11277///
11278/// Instantiate a resource method builder
11279///
11280/// ```test_harness,no_run
11281/// # extern crate hyper;
11282/// # extern crate hyper_rustls;
11283/// # extern crate google_appengine1 as appengine1;
11284/// # async fn dox() {
11285/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11286///
11287/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11288/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11289/// # .with_native_roots()
11290/// # .unwrap()
11291/// # .https_only()
11292/// # .enable_http2()
11293/// # .build();
11294///
11295/// # let executor = hyper_util::rt::TokioExecutor::new();
11296/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11297/// # secret,
11298/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11299/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11300/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11301/// # ),
11302/// # ).build().await.unwrap();
11303///
11304/// # let client = hyper_util::client::legacy::Client::builder(
11305/// # hyper_util::rt::TokioExecutor::new()
11306/// # )
11307/// # .build(
11308/// # hyper_rustls::HttpsConnectorBuilder::new()
11309/// # .with_native_roots()
11310/// # .unwrap()
11311/// # .https_or_http()
11312/// # .enable_http2()
11313/// # .build()
11314/// # );
11315/// # let mut hub = Appengine::new(client, auth);
11316/// // You can configure optional parameters by calling the respective setters at will, and
11317/// // execute the final call using `doit()`.
11318/// // Values shown here are possibly random and not representative !
11319/// let result = hub.apps().services_versions_instances_get("appsId", "servicesId", "versionsId", "instancesId")
11320/// .doit().await;
11321/// # }
11322/// ```
11323pub struct AppServiceVersionInstanceGetCall<'a, C>
11324where
11325 C: 'a,
11326{
11327 hub: &'a Appengine<C>,
11328 _apps_id: String,
11329 _services_id: String,
11330 _versions_id: String,
11331 _instances_id: String,
11332 _delegate: Option<&'a mut dyn common::Delegate>,
11333 _additional_params: HashMap<String, String>,
11334 _scopes: BTreeSet<String>,
11335}
11336
11337impl<'a, C> common::CallBuilder for AppServiceVersionInstanceGetCall<'a, C> {}
11338
11339impl<'a, C> AppServiceVersionInstanceGetCall<'a, C>
11340where
11341 C: common::Connector,
11342{
11343 /// Perform the operation you have build so far.
11344 pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
11345 use std::borrow::Cow;
11346 use std::io::{Read, Seek};
11347
11348 use common::{url::Params, ToParts};
11349 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11350
11351 let mut dd = common::DefaultDelegate;
11352 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11353 dlg.begin(common::MethodInfo {
11354 id: "appengine.apps.services.versions.instances.get",
11355 http_method: hyper::Method::GET,
11356 });
11357
11358 for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
11359 if self._additional_params.contains_key(field) {
11360 dlg.finished(false);
11361 return Err(common::Error::FieldClash(field));
11362 }
11363 }
11364
11365 let mut params = Params::with_capacity(6 + self._additional_params.len());
11366 params.push("appsId", self._apps_id);
11367 params.push("servicesId", self._services_id);
11368 params.push("versionsId", self._versions_id);
11369 params.push("instancesId", self._instances_id);
11370
11371 params.extend(self._additional_params.iter());
11372
11373 params.push("alt", "json");
11374 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}";
11375 if self._scopes.is_empty() {
11376 self._scopes
11377 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11378 }
11379
11380 #[allow(clippy::single_element_loop)]
11381 for &(find_this, param_name) in [
11382 ("{appsId}", "appsId"),
11383 ("{servicesId}", "servicesId"),
11384 ("{versionsId}", "versionsId"),
11385 ("{instancesId}", "instancesId"),
11386 ]
11387 .iter()
11388 {
11389 url = params.uri_replacement(url, param_name, find_this, false);
11390 }
11391 {
11392 let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"];
11393 params.remove_params(&to_remove);
11394 }
11395
11396 let url = params.parse_with_url(&url);
11397
11398 loop {
11399 let token = match self
11400 .hub
11401 .auth
11402 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11403 .await
11404 {
11405 Ok(token) => token,
11406 Err(e) => match dlg.token(e) {
11407 Ok(token) => token,
11408 Err(e) => {
11409 dlg.finished(false);
11410 return Err(common::Error::MissingToken(e));
11411 }
11412 },
11413 };
11414 let mut req_result = {
11415 let client = &self.hub.client;
11416 dlg.pre_request();
11417 let mut req_builder = hyper::Request::builder()
11418 .method(hyper::Method::GET)
11419 .uri(url.as_str())
11420 .header(USER_AGENT, self.hub._user_agent.clone());
11421
11422 if let Some(token) = token.as_ref() {
11423 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11424 }
11425
11426 let request = req_builder
11427 .header(CONTENT_LENGTH, 0_u64)
11428 .body(common::to_body::<String>(None));
11429
11430 client.request(request.unwrap()).await
11431 };
11432
11433 match req_result {
11434 Err(err) => {
11435 if let common::Retry::After(d) = dlg.http_error(&err) {
11436 sleep(d).await;
11437 continue;
11438 }
11439 dlg.finished(false);
11440 return Err(common::Error::HttpError(err));
11441 }
11442 Ok(res) => {
11443 let (mut parts, body) = res.into_parts();
11444 let mut body = common::Body::new(body);
11445 if !parts.status.is_success() {
11446 let bytes = common::to_bytes(body).await.unwrap_or_default();
11447 let error = serde_json::from_str(&common::to_string(&bytes));
11448 let response = common::to_response(parts, bytes.into());
11449
11450 if let common::Retry::After(d) =
11451 dlg.http_failure(&response, error.as_ref().ok())
11452 {
11453 sleep(d).await;
11454 continue;
11455 }
11456
11457 dlg.finished(false);
11458
11459 return Err(match error {
11460 Ok(value) => common::Error::BadRequest(value),
11461 _ => common::Error::Failure(response),
11462 });
11463 }
11464 let response = {
11465 let bytes = common::to_bytes(body).await.unwrap_or_default();
11466 let encoded = common::to_string(&bytes);
11467 match serde_json::from_str(&encoded) {
11468 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11469 Err(error) => {
11470 dlg.response_json_decode_error(&encoded, &error);
11471 return Err(common::Error::JsonDecodeError(
11472 encoded.to_string(),
11473 error,
11474 ));
11475 }
11476 }
11477 };
11478
11479 dlg.finished(true);
11480 return Ok(response);
11481 }
11482 }
11483 }
11484 }
11485
11486 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
11487 ///
11488 /// Sets the *apps id* path property to the given value.
11489 ///
11490 /// Even though the property as already been set when instantiating this call,
11491 /// we provide this method for API completeness.
11492 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
11493 self._apps_id = new_value.to_string();
11494 self
11495 }
11496 /// Part of `name`. See documentation of `appsId`.
11497 ///
11498 /// Sets the *services id* path property to the given value.
11499 ///
11500 /// Even though the property as already been set when instantiating this call,
11501 /// we provide this method for API completeness.
11502 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
11503 self._services_id = new_value.to_string();
11504 self
11505 }
11506 /// Part of `name`. See documentation of `appsId`.
11507 ///
11508 /// Sets the *versions id* path property to the given value.
11509 ///
11510 /// Even though the property as already been set when instantiating this call,
11511 /// we provide this method for API completeness.
11512 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
11513 self._versions_id = new_value.to_string();
11514 self
11515 }
11516 /// Part of `name`. See documentation of `appsId`.
11517 ///
11518 /// Sets the *instances id* path property to the given value.
11519 ///
11520 /// Even though the property as already been set when instantiating this call,
11521 /// we provide this method for API completeness.
11522 pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
11523 self._instances_id = new_value.to_string();
11524 self
11525 }
11526 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11527 /// while executing the actual API request.
11528 ///
11529 /// ````text
11530 /// It should be used to handle progress information, and to implement a certain level of resilience.
11531 /// ````
11532 ///
11533 /// Sets the *delegate* property to the given value.
11534 pub fn delegate(
11535 mut self,
11536 new_value: &'a mut dyn common::Delegate,
11537 ) -> AppServiceVersionInstanceGetCall<'a, C> {
11538 self._delegate = Some(new_value);
11539 self
11540 }
11541
11542 /// Set any additional parameter of the query string used in the request.
11543 /// It should be used to set parameters which are not yet available through their own
11544 /// setters.
11545 ///
11546 /// Please note that this method must not be used to set any of the known parameters
11547 /// which have their own setter method. If done anyway, the request will fail.
11548 ///
11549 /// # Additional Parameters
11550 ///
11551 /// * *$.xgafv* (query-string) - V1 error format.
11552 /// * *access_token* (query-string) - OAuth access token.
11553 /// * *alt* (query-string) - Data format for response.
11554 /// * *callback* (query-string) - JSONP
11555 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11556 /// * *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.
11557 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11558 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11559 /// * *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.
11560 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11561 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11562 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceGetCall<'a, C>
11563 where
11564 T: AsRef<str>,
11565 {
11566 self._additional_params
11567 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11568 self
11569 }
11570
11571 /// Identifies the authorization scope for the method you are building.
11572 ///
11573 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11574 /// [`Scope::CloudPlatformReadOnly`].
11575 ///
11576 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11577 /// tokens for more than one scope.
11578 ///
11579 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11580 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11581 /// sufficient, a read-write scope will do as well.
11582 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceGetCall<'a, C>
11583 where
11584 St: AsRef<str>,
11585 {
11586 self._scopes.insert(String::from(scope.as_ref()));
11587 self
11588 }
11589 /// Identifies the authorization scope(s) for the method you are building.
11590 ///
11591 /// See [`Self::add_scope()`] for details.
11592 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceGetCall<'a, C>
11593 where
11594 I: IntoIterator<Item = St>,
11595 St: AsRef<str>,
11596 {
11597 self._scopes
11598 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11599 self
11600 }
11601
11602 /// Removes all scopes, and no default scope will be used either.
11603 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11604 /// for details).
11605 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceGetCall<'a, C> {
11606 self._scopes.clear();
11607 self
11608 }
11609}
11610
11611/// 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).
11612///
11613/// A builder for the *services.versions.instances.list* method supported by a *app* resource.
11614/// It is not used directly, but through a [`AppMethods`] instance.
11615///
11616/// # Example
11617///
11618/// Instantiate a resource method builder
11619///
11620/// ```test_harness,no_run
11621/// # extern crate hyper;
11622/// # extern crate hyper_rustls;
11623/// # extern crate google_appengine1 as appengine1;
11624/// # async fn dox() {
11625/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11626///
11627/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11628/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11629/// # .with_native_roots()
11630/// # .unwrap()
11631/// # .https_only()
11632/// # .enable_http2()
11633/// # .build();
11634///
11635/// # let executor = hyper_util::rt::TokioExecutor::new();
11636/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11637/// # secret,
11638/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11639/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11640/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11641/// # ),
11642/// # ).build().await.unwrap();
11643///
11644/// # let client = hyper_util::client::legacy::Client::builder(
11645/// # hyper_util::rt::TokioExecutor::new()
11646/// # )
11647/// # .build(
11648/// # hyper_rustls::HttpsConnectorBuilder::new()
11649/// # .with_native_roots()
11650/// # .unwrap()
11651/// # .https_or_http()
11652/// # .enable_http2()
11653/// # .build()
11654/// # );
11655/// # let mut hub = Appengine::new(client, auth);
11656/// // You can configure optional parameters by calling the respective setters at will, and
11657/// // execute the final call using `doit()`.
11658/// // Values shown here are possibly random and not representative !
11659/// let result = hub.apps().services_versions_instances_list("appsId", "servicesId", "versionsId")
11660/// .page_token("amet.")
11661/// .page_size(-30)
11662/// .doit().await;
11663/// # }
11664/// ```
11665pub struct AppServiceVersionInstanceListCall<'a, C>
11666where
11667 C: 'a,
11668{
11669 hub: &'a Appengine<C>,
11670 _apps_id: String,
11671 _services_id: String,
11672 _versions_id: String,
11673 _page_token: Option<String>,
11674 _page_size: Option<i32>,
11675 _delegate: Option<&'a mut dyn common::Delegate>,
11676 _additional_params: HashMap<String, String>,
11677 _scopes: BTreeSet<String>,
11678}
11679
11680impl<'a, C> common::CallBuilder for AppServiceVersionInstanceListCall<'a, C> {}
11681
11682impl<'a, C> AppServiceVersionInstanceListCall<'a, C>
11683where
11684 C: common::Connector,
11685{
11686 /// Perform the operation you have build so far.
11687 pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
11688 use std::borrow::Cow;
11689 use std::io::{Read, Seek};
11690
11691 use common::{url::Params, ToParts};
11692 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11693
11694 let mut dd = common::DefaultDelegate;
11695 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11696 dlg.begin(common::MethodInfo {
11697 id: "appengine.apps.services.versions.instances.list",
11698 http_method: hyper::Method::GET,
11699 });
11700
11701 for &field in [
11702 "alt",
11703 "appsId",
11704 "servicesId",
11705 "versionsId",
11706 "pageToken",
11707 "pageSize",
11708 ]
11709 .iter()
11710 {
11711 if self._additional_params.contains_key(field) {
11712 dlg.finished(false);
11713 return Err(common::Error::FieldClash(field));
11714 }
11715 }
11716
11717 let mut params = Params::with_capacity(7 + self._additional_params.len());
11718 params.push("appsId", self._apps_id);
11719 params.push("servicesId", self._services_id);
11720 params.push("versionsId", self._versions_id);
11721 if let Some(value) = self._page_token.as_ref() {
11722 params.push("pageToken", value);
11723 }
11724 if let Some(value) = self._page_size.as_ref() {
11725 params.push("pageSize", value.to_string());
11726 }
11727
11728 params.extend(self._additional_params.iter());
11729
11730 params.push("alt", "json");
11731 let mut url = self.hub._base_url.clone()
11732 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances";
11733 if self._scopes.is_empty() {
11734 self._scopes
11735 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11736 }
11737
11738 #[allow(clippy::single_element_loop)]
11739 for &(find_this, param_name) in [
11740 ("{appsId}", "appsId"),
11741 ("{servicesId}", "servicesId"),
11742 ("{versionsId}", "versionsId"),
11743 ]
11744 .iter()
11745 {
11746 url = params.uri_replacement(url, param_name, find_this, false);
11747 }
11748 {
11749 let to_remove = ["versionsId", "servicesId", "appsId"];
11750 params.remove_params(&to_remove);
11751 }
11752
11753 let url = params.parse_with_url(&url);
11754
11755 loop {
11756 let token = match self
11757 .hub
11758 .auth
11759 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11760 .await
11761 {
11762 Ok(token) => token,
11763 Err(e) => match dlg.token(e) {
11764 Ok(token) => token,
11765 Err(e) => {
11766 dlg.finished(false);
11767 return Err(common::Error::MissingToken(e));
11768 }
11769 },
11770 };
11771 let mut req_result = {
11772 let client = &self.hub.client;
11773 dlg.pre_request();
11774 let mut req_builder = hyper::Request::builder()
11775 .method(hyper::Method::GET)
11776 .uri(url.as_str())
11777 .header(USER_AGENT, self.hub._user_agent.clone());
11778
11779 if let Some(token) = token.as_ref() {
11780 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11781 }
11782
11783 let request = req_builder
11784 .header(CONTENT_LENGTH, 0_u64)
11785 .body(common::to_body::<String>(None));
11786
11787 client.request(request.unwrap()).await
11788 };
11789
11790 match req_result {
11791 Err(err) => {
11792 if let common::Retry::After(d) = dlg.http_error(&err) {
11793 sleep(d).await;
11794 continue;
11795 }
11796 dlg.finished(false);
11797 return Err(common::Error::HttpError(err));
11798 }
11799 Ok(res) => {
11800 let (mut parts, body) = res.into_parts();
11801 let mut body = common::Body::new(body);
11802 if !parts.status.is_success() {
11803 let bytes = common::to_bytes(body).await.unwrap_or_default();
11804 let error = serde_json::from_str(&common::to_string(&bytes));
11805 let response = common::to_response(parts, bytes.into());
11806
11807 if let common::Retry::After(d) =
11808 dlg.http_failure(&response, error.as_ref().ok())
11809 {
11810 sleep(d).await;
11811 continue;
11812 }
11813
11814 dlg.finished(false);
11815
11816 return Err(match error {
11817 Ok(value) => common::Error::BadRequest(value),
11818 _ => common::Error::Failure(response),
11819 });
11820 }
11821 let response = {
11822 let bytes = common::to_bytes(body).await.unwrap_or_default();
11823 let encoded = common::to_string(&bytes);
11824 match serde_json::from_str(&encoded) {
11825 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11826 Err(error) => {
11827 dlg.response_json_decode_error(&encoded, &error);
11828 return Err(common::Error::JsonDecodeError(
11829 encoded.to_string(),
11830 error,
11831 ));
11832 }
11833 }
11834 };
11835
11836 dlg.finished(true);
11837 return Ok(response);
11838 }
11839 }
11840 }
11841 }
11842
11843 /// Part of `parent`. Required. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1.
11844 ///
11845 /// Sets the *apps id* path property to the given value.
11846 ///
11847 /// Even though the property as already been set when instantiating this call,
11848 /// we provide this method for API completeness.
11849 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
11850 self._apps_id = new_value.to_string();
11851 self
11852 }
11853 /// Part of `parent`. See documentation of `appsId`.
11854 ///
11855 /// Sets the *services id* path property to the given value.
11856 ///
11857 /// Even though the property as already been set when instantiating this call,
11858 /// we provide this method for API completeness.
11859 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
11860 self._services_id = new_value.to_string();
11861 self
11862 }
11863 /// Part of `parent`. See documentation of `appsId`.
11864 ///
11865 /// Sets the *versions id* path property to the given value.
11866 ///
11867 /// Even though the property as already been set when instantiating this call,
11868 /// we provide this method for API completeness.
11869 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
11870 self._versions_id = new_value.to_string();
11871 self
11872 }
11873 /// Continuation token for fetching the next page of results.
11874 ///
11875 /// Sets the *page token* query property to the given value.
11876 pub fn page_token(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
11877 self._page_token = Some(new_value.to_string());
11878 self
11879 }
11880 /// Maximum results to return per page.
11881 ///
11882 /// Sets the *page size* query property to the given value.
11883 pub fn page_size(mut self, new_value: i32) -> AppServiceVersionInstanceListCall<'a, C> {
11884 self._page_size = Some(new_value);
11885 self
11886 }
11887 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11888 /// while executing the actual API request.
11889 ///
11890 /// ````text
11891 /// It should be used to handle progress information, and to implement a certain level of resilience.
11892 /// ````
11893 ///
11894 /// Sets the *delegate* property to the given value.
11895 pub fn delegate(
11896 mut self,
11897 new_value: &'a mut dyn common::Delegate,
11898 ) -> AppServiceVersionInstanceListCall<'a, C> {
11899 self._delegate = Some(new_value);
11900 self
11901 }
11902
11903 /// Set any additional parameter of the query string used in the request.
11904 /// It should be used to set parameters which are not yet available through their own
11905 /// setters.
11906 ///
11907 /// Please note that this method must not be used to set any of the known parameters
11908 /// which have their own setter method. If done anyway, the request will fail.
11909 ///
11910 /// # Additional Parameters
11911 ///
11912 /// * *$.xgafv* (query-string) - V1 error format.
11913 /// * *access_token* (query-string) - OAuth access token.
11914 /// * *alt* (query-string) - Data format for response.
11915 /// * *callback* (query-string) - JSONP
11916 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11917 /// * *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.
11918 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11919 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11920 /// * *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.
11921 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11922 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11923 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceListCall<'a, C>
11924 where
11925 T: AsRef<str>,
11926 {
11927 self._additional_params
11928 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11929 self
11930 }
11931
11932 /// Identifies the authorization scope for the method you are building.
11933 ///
11934 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11935 /// [`Scope::CloudPlatformReadOnly`].
11936 ///
11937 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11938 /// tokens for more than one scope.
11939 ///
11940 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11941 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11942 /// sufficient, a read-write scope will do as well.
11943 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceListCall<'a, C>
11944 where
11945 St: AsRef<str>,
11946 {
11947 self._scopes.insert(String::from(scope.as_ref()));
11948 self
11949 }
11950 /// Identifies the authorization scope(s) for the method you are building.
11951 ///
11952 /// See [`Self::add_scope()`] for details.
11953 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceListCall<'a, C>
11954 where
11955 I: IntoIterator<Item = St>,
11956 St: AsRef<str>,
11957 {
11958 self._scopes
11959 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11960 self
11961 }
11962
11963 /// Removes all scopes, and no default scope will be used either.
11964 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11965 /// for details).
11966 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceListCall<'a, C> {
11967 self._scopes.clear();
11968 self
11969 }
11970}
11971
11972/// Deploys code and resource files to a new version.
11973///
11974/// A builder for the *services.versions.create* method supported by a *app* resource.
11975/// It is not used directly, but through a [`AppMethods`] instance.
11976///
11977/// # Example
11978///
11979/// Instantiate a resource method builder
11980///
11981/// ```test_harness,no_run
11982/// # extern crate hyper;
11983/// # extern crate hyper_rustls;
11984/// # extern crate google_appengine1 as appengine1;
11985/// use appengine1::api::Version;
11986/// # async fn dox() {
11987/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11988///
11989/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11990/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11991/// # .with_native_roots()
11992/// # .unwrap()
11993/// # .https_only()
11994/// # .enable_http2()
11995/// # .build();
11996///
11997/// # let executor = hyper_util::rt::TokioExecutor::new();
11998/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11999/// # secret,
12000/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12001/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12002/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12003/// # ),
12004/// # ).build().await.unwrap();
12005///
12006/// # let client = hyper_util::client::legacy::Client::builder(
12007/// # hyper_util::rt::TokioExecutor::new()
12008/// # )
12009/// # .build(
12010/// # hyper_rustls::HttpsConnectorBuilder::new()
12011/// # .with_native_roots()
12012/// # .unwrap()
12013/// # .https_or_http()
12014/// # .enable_http2()
12015/// # .build()
12016/// # );
12017/// # let mut hub = Appengine::new(client, auth);
12018/// // As the method needs a request, you would usually fill it with the desired information
12019/// // into the respective structure. Some of the parts shown here might not be applicable !
12020/// // Values shown here are possibly random and not representative !
12021/// let mut req = Version::default();
12022///
12023/// // You can configure optional parameters by calling the respective setters at will, and
12024/// // execute the final call using `doit()`.
12025/// // Values shown here are possibly random and not representative !
12026/// let result = hub.apps().services_versions_create(req, "appsId", "servicesId")
12027/// .doit().await;
12028/// # }
12029/// ```
12030pub struct AppServiceVersionCreateCall<'a, C>
12031where
12032 C: 'a,
12033{
12034 hub: &'a Appengine<C>,
12035 _request: Version,
12036 _apps_id: String,
12037 _services_id: String,
12038 _delegate: Option<&'a mut dyn common::Delegate>,
12039 _additional_params: HashMap<String, String>,
12040 _scopes: BTreeSet<String>,
12041}
12042
12043impl<'a, C> common::CallBuilder for AppServiceVersionCreateCall<'a, C> {}
12044
12045impl<'a, C> AppServiceVersionCreateCall<'a, C>
12046where
12047 C: common::Connector,
12048{
12049 /// Perform the operation you have build so far.
12050 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12051 use std::borrow::Cow;
12052 use std::io::{Read, Seek};
12053
12054 use common::{url::Params, ToParts};
12055 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12056
12057 let mut dd = common::DefaultDelegate;
12058 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12059 dlg.begin(common::MethodInfo {
12060 id: "appengine.apps.services.versions.create",
12061 http_method: hyper::Method::POST,
12062 });
12063
12064 for &field in ["alt", "appsId", "servicesId"].iter() {
12065 if self._additional_params.contains_key(field) {
12066 dlg.finished(false);
12067 return Err(common::Error::FieldClash(field));
12068 }
12069 }
12070
12071 let mut params = Params::with_capacity(5 + self._additional_params.len());
12072 params.push("appsId", self._apps_id);
12073 params.push("servicesId", self._services_id);
12074
12075 params.extend(self._additional_params.iter());
12076
12077 params.push("alt", "json");
12078 let mut url =
12079 self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions";
12080 if self._scopes.is_empty() {
12081 self._scopes
12082 .insert(Scope::CloudPlatform.as_ref().to_string());
12083 }
12084
12085 #[allow(clippy::single_element_loop)]
12086 for &(find_this, param_name) in
12087 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
12088 {
12089 url = params.uri_replacement(url, param_name, find_this, false);
12090 }
12091 {
12092 let to_remove = ["servicesId", "appsId"];
12093 params.remove_params(&to_remove);
12094 }
12095
12096 let url = params.parse_with_url(&url);
12097
12098 let mut json_mime_type = mime::APPLICATION_JSON;
12099 let mut request_value_reader = {
12100 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12101 common::remove_json_null_values(&mut value);
12102 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12103 serde_json::to_writer(&mut dst, &value).unwrap();
12104 dst
12105 };
12106 let request_size = request_value_reader
12107 .seek(std::io::SeekFrom::End(0))
12108 .unwrap();
12109 request_value_reader
12110 .seek(std::io::SeekFrom::Start(0))
12111 .unwrap();
12112
12113 loop {
12114 let token = match self
12115 .hub
12116 .auth
12117 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12118 .await
12119 {
12120 Ok(token) => token,
12121 Err(e) => match dlg.token(e) {
12122 Ok(token) => token,
12123 Err(e) => {
12124 dlg.finished(false);
12125 return Err(common::Error::MissingToken(e));
12126 }
12127 },
12128 };
12129 request_value_reader
12130 .seek(std::io::SeekFrom::Start(0))
12131 .unwrap();
12132 let mut req_result = {
12133 let client = &self.hub.client;
12134 dlg.pre_request();
12135 let mut req_builder = hyper::Request::builder()
12136 .method(hyper::Method::POST)
12137 .uri(url.as_str())
12138 .header(USER_AGENT, self.hub._user_agent.clone());
12139
12140 if let Some(token) = token.as_ref() {
12141 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12142 }
12143
12144 let request = req_builder
12145 .header(CONTENT_TYPE, json_mime_type.to_string())
12146 .header(CONTENT_LENGTH, request_size as u64)
12147 .body(common::to_body(
12148 request_value_reader.get_ref().clone().into(),
12149 ));
12150
12151 client.request(request.unwrap()).await
12152 };
12153
12154 match req_result {
12155 Err(err) => {
12156 if let common::Retry::After(d) = dlg.http_error(&err) {
12157 sleep(d).await;
12158 continue;
12159 }
12160 dlg.finished(false);
12161 return Err(common::Error::HttpError(err));
12162 }
12163 Ok(res) => {
12164 let (mut parts, body) = res.into_parts();
12165 let mut body = common::Body::new(body);
12166 if !parts.status.is_success() {
12167 let bytes = common::to_bytes(body).await.unwrap_or_default();
12168 let error = serde_json::from_str(&common::to_string(&bytes));
12169 let response = common::to_response(parts, bytes.into());
12170
12171 if let common::Retry::After(d) =
12172 dlg.http_failure(&response, error.as_ref().ok())
12173 {
12174 sleep(d).await;
12175 continue;
12176 }
12177
12178 dlg.finished(false);
12179
12180 return Err(match error {
12181 Ok(value) => common::Error::BadRequest(value),
12182 _ => common::Error::Failure(response),
12183 });
12184 }
12185 let response = {
12186 let bytes = common::to_bytes(body).await.unwrap_or_default();
12187 let encoded = common::to_string(&bytes);
12188 match serde_json::from_str(&encoded) {
12189 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12190 Err(error) => {
12191 dlg.response_json_decode_error(&encoded, &error);
12192 return Err(common::Error::JsonDecodeError(
12193 encoded.to_string(),
12194 error,
12195 ));
12196 }
12197 }
12198 };
12199
12200 dlg.finished(true);
12201 return Ok(response);
12202 }
12203 }
12204 }
12205 }
12206
12207 ///
12208 /// Sets the *request* property to the given value.
12209 ///
12210 /// Even though the property as already been set when instantiating this call,
12211 /// we provide this method for API completeness.
12212 pub fn request(mut self, new_value: Version) -> AppServiceVersionCreateCall<'a, C> {
12213 self._request = new_value;
12214 self
12215 }
12216 /// Part of `parent`. Required. Name of the parent resource to create this version under. Example: apps/myapp/services/default.
12217 ///
12218 /// Sets the *apps id* path property to the given value.
12219 ///
12220 /// Even though the property as already been set when instantiating this call,
12221 /// we provide this method for API completeness.
12222 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, C> {
12223 self._apps_id = new_value.to_string();
12224 self
12225 }
12226 /// Part of `parent`. See documentation of `appsId`.
12227 ///
12228 /// Sets the *services id* path property to the given value.
12229 ///
12230 /// Even though the property as already been set when instantiating this call,
12231 /// we provide this method for API completeness.
12232 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, C> {
12233 self._services_id = new_value.to_string();
12234 self
12235 }
12236 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12237 /// while executing the actual API request.
12238 ///
12239 /// ````text
12240 /// It should be used to handle progress information, and to implement a certain level of resilience.
12241 /// ````
12242 ///
12243 /// Sets the *delegate* property to the given value.
12244 pub fn delegate(
12245 mut self,
12246 new_value: &'a mut dyn common::Delegate,
12247 ) -> AppServiceVersionCreateCall<'a, C> {
12248 self._delegate = Some(new_value);
12249 self
12250 }
12251
12252 /// Set any additional parameter of the query string used in the request.
12253 /// It should be used to set parameters which are not yet available through their own
12254 /// setters.
12255 ///
12256 /// Please note that this method must not be used to set any of the known parameters
12257 /// which have their own setter method. If done anyway, the request will fail.
12258 ///
12259 /// # Additional Parameters
12260 ///
12261 /// * *$.xgafv* (query-string) - V1 error format.
12262 /// * *access_token* (query-string) - OAuth access token.
12263 /// * *alt* (query-string) - Data format for response.
12264 /// * *callback* (query-string) - JSONP
12265 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12266 /// * *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.
12267 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12268 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12269 /// * *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.
12270 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12271 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12272 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionCreateCall<'a, C>
12273 where
12274 T: AsRef<str>,
12275 {
12276 self._additional_params
12277 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12278 self
12279 }
12280
12281 /// Identifies the authorization scope for the method you are building.
12282 ///
12283 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12284 /// [`Scope::CloudPlatform`].
12285 ///
12286 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12287 /// tokens for more than one scope.
12288 ///
12289 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12290 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12291 /// sufficient, a read-write scope will do as well.
12292 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionCreateCall<'a, C>
12293 where
12294 St: AsRef<str>,
12295 {
12296 self._scopes.insert(String::from(scope.as_ref()));
12297 self
12298 }
12299 /// Identifies the authorization scope(s) for the method you are building.
12300 ///
12301 /// See [`Self::add_scope()`] for details.
12302 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionCreateCall<'a, C>
12303 where
12304 I: IntoIterator<Item = St>,
12305 St: AsRef<str>,
12306 {
12307 self._scopes
12308 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12309 self
12310 }
12311
12312 /// Removes all scopes, and no default scope will be used either.
12313 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12314 /// for details).
12315 pub fn clear_scopes(mut self) -> AppServiceVersionCreateCall<'a, C> {
12316 self._scopes.clear();
12317 self
12318 }
12319}
12320
12321/// Deletes an existing Version resource.
12322///
12323/// A builder for the *services.versions.delete* method supported by a *app* resource.
12324/// It is not used directly, but through a [`AppMethods`] instance.
12325///
12326/// # Example
12327///
12328/// Instantiate a resource method builder
12329///
12330/// ```test_harness,no_run
12331/// # extern crate hyper;
12332/// # extern crate hyper_rustls;
12333/// # extern crate google_appengine1 as appengine1;
12334/// # async fn dox() {
12335/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12336///
12337/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12338/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12339/// # .with_native_roots()
12340/// # .unwrap()
12341/// # .https_only()
12342/// # .enable_http2()
12343/// # .build();
12344///
12345/// # let executor = hyper_util::rt::TokioExecutor::new();
12346/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12347/// # secret,
12348/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12349/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12350/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12351/// # ),
12352/// # ).build().await.unwrap();
12353///
12354/// # let client = hyper_util::client::legacy::Client::builder(
12355/// # hyper_util::rt::TokioExecutor::new()
12356/// # )
12357/// # .build(
12358/// # hyper_rustls::HttpsConnectorBuilder::new()
12359/// # .with_native_roots()
12360/// # .unwrap()
12361/// # .https_or_http()
12362/// # .enable_http2()
12363/// # .build()
12364/// # );
12365/// # let mut hub = Appengine::new(client, auth);
12366/// // You can configure optional parameters by calling the respective setters at will, and
12367/// // execute the final call using `doit()`.
12368/// // Values shown here are possibly random and not representative !
12369/// let result = hub.apps().services_versions_delete("appsId", "servicesId", "versionsId")
12370/// .doit().await;
12371/// # }
12372/// ```
12373pub struct AppServiceVersionDeleteCall<'a, C>
12374where
12375 C: 'a,
12376{
12377 hub: &'a Appengine<C>,
12378 _apps_id: String,
12379 _services_id: String,
12380 _versions_id: String,
12381 _delegate: Option<&'a mut dyn common::Delegate>,
12382 _additional_params: HashMap<String, String>,
12383 _scopes: BTreeSet<String>,
12384}
12385
12386impl<'a, C> common::CallBuilder for AppServiceVersionDeleteCall<'a, C> {}
12387
12388impl<'a, C> AppServiceVersionDeleteCall<'a, C>
12389where
12390 C: common::Connector,
12391{
12392 /// Perform the operation you have build so far.
12393 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12394 use std::borrow::Cow;
12395 use std::io::{Read, Seek};
12396
12397 use common::{url::Params, ToParts};
12398 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12399
12400 let mut dd = common::DefaultDelegate;
12401 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12402 dlg.begin(common::MethodInfo {
12403 id: "appengine.apps.services.versions.delete",
12404 http_method: hyper::Method::DELETE,
12405 });
12406
12407 for &field in ["alt", "appsId", "servicesId", "versionsId"].iter() {
12408 if self._additional_params.contains_key(field) {
12409 dlg.finished(false);
12410 return Err(common::Error::FieldClash(field));
12411 }
12412 }
12413
12414 let mut params = Params::with_capacity(5 + self._additional_params.len());
12415 params.push("appsId", self._apps_id);
12416 params.push("servicesId", self._services_id);
12417 params.push("versionsId", self._versions_id);
12418
12419 params.extend(self._additional_params.iter());
12420
12421 params.push("alt", "json");
12422 let mut url = self.hub._base_url.clone()
12423 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}";
12424 if self._scopes.is_empty() {
12425 self._scopes
12426 .insert(Scope::CloudPlatform.as_ref().to_string());
12427 }
12428
12429 #[allow(clippy::single_element_loop)]
12430 for &(find_this, param_name) in [
12431 ("{appsId}", "appsId"),
12432 ("{servicesId}", "servicesId"),
12433 ("{versionsId}", "versionsId"),
12434 ]
12435 .iter()
12436 {
12437 url = params.uri_replacement(url, param_name, find_this, false);
12438 }
12439 {
12440 let to_remove = ["versionsId", "servicesId", "appsId"];
12441 params.remove_params(&to_remove);
12442 }
12443
12444 let url = params.parse_with_url(&url);
12445
12446 loop {
12447 let token = match self
12448 .hub
12449 .auth
12450 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12451 .await
12452 {
12453 Ok(token) => token,
12454 Err(e) => match dlg.token(e) {
12455 Ok(token) => token,
12456 Err(e) => {
12457 dlg.finished(false);
12458 return Err(common::Error::MissingToken(e));
12459 }
12460 },
12461 };
12462 let mut req_result = {
12463 let client = &self.hub.client;
12464 dlg.pre_request();
12465 let mut req_builder = hyper::Request::builder()
12466 .method(hyper::Method::DELETE)
12467 .uri(url.as_str())
12468 .header(USER_AGENT, self.hub._user_agent.clone());
12469
12470 if let Some(token) = token.as_ref() {
12471 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12472 }
12473
12474 let request = req_builder
12475 .header(CONTENT_LENGTH, 0_u64)
12476 .body(common::to_body::<String>(None));
12477
12478 client.request(request.unwrap()).await
12479 };
12480
12481 match req_result {
12482 Err(err) => {
12483 if let common::Retry::After(d) = dlg.http_error(&err) {
12484 sleep(d).await;
12485 continue;
12486 }
12487 dlg.finished(false);
12488 return Err(common::Error::HttpError(err));
12489 }
12490 Ok(res) => {
12491 let (mut parts, body) = res.into_parts();
12492 let mut body = common::Body::new(body);
12493 if !parts.status.is_success() {
12494 let bytes = common::to_bytes(body).await.unwrap_or_default();
12495 let error = serde_json::from_str(&common::to_string(&bytes));
12496 let response = common::to_response(parts, bytes.into());
12497
12498 if let common::Retry::After(d) =
12499 dlg.http_failure(&response, error.as_ref().ok())
12500 {
12501 sleep(d).await;
12502 continue;
12503 }
12504
12505 dlg.finished(false);
12506
12507 return Err(match error {
12508 Ok(value) => common::Error::BadRequest(value),
12509 _ => common::Error::Failure(response),
12510 });
12511 }
12512 let response = {
12513 let bytes = common::to_bytes(body).await.unwrap_or_default();
12514 let encoded = common::to_string(&bytes);
12515 match serde_json::from_str(&encoded) {
12516 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12517 Err(error) => {
12518 dlg.response_json_decode_error(&encoded, &error);
12519 return Err(common::Error::JsonDecodeError(
12520 encoded.to_string(),
12521 error,
12522 ));
12523 }
12524 }
12525 };
12526
12527 dlg.finished(true);
12528 return Ok(response);
12529 }
12530 }
12531 }
12532 }
12533
12534 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
12535 ///
12536 /// Sets the *apps id* path property to the given value.
12537 ///
12538 /// Even though the property as already been set when instantiating this call,
12539 /// we provide this method for API completeness.
12540 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C> {
12541 self._apps_id = new_value.to_string();
12542 self
12543 }
12544 /// Part of `name`. See documentation of `appsId`.
12545 ///
12546 /// Sets the *services id* path property to the given value.
12547 ///
12548 /// Even though the property as already been set when instantiating this call,
12549 /// we provide this method for API completeness.
12550 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C> {
12551 self._services_id = new_value.to_string();
12552 self
12553 }
12554 /// Part of `name`. See documentation of `appsId`.
12555 ///
12556 /// Sets the *versions id* path property to the given value.
12557 ///
12558 /// Even though the property as already been set when instantiating this call,
12559 /// we provide this method for API completeness.
12560 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C> {
12561 self._versions_id = new_value.to_string();
12562 self
12563 }
12564 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12565 /// while executing the actual API request.
12566 ///
12567 /// ````text
12568 /// It should be used to handle progress information, and to implement a certain level of resilience.
12569 /// ````
12570 ///
12571 /// Sets the *delegate* property to the given value.
12572 pub fn delegate(
12573 mut self,
12574 new_value: &'a mut dyn common::Delegate,
12575 ) -> AppServiceVersionDeleteCall<'a, C> {
12576 self._delegate = Some(new_value);
12577 self
12578 }
12579
12580 /// Set any additional parameter of the query string used in the request.
12581 /// It should be used to set parameters which are not yet available through their own
12582 /// setters.
12583 ///
12584 /// Please note that this method must not be used to set any of the known parameters
12585 /// which have their own setter method. If done anyway, the request will fail.
12586 ///
12587 /// # Additional Parameters
12588 ///
12589 /// * *$.xgafv* (query-string) - V1 error format.
12590 /// * *access_token* (query-string) - OAuth access token.
12591 /// * *alt* (query-string) - Data format for response.
12592 /// * *callback* (query-string) - JSONP
12593 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12594 /// * *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.
12595 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12596 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12597 /// * *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.
12598 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12599 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12600 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionDeleteCall<'a, C>
12601 where
12602 T: AsRef<str>,
12603 {
12604 self._additional_params
12605 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12606 self
12607 }
12608
12609 /// Identifies the authorization scope for the method you are building.
12610 ///
12611 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12612 /// [`Scope::CloudPlatform`].
12613 ///
12614 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12615 /// tokens for more than one scope.
12616 ///
12617 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12618 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12619 /// sufficient, a read-write scope will do as well.
12620 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionDeleteCall<'a, C>
12621 where
12622 St: AsRef<str>,
12623 {
12624 self._scopes.insert(String::from(scope.as_ref()));
12625 self
12626 }
12627 /// Identifies the authorization scope(s) for the method you are building.
12628 ///
12629 /// See [`Self::add_scope()`] for details.
12630 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionDeleteCall<'a, C>
12631 where
12632 I: IntoIterator<Item = St>,
12633 St: AsRef<str>,
12634 {
12635 self._scopes
12636 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12637 self
12638 }
12639
12640 /// Removes all scopes, and no default scope will be used either.
12641 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12642 /// for details).
12643 pub fn clear_scopes(mut self) -> AppServiceVersionDeleteCall<'a, C> {
12644 self._scopes.clear();
12645 self
12646 }
12647}
12648
12649/// Exports a user image to Artifact Registry.
12650///
12651/// A builder for the *services.versions.exportAppImage* method supported by a *app* resource.
12652/// It is not used directly, but through a [`AppMethods`] instance.
12653///
12654/// # Example
12655///
12656/// Instantiate a resource method builder
12657///
12658/// ```test_harness,no_run
12659/// # extern crate hyper;
12660/// # extern crate hyper_rustls;
12661/// # extern crate google_appengine1 as appengine1;
12662/// use appengine1::api::ExportAppImageRequest;
12663/// # async fn dox() {
12664/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12665///
12666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12668/// # .with_native_roots()
12669/// # .unwrap()
12670/// # .https_only()
12671/// # .enable_http2()
12672/// # .build();
12673///
12674/// # let executor = hyper_util::rt::TokioExecutor::new();
12675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12676/// # secret,
12677/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12678/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12679/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12680/// # ),
12681/// # ).build().await.unwrap();
12682///
12683/// # let client = hyper_util::client::legacy::Client::builder(
12684/// # hyper_util::rt::TokioExecutor::new()
12685/// # )
12686/// # .build(
12687/// # hyper_rustls::HttpsConnectorBuilder::new()
12688/// # .with_native_roots()
12689/// # .unwrap()
12690/// # .https_or_http()
12691/// # .enable_http2()
12692/// # .build()
12693/// # );
12694/// # let mut hub = Appengine::new(client, auth);
12695/// // As the method needs a request, you would usually fill it with the desired information
12696/// // into the respective structure. Some of the parts shown here might not be applicable !
12697/// // Values shown here are possibly random and not representative !
12698/// let mut req = ExportAppImageRequest::default();
12699///
12700/// // You can configure optional parameters by calling the respective setters at will, and
12701/// // execute the final call using `doit()`.
12702/// // Values shown here are possibly random and not representative !
12703/// let result = hub.apps().services_versions_export_app_image(req, "appsId", "servicesId", "versionsId")
12704/// .doit().await;
12705/// # }
12706/// ```
12707pub struct AppServiceVersionExportAppImageCall<'a, C>
12708where
12709 C: 'a,
12710{
12711 hub: &'a Appengine<C>,
12712 _request: ExportAppImageRequest,
12713 _apps_id: String,
12714 _services_id: String,
12715 _versions_id: String,
12716 _delegate: Option<&'a mut dyn common::Delegate>,
12717 _additional_params: HashMap<String, String>,
12718 _scopes: BTreeSet<String>,
12719}
12720
12721impl<'a, C> common::CallBuilder for AppServiceVersionExportAppImageCall<'a, C> {}
12722
12723impl<'a, C> AppServiceVersionExportAppImageCall<'a, C>
12724where
12725 C: common::Connector,
12726{
12727 /// Perform the operation you have build so far.
12728 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12729 use std::borrow::Cow;
12730 use std::io::{Read, Seek};
12731
12732 use common::{url::Params, ToParts};
12733 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12734
12735 let mut dd = common::DefaultDelegate;
12736 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12737 dlg.begin(common::MethodInfo {
12738 id: "appengine.apps.services.versions.exportAppImage",
12739 http_method: hyper::Method::POST,
12740 });
12741
12742 for &field in ["alt", "appsId", "servicesId", "versionsId"].iter() {
12743 if self._additional_params.contains_key(field) {
12744 dlg.finished(false);
12745 return Err(common::Error::FieldClash(field));
12746 }
12747 }
12748
12749 let mut params = Params::with_capacity(6 + self._additional_params.len());
12750 params.push("appsId", self._apps_id);
12751 params.push("servicesId", self._services_id);
12752 params.push("versionsId", self._versions_id);
12753
12754 params.extend(self._additional_params.iter());
12755
12756 params.push("alt", "json");
12757 let mut url = self.hub._base_url.clone()
12758 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}:exportAppImage";
12759 if self._scopes.is_empty() {
12760 self._scopes
12761 .insert(Scope::CloudPlatform.as_ref().to_string());
12762 }
12763
12764 #[allow(clippy::single_element_loop)]
12765 for &(find_this, param_name) in [
12766 ("{appsId}", "appsId"),
12767 ("{servicesId}", "servicesId"),
12768 ("{versionsId}", "versionsId"),
12769 ]
12770 .iter()
12771 {
12772 url = params.uri_replacement(url, param_name, find_this, false);
12773 }
12774 {
12775 let to_remove = ["versionsId", "servicesId", "appsId"];
12776 params.remove_params(&to_remove);
12777 }
12778
12779 let url = params.parse_with_url(&url);
12780
12781 let mut json_mime_type = mime::APPLICATION_JSON;
12782 let mut request_value_reader = {
12783 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12784 common::remove_json_null_values(&mut value);
12785 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12786 serde_json::to_writer(&mut dst, &value).unwrap();
12787 dst
12788 };
12789 let request_size = request_value_reader
12790 .seek(std::io::SeekFrom::End(0))
12791 .unwrap();
12792 request_value_reader
12793 .seek(std::io::SeekFrom::Start(0))
12794 .unwrap();
12795
12796 loop {
12797 let token = match self
12798 .hub
12799 .auth
12800 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12801 .await
12802 {
12803 Ok(token) => token,
12804 Err(e) => match dlg.token(e) {
12805 Ok(token) => token,
12806 Err(e) => {
12807 dlg.finished(false);
12808 return Err(common::Error::MissingToken(e));
12809 }
12810 },
12811 };
12812 request_value_reader
12813 .seek(std::io::SeekFrom::Start(0))
12814 .unwrap();
12815 let mut req_result = {
12816 let client = &self.hub.client;
12817 dlg.pre_request();
12818 let mut req_builder = hyper::Request::builder()
12819 .method(hyper::Method::POST)
12820 .uri(url.as_str())
12821 .header(USER_AGENT, self.hub._user_agent.clone());
12822
12823 if let Some(token) = token.as_ref() {
12824 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12825 }
12826
12827 let request = req_builder
12828 .header(CONTENT_TYPE, json_mime_type.to_string())
12829 .header(CONTENT_LENGTH, request_size as u64)
12830 .body(common::to_body(
12831 request_value_reader.get_ref().clone().into(),
12832 ));
12833
12834 client.request(request.unwrap()).await
12835 };
12836
12837 match req_result {
12838 Err(err) => {
12839 if let common::Retry::After(d) = dlg.http_error(&err) {
12840 sleep(d).await;
12841 continue;
12842 }
12843 dlg.finished(false);
12844 return Err(common::Error::HttpError(err));
12845 }
12846 Ok(res) => {
12847 let (mut parts, body) = res.into_parts();
12848 let mut body = common::Body::new(body);
12849 if !parts.status.is_success() {
12850 let bytes = common::to_bytes(body).await.unwrap_or_default();
12851 let error = serde_json::from_str(&common::to_string(&bytes));
12852 let response = common::to_response(parts, bytes.into());
12853
12854 if let common::Retry::After(d) =
12855 dlg.http_failure(&response, error.as_ref().ok())
12856 {
12857 sleep(d).await;
12858 continue;
12859 }
12860
12861 dlg.finished(false);
12862
12863 return Err(match error {
12864 Ok(value) => common::Error::BadRequest(value),
12865 _ => common::Error::Failure(response),
12866 });
12867 }
12868 let response = {
12869 let bytes = common::to_bytes(body).await.unwrap_or_default();
12870 let encoded = common::to_string(&bytes);
12871 match serde_json::from_str(&encoded) {
12872 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12873 Err(error) => {
12874 dlg.response_json_decode_error(&encoded, &error);
12875 return Err(common::Error::JsonDecodeError(
12876 encoded.to_string(),
12877 error,
12878 ));
12879 }
12880 }
12881 };
12882
12883 dlg.finished(true);
12884 return Ok(response);
12885 }
12886 }
12887 }
12888 }
12889
12890 ///
12891 /// Sets the *request* property to the given value.
12892 ///
12893 /// Even though the property as already been set when instantiating this call,
12894 /// we provide this method for API completeness.
12895 pub fn request(
12896 mut self,
12897 new_value: ExportAppImageRequest,
12898 ) -> AppServiceVersionExportAppImageCall<'a, C> {
12899 self._request = new_value;
12900 self
12901 }
12902 /// Part of `name`. Required. Name of the App Engine version resource. Format: apps/{app}/services/{service}/versions/{version}
12903 ///
12904 /// Sets the *apps id* path property to the given value.
12905 ///
12906 /// Even though the property as already been set when instantiating this call,
12907 /// we provide this method for API completeness.
12908 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionExportAppImageCall<'a, C> {
12909 self._apps_id = new_value.to_string();
12910 self
12911 }
12912 /// Part of `name`. See documentation of `appsId`.
12913 ///
12914 /// Sets the *services id* path property to the given value.
12915 ///
12916 /// Even though the property as already been set when instantiating this call,
12917 /// we provide this method for API completeness.
12918 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionExportAppImageCall<'a, C> {
12919 self._services_id = new_value.to_string();
12920 self
12921 }
12922 /// Part of `name`. See documentation of `appsId`.
12923 ///
12924 /// Sets the *versions id* path property to the given value.
12925 ///
12926 /// Even though the property as already been set when instantiating this call,
12927 /// we provide this method for API completeness.
12928 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionExportAppImageCall<'a, C> {
12929 self._versions_id = new_value.to_string();
12930 self
12931 }
12932 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12933 /// while executing the actual API request.
12934 ///
12935 /// ````text
12936 /// It should be used to handle progress information, and to implement a certain level of resilience.
12937 /// ````
12938 ///
12939 /// Sets the *delegate* property to the given value.
12940 pub fn delegate(
12941 mut self,
12942 new_value: &'a mut dyn common::Delegate,
12943 ) -> AppServiceVersionExportAppImageCall<'a, C> {
12944 self._delegate = Some(new_value);
12945 self
12946 }
12947
12948 /// Set any additional parameter of the query string used in the request.
12949 /// It should be used to set parameters which are not yet available through their own
12950 /// setters.
12951 ///
12952 /// Please note that this method must not be used to set any of the known parameters
12953 /// which have their own setter method. If done anyway, the request will fail.
12954 ///
12955 /// # Additional Parameters
12956 ///
12957 /// * *$.xgafv* (query-string) - V1 error format.
12958 /// * *access_token* (query-string) - OAuth access token.
12959 /// * *alt* (query-string) - Data format for response.
12960 /// * *callback* (query-string) - JSONP
12961 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12962 /// * *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.
12963 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12964 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12965 /// * *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.
12966 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12967 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12968 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionExportAppImageCall<'a, C>
12969 where
12970 T: AsRef<str>,
12971 {
12972 self._additional_params
12973 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12974 self
12975 }
12976
12977 /// Identifies the authorization scope for the method you are building.
12978 ///
12979 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12980 /// [`Scope::CloudPlatform`].
12981 ///
12982 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12983 /// tokens for more than one scope.
12984 ///
12985 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12986 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12987 /// sufficient, a read-write scope will do as well.
12988 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionExportAppImageCall<'a, C>
12989 where
12990 St: AsRef<str>,
12991 {
12992 self._scopes.insert(String::from(scope.as_ref()));
12993 self
12994 }
12995 /// Identifies the authorization scope(s) for the method you are building.
12996 ///
12997 /// See [`Self::add_scope()`] for details.
12998 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionExportAppImageCall<'a, C>
12999 where
13000 I: IntoIterator<Item = St>,
13001 St: AsRef<str>,
13002 {
13003 self._scopes
13004 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13005 self
13006 }
13007
13008 /// Removes all scopes, and no default scope will be used either.
13009 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13010 /// for details).
13011 pub fn clear_scopes(mut self) -> AppServiceVersionExportAppImageCall<'a, C> {
13012 self._scopes.clear();
13013 self
13014 }
13015}
13016
13017/// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.
13018///
13019/// A builder for the *services.versions.get* method supported by a *app* resource.
13020/// It is not used directly, but through a [`AppMethods`] instance.
13021///
13022/// # Example
13023///
13024/// Instantiate a resource method builder
13025///
13026/// ```test_harness,no_run
13027/// # extern crate hyper;
13028/// # extern crate hyper_rustls;
13029/// # extern crate google_appengine1 as appengine1;
13030/// # async fn dox() {
13031/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13032///
13033/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13034/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13035/// # .with_native_roots()
13036/// # .unwrap()
13037/// # .https_only()
13038/// # .enable_http2()
13039/// # .build();
13040///
13041/// # let executor = hyper_util::rt::TokioExecutor::new();
13042/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13043/// # secret,
13044/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13045/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13046/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13047/// # ),
13048/// # ).build().await.unwrap();
13049///
13050/// # let client = hyper_util::client::legacy::Client::builder(
13051/// # hyper_util::rt::TokioExecutor::new()
13052/// # )
13053/// # .build(
13054/// # hyper_rustls::HttpsConnectorBuilder::new()
13055/// # .with_native_roots()
13056/// # .unwrap()
13057/// # .https_or_http()
13058/// # .enable_http2()
13059/// # .build()
13060/// # );
13061/// # let mut hub = Appengine::new(client, auth);
13062/// // You can configure optional parameters by calling the respective setters at will, and
13063/// // execute the final call using `doit()`.
13064/// // Values shown here are possibly random and not representative !
13065/// let result = hub.apps().services_versions_get("appsId", "servicesId", "versionsId")
13066/// .view("ea")
13067/// .doit().await;
13068/// # }
13069/// ```
13070pub struct AppServiceVersionGetCall<'a, C>
13071where
13072 C: 'a,
13073{
13074 hub: &'a Appengine<C>,
13075 _apps_id: String,
13076 _services_id: String,
13077 _versions_id: String,
13078 _view: Option<String>,
13079 _delegate: Option<&'a mut dyn common::Delegate>,
13080 _additional_params: HashMap<String, String>,
13081 _scopes: BTreeSet<String>,
13082}
13083
13084impl<'a, C> common::CallBuilder for AppServiceVersionGetCall<'a, C> {}
13085
13086impl<'a, C> AppServiceVersionGetCall<'a, C>
13087where
13088 C: common::Connector,
13089{
13090 /// Perform the operation you have build so far.
13091 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
13092 use std::borrow::Cow;
13093 use std::io::{Read, Seek};
13094
13095 use common::{url::Params, ToParts};
13096 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13097
13098 let mut dd = common::DefaultDelegate;
13099 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13100 dlg.begin(common::MethodInfo {
13101 id: "appengine.apps.services.versions.get",
13102 http_method: hyper::Method::GET,
13103 });
13104
13105 for &field in ["alt", "appsId", "servicesId", "versionsId", "view"].iter() {
13106 if self._additional_params.contains_key(field) {
13107 dlg.finished(false);
13108 return Err(common::Error::FieldClash(field));
13109 }
13110 }
13111
13112 let mut params = Params::with_capacity(6 + self._additional_params.len());
13113 params.push("appsId", self._apps_id);
13114 params.push("servicesId", self._services_id);
13115 params.push("versionsId", self._versions_id);
13116 if let Some(value) = self._view.as_ref() {
13117 params.push("view", value);
13118 }
13119
13120 params.extend(self._additional_params.iter());
13121
13122 params.push("alt", "json");
13123 let mut url = self.hub._base_url.clone()
13124 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}";
13125 if self._scopes.is_empty() {
13126 self._scopes
13127 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
13128 }
13129
13130 #[allow(clippy::single_element_loop)]
13131 for &(find_this, param_name) in [
13132 ("{appsId}", "appsId"),
13133 ("{servicesId}", "servicesId"),
13134 ("{versionsId}", "versionsId"),
13135 ]
13136 .iter()
13137 {
13138 url = params.uri_replacement(url, param_name, find_this, false);
13139 }
13140 {
13141 let to_remove = ["versionsId", "servicesId", "appsId"];
13142 params.remove_params(&to_remove);
13143 }
13144
13145 let url = params.parse_with_url(&url);
13146
13147 loop {
13148 let token = match self
13149 .hub
13150 .auth
13151 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13152 .await
13153 {
13154 Ok(token) => token,
13155 Err(e) => match dlg.token(e) {
13156 Ok(token) => token,
13157 Err(e) => {
13158 dlg.finished(false);
13159 return Err(common::Error::MissingToken(e));
13160 }
13161 },
13162 };
13163 let mut req_result = {
13164 let client = &self.hub.client;
13165 dlg.pre_request();
13166 let mut req_builder = hyper::Request::builder()
13167 .method(hyper::Method::GET)
13168 .uri(url.as_str())
13169 .header(USER_AGENT, self.hub._user_agent.clone());
13170
13171 if let Some(token) = token.as_ref() {
13172 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13173 }
13174
13175 let request = req_builder
13176 .header(CONTENT_LENGTH, 0_u64)
13177 .body(common::to_body::<String>(None));
13178
13179 client.request(request.unwrap()).await
13180 };
13181
13182 match req_result {
13183 Err(err) => {
13184 if let common::Retry::After(d) = dlg.http_error(&err) {
13185 sleep(d).await;
13186 continue;
13187 }
13188 dlg.finished(false);
13189 return Err(common::Error::HttpError(err));
13190 }
13191 Ok(res) => {
13192 let (mut parts, body) = res.into_parts();
13193 let mut body = common::Body::new(body);
13194 if !parts.status.is_success() {
13195 let bytes = common::to_bytes(body).await.unwrap_or_default();
13196 let error = serde_json::from_str(&common::to_string(&bytes));
13197 let response = common::to_response(parts, bytes.into());
13198
13199 if let common::Retry::After(d) =
13200 dlg.http_failure(&response, error.as_ref().ok())
13201 {
13202 sleep(d).await;
13203 continue;
13204 }
13205
13206 dlg.finished(false);
13207
13208 return Err(match error {
13209 Ok(value) => common::Error::BadRequest(value),
13210 _ => common::Error::Failure(response),
13211 });
13212 }
13213 let response = {
13214 let bytes = common::to_bytes(body).await.unwrap_or_default();
13215 let encoded = common::to_string(&bytes);
13216 match serde_json::from_str(&encoded) {
13217 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13218 Err(error) => {
13219 dlg.response_json_decode_error(&encoded, &error);
13220 return Err(common::Error::JsonDecodeError(
13221 encoded.to_string(),
13222 error,
13223 ));
13224 }
13225 }
13226 };
13227
13228 dlg.finished(true);
13229 return Ok(response);
13230 }
13231 }
13232 }
13233 }
13234
13235 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
13236 ///
13237 /// Sets the *apps id* path property to the given value.
13238 ///
13239 /// Even though the property as already been set when instantiating this call,
13240 /// we provide this method for API completeness.
13241 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
13242 self._apps_id = new_value.to_string();
13243 self
13244 }
13245 /// Part of `name`. See documentation of `appsId`.
13246 ///
13247 /// Sets the *services id* path property to the given value.
13248 ///
13249 /// Even though the property as already been set when instantiating this call,
13250 /// we provide this method for API completeness.
13251 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
13252 self._services_id = new_value.to_string();
13253 self
13254 }
13255 /// Part of `name`. See documentation of `appsId`.
13256 ///
13257 /// Sets the *versions id* path property to the given value.
13258 ///
13259 /// Even though the property as already been set when instantiating this call,
13260 /// we provide this method for API completeness.
13261 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
13262 self._versions_id = new_value.to_string();
13263 self
13264 }
13265 /// Controls the set of fields returned in the Get response.
13266 ///
13267 /// Sets the *view* query property to the given value.
13268 pub fn view(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
13269 self._view = Some(new_value.to_string());
13270 self
13271 }
13272 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13273 /// while executing the actual API request.
13274 ///
13275 /// ````text
13276 /// It should be used to handle progress information, and to implement a certain level of resilience.
13277 /// ````
13278 ///
13279 /// Sets the *delegate* property to the given value.
13280 pub fn delegate(
13281 mut self,
13282 new_value: &'a mut dyn common::Delegate,
13283 ) -> AppServiceVersionGetCall<'a, C> {
13284 self._delegate = Some(new_value);
13285 self
13286 }
13287
13288 /// Set any additional parameter of the query string used in the request.
13289 /// It should be used to set parameters which are not yet available through their own
13290 /// setters.
13291 ///
13292 /// Please note that this method must not be used to set any of the known parameters
13293 /// which have their own setter method. If done anyway, the request will fail.
13294 ///
13295 /// # Additional Parameters
13296 ///
13297 /// * *$.xgafv* (query-string) - V1 error format.
13298 /// * *access_token* (query-string) - OAuth access token.
13299 /// * *alt* (query-string) - Data format for response.
13300 /// * *callback* (query-string) - JSONP
13301 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13302 /// * *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.
13303 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13304 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13305 /// * *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.
13306 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13307 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13308 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionGetCall<'a, C>
13309 where
13310 T: AsRef<str>,
13311 {
13312 self._additional_params
13313 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13314 self
13315 }
13316
13317 /// Identifies the authorization scope for the method you are building.
13318 ///
13319 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13320 /// [`Scope::CloudPlatformReadOnly`].
13321 ///
13322 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13323 /// tokens for more than one scope.
13324 ///
13325 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13326 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13327 /// sufficient, a read-write scope will do as well.
13328 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionGetCall<'a, C>
13329 where
13330 St: AsRef<str>,
13331 {
13332 self._scopes.insert(String::from(scope.as_ref()));
13333 self
13334 }
13335 /// Identifies the authorization scope(s) for the method you are building.
13336 ///
13337 /// See [`Self::add_scope()`] for details.
13338 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionGetCall<'a, C>
13339 where
13340 I: IntoIterator<Item = St>,
13341 St: AsRef<str>,
13342 {
13343 self._scopes
13344 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13345 self
13346 }
13347
13348 /// Removes all scopes, and no default scope will be used either.
13349 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13350 /// for details).
13351 pub fn clear_scopes(mut self) -> AppServiceVersionGetCall<'a, C> {
13352 self._scopes.clear();
13353 self
13354 }
13355}
13356
13357/// Lists the versions of a service.
13358///
13359/// A builder for the *services.versions.list* method supported by a *app* resource.
13360/// It is not used directly, but through a [`AppMethods`] instance.
13361///
13362/// # Example
13363///
13364/// Instantiate a resource method builder
13365///
13366/// ```test_harness,no_run
13367/// # extern crate hyper;
13368/// # extern crate hyper_rustls;
13369/// # extern crate google_appengine1 as appengine1;
13370/// # async fn dox() {
13371/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13372///
13373/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13374/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13375/// # .with_native_roots()
13376/// # .unwrap()
13377/// # .https_only()
13378/// # .enable_http2()
13379/// # .build();
13380///
13381/// # let executor = hyper_util::rt::TokioExecutor::new();
13382/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13383/// # secret,
13384/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13385/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13386/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13387/// # ),
13388/// # ).build().await.unwrap();
13389///
13390/// # let client = hyper_util::client::legacy::Client::builder(
13391/// # hyper_util::rt::TokioExecutor::new()
13392/// # )
13393/// # .build(
13394/// # hyper_rustls::HttpsConnectorBuilder::new()
13395/// # .with_native_roots()
13396/// # .unwrap()
13397/// # .https_or_http()
13398/// # .enable_http2()
13399/// # .build()
13400/// # );
13401/// # let mut hub = Appengine::new(client, auth);
13402/// // You can configure optional parameters by calling the respective setters at will, and
13403/// // execute the final call using `doit()`.
13404/// // Values shown here are possibly random and not representative !
13405/// let result = hub.apps().services_versions_list("appsId", "servicesId")
13406/// .view("invidunt")
13407/// .page_token("no")
13408/// .page_size(-7)
13409/// .doit().await;
13410/// # }
13411/// ```
13412pub struct AppServiceVersionListCall<'a, C>
13413where
13414 C: 'a,
13415{
13416 hub: &'a Appengine<C>,
13417 _apps_id: String,
13418 _services_id: String,
13419 _view: Option<String>,
13420 _page_token: Option<String>,
13421 _page_size: Option<i32>,
13422 _delegate: Option<&'a mut dyn common::Delegate>,
13423 _additional_params: HashMap<String, String>,
13424 _scopes: BTreeSet<String>,
13425}
13426
13427impl<'a, C> common::CallBuilder for AppServiceVersionListCall<'a, C> {}
13428
13429impl<'a, C> AppServiceVersionListCall<'a, C>
13430where
13431 C: common::Connector,
13432{
13433 /// Perform the operation you have build so far.
13434 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
13435 use std::borrow::Cow;
13436 use std::io::{Read, Seek};
13437
13438 use common::{url::Params, ToParts};
13439 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13440
13441 let mut dd = common::DefaultDelegate;
13442 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13443 dlg.begin(common::MethodInfo {
13444 id: "appengine.apps.services.versions.list",
13445 http_method: hyper::Method::GET,
13446 });
13447
13448 for &field in [
13449 "alt",
13450 "appsId",
13451 "servicesId",
13452 "view",
13453 "pageToken",
13454 "pageSize",
13455 ]
13456 .iter()
13457 {
13458 if self._additional_params.contains_key(field) {
13459 dlg.finished(false);
13460 return Err(common::Error::FieldClash(field));
13461 }
13462 }
13463
13464 let mut params = Params::with_capacity(7 + self._additional_params.len());
13465 params.push("appsId", self._apps_id);
13466 params.push("servicesId", self._services_id);
13467 if let Some(value) = self._view.as_ref() {
13468 params.push("view", value);
13469 }
13470 if let Some(value) = self._page_token.as_ref() {
13471 params.push("pageToken", value);
13472 }
13473 if let Some(value) = self._page_size.as_ref() {
13474 params.push("pageSize", value.to_string());
13475 }
13476
13477 params.extend(self._additional_params.iter());
13478
13479 params.push("alt", "json");
13480 let mut url =
13481 self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions";
13482 if self._scopes.is_empty() {
13483 self._scopes
13484 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
13485 }
13486
13487 #[allow(clippy::single_element_loop)]
13488 for &(find_this, param_name) in
13489 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
13490 {
13491 url = params.uri_replacement(url, param_name, find_this, false);
13492 }
13493 {
13494 let to_remove = ["servicesId", "appsId"];
13495 params.remove_params(&to_remove);
13496 }
13497
13498 let url = params.parse_with_url(&url);
13499
13500 loop {
13501 let token = match self
13502 .hub
13503 .auth
13504 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13505 .await
13506 {
13507 Ok(token) => token,
13508 Err(e) => match dlg.token(e) {
13509 Ok(token) => token,
13510 Err(e) => {
13511 dlg.finished(false);
13512 return Err(common::Error::MissingToken(e));
13513 }
13514 },
13515 };
13516 let mut req_result = {
13517 let client = &self.hub.client;
13518 dlg.pre_request();
13519 let mut req_builder = hyper::Request::builder()
13520 .method(hyper::Method::GET)
13521 .uri(url.as_str())
13522 .header(USER_AGENT, self.hub._user_agent.clone());
13523
13524 if let Some(token) = token.as_ref() {
13525 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13526 }
13527
13528 let request = req_builder
13529 .header(CONTENT_LENGTH, 0_u64)
13530 .body(common::to_body::<String>(None));
13531
13532 client.request(request.unwrap()).await
13533 };
13534
13535 match req_result {
13536 Err(err) => {
13537 if let common::Retry::After(d) = dlg.http_error(&err) {
13538 sleep(d).await;
13539 continue;
13540 }
13541 dlg.finished(false);
13542 return Err(common::Error::HttpError(err));
13543 }
13544 Ok(res) => {
13545 let (mut parts, body) = res.into_parts();
13546 let mut body = common::Body::new(body);
13547 if !parts.status.is_success() {
13548 let bytes = common::to_bytes(body).await.unwrap_or_default();
13549 let error = serde_json::from_str(&common::to_string(&bytes));
13550 let response = common::to_response(parts, bytes.into());
13551
13552 if let common::Retry::After(d) =
13553 dlg.http_failure(&response, error.as_ref().ok())
13554 {
13555 sleep(d).await;
13556 continue;
13557 }
13558
13559 dlg.finished(false);
13560
13561 return Err(match error {
13562 Ok(value) => common::Error::BadRequest(value),
13563 _ => common::Error::Failure(response),
13564 });
13565 }
13566 let response = {
13567 let bytes = common::to_bytes(body).await.unwrap_or_default();
13568 let encoded = common::to_string(&bytes);
13569 match serde_json::from_str(&encoded) {
13570 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13571 Err(error) => {
13572 dlg.response_json_decode_error(&encoded, &error);
13573 return Err(common::Error::JsonDecodeError(
13574 encoded.to_string(),
13575 error,
13576 ));
13577 }
13578 }
13579 };
13580
13581 dlg.finished(true);
13582 return Ok(response);
13583 }
13584 }
13585 }
13586 }
13587
13588 /// Part of `parent`. Required. Name of the parent Service resource. Example: apps/myapp/services/default.
13589 ///
13590 /// Sets the *apps id* path property to the given value.
13591 ///
13592 /// Even though the property as already been set when instantiating this call,
13593 /// we provide this method for API completeness.
13594 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
13595 self._apps_id = new_value.to_string();
13596 self
13597 }
13598 /// Part of `parent`. See documentation of `appsId`.
13599 ///
13600 /// Sets the *services id* path property to the given value.
13601 ///
13602 /// Even though the property as already been set when instantiating this call,
13603 /// we provide this method for API completeness.
13604 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
13605 self._services_id = new_value.to_string();
13606 self
13607 }
13608 /// Controls the set of fields returned in the List response.
13609 ///
13610 /// Sets the *view* query property to the given value.
13611 pub fn view(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
13612 self._view = Some(new_value.to_string());
13613 self
13614 }
13615 /// Continuation token for fetching the next page of results.
13616 ///
13617 /// Sets the *page token* query property to the given value.
13618 pub fn page_token(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
13619 self._page_token = Some(new_value.to_string());
13620 self
13621 }
13622 /// Maximum results to return per page.
13623 ///
13624 /// Sets the *page size* query property to the given value.
13625 pub fn page_size(mut self, new_value: i32) -> AppServiceVersionListCall<'a, C> {
13626 self._page_size = Some(new_value);
13627 self
13628 }
13629 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13630 /// while executing the actual API request.
13631 ///
13632 /// ````text
13633 /// It should be used to handle progress information, and to implement a certain level of resilience.
13634 /// ````
13635 ///
13636 /// Sets the *delegate* property to the given value.
13637 pub fn delegate(
13638 mut self,
13639 new_value: &'a mut dyn common::Delegate,
13640 ) -> AppServiceVersionListCall<'a, C> {
13641 self._delegate = Some(new_value);
13642 self
13643 }
13644
13645 /// Set any additional parameter of the query string used in the request.
13646 /// It should be used to set parameters which are not yet available through their own
13647 /// setters.
13648 ///
13649 /// Please note that this method must not be used to set any of the known parameters
13650 /// which have their own setter method. If done anyway, the request will fail.
13651 ///
13652 /// # Additional Parameters
13653 ///
13654 /// * *$.xgafv* (query-string) - V1 error format.
13655 /// * *access_token* (query-string) - OAuth access token.
13656 /// * *alt* (query-string) - Data format for response.
13657 /// * *callback* (query-string) - JSONP
13658 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13659 /// * *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.
13660 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13661 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13662 /// * *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.
13663 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13664 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13665 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionListCall<'a, C>
13666 where
13667 T: AsRef<str>,
13668 {
13669 self._additional_params
13670 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13671 self
13672 }
13673
13674 /// Identifies the authorization scope for the method you are building.
13675 ///
13676 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13677 /// [`Scope::CloudPlatformReadOnly`].
13678 ///
13679 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13680 /// tokens for more than one scope.
13681 ///
13682 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13683 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13684 /// sufficient, a read-write scope will do as well.
13685 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionListCall<'a, C>
13686 where
13687 St: AsRef<str>,
13688 {
13689 self._scopes.insert(String::from(scope.as_ref()));
13690 self
13691 }
13692 /// Identifies the authorization scope(s) for the method you are building.
13693 ///
13694 /// See [`Self::add_scope()`] for details.
13695 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionListCall<'a, C>
13696 where
13697 I: IntoIterator<Item = St>,
13698 St: AsRef<str>,
13699 {
13700 self._scopes
13701 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13702 self
13703 }
13704
13705 /// Removes all scopes, and no default scope will be used either.
13706 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13707 /// for details).
13708 pub fn clear_scopes(mut self) -> AppServiceVersionListCall<'a, C> {
13709 self._scopes.clear();
13710 self
13711 }
13712}
13713
13714/// 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:Standard environment instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class)automatic scaling in the standard environment: automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automaticScaling.standard_scheduler_settings.max_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.min_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_cpu_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_throughput_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings)basic scaling or manual scaling in the standard environment: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)Flexible environment serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status)automatic scaling in the flexible environment: automatic_scaling.min_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cool_down_period_sec (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cpu_utilization.target_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling)manual scaling in the flexible environment: manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)
13715///
13716/// A builder for the *services.versions.patch* method supported by a *app* resource.
13717/// It is not used directly, but through a [`AppMethods`] instance.
13718///
13719/// # Example
13720///
13721/// Instantiate a resource method builder
13722///
13723/// ```test_harness,no_run
13724/// # extern crate hyper;
13725/// # extern crate hyper_rustls;
13726/// # extern crate google_appengine1 as appengine1;
13727/// use appengine1::api::Version;
13728/// # async fn dox() {
13729/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13730///
13731/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13732/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13733/// # .with_native_roots()
13734/// # .unwrap()
13735/// # .https_only()
13736/// # .enable_http2()
13737/// # .build();
13738///
13739/// # let executor = hyper_util::rt::TokioExecutor::new();
13740/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13741/// # secret,
13742/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13743/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13744/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13745/// # ),
13746/// # ).build().await.unwrap();
13747///
13748/// # let client = hyper_util::client::legacy::Client::builder(
13749/// # hyper_util::rt::TokioExecutor::new()
13750/// # )
13751/// # .build(
13752/// # hyper_rustls::HttpsConnectorBuilder::new()
13753/// # .with_native_roots()
13754/// # .unwrap()
13755/// # .https_or_http()
13756/// # .enable_http2()
13757/// # .build()
13758/// # );
13759/// # let mut hub = Appengine::new(client, auth);
13760/// // As the method needs a request, you would usually fill it with the desired information
13761/// // into the respective structure. Some of the parts shown here might not be applicable !
13762/// // Values shown here are possibly random and not representative !
13763/// let mut req = Version::default();
13764///
13765/// // You can configure optional parameters by calling the respective setters at will, and
13766/// // execute the final call using `doit()`.
13767/// // Values shown here are possibly random and not representative !
13768/// let result = hub.apps().services_versions_patch(req, "appsId", "servicesId", "versionsId")
13769/// .update_mask(FieldMask::new::<&str>(&[]))
13770/// .doit().await;
13771/// # }
13772/// ```
13773pub struct AppServiceVersionPatchCall<'a, C>
13774where
13775 C: 'a,
13776{
13777 hub: &'a Appengine<C>,
13778 _request: Version,
13779 _apps_id: String,
13780 _services_id: String,
13781 _versions_id: String,
13782 _update_mask: Option<common::FieldMask>,
13783 _delegate: Option<&'a mut dyn common::Delegate>,
13784 _additional_params: HashMap<String, String>,
13785 _scopes: BTreeSet<String>,
13786}
13787
13788impl<'a, C> common::CallBuilder for AppServiceVersionPatchCall<'a, C> {}
13789
13790impl<'a, C> AppServiceVersionPatchCall<'a, C>
13791where
13792 C: common::Connector,
13793{
13794 /// Perform the operation you have build so far.
13795 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13796 use std::borrow::Cow;
13797 use std::io::{Read, Seek};
13798
13799 use common::{url::Params, ToParts};
13800 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13801
13802 let mut dd = common::DefaultDelegate;
13803 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13804 dlg.begin(common::MethodInfo {
13805 id: "appengine.apps.services.versions.patch",
13806 http_method: hyper::Method::PATCH,
13807 });
13808
13809 for &field in ["alt", "appsId", "servicesId", "versionsId", "updateMask"].iter() {
13810 if self._additional_params.contains_key(field) {
13811 dlg.finished(false);
13812 return Err(common::Error::FieldClash(field));
13813 }
13814 }
13815
13816 let mut params = Params::with_capacity(7 + self._additional_params.len());
13817 params.push("appsId", self._apps_id);
13818 params.push("servicesId", self._services_id);
13819 params.push("versionsId", self._versions_id);
13820 if let Some(value) = self._update_mask.as_ref() {
13821 params.push("updateMask", value.to_string());
13822 }
13823
13824 params.extend(self._additional_params.iter());
13825
13826 params.push("alt", "json");
13827 let mut url = self.hub._base_url.clone()
13828 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}";
13829 if self._scopes.is_empty() {
13830 self._scopes
13831 .insert(Scope::CloudPlatform.as_ref().to_string());
13832 }
13833
13834 #[allow(clippy::single_element_loop)]
13835 for &(find_this, param_name) in [
13836 ("{appsId}", "appsId"),
13837 ("{servicesId}", "servicesId"),
13838 ("{versionsId}", "versionsId"),
13839 ]
13840 .iter()
13841 {
13842 url = params.uri_replacement(url, param_name, find_this, false);
13843 }
13844 {
13845 let to_remove = ["versionsId", "servicesId", "appsId"];
13846 params.remove_params(&to_remove);
13847 }
13848
13849 let url = params.parse_with_url(&url);
13850
13851 let mut json_mime_type = mime::APPLICATION_JSON;
13852 let mut request_value_reader = {
13853 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13854 common::remove_json_null_values(&mut value);
13855 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13856 serde_json::to_writer(&mut dst, &value).unwrap();
13857 dst
13858 };
13859 let request_size = request_value_reader
13860 .seek(std::io::SeekFrom::End(0))
13861 .unwrap();
13862 request_value_reader
13863 .seek(std::io::SeekFrom::Start(0))
13864 .unwrap();
13865
13866 loop {
13867 let token = match self
13868 .hub
13869 .auth
13870 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13871 .await
13872 {
13873 Ok(token) => token,
13874 Err(e) => match dlg.token(e) {
13875 Ok(token) => token,
13876 Err(e) => {
13877 dlg.finished(false);
13878 return Err(common::Error::MissingToken(e));
13879 }
13880 },
13881 };
13882 request_value_reader
13883 .seek(std::io::SeekFrom::Start(0))
13884 .unwrap();
13885 let mut req_result = {
13886 let client = &self.hub.client;
13887 dlg.pre_request();
13888 let mut req_builder = hyper::Request::builder()
13889 .method(hyper::Method::PATCH)
13890 .uri(url.as_str())
13891 .header(USER_AGENT, self.hub._user_agent.clone());
13892
13893 if let Some(token) = token.as_ref() {
13894 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13895 }
13896
13897 let request = req_builder
13898 .header(CONTENT_TYPE, json_mime_type.to_string())
13899 .header(CONTENT_LENGTH, request_size as u64)
13900 .body(common::to_body(
13901 request_value_reader.get_ref().clone().into(),
13902 ));
13903
13904 client.request(request.unwrap()).await
13905 };
13906
13907 match req_result {
13908 Err(err) => {
13909 if let common::Retry::After(d) = dlg.http_error(&err) {
13910 sleep(d).await;
13911 continue;
13912 }
13913 dlg.finished(false);
13914 return Err(common::Error::HttpError(err));
13915 }
13916 Ok(res) => {
13917 let (mut parts, body) = res.into_parts();
13918 let mut body = common::Body::new(body);
13919 if !parts.status.is_success() {
13920 let bytes = common::to_bytes(body).await.unwrap_or_default();
13921 let error = serde_json::from_str(&common::to_string(&bytes));
13922 let response = common::to_response(parts, bytes.into());
13923
13924 if let common::Retry::After(d) =
13925 dlg.http_failure(&response, error.as_ref().ok())
13926 {
13927 sleep(d).await;
13928 continue;
13929 }
13930
13931 dlg.finished(false);
13932
13933 return Err(match error {
13934 Ok(value) => common::Error::BadRequest(value),
13935 _ => common::Error::Failure(response),
13936 });
13937 }
13938 let response = {
13939 let bytes = common::to_bytes(body).await.unwrap_or_default();
13940 let encoded = common::to_string(&bytes);
13941 match serde_json::from_str(&encoded) {
13942 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13943 Err(error) => {
13944 dlg.response_json_decode_error(&encoded, &error);
13945 return Err(common::Error::JsonDecodeError(
13946 encoded.to_string(),
13947 error,
13948 ));
13949 }
13950 }
13951 };
13952
13953 dlg.finished(true);
13954 return Ok(response);
13955 }
13956 }
13957 }
13958 }
13959
13960 ///
13961 /// Sets the *request* property to the given value.
13962 ///
13963 /// Even though the property as already been set when instantiating this call,
13964 /// we provide this method for API completeness.
13965 pub fn request(mut self, new_value: Version) -> AppServiceVersionPatchCall<'a, C> {
13966 self._request = new_value;
13967 self
13968 }
13969 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default/versions/1.
13970 ///
13971 /// Sets the *apps id* path property to the given value.
13972 ///
13973 /// Even though the property as already been set when instantiating this call,
13974 /// we provide this method for API completeness.
13975 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, C> {
13976 self._apps_id = new_value.to_string();
13977 self
13978 }
13979 /// Part of `name`. See documentation of `appsId`.
13980 ///
13981 /// Sets the *services id* path property to the given value.
13982 ///
13983 /// Even though the property as already been set when instantiating this call,
13984 /// we provide this method for API completeness.
13985 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, C> {
13986 self._services_id = new_value.to_string();
13987 self
13988 }
13989 /// Part of `name`. See documentation of `appsId`.
13990 ///
13991 /// Sets the *versions id* path property to the given value.
13992 ///
13993 /// Even though the property as already been set when instantiating this call,
13994 /// we provide this method for API completeness.
13995 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, C> {
13996 self._versions_id = new_value.to_string();
13997 self
13998 }
13999 /// Standard field mask for the set of fields to be updated.
14000 ///
14001 /// Sets the *update mask* query property to the given value.
14002 pub fn update_mask(
14003 mut self,
14004 new_value: common::FieldMask,
14005 ) -> AppServiceVersionPatchCall<'a, C> {
14006 self._update_mask = Some(new_value);
14007 self
14008 }
14009 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14010 /// while executing the actual API request.
14011 ///
14012 /// ````text
14013 /// It should be used to handle progress information, and to implement a certain level of resilience.
14014 /// ````
14015 ///
14016 /// Sets the *delegate* property to the given value.
14017 pub fn delegate(
14018 mut self,
14019 new_value: &'a mut dyn common::Delegate,
14020 ) -> AppServiceVersionPatchCall<'a, C> {
14021 self._delegate = Some(new_value);
14022 self
14023 }
14024
14025 /// Set any additional parameter of the query string used in the request.
14026 /// It should be used to set parameters which are not yet available through their own
14027 /// setters.
14028 ///
14029 /// Please note that this method must not be used to set any of the known parameters
14030 /// which have their own setter method. If done anyway, the request will fail.
14031 ///
14032 /// # Additional Parameters
14033 ///
14034 /// * *$.xgafv* (query-string) - V1 error format.
14035 /// * *access_token* (query-string) - OAuth access token.
14036 /// * *alt* (query-string) - Data format for response.
14037 /// * *callback* (query-string) - JSONP
14038 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14039 /// * *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.
14040 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14041 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14042 /// * *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.
14043 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14044 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14045 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionPatchCall<'a, C>
14046 where
14047 T: AsRef<str>,
14048 {
14049 self._additional_params
14050 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14051 self
14052 }
14053
14054 /// Identifies the authorization scope for the method you are building.
14055 ///
14056 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14057 /// [`Scope::CloudPlatform`].
14058 ///
14059 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14060 /// tokens for more than one scope.
14061 ///
14062 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14063 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14064 /// sufficient, a read-write scope will do as well.
14065 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionPatchCall<'a, C>
14066 where
14067 St: AsRef<str>,
14068 {
14069 self._scopes.insert(String::from(scope.as_ref()));
14070 self
14071 }
14072 /// Identifies the authorization scope(s) for the method you are building.
14073 ///
14074 /// See [`Self::add_scope()`] for details.
14075 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionPatchCall<'a, C>
14076 where
14077 I: IntoIterator<Item = St>,
14078 St: AsRef<str>,
14079 {
14080 self._scopes
14081 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14082 self
14083 }
14084
14085 /// Removes all scopes, and no default scope will be used either.
14086 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14087 /// for details).
14088 pub fn clear_scopes(mut self) -> AppServiceVersionPatchCall<'a, C> {
14089 self._scopes.clear();
14090 self
14091 }
14092}
14093
14094/// Deletes the specified service and all enclosed versions.
14095///
14096/// A builder for the *services.delete* method supported by a *app* resource.
14097/// It is not used directly, but through a [`AppMethods`] instance.
14098///
14099/// # Example
14100///
14101/// Instantiate a resource method builder
14102///
14103/// ```test_harness,no_run
14104/// # extern crate hyper;
14105/// # extern crate hyper_rustls;
14106/// # extern crate google_appengine1 as appengine1;
14107/// # async fn dox() {
14108/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14109///
14110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14111/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14112/// # .with_native_roots()
14113/// # .unwrap()
14114/// # .https_only()
14115/// # .enable_http2()
14116/// # .build();
14117///
14118/// # let executor = hyper_util::rt::TokioExecutor::new();
14119/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14120/// # secret,
14121/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14122/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14123/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14124/// # ),
14125/// # ).build().await.unwrap();
14126///
14127/// # let client = hyper_util::client::legacy::Client::builder(
14128/// # hyper_util::rt::TokioExecutor::new()
14129/// # )
14130/// # .build(
14131/// # hyper_rustls::HttpsConnectorBuilder::new()
14132/// # .with_native_roots()
14133/// # .unwrap()
14134/// # .https_or_http()
14135/// # .enable_http2()
14136/// # .build()
14137/// # );
14138/// # let mut hub = Appengine::new(client, auth);
14139/// // You can configure optional parameters by calling the respective setters at will, and
14140/// // execute the final call using `doit()`.
14141/// // Values shown here are possibly random and not representative !
14142/// let result = hub.apps().services_delete("appsId", "servicesId")
14143/// .doit().await;
14144/// # }
14145/// ```
14146pub struct AppServiceDeleteCall<'a, C>
14147where
14148 C: 'a,
14149{
14150 hub: &'a Appengine<C>,
14151 _apps_id: String,
14152 _services_id: String,
14153 _delegate: Option<&'a mut dyn common::Delegate>,
14154 _additional_params: HashMap<String, String>,
14155 _scopes: BTreeSet<String>,
14156}
14157
14158impl<'a, C> common::CallBuilder for AppServiceDeleteCall<'a, C> {}
14159
14160impl<'a, C> AppServiceDeleteCall<'a, C>
14161where
14162 C: common::Connector,
14163{
14164 /// Perform the operation you have build so far.
14165 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14166 use std::borrow::Cow;
14167 use std::io::{Read, Seek};
14168
14169 use common::{url::Params, ToParts};
14170 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14171
14172 let mut dd = common::DefaultDelegate;
14173 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14174 dlg.begin(common::MethodInfo {
14175 id: "appengine.apps.services.delete",
14176 http_method: hyper::Method::DELETE,
14177 });
14178
14179 for &field in ["alt", "appsId", "servicesId"].iter() {
14180 if self._additional_params.contains_key(field) {
14181 dlg.finished(false);
14182 return Err(common::Error::FieldClash(field));
14183 }
14184 }
14185
14186 let mut params = Params::with_capacity(4 + self._additional_params.len());
14187 params.push("appsId", self._apps_id);
14188 params.push("servicesId", self._services_id);
14189
14190 params.extend(self._additional_params.iter());
14191
14192 params.push("alt", "json");
14193 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}";
14194 if self._scopes.is_empty() {
14195 self._scopes
14196 .insert(Scope::CloudPlatform.as_ref().to_string());
14197 }
14198
14199 #[allow(clippy::single_element_loop)]
14200 for &(find_this, param_name) in
14201 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
14202 {
14203 url = params.uri_replacement(url, param_name, find_this, false);
14204 }
14205 {
14206 let to_remove = ["servicesId", "appsId"];
14207 params.remove_params(&to_remove);
14208 }
14209
14210 let url = params.parse_with_url(&url);
14211
14212 loop {
14213 let token = match self
14214 .hub
14215 .auth
14216 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14217 .await
14218 {
14219 Ok(token) => token,
14220 Err(e) => match dlg.token(e) {
14221 Ok(token) => token,
14222 Err(e) => {
14223 dlg.finished(false);
14224 return Err(common::Error::MissingToken(e));
14225 }
14226 },
14227 };
14228 let mut req_result = {
14229 let client = &self.hub.client;
14230 dlg.pre_request();
14231 let mut req_builder = hyper::Request::builder()
14232 .method(hyper::Method::DELETE)
14233 .uri(url.as_str())
14234 .header(USER_AGENT, self.hub._user_agent.clone());
14235
14236 if let Some(token) = token.as_ref() {
14237 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14238 }
14239
14240 let request = req_builder
14241 .header(CONTENT_LENGTH, 0_u64)
14242 .body(common::to_body::<String>(None));
14243
14244 client.request(request.unwrap()).await
14245 };
14246
14247 match req_result {
14248 Err(err) => {
14249 if let common::Retry::After(d) = dlg.http_error(&err) {
14250 sleep(d).await;
14251 continue;
14252 }
14253 dlg.finished(false);
14254 return Err(common::Error::HttpError(err));
14255 }
14256 Ok(res) => {
14257 let (mut parts, body) = res.into_parts();
14258 let mut body = common::Body::new(body);
14259 if !parts.status.is_success() {
14260 let bytes = common::to_bytes(body).await.unwrap_or_default();
14261 let error = serde_json::from_str(&common::to_string(&bytes));
14262 let response = common::to_response(parts, bytes.into());
14263
14264 if let common::Retry::After(d) =
14265 dlg.http_failure(&response, error.as_ref().ok())
14266 {
14267 sleep(d).await;
14268 continue;
14269 }
14270
14271 dlg.finished(false);
14272
14273 return Err(match error {
14274 Ok(value) => common::Error::BadRequest(value),
14275 _ => common::Error::Failure(response),
14276 });
14277 }
14278 let response = {
14279 let bytes = common::to_bytes(body).await.unwrap_or_default();
14280 let encoded = common::to_string(&bytes);
14281 match serde_json::from_str(&encoded) {
14282 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14283 Err(error) => {
14284 dlg.response_json_decode_error(&encoded, &error);
14285 return Err(common::Error::JsonDecodeError(
14286 encoded.to_string(),
14287 error,
14288 ));
14289 }
14290 }
14291 };
14292
14293 dlg.finished(true);
14294 return Ok(response);
14295 }
14296 }
14297 }
14298 }
14299
14300 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default.
14301 ///
14302 /// Sets the *apps id* path property to the given value.
14303 ///
14304 /// Even though the property as already been set when instantiating this call,
14305 /// we provide this method for API completeness.
14306 pub fn apps_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, C> {
14307 self._apps_id = new_value.to_string();
14308 self
14309 }
14310 /// Part of `name`. See documentation of `appsId`.
14311 ///
14312 /// Sets the *services id* path property to the given value.
14313 ///
14314 /// Even though the property as already been set when instantiating this call,
14315 /// we provide this method for API completeness.
14316 pub fn services_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, C> {
14317 self._services_id = new_value.to_string();
14318 self
14319 }
14320 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14321 /// while executing the actual API request.
14322 ///
14323 /// ````text
14324 /// It should be used to handle progress information, and to implement a certain level of resilience.
14325 /// ````
14326 ///
14327 /// Sets the *delegate* property to the given value.
14328 pub fn delegate(
14329 mut self,
14330 new_value: &'a mut dyn common::Delegate,
14331 ) -> AppServiceDeleteCall<'a, C> {
14332 self._delegate = Some(new_value);
14333 self
14334 }
14335
14336 /// Set any additional parameter of the query string used in the request.
14337 /// It should be used to set parameters which are not yet available through their own
14338 /// setters.
14339 ///
14340 /// Please note that this method must not be used to set any of the known parameters
14341 /// which have their own setter method. If done anyway, the request will fail.
14342 ///
14343 /// # Additional Parameters
14344 ///
14345 /// * *$.xgafv* (query-string) - V1 error format.
14346 /// * *access_token* (query-string) - OAuth access token.
14347 /// * *alt* (query-string) - Data format for response.
14348 /// * *callback* (query-string) - JSONP
14349 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14350 /// * *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.
14351 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14352 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14353 /// * *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.
14354 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14355 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14356 pub fn param<T>(mut self, name: T, value: T) -> AppServiceDeleteCall<'a, C>
14357 where
14358 T: AsRef<str>,
14359 {
14360 self._additional_params
14361 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14362 self
14363 }
14364
14365 /// Identifies the authorization scope for the method you are building.
14366 ///
14367 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14368 /// [`Scope::CloudPlatform`].
14369 ///
14370 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14371 /// tokens for more than one scope.
14372 ///
14373 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14374 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14375 /// sufficient, a read-write scope will do as well.
14376 pub fn add_scope<St>(mut self, scope: St) -> AppServiceDeleteCall<'a, C>
14377 where
14378 St: AsRef<str>,
14379 {
14380 self._scopes.insert(String::from(scope.as_ref()));
14381 self
14382 }
14383 /// Identifies the authorization scope(s) for the method you are building.
14384 ///
14385 /// See [`Self::add_scope()`] for details.
14386 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceDeleteCall<'a, C>
14387 where
14388 I: IntoIterator<Item = St>,
14389 St: AsRef<str>,
14390 {
14391 self._scopes
14392 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14393 self
14394 }
14395
14396 /// Removes all scopes, and no default scope will be used either.
14397 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14398 /// for details).
14399 pub fn clear_scopes(mut self) -> AppServiceDeleteCall<'a, C> {
14400 self._scopes.clear();
14401 self
14402 }
14403}
14404
14405/// Gets the current configuration of the specified service.
14406///
14407/// A builder for the *services.get* method supported by a *app* resource.
14408/// It is not used directly, but through a [`AppMethods`] instance.
14409///
14410/// # Example
14411///
14412/// Instantiate a resource method builder
14413///
14414/// ```test_harness,no_run
14415/// # extern crate hyper;
14416/// # extern crate hyper_rustls;
14417/// # extern crate google_appengine1 as appengine1;
14418/// # async fn dox() {
14419/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14420///
14421/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14422/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14423/// # .with_native_roots()
14424/// # .unwrap()
14425/// # .https_only()
14426/// # .enable_http2()
14427/// # .build();
14428///
14429/// # let executor = hyper_util::rt::TokioExecutor::new();
14430/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14431/// # secret,
14432/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14433/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14434/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14435/// # ),
14436/// # ).build().await.unwrap();
14437///
14438/// # let client = hyper_util::client::legacy::Client::builder(
14439/// # hyper_util::rt::TokioExecutor::new()
14440/// # )
14441/// # .build(
14442/// # hyper_rustls::HttpsConnectorBuilder::new()
14443/// # .with_native_roots()
14444/// # .unwrap()
14445/// # .https_or_http()
14446/// # .enable_http2()
14447/// # .build()
14448/// # );
14449/// # let mut hub = Appengine::new(client, auth);
14450/// // You can configure optional parameters by calling the respective setters at will, and
14451/// // execute the final call using `doit()`.
14452/// // Values shown here are possibly random and not representative !
14453/// let result = hub.apps().services_get("appsId", "servicesId")
14454/// .doit().await;
14455/// # }
14456/// ```
14457pub struct AppServiceGetCall<'a, C>
14458where
14459 C: 'a,
14460{
14461 hub: &'a Appengine<C>,
14462 _apps_id: String,
14463 _services_id: String,
14464 _delegate: Option<&'a mut dyn common::Delegate>,
14465 _additional_params: HashMap<String, String>,
14466 _scopes: BTreeSet<String>,
14467}
14468
14469impl<'a, C> common::CallBuilder for AppServiceGetCall<'a, C> {}
14470
14471impl<'a, C> AppServiceGetCall<'a, C>
14472where
14473 C: common::Connector,
14474{
14475 /// Perform the operation you have build so far.
14476 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
14477 use std::borrow::Cow;
14478 use std::io::{Read, Seek};
14479
14480 use common::{url::Params, ToParts};
14481 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14482
14483 let mut dd = common::DefaultDelegate;
14484 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14485 dlg.begin(common::MethodInfo {
14486 id: "appengine.apps.services.get",
14487 http_method: hyper::Method::GET,
14488 });
14489
14490 for &field in ["alt", "appsId", "servicesId"].iter() {
14491 if self._additional_params.contains_key(field) {
14492 dlg.finished(false);
14493 return Err(common::Error::FieldClash(field));
14494 }
14495 }
14496
14497 let mut params = Params::with_capacity(4 + self._additional_params.len());
14498 params.push("appsId", self._apps_id);
14499 params.push("servicesId", self._services_id);
14500
14501 params.extend(self._additional_params.iter());
14502
14503 params.push("alt", "json");
14504 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}";
14505 if self._scopes.is_empty() {
14506 self._scopes
14507 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
14508 }
14509
14510 #[allow(clippy::single_element_loop)]
14511 for &(find_this, param_name) in
14512 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
14513 {
14514 url = params.uri_replacement(url, param_name, find_this, false);
14515 }
14516 {
14517 let to_remove = ["servicesId", "appsId"];
14518 params.remove_params(&to_remove);
14519 }
14520
14521 let url = params.parse_with_url(&url);
14522
14523 loop {
14524 let token = match self
14525 .hub
14526 .auth
14527 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14528 .await
14529 {
14530 Ok(token) => token,
14531 Err(e) => match dlg.token(e) {
14532 Ok(token) => token,
14533 Err(e) => {
14534 dlg.finished(false);
14535 return Err(common::Error::MissingToken(e));
14536 }
14537 },
14538 };
14539 let mut req_result = {
14540 let client = &self.hub.client;
14541 dlg.pre_request();
14542 let mut req_builder = hyper::Request::builder()
14543 .method(hyper::Method::GET)
14544 .uri(url.as_str())
14545 .header(USER_AGENT, self.hub._user_agent.clone());
14546
14547 if let Some(token) = token.as_ref() {
14548 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14549 }
14550
14551 let request = req_builder
14552 .header(CONTENT_LENGTH, 0_u64)
14553 .body(common::to_body::<String>(None));
14554
14555 client.request(request.unwrap()).await
14556 };
14557
14558 match req_result {
14559 Err(err) => {
14560 if let common::Retry::After(d) = dlg.http_error(&err) {
14561 sleep(d).await;
14562 continue;
14563 }
14564 dlg.finished(false);
14565 return Err(common::Error::HttpError(err));
14566 }
14567 Ok(res) => {
14568 let (mut parts, body) = res.into_parts();
14569 let mut body = common::Body::new(body);
14570 if !parts.status.is_success() {
14571 let bytes = common::to_bytes(body).await.unwrap_or_default();
14572 let error = serde_json::from_str(&common::to_string(&bytes));
14573 let response = common::to_response(parts, bytes.into());
14574
14575 if let common::Retry::After(d) =
14576 dlg.http_failure(&response, error.as_ref().ok())
14577 {
14578 sleep(d).await;
14579 continue;
14580 }
14581
14582 dlg.finished(false);
14583
14584 return Err(match error {
14585 Ok(value) => common::Error::BadRequest(value),
14586 _ => common::Error::Failure(response),
14587 });
14588 }
14589 let response = {
14590 let bytes = common::to_bytes(body).await.unwrap_or_default();
14591 let encoded = common::to_string(&bytes);
14592 match serde_json::from_str(&encoded) {
14593 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14594 Err(error) => {
14595 dlg.response_json_decode_error(&encoded, &error);
14596 return Err(common::Error::JsonDecodeError(
14597 encoded.to_string(),
14598 error,
14599 ));
14600 }
14601 }
14602 };
14603
14604 dlg.finished(true);
14605 return Ok(response);
14606 }
14607 }
14608 }
14609 }
14610
14611 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default.
14612 ///
14613 /// Sets the *apps id* path property to the given value.
14614 ///
14615 /// Even though the property as already been set when instantiating this call,
14616 /// we provide this method for API completeness.
14617 pub fn apps_id(mut self, new_value: &str) -> AppServiceGetCall<'a, C> {
14618 self._apps_id = new_value.to_string();
14619 self
14620 }
14621 /// Part of `name`. See documentation of `appsId`.
14622 ///
14623 /// Sets the *services id* path property to the given value.
14624 ///
14625 /// Even though the property as already been set when instantiating this call,
14626 /// we provide this method for API completeness.
14627 pub fn services_id(mut self, new_value: &str) -> AppServiceGetCall<'a, C> {
14628 self._services_id = new_value.to_string();
14629 self
14630 }
14631 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14632 /// while executing the actual API request.
14633 ///
14634 /// ````text
14635 /// It should be used to handle progress information, and to implement a certain level of resilience.
14636 /// ````
14637 ///
14638 /// Sets the *delegate* property to the given value.
14639 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppServiceGetCall<'a, C> {
14640 self._delegate = Some(new_value);
14641 self
14642 }
14643
14644 /// Set any additional parameter of the query string used in the request.
14645 /// It should be used to set parameters which are not yet available through their own
14646 /// setters.
14647 ///
14648 /// Please note that this method must not be used to set any of the known parameters
14649 /// which have their own setter method. If done anyway, the request will fail.
14650 ///
14651 /// # Additional Parameters
14652 ///
14653 /// * *$.xgafv* (query-string) - V1 error format.
14654 /// * *access_token* (query-string) - OAuth access token.
14655 /// * *alt* (query-string) - Data format for response.
14656 /// * *callback* (query-string) - JSONP
14657 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14658 /// * *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.
14659 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14660 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14661 /// * *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.
14662 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14663 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14664 pub fn param<T>(mut self, name: T, value: T) -> AppServiceGetCall<'a, C>
14665 where
14666 T: AsRef<str>,
14667 {
14668 self._additional_params
14669 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14670 self
14671 }
14672
14673 /// Identifies the authorization scope for the method you are building.
14674 ///
14675 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14676 /// [`Scope::CloudPlatformReadOnly`].
14677 ///
14678 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14679 /// tokens for more than one scope.
14680 ///
14681 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14682 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14683 /// sufficient, a read-write scope will do as well.
14684 pub fn add_scope<St>(mut self, scope: St) -> AppServiceGetCall<'a, C>
14685 where
14686 St: AsRef<str>,
14687 {
14688 self._scopes.insert(String::from(scope.as_ref()));
14689 self
14690 }
14691 /// Identifies the authorization scope(s) for the method you are building.
14692 ///
14693 /// See [`Self::add_scope()`] for details.
14694 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceGetCall<'a, C>
14695 where
14696 I: IntoIterator<Item = St>,
14697 St: AsRef<str>,
14698 {
14699 self._scopes
14700 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14701 self
14702 }
14703
14704 /// Removes all scopes, and no default scope will be used either.
14705 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14706 /// for details).
14707 pub fn clear_scopes(mut self) -> AppServiceGetCall<'a, C> {
14708 self._scopes.clear();
14709 self
14710 }
14711}
14712
14713/// Lists all the services in the application.
14714///
14715/// A builder for the *services.list* method supported by a *app* resource.
14716/// It is not used directly, but through a [`AppMethods`] instance.
14717///
14718/// # Example
14719///
14720/// Instantiate a resource method builder
14721///
14722/// ```test_harness,no_run
14723/// # extern crate hyper;
14724/// # extern crate hyper_rustls;
14725/// # extern crate google_appengine1 as appengine1;
14726/// # async fn dox() {
14727/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14728///
14729/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14730/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14731/// # .with_native_roots()
14732/// # .unwrap()
14733/// # .https_only()
14734/// # .enable_http2()
14735/// # .build();
14736///
14737/// # let executor = hyper_util::rt::TokioExecutor::new();
14738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14739/// # secret,
14740/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14741/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14742/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14743/// # ),
14744/// # ).build().await.unwrap();
14745///
14746/// # let client = hyper_util::client::legacy::Client::builder(
14747/// # hyper_util::rt::TokioExecutor::new()
14748/// # )
14749/// # .build(
14750/// # hyper_rustls::HttpsConnectorBuilder::new()
14751/// # .with_native_roots()
14752/// # .unwrap()
14753/// # .https_or_http()
14754/// # .enable_http2()
14755/// # .build()
14756/// # );
14757/// # let mut hub = Appengine::new(client, auth);
14758/// // You can configure optional parameters by calling the respective setters at will, and
14759/// // execute the final call using `doit()`.
14760/// // Values shown here are possibly random and not representative !
14761/// let result = hub.apps().services_list("appsId")
14762/// .page_token("sanctus")
14763/// .page_size(-56)
14764/// .doit().await;
14765/// # }
14766/// ```
14767pub struct AppServiceListCall<'a, C>
14768where
14769 C: 'a,
14770{
14771 hub: &'a Appengine<C>,
14772 _apps_id: String,
14773 _page_token: Option<String>,
14774 _page_size: Option<i32>,
14775 _delegate: Option<&'a mut dyn common::Delegate>,
14776 _additional_params: HashMap<String, String>,
14777 _scopes: BTreeSet<String>,
14778}
14779
14780impl<'a, C> common::CallBuilder for AppServiceListCall<'a, C> {}
14781
14782impl<'a, C> AppServiceListCall<'a, C>
14783where
14784 C: common::Connector,
14785{
14786 /// Perform the operation you have build so far.
14787 pub async fn doit(mut self) -> common::Result<(common::Response, ListServicesResponse)> {
14788 use std::borrow::Cow;
14789 use std::io::{Read, Seek};
14790
14791 use common::{url::Params, ToParts};
14792 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14793
14794 let mut dd = common::DefaultDelegate;
14795 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14796 dlg.begin(common::MethodInfo {
14797 id: "appengine.apps.services.list",
14798 http_method: hyper::Method::GET,
14799 });
14800
14801 for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
14802 if self._additional_params.contains_key(field) {
14803 dlg.finished(false);
14804 return Err(common::Error::FieldClash(field));
14805 }
14806 }
14807
14808 let mut params = Params::with_capacity(5 + self._additional_params.len());
14809 params.push("appsId", self._apps_id);
14810 if let Some(value) = self._page_token.as_ref() {
14811 params.push("pageToken", value);
14812 }
14813 if let Some(value) = self._page_size.as_ref() {
14814 params.push("pageSize", value.to_string());
14815 }
14816
14817 params.extend(self._additional_params.iter());
14818
14819 params.push("alt", "json");
14820 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services";
14821 if self._scopes.is_empty() {
14822 self._scopes
14823 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
14824 }
14825
14826 #[allow(clippy::single_element_loop)]
14827 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
14828 url = params.uri_replacement(url, param_name, find_this, false);
14829 }
14830 {
14831 let to_remove = ["appsId"];
14832 params.remove_params(&to_remove);
14833 }
14834
14835 let url = params.parse_with_url(&url);
14836
14837 loop {
14838 let token = match self
14839 .hub
14840 .auth
14841 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14842 .await
14843 {
14844 Ok(token) => token,
14845 Err(e) => match dlg.token(e) {
14846 Ok(token) => token,
14847 Err(e) => {
14848 dlg.finished(false);
14849 return Err(common::Error::MissingToken(e));
14850 }
14851 },
14852 };
14853 let mut req_result = {
14854 let client = &self.hub.client;
14855 dlg.pre_request();
14856 let mut req_builder = hyper::Request::builder()
14857 .method(hyper::Method::GET)
14858 .uri(url.as_str())
14859 .header(USER_AGENT, self.hub._user_agent.clone());
14860
14861 if let Some(token) = token.as_ref() {
14862 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14863 }
14864
14865 let request = req_builder
14866 .header(CONTENT_LENGTH, 0_u64)
14867 .body(common::to_body::<String>(None));
14868
14869 client.request(request.unwrap()).await
14870 };
14871
14872 match req_result {
14873 Err(err) => {
14874 if let common::Retry::After(d) = dlg.http_error(&err) {
14875 sleep(d).await;
14876 continue;
14877 }
14878 dlg.finished(false);
14879 return Err(common::Error::HttpError(err));
14880 }
14881 Ok(res) => {
14882 let (mut parts, body) = res.into_parts();
14883 let mut body = common::Body::new(body);
14884 if !parts.status.is_success() {
14885 let bytes = common::to_bytes(body).await.unwrap_or_default();
14886 let error = serde_json::from_str(&common::to_string(&bytes));
14887 let response = common::to_response(parts, bytes.into());
14888
14889 if let common::Retry::After(d) =
14890 dlg.http_failure(&response, error.as_ref().ok())
14891 {
14892 sleep(d).await;
14893 continue;
14894 }
14895
14896 dlg.finished(false);
14897
14898 return Err(match error {
14899 Ok(value) => common::Error::BadRequest(value),
14900 _ => common::Error::Failure(response),
14901 });
14902 }
14903 let response = {
14904 let bytes = common::to_bytes(body).await.unwrap_or_default();
14905 let encoded = common::to_string(&bytes);
14906 match serde_json::from_str(&encoded) {
14907 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14908 Err(error) => {
14909 dlg.response_json_decode_error(&encoded, &error);
14910 return Err(common::Error::JsonDecodeError(
14911 encoded.to_string(),
14912 error,
14913 ));
14914 }
14915 }
14916 };
14917
14918 dlg.finished(true);
14919 return Ok(response);
14920 }
14921 }
14922 }
14923 }
14924
14925 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
14926 ///
14927 /// Sets the *apps id* path property to the given value.
14928 ///
14929 /// Even though the property as already been set when instantiating this call,
14930 /// we provide this method for API completeness.
14931 pub fn apps_id(mut self, new_value: &str) -> AppServiceListCall<'a, C> {
14932 self._apps_id = new_value.to_string();
14933 self
14934 }
14935 /// Continuation token for fetching the next page of results.
14936 ///
14937 /// Sets the *page token* query property to the given value.
14938 pub fn page_token(mut self, new_value: &str) -> AppServiceListCall<'a, C> {
14939 self._page_token = Some(new_value.to_string());
14940 self
14941 }
14942 /// Maximum results to return per page.
14943 ///
14944 /// Sets the *page size* query property to the given value.
14945 pub fn page_size(mut self, new_value: i32) -> AppServiceListCall<'a, C> {
14946 self._page_size = Some(new_value);
14947 self
14948 }
14949 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14950 /// while executing the actual API request.
14951 ///
14952 /// ````text
14953 /// It should be used to handle progress information, and to implement a certain level of resilience.
14954 /// ````
14955 ///
14956 /// Sets the *delegate* property to the given value.
14957 pub fn delegate(
14958 mut self,
14959 new_value: &'a mut dyn common::Delegate,
14960 ) -> AppServiceListCall<'a, C> {
14961 self._delegate = Some(new_value);
14962 self
14963 }
14964
14965 /// Set any additional parameter of the query string used in the request.
14966 /// It should be used to set parameters which are not yet available through their own
14967 /// setters.
14968 ///
14969 /// Please note that this method must not be used to set any of the known parameters
14970 /// which have their own setter method. If done anyway, the request will fail.
14971 ///
14972 /// # Additional Parameters
14973 ///
14974 /// * *$.xgafv* (query-string) - V1 error format.
14975 /// * *access_token* (query-string) - OAuth access token.
14976 /// * *alt* (query-string) - Data format for response.
14977 /// * *callback* (query-string) - JSONP
14978 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14979 /// * *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.
14980 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14981 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14982 /// * *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.
14983 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14984 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14985 pub fn param<T>(mut self, name: T, value: T) -> AppServiceListCall<'a, C>
14986 where
14987 T: AsRef<str>,
14988 {
14989 self._additional_params
14990 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14991 self
14992 }
14993
14994 /// Identifies the authorization scope for the method you are building.
14995 ///
14996 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14997 /// [`Scope::CloudPlatformReadOnly`].
14998 ///
14999 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15000 /// tokens for more than one scope.
15001 ///
15002 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15003 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15004 /// sufficient, a read-write scope will do as well.
15005 pub fn add_scope<St>(mut self, scope: St) -> AppServiceListCall<'a, C>
15006 where
15007 St: AsRef<str>,
15008 {
15009 self._scopes.insert(String::from(scope.as_ref()));
15010 self
15011 }
15012 /// Identifies the authorization scope(s) for the method you are building.
15013 ///
15014 /// See [`Self::add_scope()`] for details.
15015 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceListCall<'a, C>
15016 where
15017 I: IntoIterator<Item = St>,
15018 St: AsRef<str>,
15019 {
15020 self._scopes
15021 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15022 self
15023 }
15024
15025 /// Removes all scopes, and no default scope will be used either.
15026 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15027 /// for details).
15028 pub fn clear_scopes(mut self) -> AppServiceListCall<'a, C> {
15029 self._scopes.clear();
15030 self
15031 }
15032}
15033
15034/// Updates the configuration of the specified service.
15035///
15036/// A builder for the *services.patch* method supported by a *app* resource.
15037/// It is not used directly, but through a [`AppMethods`] instance.
15038///
15039/// # Example
15040///
15041/// Instantiate a resource method builder
15042///
15043/// ```test_harness,no_run
15044/// # extern crate hyper;
15045/// # extern crate hyper_rustls;
15046/// # extern crate google_appengine1 as appengine1;
15047/// use appengine1::api::Service;
15048/// # async fn dox() {
15049/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15050///
15051/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15052/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15053/// # .with_native_roots()
15054/// # .unwrap()
15055/// # .https_only()
15056/// # .enable_http2()
15057/// # .build();
15058///
15059/// # let executor = hyper_util::rt::TokioExecutor::new();
15060/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15061/// # secret,
15062/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15063/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15064/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15065/// # ),
15066/// # ).build().await.unwrap();
15067///
15068/// # let client = hyper_util::client::legacy::Client::builder(
15069/// # hyper_util::rt::TokioExecutor::new()
15070/// # )
15071/// # .build(
15072/// # hyper_rustls::HttpsConnectorBuilder::new()
15073/// # .with_native_roots()
15074/// # .unwrap()
15075/// # .https_or_http()
15076/// # .enable_http2()
15077/// # .build()
15078/// # );
15079/// # let mut hub = Appengine::new(client, auth);
15080/// // As the method needs a request, you would usually fill it with the desired information
15081/// // into the respective structure. Some of the parts shown here might not be applicable !
15082/// // Values shown here are possibly random and not representative !
15083/// let mut req = Service::default();
15084///
15085/// // You can configure optional parameters by calling the respective setters at will, and
15086/// // execute the final call using `doit()`.
15087/// // Values shown here are possibly random and not representative !
15088/// let result = hub.apps().services_patch(req, "appsId", "servicesId")
15089/// .update_mask(FieldMask::new::<&str>(&[]))
15090/// .migrate_traffic(true)
15091/// .doit().await;
15092/// # }
15093/// ```
15094pub struct AppServicePatchCall<'a, C>
15095where
15096 C: 'a,
15097{
15098 hub: &'a Appengine<C>,
15099 _request: Service,
15100 _apps_id: String,
15101 _services_id: String,
15102 _update_mask: Option<common::FieldMask>,
15103 _migrate_traffic: Option<bool>,
15104 _delegate: Option<&'a mut dyn common::Delegate>,
15105 _additional_params: HashMap<String, String>,
15106 _scopes: BTreeSet<String>,
15107}
15108
15109impl<'a, C> common::CallBuilder for AppServicePatchCall<'a, C> {}
15110
15111impl<'a, C> AppServicePatchCall<'a, C>
15112where
15113 C: common::Connector,
15114{
15115 /// Perform the operation you have build so far.
15116 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15117 use std::borrow::Cow;
15118 use std::io::{Read, Seek};
15119
15120 use common::{url::Params, ToParts};
15121 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15122
15123 let mut dd = common::DefaultDelegate;
15124 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15125 dlg.begin(common::MethodInfo {
15126 id: "appengine.apps.services.patch",
15127 http_method: hyper::Method::PATCH,
15128 });
15129
15130 for &field in [
15131 "alt",
15132 "appsId",
15133 "servicesId",
15134 "updateMask",
15135 "migrateTraffic",
15136 ]
15137 .iter()
15138 {
15139 if self._additional_params.contains_key(field) {
15140 dlg.finished(false);
15141 return Err(common::Error::FieldClash(field));
15142 }
15143 }
15144
15145 let mut params = Params::with_capacity(7 + self._additional_params.len());
15146 params.push("appsId", self._apps_id);
15147 params.push("servicesId", self._services_id);
15148 if let Some(value) = self._update_mask.as_ref() {
15149 params.push("updateMask", value.to_string());
15150 }
15151 if let Some(value) = self._migrate_traffic.as_ref() {
15152 params.push("migrateTraffic", value.to_string());
15153 }
15154
15155 params.extend(self._additional_params.iter());
15156
15157 params.push("alt", "json");
15158 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}";
15159 if self._scopes.is_empty() {
15160 self._scopes
15161 .insert(Scope::CloudPlatform.as_ref().to_string());
15162 }
15163
15164 #[allow(clippy::single_element_loop)]
15165 for &(find_this, param_name) in
15166 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
15167 {
15168 url = params.uri_replacement(url, param_name, find_this, false);
15169 }
15170 {
15171 let to_remove = ["servicesId", "appsId"];
15172 params.remove_params(&to_remove);
15173 }
15174
15175 let url = params.parse_with_url(&url);
15176
15177 let mut json_mime_type = mime::APPLICATION_JSON;
15178 let mut request_value_reader = {
15179 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15180 common::remove_json_null_values(&mut value);
15181 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15182 serde_json::to_writer(&mut dst, &value).unwrap();
15183 dst
15184 };
15185 let request_size = request_value_reader
15186 .seek(std::io::SeekFrom::End(0))
15187 .unwrap();
15188 request_value_reader
15189 .seek(std::io::SeekFrom::Start(0))
15190 .unwrap();
15191
15192 loop {
15193 let token = match self
15194 .hub
15195 .auth
15196 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15197 .await
15198 {
15199 Ok(token) => token,
15200 Err(e) => match dlg.token(e) {
15201 Ok(token) => token,
15202 Err(e) => {
15203 dlg.finished(false);
15204 return Err(common::Error::MissingToken(e));
15205 }
15206 },
15207 };
15208 request_value_reader
15209 .seek(std::io::SeekFrom::Start(0))
15210 .unwrap();
15211 let mut req_result = {
15212 let client = &self.hub.client;
15213 dlg.pre_request();
15214 let mut req_builder = hyper::Request::builder()
15215 .method(hyper::Method::PATCH)
15216 .uri(url.as_str())
15217 .header(USER_AGENT, self.hub._user_agent.clone());
15218
15219 if let Some(token) = token.as_ref() {
15220 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15221 }
15222
15223 let request = req_builder
15224 .header(CONTENT_TYPE, json_mime_type.to_string())
15225 .header(CONTENT_LENGTH, request_size as u64)
15226 .body(common::to_body(
15227 request_value_reader.get_ref().clone().into(),
15228 ));
15229
15230 client.request(request.unwrap()).await
15231 };
15232
15233 match req_result {
15234 Err(err) => {
15235 if let common::Retry::After(d) = dlg.http_error(&err) {
15236 sleep(d).await;
15237 continue;
15238 }
15239 dlg.finished(false);
15240 return Err(common::Error::HttpError(err));
15241 }
15242 Ok(res) => {
15243 let (mut parts, body) = res.into_parts();
15244 let mut body = common::Body::new(body);
15245 if !parts.status.is_success() {
15246 let bytes = common::to_bytes(body).await.unwrap_or_default();
15247 let error = serde_json::from_str(&common::to_string(&bytes));
15248 let response = common::to_response(parts, bytes.into());
15249
15250 if let common::Retry::After(d) =
15251 dlg.http_failure(&response, error.as_ref().ok())
15252 {
15253 sleep(d).await;
15254 continue;
15255 }
15256
15257 dlg.finished(false);
15258
15259 return Err(match error {
15260 Ok(value) => common::Error::BadRequest(value),
15261 _ => common::Error::Failure(response),
15262 });
15263 }
15264 let response = {
15265 let bytes = common::to_bytes(body).await.unwrap_or_default();
15266 let encoded = common::to_string(&bytes);
15267 match serde_json::from_str(&encoded) {
15268 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15269 Err(error) => {
15270 dlg.response_json_decode_error(&encoded, &error);
15271 return Err(common::Error::JsonDecodeError(
15272 encoded.to_string(),
15273 error,
15274 ));
15275 }
15276 }
15277 };
15278
15279 dlg.finished(true);
15280 return Ok(response);
15281 }
15282 }
15283 }
15284 }
15285
15286 ///
15287 /// Sets the *request* property to the given value.
15288 ///
15289 /// Even though the property as already been set when instantiating this call,
15290 /// we provide this method for API completeness.
15291 pub fn request(mut self, new_value: Service) -> AppServicePatchCall<'a, C> {
15292 self._request = new_value;
15293 self
15294 }
15295 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default.
15296 ///
15297 /// Sets the *apps id* path property to the given value.
15298 ///
15299 /// Even though the property as already been set when instantiating this call,
15300 /// we provide this method for API completeness.
15301 pub fn apps_id(mut self, new_value: &str) -> AppServicePatchCall<'a, C> {
15302 self._apps_id = new_value.to_string();
15303 self
15304 }
15305 /// Part of `name`. See documentation of `appsId`.
15306 ///
15307 /// Sets the *services id* path property to the given value.
15308 ///
15309 /// Even though the property as already been set when instantiating this call,
15310 /// we provide this method for API completeness.
15311 pub fn services_id(mut self, new_value: &str) -> AppServicePatchCall<'a, C> {
15312 self._services_id = new_value.to_string();
15313 self
15314 }
15315 /// Required. Standard field mask for the set of fields to be updated.
15316 ///
15317 /// Sets the *update mask* query property to the given value.
15318 pub fn update_mask(mut self, new_value: common::FieldMask) -> AppServicePatchCall<'a, C> {
15319 self._update_mask = Some(new_value);
15320 self
15321 }
15322 /// 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/v1/apps.services.versions#InboundServiceType) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#AutomaticScaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#ShardBy) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).
15323 ///
15324 /// Sets the *migrate traffic* query property to the given value.
15325 pub fn migrate_traffic(mut self, new_value: bool) -> AppServicePatchCall<'a, C> {
15326 self._migrate_traffic = Some(new_value);
15327 self
15328 }
15329 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15330 /// while executing the actual API request.
15331 ///
15332 /// ````text
15333 /// It should be used to handle progress information, and to implement a certain level of resilience.
15334 /// ````
15335 ///
15336 /// Sets the *delegate* property to the given value.
15337 pub fn delegate(
15338 mut self,
15339 new_value: &'a mut dyn common::Delegate,
15340 ) -> AppServicePatchCall<'a, C> {
15341 self._delegate = Some(new_value);
15342 self
15343 }
15344
15345 /// Set any additional parameter of the query string used in the request.
15346 /// It should be used to set parameters which are not yet available through their own
15347 /// setters.
15348 ///
15349 /// Please note that this method must not be used to set any of the known parameters
15350 /// which have their own setter method. If done anyway, the request will fail.
15351 ///
15352 /// # Additional Parameters
15353 ///
15354 /// * *$.xgafv* (query-string) - V1 error format.
15355 /// * *access_token* (query-string) - OAuth access token.
15356 /// * *alt* (query-string) - Data format for response.
15357 /// * *callback* (query-string) - JSONP
15358 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15359 /// * *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.
15360 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15361 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15362 /// * *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.
15363 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15364 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15365 pub fn param<T>(mut self, name: T, value: T) -> AppServicePatchCall<'a, C>
15366 where
15367 T: AsRef<str>,
15368 {
15369 self._additional_params
15370 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15371 self
15372 }
15373
15374 /// Identifies the authorization scope for the method you are building.
15375 ///
15376 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15377 /// [`Scope::CloudPlatform`].
15378 ///
15379 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15380 /// tokens for more than one scope.
15381 ///
15382 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15383 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15384 /// sufficient, a read-write scope will do as well.
15385 pub fn add_scope<St>(mut self, scope: St) -> AppServicePatchCall<'a, C>
15386 where
15387 St: AsRef<str>,
15388 {
15389 self._scopes.insert(String::from(scope.as_ref()));
15390 self
15391 }
15392 /// Identifies the authorization scope(s) for the method you are building.
15393 ///
15394 /// See [`Self::add_scope()`] for details.
15395 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServicePatchCall<'a, C>
15396 where
15397 I: IntoIterator<Item = St>,
15398 St: AsRef<str>,
15399 {
15400 self._scopes
15401 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15402 self
15403 }
15404
15405 /// Removes all scopes, and no default scope will be used either.
15406 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15407 /// for details).
15408 pub fn clear_scopes(mut self) -> AppServicePatchCall<'a, C> {
15409 self._scopes.clear();
15410 self
15411 }
15412}
15413
15414/// Creates an App Engine application for a Google Cloud Platform project. Required fields: id - The ID of the target Cloud Platform project. 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/standard/python/console/).
15415///
15416/// A builder for the *create* method supported by a *app* resource.
15417/// It is not used directly, but through a [`AppMethods`] instance.
15418///
15419/// # Example
15420///
15421/// Instantiate a resource method builder
15422///
15423/// ```test_harness,no_run
15424/// # extern crate hyper;
15425/// # extern crate hyper_rustls;
15426/// # extern crate google_appengine1 as appengine1;
15427/// use appengine1::api::Application;
15428/// # async fn dox() {
15429/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15430///
15431/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15432/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15433/// # .with_native_roots()
15434/// # .unwrap()
15435/// # .https_only()
15436/// # .enable_http2()
15437/// # .build();
15438///
15439/// # let executor = hyper_util::rt::TokioExecutor::new();
15440/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15441/// # secret,
15442/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15443/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15444/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15445/// # ),
15446/// # ).build().await.unwrap();
15447///
15448/// # let client = hyper_util::client::legacy::Client::builder(
15449/// # hyper_util::rt::TokioExecutor::new()
15450/// # )
15451/// # .build(
15452/// # hyper_rustls::HttpsConnectorBuilder::new()
15453/// # .with_native_roots()
15454/// # .unwrap()
15455/// # .https_or_http()
15456/// # .enable_http2()
15457/// # .build()
15458/// # );
15459/// # let mut hub = Appengine::new(client, auth);
15460/// // As the method needs a request, you would usually fill it with the desired information
15461/// // into the respective structure. Some of the parts shown here might not be applicable !
15462/// // Values shown here are possibly random and not representative !
15463/// let mut req = Application::default();
15464///
15465/// // You can configure optional parameters by calling the respective setters at will, and
15466/// // execute the final call using `doit()`.
15467/// // Values shown here are possibly random and not representative !
15468/// let result = hub.apps().create(req)
15469/// .doit().await;
15470/// # }
15471/// ```
15472pub struct AppCreateCall<'a, C>
15473where
15474 C: 'a,
15475{
15476 hub: &'a Appengine<C>,
15477 _request: Application,
15478 _delegate: Option<&'a mut dyn common::Delegate>,
15479 _additional_params: HashMap<String, String>,
15480 _scopes: BTreeSet<String>,
15481}
15482
15483impl<'a, C> common::CallBuilder for AppCreateCall<'a, C> {}
15484
15485impl<'a, C> AppCreateCall<'a, C>
15486where
15487 C: common::Connector,
15488{
15489 /// Perform the operation you have build so far.
15490 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15491 use std::borrow::Cow;
15492 use std::io::{Read, Seek};
15493
15494 use common::{url::Params, ToParts};
15495 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15496
15497 let mut dd = common::DefaultDelegate;
15498 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15499 dlg.begin(common::MethodInfo {
15500 id: "appengine.apps.create",
15501 http_method: hyper::Method::POST,
15502 });
15503
15504 for &field in ["alt"].iter() {
15505 if self._additional_params.contains_key(field) {
15506 dlg.finished(false);
15507 return Err(common::Error::FieldClash(field));
15508 }
15509 }
15510
15511 let mut params = Params::with_capacity(3 + self._additional_params.len());
15512
15513 params.extend(self._additional_params.iter());
15514
15515 params.push("alt", "json");
15516 let mut url = self.hub._base_url.clone() + "v1/apps";
15517 if self._scopes.is_empty() {
15518 self._scopes
15519 .insert(Scope::CloudPlatform.as_ref().to_string());
15520 }
15521
15522 let url = params.parse_with_url(&url);
15523
15524 let mut json_mime_type = mime::APPLICATION_JSON;
15525 let mut request_value_reader = {
15526 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15527 common::remove_json_null_values(&mut value);
15528 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15529 serde_json::to_writer(&mut dst, &value).unwrap();
15530 dst
15531 };
15532 let request_size = request_value_reader
15533 .seek(std::io::SeekFrom::End(0))
15534 .unwrap();
15535 request_value_reader
15536 .seek(std::io::SeekFrom::Start(0))
15537 .unwrap();
15538
15539 loop {
15540 let token = match self
15541 .hub
15542 .auth
15543 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15544 .await
15545 {
15546 Ok(token) => token,
15547 Err(e) => match dlg.token(e) {
15548 Ok(token) => token,
15549 Err(e) => {
15550 dlg.finished(false);
15551 return Err(common::Error::MissingToken(e));
15552 }
15553 },
15554 };
15555 request_value_reader
15556 .seek(std::io::SeekFrom::Start(0))
15557 .unwrap();
15558 let mut req_result = {
15559 let client = &self.hub.client;
15560 dlg.pre_request();
15561 let mut req_builder = hyper::Request::builder()
15562 .method(hyper::Method::POST)
15563 .uri(url.as_str())
15564 .header(USER_AGENT, self.hub._user_agent.clone());
15565
15566 if let Some(token) = token.as_ref() {
15567 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15568 }
15569
15570 let request = req_builder
15571 .header(CONTENT_TYPE, json_mime_type.to_string())
15572 .header(CONTENT_LENGTH, request_size as u64)
15573 .body(common::to_body(
15574 request_value_reader.get_ref().clone().into(),
15575 ));
15576
15577 client.request(request.unwrap()).await
15578 };
15579
15580 match req_result {
15581 Err(err) => {
15582 if let common::Retry::After(d) = dlg.http_error(&err) {
15583 sleep(d).await;
15584 continue;
15585 }
15586 dlg.finished(false);
15587 return Err(common::Error::HttpError(err));
15588 }
15589 Ok(res) => {
15590 let (mut parts, body) = res.into_parts();
15591 let mut body = common::Body::new(body);
15592 if !parts.status.is_success() {
15593 let bytes = common::to_bytes(body).await.unwrap_or_default();
15594 let error = serde_json::from_str(&common::to_string(&bytes));
15595 let response = common::to_response(parts, bytes.into());
15596
15597 if let common::Retry::After(d) =
15598 dlg.http_failure(&response, error.as_ref().ok())
15599 {
15600 sleep(d).await;
15601 continue;
15602 }
15603
15604 dlg.finished(false);
15605
15606 return Err(match error {
15607 Ok(value) => common::Error::BadRequest(value),
15608 _ => common::Error::Failure(response),
15609 });
15610 }
15611 let response = {
15612 let bytes = common::to_bytes(body).await.unwrap_or_default();
15613 let encoded = common::to_string(&bytes);
15614 match serde_json::from_str(&encoded) {
15615 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15616 Err(error) => {
15617 dlg.response_json_decode_error(&encoded, &error);
15618 return Err(common::Error::JsonDecodeError(
15619 encoded.to_string(),
15620 error,
15621 ));
15622 }
15623 }
15624 };
15625
15626 dlg.finished(true);
15627 return Ok(response);
15628 }
15629 }
15630 }
15631 }
15632
15633 ///
15634 /// Sets the *request* property to the given value.
15635 ///
15636 /// Even though the property as already been set when instantiating this call,
15637 /// we provide this method for API completeness.
15638 pub fn request(mut self, new_value: Application) -> AppCreateCall<'a, C> {
15639 self._request = new_value;
15640 self
15641 }
15642 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15643 /// while executing the actual API request.
15644 ///
15645 /// ````text
15646 /// It should be used to handle progress information, and to implement a certain level of resilience.
15647 /// ````
15648 ///
15649 /// Sets the *delegate* property to the given value.
15650 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppCreateCall<'a, C> {
15651 self._delegate = Some(new_value);
15652 self
15653 }
15654
15655 /// Set any additional parameter of the query string used in the request.
15656 /// It should be used to set parameters which are not yet available through their own
15657 /// setters.
15658 ///
15659 /// Please note that this method must not be used to set any of the known parameters
15660 /// which have their own setter method. If done anyway, the request will fail.
15661 ///
15662 /// # Additional Parameters
15663 ///
15664 /// * *$.xgafv* (query-string) - V1 error format.
15665 /// * *access_token* (query-string) - OAuth access token.
15666 /// * *alt* (query-string) - Data format for response.
15667 /// * *callback* (query-string) - JSONP
15668 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15669 /// * *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.
15670 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15671 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15672 /// * *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.
15673 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15674 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15675 pub fn param<T>(mut self, name: T, value: T) -> AppCreateCall<'a, C>
15676 where
15677 T: AsRef<str>,
15678 {
15679 self._additional_params
15680 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15681 self
15682 }
15683
15684 /// Identifies the authorization scope for the method you are building.
15685 ///
15686 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15687 /// [`Scope::CloudPlatform`].
15688 ///
15689 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15690 /// tokens for more than one scope.
15691 ///
15692 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15693 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15694 /// sufficient, a read-write scope will do as well.
15695 pub fn add_scope<St>(mut self, scope: St) -> AppCreateCall<'a, C>
15696 where
15697 St: AsRef<str>,
15698 {
15699 self._scopes.insert(String::from(scope.as_ref()));
15700 self
15701 }
15702 /// Identifies the authorization scope(s) for the method you are building.
15703 ///
15704 /// See [`Self::add_scope()`] for details.
15705 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppCreateCall<'a, C>
15706 where
15707 I: IntoIterator<Item = St>,
15708 St: AsRef<str>,
15709 {
15710 self._scopes
15711 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15712 self
15713 }
15714
15715 /// Removes all scopes, and no default scope will be used either.
15716 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15717 /// for details).
15718 pub fn clear_scopes(mut self) -> AppCreateCall<'a, C> {
15719 self._scopes.clear();
15720 self
15721 }
15722}
15723
15724/// Gets information about an application.
15725///
15726/// A builder for the *get* method supported by a *app* resource.
15727/// It is not used directly, but through a [`AppMethods`] instance.
15728///
15729/// # Example
15730///
15731/// Instantiate a resource method builder
15732///
15733/// ```test_harness,no_run
15734/// # extern crate hyper;
15735/// # extern crate hyper_rustls;
15736/// # extern crate google_appengine1 as appengine1;
15737/// # async fn dox() {
15738/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15739///
15740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15741/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15742/// # .with_native_roots()
15743/// # .unwrap()
15744/// # .https_only()
15745/// # .enable_http2()
15746/// # .build();
15747///
15748/// # let executor = hyper_util::rt::TokioExecutor::new();
15749/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15750/// # secret,
15751/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15752/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15753/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15754/// # ),
15755/// # ).build().await.unwrap();
15756///
15757/// # let client = hyper_util::client::legacy::Client::builder(
15758/// # hyper_util::rt::TokioExecutor::new()
15759/// # )
15760/// # .build(
15761/// # hyper_rustls::HttpsConnectorBuilder::new()
15762/// # .with_native_roots()
15763/// # .unwrap()
15764/// # .https_or_http()
15765/// # .enable_http2()
15766/// # .build()
15767/// # );
15768/// # let mut hub = Appengine::new(client, auth);
15769/// // You can configure optional parameters by calling the respective setters at will, and
15770/// // execute the final call using `doit()`.
15771/// // Values shown here are possibly random and not representative !
15772/// let result = hub.apps().get("appsId")
15773/// .include_extra_data("sed")
15774/// .doit().await;
15775/// # }
15776/// ```
15777pub struct AppGetCall<'a, C>
15778where
15779 C: 'a,
15780{
15781 hub: &'a Appengine<C>,
15782 _apps_id: String,
15783 _include_extra_data: Option<String>,
15784 _delegate: Option<&'a mut dyn common::Delegate>,
15785 _additional_params: HashMap<String, String>,
15786 _scopes: BTreeSet<String>,
15787}
15788
15789impl<'a, C> common::CallBuilder for AppGetCall<'a, C> {}
15790
15791impl<'a, C> AppGetCall<'a, C>
15792where
15793 C: common::Connector,
15794{
15795 /// Perform the operation you have build so far.
15796 pub async fn doit(mut self) -> common::Result<(common::Response, Application)> {
15797 use std::borrow::Cow;
15798 use std::io::{Read, Seek};
15799
15800 use common::{url::Params, ToParts};
15801 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15802
15803 let mut dd = common::DefaultDelegate;
15804 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15805 dlg.begin(common::MethodInfo {
15806 id: "appengine.apps.get",
15807 http_method: hyper::Method::GET,
15808 });
15809
15810 for &field in ["alt", "appsId", "includeExtraData"].iter() {
15811 if self._additional_params.contains_key(field) {
15812 dlg.finished(false);
15813 return Err(common::Error::FieldClash(field));
15814 }
15815 }
15816
15817 let mut params = Params::with_capacity(4 + self._additional_params.len());
15818 params.push("appsId", self._apps_id);
15819 if let Some(value) = self._include_extra_data.as_ref() {
15820 params.push("includeExtraData", value);
15821 }
15822
15823 params.extend(self._additional_params.iter());
15824
15825 params.push("alt", "json");
15826 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}";
15827 if self._scopes.is_empty() {
15828 self._scopes
15829 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
15830 }
15831
15832 #[allow(clippy::single_element_loop)]
15833 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
15834 url = params.uri_replacement(url, param_name, find_this, false);
15835 }
15836 {
15837 let to_remove = ["appsId"];
15838 params.remove_params(&to_remove);
15839 }
15840
15841 let url = params.parse_with_url(&url);
15842
15843 loop {
15844 let token = match self
15845 .hub
15846 .auth
15847 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15848 .await
15849 {
15850 Ok(token) => token,
15851 Err(e) => match dlg.token(e) {
15852 Ok(token) => token,
15853 Err(e) => {
15854 dlg.finished(false);
15855 return Err(common::Error::MissingToken(e));
15856 }
15857 },
15858 };
15859 let mut req_result = {
15860 let client = &self.hub.client;
15861 dlg.pre_request();
15862 let mut req_builder = hyper::Request::builder()
15863 .method(hyper::Method::GET)
15864 .uri(url.as_str())
15865 .header(USER_AGENT, self.hub._user_agent.clone());
15866
15867 if let Some(token) = token.as_ref() {
15868 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15869 }
15870
15871 let request = req_builder
15872 .header(CONTENT_LENGTH, 0_u64)
15873 .body(common::to_body::<String>(None));
15874
15875 client.request(request.unwrap()).await
15876 };
15877
15878 match req_result {
15879 Err(err) => {
15880 if let common::Retry::After(d) = dlg.http_error(&err) {
15881 sleep(d).await;
15882 continue;
15883 }
15884 dlg.finished(false);
15885 return Err(common::Error::HttpError(err));
15886 }
15887 Ok(res) => {
15888 let (mut parts, body) = res.into_parts();
15889 let mut body = common::Body::new(body);
15890 if !parts.status.is_success() {
15891 let bytes = common::to_bytes(body).await.unwrap_or_default();
15892 let error = serde_json::from_str(&common::to_string(&bytes));
15893 let response = common::to_response(parts, bytes.into());
15894
15895 if let common::Retry::After(d) =
15896 dlg.http_failure(&response, error.as_ref().ok())
15897 {
15898 sleep(d).await;
15899 continue;
15900 }
15901
15902 dlg.finished(false);
15903
15904 return Err(match error {
15905 Ok(value) => common::Error::BadRequest(value),
15906 _ => common::Error::Failure(response),
15907 });
15908 }
15909 let response = {
15910 let bytes = common::to_bytes(body).await.unwrap_or_default();
15911 let encoded = common::to_string(&bytes);
15912 match serde_json::from_str(&encoded) {
15913 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15914 Err(error) => {
15915 dlg.response_json_decode_error(&encoded, &error);
15916 return Err(common::Error::JsonDecodeError(
15917 encoded.to_string(),
15918 error,
15919 ));
15920 }
15921 }
15922 };
15923
15924 dlg.finished(true);
15925 return Ok(response);
15926 }
15927 }
15928 }
15929 }
15930
15931 /// Part of `name`. Required. Name of the Application resource to get. Example: apps/myapp.
15932 ///
15933 /// Sets the *apps id* path property to the given value.
15934 ///
15935 /// Even though the property as already been set when instantiating this call,
15936 /// we provide this method for API completeness.
15937 pub fn apps_id(mut self, new_value: &str) -> AppGetCall<'a, C> {
15938 self._apps_id = new_value.to_string();
15939 self
15940 }
15941 /// Options to include extra data
15942 ///
15943 /// Sets the *include extra data* query property to the given value.
15944 pub fn include_extra_data(mut self, new_value: &str) -> AppGetCall<'a, C> {
15945 self._include_extra_data = Some(new_value.to_string());
15946 self
15947 }
15948 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15949 /// while executing the actual API request.
15950 ///
15951 /// ````text
15952 /// It should be used to handle progress information, and to implement a certain level of resilience.
15953 /// ````
15954 ///
15955 /// Sets the *delegate* property to the given value.
15956 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppGetCall<'a, C> {
15957 self._delegate = Some(new_value);
15958 self
15959 }
15960
15961 /// Set any additional parameter of the query string used in the request.
15962 /// It should be used to set parameters which are not yet available through their own
15963 /// setters.
15964 ///
15965 /// Please note that this method must not be used to set any of the known parameters
15966 /// which have their own setter method. If done anyway, the request will fail.
15967 ///
15968 /// # Additional Parameters
15969 ///
15970 /// * *$.xgafv* (query-string) - V1 error format.
15971 /// * *access_token* (query-string) - OAuth access token.
15972 /// * *alt* (query-string) - Data format for response.
15973 /// * *callback* (query-string) - JSONP
15974 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15975 /// * *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.
15976 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15977 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15978 /// * *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.
15979 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15980 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15981 pub fn param<T>(mut self, name: T, value: T) -> AppGetCall<'a, C>
15982 where
15983 T: AsRef<str>,
15984 {
15985 self._additional_params
15986 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15987 self
15988 }
15989
15990 /// Identifies the authorization scope for the method you are building.
15991 ///
15992 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15993 /// [`Scope::CloudPlatformReadOnly`].
15994 ///
15995 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15996 /// tokens for more than one scope.
15997 ///
15998 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15999 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16000 /// sufficient, a read-write scope will do as well.
16001 pub fn add_scope<St>(mut self, scope: St) -> AppGetCall<'a, C>
16002 where
16003 St: AsRef<str>,
16004 {
16005 self._scopes.insert(String::from(scope.as_ref()));
16006 self
16007 }
16008 /// Identifies the authorization scope(s) for the method you are building.
16009 ///
16010 /// See [`Self::add_scope()`] for details.
16011 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppGetCall<'a, C>
16012 where
16013 I: IntoIterator<Item = St>,
16014 St: AsRef<str>,
16015 {
16016 self._scopes
16017 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16018 self
16019 }
16020
16021 /// Removes all scopes, and no default scope will be used either.
16022 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16023 /// for details).
16024 pub fn clear_scopes(mut self) -> AppGetCall<'a, C> {
16025 self._scopes.clear();
16026 self
16027 }
16028}
16029
16030/// Lists all the available runtimes for the application.
16031///
16032/// A builder for the *listRuntimes* method supported by a *app* resource.
16033/// It is not used directly, but through a [`AppMethods`] instance.
16034///
16035/// # Example
16036///
16037/// Instantiate a resource method builder
16038///
16039/// ```test_harness,no_run
16040/// # extern crate hyper;
16041/// # extern crate hyper_rustls;
16042/// # extern crate google_appengine1 as appengine1;
16043/// # async fn dox() {
16044/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16045///
16046/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16047/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16048/// # .with_native_roots()
16049/// # .unwrap()
16050/// # .https_only()
16051/// # .enable_http2()
16052/// # .build();
16053///
16054/// # let executor = hyper_util::rt::TokioExecutor::new();
16055/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16056/// # secret,
16057/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16058/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16059/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16060/// # ),
16061/// # ).build().await.unwrap();
16062///
16063/// # let client = hyper_util::client::legacy::Client::builder(
16064/// # hyper_util::rt::TokioExecutor::new()
16065/// # )
16066/// # .build(
16067/// # hyper_rustls::HttpsConnectorBuilder::new()
16068/// # .with_native_roots()
16069/// # .unwrap()
16070/// # .https_or_http()
16071/// # .enable_http2()
16072/// # .build()
16073/// # );
16074/// # let mut hub = Appengine::new(client, auth);
16075/// // You can configure optional parameters by calling the respective setters at will, and
16076/// // execute the final call using `doit()`.
16077/// // Values shown here are possibly random and not representative !
16078/// let result = hub.apps().list_runtimes("appsId")
16079/// .environment("et")
16080/// .doit().await;
16081/// # }
16082/// ```
16083pub struct AppListRuntimeCall<'a, C>
16084where
16085 C: 'a,
16086{
16087 hub: &'a Appengine<C>,
16088 _apps_id: String,
16089 _environment: Option<String>,
16090 _delegate: Option<&'a mut dyn common::Delegate>,
16091 _additional_params: HashMap<String, String>,
16092 _scopes: BTreeSet<String>,
16093}
16094
16095impl<'a, C> common::CallBuilder for AppListRuntimeCall<'a, C> {}
16096
16097impl<'a, C> AppListRuntimeCall<'a, C>
16098where
16099 C: common::Connector,
16100{
16101 /// Perform the operation you have build so far.
16102 pub async fn doit(mut self) -> common::Result<(common::Response, ListRuntimesResponse)> {
16103 use std::borrow::Cow;
16104 use std::io::{Read, Seek};
16105
16106 use common::{url::Params, ToParts};
16107 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16108
16109 let mut dd = common::DefaultDelegate;
16110 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16111 dlg.begin(common::MethodInfo {
16112 id: "appengine.apps.listRuntimes",
16113 http_method: hyper::Method::GET,
16114 });
16115
16116 for &field in ["alt", "appsId", "environment"].iter() {
16117 if self._additional_params.contains_key(field) {
16118 dlg.finished(false);
16119 return Err(common::Error::FieldClash(field));
16120 }
16121 }
16122
16123 let mut params = Params::with_capacity(4 + self._additional_params.len());
16124 params.push("appsId", self._apps_id);
16125 if let Some(value) = self._environment.as_ref() {
16126 params.push("environment", value);
16127 }
16128
16129 params.extend(self._additional_params.iter());
16130
16131 params.push("alt", "json");
16132 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}:listRuntimes";
16133 if self._scopes.is_empty() {
16134 self._scopes
16135 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
16136 }
16137
16138 #[allow(clippy::single_element_loop)]
16139 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
16140 url = params.uri_replacement(url, param_name, find_this, false);
16141 }
16142 {
16143 let to_remove = ["appsId"];
16144 params.remove_params(&to_remove);
16145 }
16146
16147 let url = params.parse_with_url(&url);
16148
16149 loop {
16150 let token = match self
16151 .hub
16152 .auth
16153 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16154 .await
16155 {
16156 Ok(token) => token,
16157 Err(e) => match dlg.token(e) {
16158 Ok(token) => token,
16159 Err(e) => {
16160 dlg.finished(false);
16161 return Err(common::Error::MissingToken(e));
16162 }
16163 },
16164 };
16165 let mut req_result = {
16166 let client = &self.hub.client;
16167 dlg.pre_request();
16168 let mut req_builder = hyper::Request::builder()
16169 .method(hyper::Method::GET)
16170 .uri(url.as_str())
16171 .header(USER_AGENT, self.hub._user_agent.clone());
16172
16173 if let Some(token) = token.as_ref() {
16174 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16175 }
16176
16177 let request = req_builder
16178 .header(CONTENT_LENGTH, 0_u64)
16179 .body(common::to_body::<String>(None));
16180
16181 client.request(request.unwrap()).await
16182 };
16183
16184 match req_result {
16185 Err(err) => {
16186 if let common::Retry::After(d) = dlg.http_error(&err) {
16187 sleep(d).await;
16188 continue;
16189 }
16190 dlg.finished(false);
16191 return Err(common::Error::HttpError(err));
16192 }
16193 Ok(res) => {
16194 let (mut parts, body) = res.into_parts();
16195 let mut body = common::Body::new(body);
16196 if !parts.status.is_success() {
16197 let bytes = common::to_bytes(body).await.unwrap_or_default();
16198 let error = serde_json::from_str(&common::to_string(&bytes));
16199 let response = common::to_response(parts, bytes.into());
16200
16201 if let common::Retry::After(d) =
16202 dlg.http_failure(&response, error.as_ref().ok())
16203 {
16204 sleep(d).await;
16205 continue;
16206 }
16207
16208 dlg.finished(false);
16209
16210 return Err(match error {
16211 Ok(value) => common::Error::BadRequest(value),
16212 _ => common::Error::Failure(response),
16213 });
16214 }
16215 let response = {
16216 let bytes = common::to_bytes(body).await.unwrap_or_default();
16217 let encoded = common::to_string(&bytes);
16218 match serde_json::from_str(&encoded) {
16219 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16220 Err(error) => {
16221 dlg.response_json_decode_error(&encoded, &error);
16222 return Err(common::Error::JsonDecodeError(
16223 encoded.to_string(),
16224 error,
16225 ));
16226 }
16227 }
16228 };
16229
16230 dlg.finished(true);
16231 return Ok(response);
16232 }
16233 }
16234 }
16235 }
16236
16237 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
16238 ///
16239 /// Sets the *apps id* path property to the given value.
16240 ///
16241 /// Even though the property as already been set when instantiating this call,
16242 /// we provide this method for API completeness.
16243 pub fn apps_id(mut self, new_value: &str) -> AppListRuntimeCall<'a, C> {
16244 self._apps_id = new_value.to_string();
16245 self
16246 }
16247 /// Optional. The environment of the Application.
16248 ///
16249 /// Sets the *environment* query property to the given value.
16250 pub fn environment(mut self, new_value: &str) -> AppListRuntimeCall<'a, C> {
16251 self._environment = Some(new_value.to_string());
16252 self
16253 }
16254 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16255 /// while executing the actual API request.
16256 ///
16257 /// ````text
16258 /// It should be used to handle progress information, and to implement a certain level of resilience.
16259 /// ````
16260 ///
16261 /// Sets the *delegate* property to the given value.
16262 pub fn delegate(
16263 mut self,
16264 new_value: &'a mut dyn common::Delegate,
16265 ) -> AppListRuntimeCall<'a, C> {
16266 self._delegate = Some(new_value);
16267 self
16268 }
16269
16270 /// Set any additional parameter of the query string used in the request.
16271 /// It should be used to set parameters which are not yet available through their own
16272 /// setters.
16273 ///
16274 /// Please note that this method must not be used to set any of the known parameters
16275 /// which have their own setter method. If done anyway, the request will fail.
16276 ///
16277 /// # Additional Parameters
16278 ///
16279 /// * *$.xgafv* (query-string) - V1 error format.
16280 /// * *access_token* (query-string) - OAuth access token.
16281 /// * *alt* (query-string) - Data format for response.
16282 /// * *callback* (query-string) - JSONP
16283 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16284 /// * *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.
16285 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16286 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16287 /// * *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.
16288 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16289 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16290 pub fn param<T>(mut self, name: T, value: T) -> AppListRuntimeCall<'a, C>
16291 where
16292 T: AsRef<str>,
16293 {
16294 self._additional_params
16295 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16296 self
16297 }
16298
16299 /// Identifies the authorization scope for the method you are building.
16300 ///
16301 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16302 /// [`Scope::CloudPlatformReadOnly`].
16303 ///
16304 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16305 /// tokens for more than one scope.
16306 ///
16307 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16308 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16309 /// sufficient, a read-write scope will do as well.
16310 pub fn add_scope<St>(mut self, scope: St) -> AppListRuntimeCall<'a, C>
16311 where
16312 St: AsRef<str>,
16313 {
16314 self._scopes.insert(String::from(scope.as_ref()));
16315 self
16316 }
16317 /// Identifies the authorization scope(s) for the method you are building.
16318 ///
16319 /// See [`Self::add_scope()`] for details.
16320 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppListRuntimeCall<'a, C>
16321 where
16322 I: IntoIterator<Item = St>,
16323 St: AsRef<str>,
16324 {
16325 self._scopes
16326 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16327 self
16328 }
16329
16330 /// Removes all scopes, and no default scope will be used either.
16331 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16332 /// for details).
16333 pub fn clear_scopes(mut self) -> AppListRuntimeCall<'a, C> {
16334 self._scopes.clear();
16335 self
16336 }
16337}
16338
16339/// Updates the specified Application resource. You can update the following fields: auth_domain - Google authentication domain for controlling user access to the application. default_cookie_expiration - Cookie expiration policy for the application. iap - Identity-Aware Proxy properties for the application.
16340///
16341/// A builder for the *patch* method supported by a *app* resource.
16342/// It is not used directly, but through a [`AppMethods`] instance.
16343///
16344/// # Example
16345///
16346/// Instantiate a resource method builder
16347///
16348/// ```test_harness,no_run
16349/// # extern crate hyper;
16350/// # extern crate hyper_rustls;
16351/// # extern crate google_appengine1 as appengine1;
16352/// use appengine1::api::Application;
16353/// # async fn dox() {
16354/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16355///
16356/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16357/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16358/// # .with_native_roots()
16359/// # .unwrap()
16360/// # .https_only()
16361/// # .enable_http2()
16362/// # .build();
16363///
16364/// # let executor = hyper_util::rt::TokioExecutor::new();
16365/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16366/// # secret,
16367/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16368/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16369/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16370/// # ),
16371/// # ).build().await.unwrap();
16372///
16373/// # let client = hyper_util::client::legacy::Client::builder(
16374/// # hyper_util::rt::TokioExecutor::new()
16375/// # )
16376/// # .build(
16377/// # hyper_rustls::HttpsConnectorBuilder::new()
16378/// # .with_native_roots()
16379/// # .unwrap()
16380/// # .https_or_http()
16381/// # .enable_http2()
16382/// # .build()
16383/// # );
16384/// # let mut hub = Appengine::new(client, auth);
16385/// // As the method needs a request, you would usually fill it with the desired information
16386/// // into the respective structure. Some of the parts shown here might not be applicable !
16387/// // Values shown here are possibly random and not representative !
16388/// let mut req = Application::default();
16389///
16390/// // You can configure optional parameters by calling the respective setters at will, and
16391/// // execute the final call using `doit()`.
16392/// // Values shown here are possibly random and not representative !
16393/// let result = hub.apps().patch(req, "appsId")
16394/// .update_mask(FieldMask::new::<&str>(&[]))
16395/// .doit().await;
16396/// # }
16397/// ```
16398pub struct AppPatchCall<'a, C>
16399where
16400 C: 'a,
16401{
16402 hub: &'a Appengine<C>,
16403 _request: Application,
16404 _apps_id: String,
16405 _update_mask: Option<common::FieldMask>,
16406 _delegate: Option<&'a mut dyn common::Delegate>,
16407 _additional_params: HashMap<String, String>,
16408 _scopes: BTreeSet<String>,
16409}
16410
16411impl<'a, C> common::CallBuilder for AppPatchCall<'a, C> {}
16412
16413impl<'a, C> AppPatchCall<'a, C>
16414where
16415 C: common::Connector,
16416{
16417 /// Perform the operation you have build so far.
16418 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16419 use std::borrow::Cow;
16420 use std::io::{Read, Seek};
16421
16422 use common::{url::Params, ToParts};
16423 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16424
16425 let mut dd = common::DefaultDelegate;
16426 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16427 dlg.begin(common::MethodInfo {
16428 id: "appengine.apps.patch",
16429 http_method: hyper::Method::PATCH,
16430 });
16431
16432 for &field in ["alt", "appsId", "updateMask"].iter() {
16433 if self._additional_params.contains_key(field) {
16434 dlg.finished(false);
16435 return Err(common::Error::FieldClash(field));
16436 }
16437 }
16438
16439 let mut params = Params::with_capacity(5 + self._additional_params.len());
16440 params.push("appsId", self._apps_id);
16441 if let Some(value) = self._update_mask.as_ref() {
16442 params.push("updateMask", value.to_string());
16443 }
16444
16445 params.extend(self._additional_params.iter());
16446
16447 params.push("alt", "json");
16448 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}";
16449 if self._scopes.is_empty() {
16450 self._scopes
16451 .insert(Scope::CloudPlatform.as_ref().to_string());
16452 }
16453
16454 #[allow(clippy::single_element_loop)]
16455 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
16456 url = params.uri_replacement(url, param_name, find_this, false);
16457 }
16458 {
16459 let to_remove = ["appsId"];
16460 params.remove_params(&to_remove);
16461 }
16462
16463 let url = params.parse_with_url(&url);
16464
16465 let mut json_mime_type = mime::APPLICATION_JSON;
16466 let mut request_value_reader = {
16467 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16468 common::remove_json_null_values(&mut value);
16469 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16470 serde_json::to_writer(&mut dst, &value).unwrap();
16471 dst
16472 };
16473 let request_size = request_value_reader
16474 .seek(std::io::SeekFrom::End(0))
16475 .unwrap();
16476 request_value_reader
16477 .seek(std::io::SeekFrom::Start(0))
16478 .unwrap();
16479
16480 loop {
16481 let token = match self
16482 .hub
16483 .auth
16484 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16485 .await
16486 {
16487 Ok(token) => token,
16488 Err(e) => match dlg.token(e) {
16489 Ok(token) => token,
16490 Err(e) => {
16491 dlg.finished(false);
16492 return Err(common::Error::MissingToken(e));
16493 }
16494 },
16495 };
16496 request_value_reader
16497 .seek(std::io::SeekFrom::Start(0))
16498 .unwrap();
16499 let mut req_result = {
16500 let client = &self.hub.client;
16501 dlg.pre_request();
16502 let mut req_builder = hyper::Request::builder()
16503 .method(hyper::Method::PATCH)
16504 .uri(url.as_str())
16505 .header(USER_AGENT, self.hub._user_agent.clone());
16506
16507 if let Some(token) = token.as_ref() {
16508 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16509 }
16510
16511 let request = req_builder
16512 .header(CONTENT_TYPE, json_mime_type.to_string())
16513 .header(CONTENT_LENGTH, request_size as u64)
16514 .body(common::to_body(
16515 request_value_reader.get_ref().clone().into(),
16516 ));
16517
16518 client.request(request.unwrap()).await
16519 };
16520
16521 match req_result {
16522 Err(err) => {
16523 if let common::Retry::After(d) = dlg.http_error(&err) {
16524 sleep(d).await;
16525 continue;
16526 }
16527 dlg.finished(false);
16528 return Err(common::Error::HttpError(err));
16529 }
16530 Ok(res) => {
16531 let (mut parts, body) = res.into_parts();
16532 let mut body = common::Body::new(body);
16533 if !parts.status.is_success() {
16534 let bytes = common::to_bytes(body).await.unwrap_or_default();
16535 let error = serde_json::from_str(&common::to_string(&bytes));
16536 let response = common::to_response(parts, bytes.into());
16537
16538 if let common::Retry::After(d) =
16539 dlg.http_failure(&response, error.as_ref().ok())
16540 {
16541 sleep(d).await;
16542 continue;
16543 }
16544
16545 dlg.finished(false);
16546
16547 return Err(match error {
16548 Ok(value) => common::Error::BadRequest(value),
16549 _ => common::Error::Failure(response),
16550 });
16551 }
16552 let response = {
16553 let bytes = common::to_bytes(body).await.unwrap_or_default();
16554 let encoded = common::to_string(&bytes);
16555 match serde_json::from_str(&encoded) {
16556 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16557 Err(error) => {
16558 dlg.response_json_decode_error(&encoded, &error);
16559 return Err(common::Error::JsonDecodeError(
16560 encoded.to_string(),
16561 error,
16562 ));
16563 }
16564 }
16565 };
16566
16567 dlg.finished(true);
16568 return Ok(response);
16569 }
16570 }
16571 }
16572 }
16573
16574 ///
16575 /// Sets the *request* property to the given value.
16576 ///
16577 /// Even though the property as already been set when instantiating this call,
16578 /// we provide this method for API completeness.
16579 pub fn request(mut self, new_value: Application) -> AppPatchCall<'a, C> {
16580 self._request = new_value;
16581 self
16582 }
16583 /// Part of `name`. Required. Name of the Application resource to update. Example: apps/myapp.
16584 ///
16585 /// Sets the *apps id* path property to the given value.
16586 ///
16587 /// Even though the property as already been set when instantiating this call,
16588 /// we provide this method for API completeness.
16589 pub fn apps_id(mut self, new_value: &str) -> AppPatchCall<'a, C> {
16590 self._apps_id = new_value.to_string();
16591 self
16592 }
16593 /// Required. Standard field mask for the set of fields to be updated.
16594 ///
16595 /// Sets the *update mask* query property to the given value.
16596 pub fn update_mask(mut self, new_value: common::FieldMask) -> AppPatchCall<'a, C> {
16597 self._update_mask = Some(new_value);
16598 self
16599 }
16600 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16601 /// while executing the actual API request.
16602 ///
16603 /// ````text
16604 /// It should be used to handle progress information, and to implement a certain level of resilience.
16605 /// ````
16606 ///
16607 /// Sets the *delegate* property to the given value.
16608 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppPatchCall<'a, C> {
16609 self._delegate = Some(new_value);
16610 self
16611 }
16612
16613 /// Set any additional parameter of the query string used in the request.
16614 /// It should be used to set parameters which are not yet available through their own
16615 /// setters.
16616 ///
16617 /// Please note that this method must not be used to set any of the known parameters
16618 /// which have their own setter method. If done anyway, the request will fail.
16619 ///
16620 /// # Additional Parameters
16621 ///
16622 /// * *$.xgafv* (query-string) - V1 error format.
16623 /// * *access_token* (query-string) - OAuth access token.
16624 /// * *alt* (query-string) - Data format for response.
16625 /// * *callback* (query-string) - JSONP
16626 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16627 /// * *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.
16628 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16629 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16630 /// * *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.
16631 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16632 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16633 pub fn param<T>(mut self, name: T, value: T) -> AppPatchCall<'a, C>
16634 where
16635 T: AsRef<str>,
16636 {
16637 self._additional_params
16638 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16639 self
16640 }
16641
16642 /// Identifies the authorization scope for the method you are building.
16643 ///
16644 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16645 /// [`Scope::CloudPlatform`].
16646 ///
16647 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16648 /// tokens for more than one scope.
16649 ///
16650 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16651 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16652 /// sufficient, a read-write scope will do as well.
16653 pub fn add_scope<St>(mut self, scope: St) -> AppPatchCall<'a, C>
16654 where
16655 St: AsRef<str>,
16656 {
16657 self._scopes.insert(String::from(scope.as_ref()));
16658 self
16659 }
16660 /// Identifies the authorization scope(s) for the method you are building.
16661 ///
16662 /// See [`Self::add_scope()`] for details.
16663 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppPatchCall<'a, C>
16664 where
16665 I: IntoIterator<Item = St>,
16666 St: AsRef<str>,
16667 {
16668 self._scopes
16669 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16670 self
16671 }
16672
16673 /// Removes all scopes, and no default scope will be used either.
16674 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16675 /// for details).
16676 pub fn clear_scopes(mut self) -> AppPatchCall<'a, C> {
16677 self._scopes.clear();
16678 self
16679 }
16680}
16681
16682/// Recreates the required App Engine features for the specified App Engine application, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example, Error retrieving the App Engine service account. If you have deleted your App Engine service account, this will not be able to recreate it. Instead, you should attempt to use the IAM undelete API if possible at https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete?apix_params=%7B"name"%3A"projects%2F-%2FserviceAccounts%2Funique_id"%2C"resource"%3A%7B%7D%7D . If the deletion was recent, the numeric ID can be found in the Cloud Console Activity Log.
16683///
16684/// A builder for the *repair* method supported by a *app* resource.
16685/// It is not used directly, but through a [`AppMethods`] instance.
16686///
16687/// # Example
16688///
16689/// Instantiate a resource method builder
16690///
16691/// ```test_harness,no_run
16692/// # extern crate hyper;
16693/// # extern crate hyper_rustls;
16694/// # extern crate google_appengine1 as appengine1;
16695/// use appengine1::api::RepairApplicationRequest;
16696/// # async fn dox() {
16697/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16698///
16699/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16700/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16701/// # .with_native_roots()
16702/// # .unwrap()
16703/// # .https_only()
16704/// # .enable_http2()
16705/// # .build();
16706///
16707/// # let executor = hyper_util::rt::TokioExecutor::new();
16708/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16709/// # secret,
16710/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16711/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16712/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16713/// # ),
16714/// # ).build().await.unwrap();
16715///
16716/// # let client = hyper_util::client::legacy::Client::builder(
16717/// # hyper_util::rt::TokioExecutor::new()
16718/// # )
16719/// # .build(
16720/// # hyper_rustls::HttpsConnectorBuilder::new()
16721/// # .with_native_roots()
16722/// # .unwrap()
16723/// # .https_or_http()
16724/// # .enable_http2()
16725/// # .build()
16726/// # );
16727/// # let mut hub = Appengine::new(client, auth);
16728/// // As the method needs a request, you would usually fill it with the desired information
16729/// // into the respective structure. Some of the parts shown here might not be applicable !
16730/// // Values shown here are possibly random and not representative !
16731/// let mut req = RepairApplicationRequest::default();
16732///
16733/// // You can configure optional parameters by calling the respective setters at will, and
16734/// // execute the final call using `doit()`.
16735/// // Values shown here are possibly random and not representative !
16736/// let result = hub.apps().repair(req, "appsId")
16737/// .doit().await;
16738/// # }
16739/// ```
16740pub struct AppRepairCall<'a, C>
16741where
16742 C: 'a,
16743{
16744 hub: &'a Appengine<C>,
16745 _request: RepairApplicationRequest,
16746 _apps_id: String,
16747 _delegate: Option<&'a mut dyn common::Delegate>,
16748 _additional_params: HashMap<String, String>,
16749 _scopes: BTreeSet<String>,
16750}
16751
16752impl<'a, C> common::CallBuilder for AppRepairCall<'a, C> {}
16753
16754impl<'a, C> AppRepairCall<'a, C>
16755where
16756 C: common::Connector,
16757{
16758 /// Perform the operation you have build so far.
16759 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16760 use std::borrow::Cow;
16761 use std::io::{Read, Seek};
16762
16763 use common::{url::Params, ToParts};
16764 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16765
16766 let mut dd = common::DefaultDelegate;
16767 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16768 dlg.begin(common::MethodInfo {
16769 id: "appengine.apps.repair",
16770 http_method: hyper::Method::POST,
16771 });
16772
16773 for &field in ["alt", "appsId"].iter() {
16774 if self._additional_params.contains_key(field) {
16775 dlg.finished(false);
16776 return Err(common::Error::FieldClash(field));
16777 }
16778 }
16779
16780 let mut params = Params::with_capacity(4 + self._additional_params.len());
16781 params.push("appsId", self._apps_id);
16782
16783 params.extend(self._additional_params.iter());
16784
16785 params.push("alt", "json");
16786 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}:repair";
16787 if self._scopes.is_empty() {
16788 self._scopes
16789 .insert(Scope::CloudPlatform.as_ref().to_string());
16790 }
16791
16792 #[allow(clippy::single_element_loop)]
16793 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
16794 url = params.uri_replacement(url, param_name, find_this, false);
16795 }
16796 {
16797 let to_remove = ["appsId"];
16798 params.remove_params(&to_remove);
16799 }
16800
16801 let url = params.parse_with_url(&url);
16802
16803 let mut json_mime_type = mime::APPLICATION_JSON;
16804 let mut request_value_reader = {
16805 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16806 common::remove_json_null_values(&mut value);
16807 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16808 serde_json::to_writer(&mut dst, &value).unwrap();
16809 dst
16810 };
16811 let request_size = request_value_reader
16812 .seek(std::io::SeekFrom::End(0))
16813 .unwrap();
16814 request_value_reader
16815 .seek(std::io::SeekFrom::Start(0))
16816 .unwrap();
16817
16818 loop {
16819 let token = match self
16820 .hub
16821 .auth
16822 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16823 .await
16824 {
16825 Ok(token) => token,
16826 Err(e) => match dlg.token(e) {
16827 Ok(token) => token,
16828 Err(e) => {
16829 dlg.finished(false);
16830 return Err(common::Error::MissingToken(e));
16831 }
16832 },
16833 };
16834 request_value_reader
16835 .seek(std::io::SeekFrom::Start(0))
16836 .unwrap();
16837 let mut req_result = {
16838 let client = &self.hub.client;
16839 dlg.pre_request();
16840 let mut req_builder = hyper::Request::builder()
16841 .method(hyper::Method::POST)
16842 .uri(url.as_str())
16843 .header(USER_AGENT, self.hub._user_agent.clone());
16844
16845 if let Some(token) = token.as_ref() {
16846 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16847 }
16848
16849 let request = req_builder
16850 .header(CONTENT_TYPE, json_mime_type.to_string())
16851 .header(CONTENT_LENGTH, request_size as u64)
16852 .body(common::to_body(
16853 request_value_reader.get_ref().clone().into(),
16854 ));
16855
16856 client.request(request.unwrap()).await
16857 };
16858
16859 match req_result {
16860 Err(err) => {
16861 if let common::Retry::After(d) = dlg.http_error(&err) {
16862 sleep(d).await;
16863 continue;
16864 }
16865 dlg.finished(false);
16866 return Err(common::Error::HttpError(err));
16867 }
16868 Ok(res) => {
16869 let (mut parts, body) = res.into_parts();
16870 let mut body = common::Body::new(body);
16871 if !parts.status.is_success() {
16872 let bytes = common::to_bytes(body).await.unwrap_or_default();
16873 let error = serde_json::from_str(&common::to_string(&bytes));
16874 let response = common::to_response(parts, bytes.into());
16875
16876 if let common::Retry::After(d) =
16877 dlg.http_failure(&response, error.as_ref().ok())
16878 {
16879 sleep(d).await;
16880 continue;
16881 }
16882
16883 dlg.finished(false);
16884
16885 return Err(match error {
16886 Ok(value) => common::Error::BadRequest(value),
16887 _ => common::Error::Failure(response),
16888 });
16889 }
16890 let response = {
16891 let bytes = common::to_bytes(body).await.unwrap_or_default();
16892 let encoded = common::to_string(&bytes);
16893 match serde_json::from_str(&encoded) {
16894 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16895 Err(error) => {
16896 dlg.response_json_decode_error(&encoded, &error);
16897 return Err(common::Error::JsonDecodeError(
16898 encoded.to_string(),
16899 error,
16900 ));
16901 }
16902 }
16903 };
16904
16905 dlg.finished(true);
16906 return Ok(response);
16907 }
16908 }
16909 }
16910 }
16911
16912 ///
16913 /// Sets the *request* property to the given value.
16914 ///
16915 /// Even though the property as already been set when instantiating this call,
16916 /// we provide this method for API completeness.
16917 pub fn request(mut self, new_value: RepairApplicationRequest) -> AppRepairCall<'a, C> {
16918 self._request = new_value;
16919 self
16920 }
16921 /// Part of `name`. Required. Name of the application to repair. Example: apps/myapp
16922 ///
16923 /// Sets the *apps id* path property to the given value.
16924 ///
16925 /// Even though the property as already been set when instantiating this call,
16926 /// we provide this method for API completeness.
16927 pub fn apps_id(mut self, new_value: &str) -> AppRepairCall<'a, C> {
16928 self._apps_id = new_value.to_string();
16929 self
16930 }
16931 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16932 /// while executing the actual API request.
16933 ///
16934 /// ````text
16935 /// It should be used to handle progress information, and to implement a certain level of resilience.
16936 /// ````
16937 ///
16938 /// Sets the *delegate* property to the given value.
16939 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppRepairCall<'a, C> {
16940 self._delegate = Some(new_value);
16941 self
16942 }
16943
16944 /// Set any additional parameter of the query string used in the request.
16945 /// It should be used to set parameters which are not yet available through their own
16946 /// setters.
16947 ///
16948 /// Please note that this method must not be used to set any of the known parameters
16949 /// which have their own setter method. If done anyway, the request will fail.
16950 ///
16951 /// # Additional Parameters
16952 ///
16953 /// * *$.xgafv* (query-string) - V1 error format.
16954 /// * *access_token* (query-string) - OAuth access token.
16955 /// * *alt* (query-string) - Data format for response.
16956 /// * *callback* (query-string) - JSONP
16957 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16958 /// * *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.
16959 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16960 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16961 /// * *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.
16962 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16963 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16964 pub fn param<T>(mut self, name: T, value: T) -> AppRepairCall<'a, C>
16965 where
16966 T: AsRef<str>,
16967 {
16968 self._additional_params
16969 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16970 self
16971 }
16972
16973 /// Identifies the authorization scope for the method you are building.
16974 ///
16975 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16976 /// [`Scope::CloudPlatform`].
16977 ///
16978 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16979 /// tokens for more than one scope.
16980 ///
16981 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16982 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16983 /// sufficient, a read-write scope will do as well.
16984 pub fn add_scope<St>(mut self, scope: St) -> AppRepairCall<'a, C>
16985 where
16986 St: AsRef<str>,
16987 {
16988 self._scopes.insert(String::from(scope.as_ref()));
16989 self
16990 }
16991 /// Identifies the authorization scope(s) for the method you are building.
16992 ///
16993 /// See [`Self::add_scope()`] for details.
16994 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppRepairCall<'a, C>
16995 where
16996 I: IntoIterator<Item = St>,
16997 St: AsRef<str>,
16998 {
16999 self._scopes
17000 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17001 self
17002 }
17003
17004 /// Removes all scopes, and no default scope will be used either.
17005 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17006 /// for details).
17007 pub fn clear_scopes(mut self) -> AppRepairCall<'a, C> {
17008 self._scopes.clear();
17009 self
17010 }
17011}
17012
17013/// Uploads the specified SSL certificate.
17014///
17015/// A builder for the *locations.applications.authorizedCertificates.create* method supported by a *project* resource.
17016/// It is not used directly, but through a [`ProjectMethods`] instance.
17017///
17018/// # Example
17019///
17020/// Instantiate a resource method builder
17021///
17022/// ```test_harness,no_run
17023/// # extern crate hyper;
17024/// # extern crate hyper_rustls;
17025/// # extern crate google_appengine1 as appengine1;
17026/// use appengine1::api::AuthorizedCertificate;
17027/// # async fn dox() {
17028/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17029///
17030/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17031/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17032/// # .with_native_roots()
17033/// # .unwrap()
17034/// # .https_only()
17035/// # .enable_http2()
17036/// # .build();
17037///
17038/// # let executor = hyper_util::rt::TokioExecutor::new();
17039/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17040/// # secret,
17041/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17042/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17043/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17044/// # ),
17045/// # ).build().await.unwrap();
17046///
17047/// # let client = hyper_util::client::legacy::Client::builder(
17048/// # hyper_util::rt::TokioExecutor::new()
17049/// # )
17050/// # .build(
17051/// # hyper_rustls::HttpsConnectorBuilder::new()
17052/// # .with_native_roots()
17053/// # .unwrap()
17054/// # .https_or_http()
17055/// # .enable_http2()
17056/// # .build()
17057/// # );
17058/// # let mut hub = Appengine::new(client, auth);
17059/// // As the method needs a request, you would usually fill it with the desired information
17060/// // into the respective structure. Some of the parts shown here might not be applicable !
17061/// // Values shown here are possibly random and not representative !
17062/// let mut req = AuthorizedCertificate::default();
17063///
17064/// // You can configure optional parameters by calling the respective setters at will, and
17065/// // execute the final call using `doit()`.
17066/// // Values shown here are possibly random and not representative !
17067/// let result = hub.projects().locations_applications_authorized_certificates_create(req, "projectsId", "locationsId", "applicationsId")
17068/// .doit().await;
17069/// # }
17070/// ```
17071pub struct ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C>
17072where
17073 C: 'a,
17074{
17075 hub: &'a Appengine<C>,
17076 _request: AuthorizedCertificate,
17077 _projects_id: String,
17078 _locations_id: String,
17079 _applications_id: String,
17080 _delegate: Option<&'a mut dyn common::Delegate>,
17081 _additional_params: HashMap<String, String>,
17082 _scopes: BTreeSet<String>,
17083}
17084
17085impl<'a, C> common::CallBuilder
17086 for ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C>
17087{
17088}
17089
17090impl<'a, C> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C>
17091where
17092 C: common::Connector,
17093{
17094 /// Perform the operation you have build so far.
17095 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
17096 use std::borrow::Cow;
17097 use std::io::{Read, Seek};
17098
17099 use common::{url::Params, ToParts};
17100 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17101
17102 let mut dd = common::DefaultDelegate;
17103 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17104 dlg.begin(common::MethodInfo {
17105 id: "appengine.projects.locations.applications.authorizedCertificates.create",
17106 http_method: hyper::Method::POST,
17107 });
17108
17109 for &field in ["alt", "projectsId", "locationsId", "applicationsId"].iter() {
17110 if self._additional_params.contains_key(field) {
17111 dlg.finished(false);
17112 return Err(common::Error::FieldClash(field));
17113 }
17114 }
17115
17116 let mut params = Params::with_capacity(6 + self._additional_params.len());
17117 params.push("projectsId", self._projects_id);
17118 params.push("locationsId", self._locations_id);
17119 params.push("applicationsId", self._applications_id);
17120
17121 params.extend(self._additional_params.iter());
17122
17123 params.push("alt", "json");
17124 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/authorizedCertificates";
17125 if self._scopes.is_empty() {
17126 self._scopes
17127 .insert(Scope::CloudPlatform.as_ref().to_string());
17128 }
17129
17130 #[allow(clippy::single_element_loop)]
17131 for &(find_this, param_name) in [
17132 ("{projectsId}", "projectsId"),
17133 ("{locationsId}", "locationsId"),
17134 ("{applicationsId}", "applicationsId"),
17135 ]
17136 .iter()
17137 {
17138 url = params.uri_replacement(url, param_name, find_this, false);
17139 }
17140 {
17141 let to_remove = ["applicationsId", "locationsId", "projectsId"];
17142 params.remove_params(&to_remove);
17143 }
17144
17145 let url = params.parse_with_url(&url);
17146
17147 let mut json_mime_type = mime::APPLICATION_JSON;
17148 let mut request_value_reader = {
17149 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17150 common::remove_json_null_values(&mut value);
17151 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17152 serde_json::to_writer(&mut dst, &value).unwrap();
17153 dst
17154 };
17155 let request_size = request_value_reader
17156 .seek(std::io::SeekFrom::End(0))
17157 .unwrap();
17158 request_value_reader
17159 .seek(std::io::SeekFrom::Start(0))
17160 .unwrap();
17161
17162 loop {
17163 let token = match self
17164 .hub
17165 .auth
17166 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17167 .await
17168 {
17169 Ok(token) => token,
17170 Err(e) => match dlg.token(e) {
17171 Ok(token) => token,
17172 Err(e) => {
17173 dlg.finished(false);
17174 return Err(common::Error::MissingToken(e));
17175 }
17176 },
17177 };
17178 request_value_reader
17179 .seek(std::io::SeekFrom::Start(0))
17180 .unwrap();
17181 let mut req_result = {
17182 let client = &self.hub.client;
17183 dlg.pre_request();
17184 let mut req_builder = hyper::Request::builder()
17185 .method(hyper::Method::POST)
17186 .uri(url.as_str())
17187 .header(USER_AGENT, self.hub._user_agent.clone());
17188
17189 if let Some(token) = token.as_ref() {
17190 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17191 }
17192
17193 let request = req_builder
17194 .header(CONTENT_TYPE, json_mime_type.to_string())
17195 .header(CONTENT_LENGTH, request_size as u64)
17196 .body(common::to_body(
17197 request_value_reader.get_ref().clone().into(),
17198 ));
17199
17200 client.request(request.unwrap()).await
17201 };
17202
17203 match req_result {
17204 Err(err) => {
17205 if let common::Retry::After(d) = dlg.http_error(&err) {
17206 sleep(d).await;
17207 continue;
17208 }
17209 dlg.finished(false);
17210 return Err(common::Error::HttpError(err));
17211 }
17212 Ok(res) => {
17213 let (mut parts, body) = res.into_parts();
17214 let mut body = common::Body::new(body);
17215 if !parts.status.is_success() {
17216 let bytes = common::to_bytes(body).await.unwrap_or_default();
17217 let error = serde_json::from_str(&common::to_string(&bytes));
17218 let response = common::to_response(parts, bytes.into());
17219
17220 if let common::Retry::After(d) =
17221 dlg.http_failure(&response, error.as_ref().ok())
17222 {
17223 sleep(d).await;
17224 continue;
17225 }
17226
17227 dlg.finished(false);
17228
17229 return Err(match error {
17230 Ok(value) => common::Error::BadRequest(value),
17231 _ => common::Error::Failure(response),
17232 });
17233 }
17234 let response = {
17235 let bytes = common::to_bytes(body).await.unwrap_or_default();
17236 let encoded = common::to_string(&bytes);
17237 match serde_json::from_str(&encoded) {
17238 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17239 Err(error) => {
17240 dlg.response_json_decode_error(&encoded, &error);
17241 return Err(common::Error::JsonDecodeError(
17242 encoded.to_string(),
17243 error,
17244 ));
17245 }
17246 }
17247 };
17248
17249 dlg.finished(true);
17250 return Ok(response);
17251 }
17252 }
17253 }
17254 }
17255
17256 ///
17257 /// Sets the *request* property to the given value.
17258 ///
17259 /// Even though the property as already been set when instantiating this call,
17260 /// we provide this method for API completeness.
17261 pub fn request(
17262 mut self,
17263 new_value: AuthorizedCertificate,
17264 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C> {
17265 self._request = new_value;
17266 self
17267 }
17268 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
17269 ///
17270 /// Sets the *projects id* path property to the given value.
17271 ///
17272 /// Even though the property as already been set when instantiating this call,
17273 /// we provide this method for API completeness.
17274 pub fn projects_id(
17275 mut self,
17276 new_value: &str,
17277 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C> {
17278 self._projects_id = new_value.to_string();
17279 self
17280 }
17281 /// Part of `parent`. See documentation of `projectsId`.
17282 ///
17283 /// Sets the *locations id* path property to the given value.
17284 ///
17285 /// Even though the property as already been set when instantiating this call,
17286 /// we provide this method for API completeness.
17287 pub fn locations_id(
17288 mut self,
17289 new_value: &str,
17290 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C> {
17291 self._locations_id = new_value.to_string();
17292 self
17293 }
17294 /// Part of `parent`. See documentation of `projectsId`.
17295 ///
17296 /// Sets the *applications id* path property to the given value.
17297 ///
17298 /// Even though the property as already been set when instantiating this call,
17299 /// we provide this method for API completeness.
17300 pub fn applications_id(
17301 mut self,
17302 new_value: &str,
17303 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C> {
17304 self._applications_id = new_value.to_string();
17305 self
17306 }
17307 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17308 /// while executing the actual API request.
17309 ///
17310 /// ````text
17311 /// It should be used to handle progress information, and to implement a certain level of resilience.
17312 /// ````
17313 ///
17314 /// Sets the *delegate* property to the given value.
17315 pub fn delegate(
17316 mut self,
17317 new_value: &'a mut dyn common::Delegate,
17318 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C> {
17319 self._delegate = Some(new_value);
17320 self
17321 }
17322
17323 /// Set any additional parameter of the query string used in the request.
17324 /// It should be used to set parameters which are not yet available through their own
17325 /// setters.
17326 ///
17327 /// Please note that this method must not be used to set any of the known parameters
17328 /// which have their own setter method. If done anyway, the request will fail.
17329 ///
17330 /// # Additional Parameters
17331 ///
17332 /// * *$.xgafv* (query-string) - V1 error format.
17333 /// * *access_token* (query-string) - OAuth access token.
17334 /// * *alt* (query-string) - Data format for response.
17335 /// * *callback* (query-string) - JSONP
17336 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17337 /// * *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.
17338 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17339 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17340 /// * *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.
17341 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17342 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17343 pub fn param<T>(
17344 mut self,
17345 name: T,
17346 value: T,
17347 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C>
17348 where
17349 T: AsRef<str>,
17350 {
17351 self._additional_params
17352 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17353 self
17354 }
17355
17356 /// Identifies the authorization scope for the method you are building.
17357 ///
17358 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17359 /// [`Scope::CloudPlatform`].
17360 ///
17361 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17362 /// tokens for more than one scope.
17363 ///
17364 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17365 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17366 /// sufficient, a read-write scope will do as well.
17367 pub fn add_scope<St>(
17368 mut self,
17369 scope: St,
17370 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C>
17371 where
17372 St: AsRef<str>,
17373 {
17374 self._scopes.insert(String::from(scope.as_ref()));
17375 self
17376 }
17377 /// Identifies the authorization scope(s) for the method you are building.
17378 ///
17379 /// See [`Self::add_scope()`] for details.
17380 pub fn add_scopes<I, St>(
17381 mut self,
17382 scopes: I,
17383 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C>
17384 where
17385 I: IntoIterator<Item = St>,
17386 St: AsRef<str>,
17387 {
17388 self._scopes
17389 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17390 self
17391 }
17392
17393 /// Removes all scopes, and no default scope will be used either.
17394 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17395 /// for details).
17396 pub fn clear_scopes(
17397 mut self,
17398 ) -> ProjectLocationApplicationAuthorizedCertificateCreateCall<'a, C> {
17399 self._scopes.clear();
17400 self
17401 }
17402}
17403
17404/// Deletes the specified SSL certificate.
17405///
17406/// A builder for the *locations.applications.authorizedCertificates.delete* method supported by a *project* resource.
17407/// It is not used directly, but through a [`ProjectMethods`] instance.
17408///
17409/// # Example
17410///
17411/// Instantiate a resource method builder
17412///
17413/// ```test_harness,no_run
17414/// # extern crate hyper;
17415/// # extern crate hyper_rustls;
17416/// # extern crate google_appengine1 as appengine1;
17417/// # async fn dox() {
17418/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17419///
17420/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17421/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17422/// # .with_native_roots()
17423/// # .unwrap()
17424/// # .https_only()
17425/// # .enable_http2()
17426/// # .build();
17427///
17428/// # let executor = hyper_util::rt::TokioExecutor::new();
17429/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17430/// # secret,
17431/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17432/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17433/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17434/// # ),
17435/// # ).build().await.unwrap();
17436///
17437/// # let client = hyper_util::client::legacy::Client::builder(
17438/// # hyper_util::rt::TokioExecutor::new()
17439/// # )
17440/// # .build(
17441/// # hyper_rustls::HttpsConnectorBuilder::new()
17442/// # .with_native_roots()
17443/// # .unwrap()
17444/// # .https_or_http()
17445/// # .enable_http2()
17446/// # .build()
17447/// # );
17448/// # let mut hub = Appengine::new(client, auth);
17449/// // You can configure optional parameters by calling the respective setters at will, and
17450/// // execute the final call using `doit()`.
17451/// // Values shown here are possibly random and not representative !
17452/// let result = hub.projects().locations_applications_authorized_certificates_delete("projectsId", "locationsId", "applicationsId", "authorizedCertificatesId")
17453/// .doit().await;
17454/// # }
17455/// ```
17456pub struct ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C>
17457where
17458 C: 'a,
17459{
17460 hub: &'a Appengine<C>,
17461 _projects_id: String,
17462 _locations_id: String,
17463 _applications_id: String,
17464 _authorized_certificates_id: String,
17465 _delegate: Option<&'a mut dyn common::Delegate>,
17466 _additional_params: HashMap<String, String>,
17467 _scopes: BTreeSet<String>,
17468}
17469
17470impl<'a, C> common::CallBuilder
17471 for ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C>
17472{
17473}
17474
17475impl<'a, C> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C>
17476where
17477 C: common::Connector,
17478{
17479 /// Perform the operation you have build so far.
17480 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
17481 use std::borrow::Cow;
17482 use std::io::{Read, Seek};
17483
17484 use common::{url::Params, ToParts};
17485 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17486
17487 let mut dd = common::DefaultDelegate;
17488 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17489 dlg.begin(common::MethodInfo {
17490 id: "appengine.projects.locations.applications.authorizedCertificates.delete",
17491 http_method: hyper::Method::DELETE,
17492 });
17493
17494 for &field in [
17495 "alt",
17496 "projectsId",
17497 "locationsId",
17498 "applicationsId",
17499 "authorizedCertificatesId",
17500 ]
17501 .iter()
17502 {
17503 if self._additional_params.contains_key(field) {
17504 dlg.finished(false);
17505 return Err(common::Error::FieldClash(field));
17506 }
17507 }
17508
17509 let mut params = Params::with_capacity(6 + self._additional_params.len());
17510 params.push("projectsId", self._projects_id);
17511 params.push("locationsId", self._locations_id);
17512 params.push("applicationsId", self._applications_id);
17513 params.push("authorizedCertificatesId", self._authorized_certificates_id);
17514
17515 params.extend(self._additional_params.iter());
17516
17517 params.push("alt", "json");
17518 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/authorizedCertificates/{authorizedCertificatesId}";
17519 if self._scopes.is_empty() {
17520 self._scopes
17521 .insert(Scope::CloudPlatform.as_ref().to_string());
17522 }
17523
17524 #[allow(clippy::single_element_loop)]
17525 for &(find_this, param_name) in [
17526 ("{projectsId}", "projectsId"),
17527 ("{locationsId}", "locationsId"),
17528 ("{applicationsId}", "applicationsId"),
17529 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
17530 ]
17531 .iter()
17532 {
17533 url = params.uri_replacement(url, param_name, find_this, false);
17534 }
17535 {
17536 let to_remove = [
17537 "authorizedCertificatesId",
17538 "applicationsId",
17539 "locationsId",
17540 "projectsId",
17541 ];
17542 params.remove_params(&to_remove);
17543 }
17544
17545 let url = params.parse_with_url(&url);
17546
17547 loop {
17548 let token = match self
17549 .hub
17550 .auth
17551 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17552 .await
17553 {
17554 Ok(token) => token,
17555 Err(e) => match dlg.token(e) {
17556 Ok(token) => token,
17557 Err(e) => {
17558 dlg.finished(false);
17559 return Err(common::Error::MissingToken(e));
17560 }
17561 },
17562 };
17563 let mut req_result = {
17564 let client = &self.hub.client;
17565 dlg.pre_request();
17566 let mut req_builder = hyper::Request::builder()
17567 .method(hyper::Method::DELETE)
17568 .uri(url.as_str())
17569 .header(USER_AGENT, self.hub._user_agent.clone());
17570
17571 if let Some(token) = token.as_ref() {
17572 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17573 }
17574
17575 let request = req_builder
17576 .header(CONTENT_LENGTH, 0_u64)
17577 .body(common::to_body::<String>(None));
17578
17579 client.request(request.unwrap()).await
17580 };
17581
17582 match req_result {
17583 Err(err) => {
17584 if let common::Retry::After(d) = dlg.http_error(&err) {
17585 sleep(d).await;
17586 continue;
17587 }
17588 dlg.finished(false);
17589 return Err(common::Error::HttpError(err));
17590 }
17591 Ok(res) => {
17592 let (mut parts, body) = res.into_parts();
17593 let mut body = common::Body::new(body);
17594 if !parts.status.is_success() {
17595 let bytes = common::to_bytes(body).await.unwrap_or_default();
17596 let error = serde_json::from_str(&common::to_string(&bytes));
17597 let response = common::to_response(parts, bytes.into());
17598
17599 if let common::Retry::After(d) =
17600 dlg.http_failure(&response, error.as_ref().ok())
17601 {
17602 sleep(d).await;
17603 continue;
17604 }
17605
17606 dlg.finished(false);
17607
17608 return Err(match error {
17609 Ok(value) => common::Error::BadRequest(value),
17610 _ => common::Error::Failure(response),
17611 });
17612 }
17613 let response = {
17614 let bytes = common::to_bytes(body).await.unwrap_or_default();
17615 let encoded = common::to_string(&bytes);
17616 match serde_json::from_str(&encoded) {
17617 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17618 Err(error) => {
17619 dlg.response_json_decode_error(&encoded, &error);
17620 return Err(common::Error::JsonDecodeError(
17621 encoded.to_string(),
17622 error,
17623 ));
17624 }
17625 }
17626 };
17627
17628 dlg.finished(true);
17629 return Ok(response);
17630 }
17631 }
17632 }
17633 }
17634
17635 /// Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345.
17636 ///
17637 /// Sets the *projects id* path property to the given value.
17638 ///
17639 /// Even though the property as already been set when instantiating this call,
17640 /// we provide this method for API completeness.
17641 pub fn projects_id(
17642 mut self,
17643 new_value: &str,
17644 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C> {
17645 self._projects_id = new_value.to_string();
17646 self
17647 }
17648 /// Part of `name`. See documentation of `projectsId`.
17649 ///
17650 /// Sets the *locations id* path property to the given value.
17651 ///
17652 /// Even though the property as already been set when instantiating this call,
17653 /// we provide this method for API completeness.
17654 pub fn locations_id(
17655 mut self,
17656 new_value: &str,
17657 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C> {
17658 self._locations_id = new_value.to_string();
17659 self
17660 }
17661 /// Part of `name`. See documentation of `projectsId`.
17662 ///
17663 /// Sets the *applications id* path property to the given value.
17664 ///
17665 /// Even though the property as already been set when instantiating this call,
17666 /// we provide this method for API completeness.
17667 pub fn applications_id(
17668 mut self,
17669 new_value: &str,
17670 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C> {
17671 self._applications_id = new_value.to_string();
17672 self
17673 }
17674 /// Part of `name`. See documentation of `projectsId`.
17675 ///
17676 /// Sets the *authorized certificates id* path property to the given value.
17677 ///
17678 /// Even though the property as already been set when instantiating this call,
17679 /// we provide this method for API completeness.
17680 pub fn authorized_certificates_id(
17681 mut self,
17682 new_value: &str,
17683 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C> {
17684 self._authorized_certificates_id = new_value.to_string();
17685 self
17686 }
17687 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17688 /// while executing the actual API request.
17689 ///
17690 /// ````text
17691 /// It should be used to handle progress information, and to implement a certain level of resilience.
17692 /// ````
17693 ///
17694 /// Sets the *delegate* property to the given value.
17695 pub fn delegate(
17696 mut self,
17697 new_value: &'a mut dyn common::Delegate,
17698 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C> {
17699 self._delegate = Some(new_value);
17700 self
17701 }
17702
17703 /// Set any additional parameter of the query string used in the request.
17704 /// It should be used to set parameters which are not yet available through their own
17705 /// setters.
17706 ///
17707 /// Please note that this method must not be used to set any of the known parameters
17708 /// which have their own setter method. If done anyway, the request will fail.
17709 ///
17710 /// # Additional Parameters
17711 ///
17712 /// * *$.xgafv* (query-string) - V1 error format.
17713 /// * *access_token* (query-string) - OAuth access token.
17714 /// * *alt* (query-string) - Data format for response.
17715 /// * *callback* (query-string) - JSONP
17716 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17717 /// * *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.
17718 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17719 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17720 /// * *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.
17721 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17722 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17723 pub fn param<T>(
17724 mut self,
17725 name: T,
17726 value: T,
17727 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C>
17728 where
17729 T: AsRef<str>,
17730 {
17731 self._additional_params
17732 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17733 self
17734 }
17735
17736 /// Identifies the authorization scope for the method you are building.
17737 ///
17738 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17739 /// [`Scope::CloudPlatform`].
17740 ///
17741 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17742 /// tokens for more than one scope.
17743 ///
17744 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17745 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17746 /// sufficient, a read-write scope will do as well.
17747 pub fn add_scope<St>(
17748 mut self,
17749 scope: St,
17750 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C>
17751 where
17752 St: AsRef<str>,
17753 {
17754 self._scopes.insert(String::from(scope.as_ref()));
17755 self
17756 }
17757 /// Identifies the authorization scope(s) for the method you are building.
17758 ///
17759 /// See [`Self::add_scope()`] for details.
17760 pub fn add_scopes<I, St>(
17761 mut self,
17762 scopes: I,
17763 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C>
17764 where
17765 I: IntoIterator<Item = St>,
17766 St: AsRef<str>,
17767 {
17768 self._scopes
17769 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17770 self
17771 }
17772
17773 /// Removes all scopes, and no default scope will be used either.
17774 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17775 /// for details).
17776 pub fn clear_scopes(
17777 mut self,
17778 ) -> ProjectLocationApplicationAuthorizedCertificateDeleteCall<'a, C> {
17779 self._scopes.clear();
17780 self
17781 }
17782}
17783
17784/// Gets the specified SSL certificate.
17785///
17786/// A builder for the *locations.applications.authorizedCertificates.get* method supported by a *project* resource.
17787/// It is not used directly, but through a [`ProjectMethods`] instance.
17788///
17789/// # Example
17790///
17791/// Instantiate a resource method builder
17792///
17793/// ```test_harness,no_run
17794/// # extern crate hyper;
17795/// # extern crate hyper_rustls;
17796/// # extern crate google_appengine1 as appengine1;
17797/// # async fn dox() {
17798/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17799///
17800/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17801/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17802/// # .with_native_roots()
17803/// # .unwrap()
17804/// # .https_only()
17805/// # .enable_http2()
17806/// # .build();
17807///
17808/// # let executor = hyper_util::rt::TokioExecutor::new();
17809/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17810/// # secret,
17811/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17812/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17813/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17814/// # ),
17815/// # ).build().await.unwrap();
17816///
17817/// # let client = hyper_util::client::legacy::Client::builder(
17818/// # hyper_util::rt::TokioExecutor::new()
17819/// # )
17820/// # .build(
17821/// # hyper_rustls::HttpsConnectorBuilder::new()
17822/// # .with_native_roots()
17823/// # .unwrap()
17824/// # .https_or_http()
17825/// # .enable_http2()
17826/// # .build()
17827/// # );
17828/// # let mut hub = Appengine::new(client, auth);
17829/// // You can configure optional parameters by calling the respective setters at will, and
17830/// // execute the final call using `doit()`.
17831/// // Values shown here are possibly random and not representative !
17832/// let result = hub.projects().locations_applications_authorized_certificates_get("projectsId", "locationsId", "applicationsId", "authorizedCertificatesId")
17833/// .view("et")
17834/// .doit().await;
17835/// # }
17836/// ```
17837pub struct ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C>
17838where
17839 C: 'a,
17840{
17841 hub: &'a Appengine<C>,
17842 _projects_id: String,
17843 _locations_id: String,
17844 _applications_id: String,
17845 _authorized_certificates_id: String,
17846 _view: Option<String>,
17847 _delegate: Option<&'a mut dyn common::Delegate>,
17848 _additional_params: HashMap<String, String>,
17849 _scopes: BTreeSet<String>,
17850}
17851
17852impl<'a, C> common::CallBuilder for ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {}
17853
17854impl<'a, C> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C>
17855where
17856 C: common::Connector,
17857{
17858 /// Perform the operation you have build so far.
17859 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
17860 use std::borrow::Cow;
17861 use std::io::{Read, Seek};
17862
17863 use common::{url::Params, ToParts};
17864 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17865
17866 let mut dd = common::DefaultDelegate;
17867 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17868 dlg.begin(common::MethodInfo {
17869 id: "appengine.projects.locations.applications.authorizedCertificates.get",
17870 http_method: hyper::Method::GET,
17871 });
17872
17873 for &field in [
17874 "alt",
17875 "projectsId",
17876 "locationsId",
17877 "applicationsId",
17878 "authorizedCertificatesId",
17879 "view",
17880 ]
17881 .iter()
17882 {
17883 if self._additional_params.contains_key(field) {
17884 dlg.finished(false);
17885 return Err(common::Error::FieldClash(field));
17886 }
17887 }
17888
17889 let mut params = Params::with_capacity(7 + self._additional_params.len());
17890 params.push("projectsId", self._projects_id);
17891 params.push("locationsId", self._locations_id);
17892 params.push("applicationsId", self._applications_id);
17893 params.push("authorizedCertificatesId", self._authorized_certificates_id);
17894 if let Some(value) = self._view.as_ref() {
17895 params.push("view", value);
17896 }
17897
17898 params.extend(self._additional_params.iter());
17899
17900 params.push("alt", "json");
17901 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/authorizedCertificates/{authorizedCertificatesId}";
17902 if self._scopes.is_empty() {
17903 self._scopes
17904 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
17905 }
17906
17907 #[allow(clippy::single_element_loop)]
17908 for &(find_this, param_name) in [
17909 ("{projectsId}", "projectsId"),
17910 ("{locationsId}", "locationsId"),
17911 ("{applicationsId}", "applicationsId"),
17912 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
17913 ]
17914 .iter()
17915 {
17916 url = params.uri_replacement(url, param_name, find_this, false);
17917 }
17918 {
17919 let to_remove = [
17920 "authorizedCertificatesId",
17921 "applicationsId",
17922 "locationsId",
17923 "projectsId",
17924 ];
17925 params.remove_params(&to_remove);
17926 }
17927
17928 let url = params.parse_with_url(&url);
17929
17930 loop {
17931 let token = match self
17932 .hub
17933 .auth
17934 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17935 .await
17936 {
17937 Ok(token) => token,
17938 Err(e) => match dlg.token(e) {
17939 Ok(token) => token,
17940 Err(e) => {
17941 dlg.finished(false);
17942 return Err(common::Error::MissingToken(e));
17943 }
17944 },
17945 };
17946 let mut req_result = {
17947 let client = &self.hub.client;
17948 dlg.pre_request();
17949 let mut req_builder = hyper::Request::builder()
17950 .method(hyper::Method::GET)
17951 .uri(url.as_str())
17952 .header(USER_AGENT, self.hub._user_agent.clone());
17953
17954 if let Some(token) = token.as_ref() {
17955 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17956 }
17957
17958 let request = req_builder
17959 .header(CONTENT_LENGTH, 0_u64)
17960 .body(common::to_body::<String>(None));
17961
17962 client.request(request.unwrap()).await
17963 };
17964
17965 match req_result {
17966 Err(err) => {
17967 if let common::Retry::After(d) = dlg.http_error(&err) {
17968 sleep(d).await;
17969 continue;
17970 }
17971 dlg.finished(false);
17972 return Err(common::Error::HttpError(err));
17973 }
17974 Ok(res) => {
17975 let (mut parts, body) = res.into_parts();
17976 let mut body = common::Body::new(body);
17977 if !parts.status.is_success() {
17978 let bytes = common::to_bytes(body).await.unwrap_or_default();
17979 let error = serde_json::from_str(&common::to_string(&bytes));
17980 let response = common::to_response(parts, bytes.into());
17981
17982 if let common::Retry::After(d) =
17983 dlg.http_failure(&response, error.as_ref().ok())
17984 {
17985 sleep(d).await;
17986 continue;
17987 }
17988
17989 dlg.finished(false);
17990
17991 return Err(match error {
17992 Ok(value) => common::Error::BadRequest(value),
17993 _ => common::Error::Failure(response),
17994 });
17995 }
17996 let response = {
17997 let bytes = common::to_bytes(body).await.unwrap_or_default();
17998 let encoded = common::to_string(&bytes);
17999 match serde_json::from_str(&encoded) {
18000 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18001 Err(error) => {
18002 dlg.response_json_decode_error(&encoded, &error);
18003 return Err(common::Error::JsonDecodeError(
18004 encoded.to_string(),
18005 error,
18006 ));
18007 }
18008 }
18009 };
18010
18011 dlg.finished(true);
18012 return Ok(response);
18013 }
18014 }
18015 }
18016 }
18017
18018 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345.
18019 ///
18020 /// Sets the *projects id* path property to the given value.
18021 ///
18022 /// Even though the property as already been set when instantiating this call,
18023 /// we provide this method for API completeness.
18024 pub fn projects_id(
18025 mut self,
18026 new_value: &str,
18027 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
18028 self._projects_id = new_value.to_string();
18029 self
18030 }
18031 /// Part of `name`. See documentation of `projectsId`.
18032 ///
18033 /// Sets the *locations id* path property to the given value.
18034 ///
18035 /// Even though the property as already been set when instantiating this call,
18036 /// we provide this method for API completeness.
18037 pub fn locations_id(
18038 mut self,
18039 new_value: &str,
18040 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
18041 self._locations_id = new_value.to_string();
18042 self
18043 }
18044 /// Part of `name`. See documentation of `projectsId`.
18045 ///
18046 /// Sets the *applications id* path property to the given value.
18047 ///
18048 /// Even though the property as already been set when instantiating this call,
18049 /// we provide this method for API completeness.
18050 pub fn applications_id(
18051 mut self,
18052 new_value: &str,
18053 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
18054 self._applications_id = new_value.to_string();
18055 self
18056 }
18057 /// Part of `name`. See documentation of `projectsId`.
18058 ///
18059 /// Sets the *authorized certificates id* path property to the given value.
18060 ///
18061 /// Even though the property as already been set when instantiating this call,
18062 /// we provide this method for API completeness.
18063 pub fn authorized_certificates_id(
18064 mut self,
18065 new_value: &str,
18066 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
18067 self._authorized_certificates_id = new_value.to_string();
18068 self
18069 }
18070 /// Controls the set of fields returned in the GET response.
18071 ///
18072 /// Sets the *view* query property to the given value.
18073 pub fn view(
18074 mut self,
18075 new_value: &str,
18076 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
18077 self._view = Some(new_value.to_string());
18078 self
18079 }
18080 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18081 /// while executing the actual API request.
18082 ///
18083 /// ````text
18084 /// It should be used to handle progress information, and to implement a certain level of resilience.
18085 /// ````
18086 ///
18087 /// Sets the *delegate* property to the given value.
18088 pub fn delegate(
18089 mut self,
18090 new_value: &'a mut dyn common::Delegate,
18091 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
18092 self._delegate = Some(new_value);
18093 self
18094 }
18095
18096 /// Set any additional parameter of the query string used in the request.
18097 /// It should be used to set parameters which are not yet available through their own
18098 /// setters.
18099 ///
18100 /// Please note that this method must not be used to set any of the known parameters
18101 /// which have their own setter method. If done anyway, the request will fail.
18102 ///
18103 /// # Additional Parameters
18104 ///
18105 /// * *$.xgafv* (query-string) - V1 error format.
18106 /// * *access_token* (query-string) - OAuth access token.
18107 /// * *alt* (query-string) - Data format for response.
18108 /// * *callback* (query-string) - JSONP
18109 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18110 /// * *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.
18111 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18112 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18113 /// * *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.
18114 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18115 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18116 pub fn param<T>(
18117 mut self,
18118 name: T,
18119 value: T,
18120 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C>
18121 where
18122 T: AsRef<str>,
18123 {
18124 self._additional_params
18125 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18126 self
18127 }
18128
18129 /// Identifies the authorization scope for the method you are building.
18130 ///
18131 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18132 /// [`Scope::CloudPlatformReadOnly`].
18133 ///
18134 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18135 /// tokens for more than one scope.
18136 ///
18137 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18138 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18139 /// sufficient, a read-write scope will do as well.
18140 pub fn add_scope<St>(
18141 mut self,
18142 scope: St,
18143 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C>
18144 where
18145 St: AsRef<str>,
18146 {
18147 self._scopes.insert(String::from(scope.as_ref()));
18148 self
18149 }
18150 /// Identifies the authorization scope(s) for the method you are building.
18151 ///
18152 /// See [`Self::add_scope()`] for details.
18153 pub fn add_scopes<I, St>(
18154 mut self,
18155 scopes: I,
18156 ) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C>
18157 where
18158 I: IntoIterator<Item = St>,
18159 St: AsRef<str>,
18160 {
18161 self._scopes
18162 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18163 self
18164 }
18165
18166 /// Removes all scopes, and no default scope will be used either.
18167 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18168 /// for details).
18169 pub fn clear_scopes(mut self) -> ProjectLocationApplicationAuthorizedCertificateGetCall<'a, C> {
18170 self._scopes.clear();
18171 self
18172 }
18173}
18174
18175/// Lists all SSL certificates the user is authorized to administer.
18176///
18177/// A builder for the *locations.applications.authorizedCertificates.list* method supported by a *project* resource.
18178/// It is not used directly, but through a [`ProjectMethods`] instance.
18179///
18180/// # Example
18181///
18182/// Instantiate a resource method builder
18183///
18184/// ```test_harness,no_run
18185/// # extern crate hyper;
18186/// # extern crate hyper_rustls;
18187/// # extern crate google_appengine1 as appengine1;
18188/// # async fn dox() {
18189/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18190///
18191/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18192/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18193/// # .with_native_roots()
18194/// # .unwrap()
18195/// # .https_only()
18196/// # .enable_http2()
18197/// # .build();
18198///
18199/// # let executor = hyper_util::rt::TokioExecutor::new();
18200/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18201/// # secret,
18202/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18203/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18204/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18205/// # ),
18206/// # ).build().await.unwrap();
18207///
18208/// # let client = hyper_util::client::legacy::Client::builder(
18209/// # hyper_util::rt::TokioExecutor::new()
18210/// # )
18211/// # .build(
18212/// # hyper_rustls::HttpsConnectorBuilder::new()
18213/// # .with_native_roots()
18214/// # .unwrap()
18215/// # .https_or_http()
18216/// # .enable_http2()
18217/// # .build()
18218/// # );
18219/// # let mut hub = Appengine::new(client, auth);
18220/// // You can configure optional parameters by calling the respective setters at will, and
18221/// // execute the final call using `doit()`.
18222/// // Values shown here are possibly random and not representative !
18223/// let result = hub.projects().locations_applications_authorized_certificates_list("projectsId", "locationsId", "applicationsId")
18224/// .view("Stet")
18225/// .page_token("est")
18226/// .page_size(-82)
18227/// .doit().await;
18228/// # }
18229/// ```
18230pub struct ProjectLocationApplicationAuthorizedCertificateListCall<'a, C>
18231where
18232 C: 'a,
18233{
18234 hub: &'a Appengine<C>,
18235 _projects_id: String,
18236 _locations_id: String,
18237 _applications_id: String,
18238 _view: Option<String>,
18239 _page_token: Option<String>,
18240 _page_size: Option<i32>,
18241 _delegate: Option<&'a mut dyn common::Delegate>,
18242 _additional_params: HashMap<String, String>,
18243 _scopes: BTreeSet<String>,
18244}
18245
18246impl<'a, C> common::CallBuilder for ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {}
18247
18248impl<'a, C> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C>
18249where
18250 C: common::Connector,
18251{
18252 /// Perform the operation you have build so far.
18253 pub async fn doit(
18254 mut self,
18255 ) -> common::Result<(common::Response, ListAuthorizedCertificatesResponse)> {
18256 use std::borrow::Cow;
18257 use std::io::{Read, Seek};
18258
18259 use common::{url::Params, ToParts};
18260 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18261
18262 let mut dd = common::DefaultDelegate;
18263 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18264 dlg.begin(common::MethodInfo {
18265 id: "appengine.projects.locations.applications.authorizedCertificates.list",
18266 http_method: hyper::Method::GET,
18267 });
18268
18269 for &field in [
18270 "alt",
18271 "projectsId",
18272 "locationsId",
18273 "applicationsId",
18274 "view",
18275 "pageToken",
18276 "pageSize",
18277 ]
18278 .iter()
18279 {
18280 if self._additional_params.contains_key(field) {
18281 dlg.finished(false);
18282 return Err(common::Error::FieldClash(field));
18283 }
18284 }
18285
18286 let mut params = Params::with_capacity(8 + self._additional_params.len());
18287 params.push("projectsId", self._projects_id);
18288 params.push("locationsId", self._locations_id);
18289 params.push("applicationsId", self._applications_id);
18290 if let Some(value) = self._view.as_ref() {
18291 params.push("view", value);
18292 }
18293 if let Some(value) = self._page_token.as_ref() {
18294 params.push("pageToken", value);
18295 }
18296 if let Some(value) = self._page_size.as_ref() {
18297 params.push("pageSize", value.to_string());
18298 }
18299
18300 params.extend(self._additional_params.iter());
18301
18302 params.push("alt", "json");
18303 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/authorizedCertificates";
18304 if self._scopes.is_empty() {
18305 self._scopes
18306 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
18307 }
18308
18309 #[allow(clippy::single_element_loop)]
18310 for &(find_this, param_name) in [
18311 ("{projectsId}", "projectsId"),
18312 ("{locationsId}", "locationsId"),
18313 ("{applicationsId}", "applicationsId"),
18314 ]
18315 .iter()
18316 {
18317 url = params.uri_replacement(url, param_name, find_this, false);
18318 }
18319 {
18320 let to_remove = ["applicationsId", "locationsId", "projectsId"];
18321 params.remove_params(&to_remove);
18322 }
18323
18324 let url = params.parse_with_url(&url);
18325
18326 loop {
18327 let token = match self
18328 .hub
18329 .auth
18330 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18331 .await
18332 {
18333 Ok(token) => token,
18334 Err(e) => match dlg.token(e) {
18335 Ok(token) => token,
18336 Err(e) => {
18337 dlg.finished(false);
18338 return Err(common::Error::MissingToken(e));
18339 }
18340 },
18341 };
18342 let mut req_result = {
18343 let client = &self.hub.client;
18344 dlg.pre_request();
18345 let mut req_builder = hyper::Request::builder()
18346 .method(hyper::Method::GET)
18347 .uri(url.as_str())
18348 .header(USER_AGENT, self.hub._user_agent.clone());
18349
18350 if let Some(token) = token.as_ref() {
18351 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18352 }
18353
18354 let request = req_builder
18355 .header(CONTENT_LENGTH, 0_u64)
18356 .body(common::to_body::<String>(None));
18357
18358 client.request(request.unwrap()).await
18359 };
18360
18361 match req_result {
18362 Err(err) => {
18363 if let common::Retry::After(d) = dlg.http_error(&err) {
18364 sleep(d).await;
18365 continue;
18366 }
18367 dlg.finished(false);
18368 return Err(common::Error::HttpError(err));
18369 }
18370 Ok(res) => {
18371 let (mut parts, body) = res.into_parts();
18372 let mut body = common::Body::new(body);
18373 if !parts.status.is_success() {
18374 let bytes = common::to_bytes(body).await.unwrap_or_default();
18375 let error = serde_json::from_str(&common::to_string(&bytes));
18376 let response = common::to_response(parts, bytes.into());
18377
18378 if let common::Retry::After(d) =
18379 dlg.http_failure(&response, error.as_ref().ok())
18380 {
18381 sleep(d).await;
18382 continue;
18383 }
18384
18385 dlg.finished(false);
18386
18387 return Err(match error {
18388 Ok(value) => common::Error::BadRequest(value),
18389 _ => common::Error::Failure(response),
18390 });
18391 }
18392 let response = {
18393 let bytes = common::to_bytes(body).await.unwrap_or_default();
18394 let encoded = common::to_string(&bytes);
18395 match serde_json::from_str(&encoded) {
18396 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18397 Err(error) => {
18398 dlg.response_json_decode_error(&encoded, &error);
18399 return Err(common::Error::JsonDecodeError(
18400 encoded.to_string(),
18401 error,
18402 ));
18403 }
18404 }
18405 };
18406
18407 dlg.finished(true);
18408 return Ok(response);
18409 }
18410 }
18411 }
18412 }
18413
18414 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
18415 ///
18416 /// Sets the *projects id* path property to the given value.
18417 ///
18418 /// Even though the property as already been set when instantiating this call,
18419 /// we provide this method for API completeness.
18420 pub fn projects_id(
18421 mut self,
18422 new_value: &str,
18423 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18424 self._projects_id = new_value.to_string();
18425 self
18426 }
18427 /// Part of `parent`. See documentation of `projectsId`.
18428 ///
18429 /// Sets the *locations id* path property to the given value.
18430 ///
18431 /// Even though the property as already been set when instantiating this call,
18432 /// we provide this method for API completeness.
18433 pub fn locations_id(
18434 mut self,
18435 new_value: &str,
18436 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18437 self._locations_id = new_value.to_string();
18438 self
18439 }
18440 /// Part of `parent`. See documentation of `projectsId`.
18441 ///
18442 /// Sets the *applications id* path property to the given value.
18443 ///
18444 /// Even though the property as already been set when instantiating this call,
18445 /// we provide this method for API completeness.
18446 pub fn applications_id(
18447 mut self,
18448 new_value: &str,
18449 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18450 self._applications_id = new_value.to_string();
18451 self
18452 }
18453 /// Controls the set of fields returned in the LIST response.
18454 ///
18455 /// Sets the *view* query property to the given value.
18456 pub fn view(
18457 mut self,
18458 new_value: &str,
18459 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18460 self._view = Some(new_value.to_string());
18461 self
18462 }
18463 /// Continuation token for fetching the next page of results.
18464 ///
18465 /// Sets the *page token* query property to the given value.
18466 pub fn page_token(
18467 mut self,
18468 new_value: &str,
18469 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18470 self._page_token = Some(new_value.to_string());
18471 self
18472 }
18473 /// Maximum results to return per page.
18474 ///
18475 /// Sets the *page size* query property to the given value.
18476 pub fn page_size(
18477 mut self,
18478 new_value: i32,
18479 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18480 self._page_size = Some(new_value);
18481 self
18482 }
18483 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18484 /// while executing the actual API request.
18485 ///
18486 /// ````text
18487 /// It should be used to handle progress information, and to implement a certain level of resilience.
18488 /// ````
18489 ///
18490 /// Sets the *delegate* property to the given value.
18491 pub fn delegate(
18492 mut self,
18493 new_value: &'a mut dyn common::Delegate,
18494 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18495 self._delegate = Some(new_value);
18496 self
18497 }
18498
18499 /// Set any additional parameter of the query string used in the request.
18500 /// It should be used to set parameters which are not yet available through their own
18501 /// setters.
18502 ///
18503 /// Please note that this method must not be used to set any of the known parameters
18504 /// which have their own setter method. If done anyway, the request will fail.
18505 ///
18506 /// # Additional Parameters
18507 ///
18508 /// * *$.xgafv* (query-string) - V1 error format.
18509 /// * *access_token* (query-string) - OAuth access token.
18510 /// * *alt* (query-string) - Data format for response.
18511 /// * *callback* (query-string) - JSONP
18512 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18513 /// * *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.
18514 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18515 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18516 /// * *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.
18517 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18518 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18519 pub fn param<T>(
18520 mut self,
18521 name: T,
18522 value: T,
18523 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C>
18524 where
18525 T: AsRef<str>,
18526 {
18527 self._additional_params
18528 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18529 self
18530 }
18531
18532 /// Identifies the authorization scope for the method you are building.
18533 ///
18534 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18535 /// [`Scope::CloudPlatformReadOnly`].
18536 ///
18537 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18538 /// tokens for more than one scope.
18539 ///
18540 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18541 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18542 /// sufficient, a read-write scope will do as well.
18543 pub fn add_scope<St>(
18544 mut self,
18545 scope: St,
18546 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C>
18547 where
18548 St: AsRef<str>,
18549 {
18550 self._scopes.insert(String::from(scope.as_ref()));
18551 self
18552 }
18553 /// Identifies the authorization scope(s) for the method you are building.
18554 ///
18555 /// See [`Self::add_scope()`] for details.
18556 pub fn add_scopes<I, St>(
18557 mut self,
18558 scopes: I,
18559 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C>
18560 where
18561 I: IntoIterator<Item = St>,
18562 St: AsRef<str>,
18563 {
18564 self._scopes
18565 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18566 self
18567 }
18568
18569 /// Removes all scopes, and no default scope will be used either.
18570 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18571 /// for details).
18572 pub fn clear_scopes(
18573 mut self,
18574 ) -> ProjectLocationApplicationAuthorizedCertificateListCall<'a, C> {
18575 self._scopes.clear();
18576 self
18577 }
18578}
18579
18580/// Updates the specified SSL certificate. To renew a certificate and maintain its existing domain mappings, update certificate_data with a new certificate. The new certificate must be applicable to the same domains as the original certificate. The certificate display_name may also be updated.
18581///
18582/// A builder for the *locations.applications.authorizedCertificates.patch* method supported by a *project* resource.
18583/// It is not used directly, but through a [`ProjectMethods`] instance.
18584///
18585/// # Example
18586///
18587/// Instantiate a resource method builder
18588///
18589/// ```test_harness,no_run
18590/// # extern crate hyper;
18591/// # extern crate hyper_rustls;
18592/// # extern crate google_appengine1 as appengine1;
18593/// use appengine1::api::AuthorizedCertificate;
18594/// # async fn dox() {
18595/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18596///
18597/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18598/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18599/// # .with_native_roots()
18600/// # .unwrap()
18601/// # .https_only()
18602/// # .enable_http2()
18603/// # .build();
18604///
18605/// # let executor = hyper_util::rt::TokioExecutor::new();
18606/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18607/// # secret,
18608/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18609/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18610/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18611/// # ),
18612/// # ).build().await.unwrap();
18613///
18614/// # let client = hyper_util::client::legacy::Client::builder(
18615/// # hyper_util::rt::TokioExecutor::new()
18616/// # )
18617/// # .build(
18618/// # hyper_rustls::HttpsConnectorBuilder::new()
18619/// # .with_native_roots()
18620/// # .unwrap()
18621/// # .https_or_http()
18622/// # .enable_http2()
18623/// # .build()
18624/// # );
18625/// # let mut hub = Appengine::new(client, auth);
18626/// // As the method needs a request, you would usually fill it with the desired information
18627/// // into the respective structure. Some of the parts shown here might not be applicable !
18628/// // Values shown here are possibly random and not representative !
18629/// let mut req = AuthorizedCertificate::default();
18630///
18631/// // You can configure optional parameters by calling the respective setters at will, and
18632/// // execute the final call using `doit()`.
18633/// // Values shown here are possibly random and not representative !
18634/// let result = hub.projects().locations_applications_authorized_certificates_patch(req, "projectsId", "locationsId", "applicationsId", "authorizedCertificatesId")
18635/// .update_mask(FieldMask::new::<&str>(&[]))
18636/// .doit().await;
18637/// # }
18638/// ```
18639pub struct ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C>
18640where
18641 C: 'a,
18642{
18643 hub: &'a Appengine<C>,
18644 _request: AuthorizedCertificate,
18645 _projects_id: String,
18646 _locations_id: String,
18647 _applications_id: String,
18648 _authorized_certificates_id: String,
18649 _update_mask: Option<common::FieldMask>,
18650 _delegate: Option<&'a mut dyn common::Delegate>,
18651 _additional_params: HashMap<String, String>,
18652 _scopes: BTreeSet<String>,
18653}
18654
18655impl<'a, C> common::CallBuilder
18656 for ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C>
18657{
18658}
18659
18660impl<'a, C> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C>
18661where
18662 C: common::Connector,
18663{
18664 /// Perform the operation you have build so far.
18665 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
18666 use std::borrow::Cow;
18667 use std::io::{Read, Seek};
18668
18669 use common::{url::Params, ToParts};
18670 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18671
18672 let mut dd = common::DefaultDelegate;
18673 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18674 dlg.begin(common::MethodInfo {
18675 id: "appengine.projects.locations.applications.authorizedCertificates.patch",
18676 http_method: hyper::Method::PATCH,
18677 });
18678
18679 for &field in [
18680 "alt",
18681 "projectsId",
18682 "locationsId",
18683 "applicationsId",
18684 "authorizedCertificatesId",
18685 "updateMask",
18686 ]
18687 .iter()
18688 {
18689 if self._additional_params.contains_key(field) {
18690 dlg.finished(false);
18691 return Err(common::Error::FieldClash(field));
18692 }
18693 }
18694
18695 let mut params = Params::with_capacity(8 + self._additional_params.len());
18696 params.push("projectsId", self._projects_id);
18697 params.push("locationsId", self._locations_id);
18698 params.push("applicationsId", self._applications_id);
18699 params.push("authorizedCertificatesId", self._authorized_certificates_id);
18700 if let Some(value) = self._update_mask.as_ref() {
18701 params.push("updateMask", value.to_string());
18702 }
18703
18704 params.extend(self._additional_params.iter());
18705
18706 params.push("alt", "json");
18707 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/authorizedCertificates/{authorizedCertificatesId}";
18708 if self._scopes.is_empty() {
18709 self._scopes
18710 .insert(Scope::CloudPlatform.as_ref().to_string());
18711 }
18712
18713 #[allow(clippy::single_element_loop)]
18714 for &(find_this, param_name) in [
18715 ("{projectsId}", "projectsId"),
18716 ("{locationsId}", "locationsId"),
18717 ("{applicationsId}", "applicationsId"),
18718 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
18719 ]
18720 .iter()
18721 {
18722 url = params.uri_replacement(url, param_name, find_this, false);
18723 }
18724 {
18725 let to_remove = [
18726 "authorizedCertificatesId",
18727 "applicationsId",
18728 "locationsId",
18729 "projectsId",
18730 ];
18731 params.remove_params(&to_remove);
18732 }
18733
18734 let url = params.parse_with_url(&url);
18735
18736 let mut json_mime_type = mime::APPLICATION_JSON;
18737 let mut request_value_reader = {
18738 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18739 common::remove_json_null_values(&mut value);
18740 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18741 serde_json::to_writer(&mut dst, &value).unwrap();
18742 dst
18743 };
18744 let request_size = request_value_reader
18745 .seek(std::io::SeekFrom::End(0))
18746 .unwrap();
18747 request_value_reader
18748 .seek(std::io::SeekFrom::Start(0))
18749 .unwrap();
18750
18751 loop {
18752 let token = match self
18753 .hub
18754 .auth
18755 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18756 .await
18757 {
18758 Ok(token) => token,
18759 Err(e) => match dlg.token(e) {
18760 Ok(token) => token,
18761 Err(e) => {
18762 dlg.finished(false);
18763 return Err(common::Error::MissingToken(e));
18764 }
18765 },
18766 };
18767 request_value_reader
18768 .seek(std::io::SeekFrom::Start(0))
18769 .unwrap();
18770 let mut req_result = {
18771 let client = &self.hub.client;
18772 dlg.pre_request();
18773 let mut req_builder = hyper::Request::builder()
18774 .method(hyper::Method::PATCH)
18775 .uri(url.as_str())
18776 .header(USER_AGENT, self.hub._user_agent.clone());
18777
18778 if let Some(token) = token.as_ref() {
18779 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18780 }
18781
18782 let request = req_builder
18783 .header(CONTENT_TYPE, json_mime_type.to_string())
18784 .header(CONTENT_LENGTH, request_size as u64)
18785 .body(common::to_body(
18786 request_value_reader.get_ref().clone().into(),
18787 ));
18788
18789 client.request(request.unwrap()).await
18790 };
18791
18792 match req_result {
18793 Err(err) => {
18794 if let common::Retry::After(d) = dlg.http_error(&err) {
18795 sleep(d).await;
18796 continue;
18797 }
18798 dlg.finished(false);
18799 return Err(common::Error::HttpError(err));
18800 }
18801 Ok(res) => {
18802 let (mut parts, body) = res.into_parts();
18803 let mut body = common::Body::new(body);
18804 if !parts.status.is_success() {
18805 let bytes = common::to_bytes(body).await.unwrap_or_default();
18806 let error = serde_json::from_str(&common::to_string(&bytes));
18807 let response = common::to_response(parts, bytes.into());
18808
18809 if let common::Retry::After(d) =
18810 dlg.http_failure(&response, error.as_ref().ok())
18811 {
18812 sleep(d).await;
18813 continue;
18814 }
18815
18816 dlg.finished(false);
18817
18818 return Err(match error {
18819 Ok(value) => common::Error::BadRequest(value),
18820 _ => common::Error::Failure(response),
18821 });
18822 }
18823 let response = {
18824 let bytes = common::to_bytes(body).await.unwrap_or_default();
18825 let encoded = common::to_string(&bytes);
18826 match serde_json::from_str(&encoded) {
18827 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18828 Err(error) => {
18829 dlg.response_json_decode_error(&encoded, &error);
18830 return Err(common::Error::JsonDecodeError(
18831 encoded.to_string(),
18832 error,
18833 ));
18834 }
18835 }
18836 };
18837
18838 dlg.finished(true);
18839 return Ok(response);
18840 }
18841 }
18842 }
18843 }
18844
18845 ///
18846 /// Sets the *request* property to the given value.
18847 ///
18848 /// Even though the property as already been set when instantiating this call,
18849 /// we provide this method for API completeness.
18850 pub fn request(
18851 mut self,
18852 new_value: AuthorizedCertificate,
18853 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
18854 self._request = new_value;
18855 self
18856 }
18857 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345.
18858 ///
18859 /// Sets the *projects id* path property to the given value.
18860 ///
18861 /// Even though the property as already been set when instantiating this call,
18862 /// we provide this method for API completeness.
18863 pub fn projects_id(
18864 mut self,
18865 new_value: &str,
18866 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
18867 self._projects_id = new_value.to_string();
18868 self
18869 }
18870 /// Part of `name`. See documentation of `projectsId`.
18871 ///
18872 /// Sets the *locations id* path property to the given value.
18873 ///
18874 /// Even though the property as already been set when instantiating this call,
18875 /// we provide this method for API completeness.
18876 pub fn locations_id(
18877 mut self,
18878 new_value: &str,
18879 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
18880 self._locations_id = new_value.to_string();
18881 self
18882 }
18883 /// Part of `name`. See documentation of `projectsId`.
18884 ///
18885 /// Sets the *applications id* path property to the given value.
18886 ///
18887 /// Even though the property as already been set when instantiating this call,
18888 /// we provide this method for API completeness.
18889 pub fn applications_id(
18890 mut self,
18891 new_value: &str,
18892 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
18893 self._applications_id = new_value.to_string();
18894 self
18895 }
18896 /// Part of `name`. See documentation of `projectsId`.
18897 ///
18898 /// Sets the *authorized certificates id* path property to the given value.
18899 ///
18900 /// Even though the property as already been set when instantiating this call,
18901 /// we provide this method for API completeness.
18902 pub fn authorized_certificates_id(
18903 mut self,
18904 new_value: &str,
18905 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
18906 self._authorized_certificates_id = new_value.to_string();
18907 self
18908 }
18909 /// Standard field mask for the set of fields to be updated. Updates are only supported on the certificate_raw_data and display_name fields.
18910 ///
18911 /// Sets the *update mask* query property to the given value.
18912 pub fn update_mask(
18913 mut self,
18914 new_value: common::FieldMask,
18915 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
18916 self._update_mask = Some(new_value);
18917 self
18918 }
18919 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18920 /// while executing the actual API request.
18921 ///
18922 /// ````text
18923 /// It should be used to handle progress information, and to implement a certain level of resilience.
18924 /// ````
18925 ///
18926 /// Sets the *delegate* property to the given value.
18927 pub fn delegate(
18928 mut self,
18929 new_value: &'a mut dyn common::Delegate,
18930 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
18931 self._delegate = Some(new_value);
18932 self
18933 }
18934
18935 /// Set any additional parameter of the query string used in the request.
18936 /// It should be used to set parameters which are not yet available through their own
18937 /// setters.
18938 ///
18939 /// Please note that this method must not be used to set any of the known parameters
18940 /// which have their own setter method. If done anyway, the request will fail.
18941 ///
18942 /// # Additional Parameters
18943 ///
18944 /// * *$.xgafv* (query-string) - V1 error format.
18945 /// * *access_token* (query-string) - OAuth access token.
18946 /// * *alt* (query-string) - Data format for response.
18947 /// * *callback* (query-string) - JSONP
18948 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18949 /// * *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.
18950 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18951 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18952 /// * *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.
18953 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18954 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18955 pub fn param<T>(
18956 mut self,
18957 name: T,
18958 value: T,
18959 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C>
18960 where
18961 T: AsRef<str>,
18962 {
18963 self._additional_params
18964 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18965 self
18966 }
18967
18968 /// Identifies the authorization scope for the method you are building.
18969 ///
18970 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18971 /// [`Scope::CloudPlatform`].
18972 ///
18973 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18974 /// tokens for more than one scope.
18975 ///
18976 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18977 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18978 /// sufficient, a read-write scope will do as well.
18979 pub fn add_scope<St>(
18980 mut self,
18981 scope: St,
18982 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C>
18983 where
18984 St: AsRef<str>,
18985 {
18986 self._scopes.insert(String::from(scope.as_ref()));
18987 self
18988 }
18989 /// Identifies the authorization scope(s) for the method you are building.
18990 ///
18991 /// See [`Self::add_scope()`] for details.
18992 pub fn add_scopes<I, St>(
18993 mut self,
18994 scopes: I,
18995 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C>
18996 where
18997 I: IntoIterator<Item = St>,
18998 St: AsRef<str>,
18999 {
19000 self._scopes
19001 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19002 self
19003 }
19004
19005 /// Removes all scopes, and no default scope will be used either.
19006 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19007 /// for details).
19008 pub fn clear_scopes(
19009 mut self,
19010 ) -> ProjectLocationApplicationAuthorizedCertificatePatchCall<'a, C> {
19011 self._scopes.clear();
19012 self
19013 }
19014}
19015
19016/// Lists all domains the user is authorized to administer.
19017///
19018/// A builder for the *locations.applications.authorizedDomains.list* method supported by a *project* resource.
19019/// It is not used directly, but through a [`ProjectMethods`] instance.
19020///
19021/// # Example
19022///
19023/// Instantiate a resource method builder
19024///
19025/// ```test_harness,no_run
19026/// # extern crate hyper;
19027/// # extern crate hyper_rustls;
19028/// # extern crate google_appengine1 as appengine1;
19029/// # async fn dox() {
19030/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19031///
19032/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19033/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19034/// # .with_native_roots()
19035/// # .unwrap()
19036/// # .https_only()
19037/// # .enable_http2()
19038/// # .build();
19039///
19040/// # let executor = hyper_util::rt::TokioExecutor::new();
19041/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19042/// # secret,
19043/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19044/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19045/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19046/// # ),
19047/// # ).build().await.unwrap();
19048///
19049/// # let client = hyper_util::client::legacy::Client::builder(
19050/// # hyper_util::rt::TokioExecutor::new()
19051/// # )
19052/// # .build(
19053/// # hyper_rustls::HttpsConnectorBuilder::new()
19054/// # .with_native_roots()
19055/// # .unwrap()
19056/// # .https_or_http()
19057/// # .enable_http2()
19058/// # .build()
19059/// # );
19060/// # let mut hub = Appengine::new(client, auth);
19061/// // You can configure optional parameters by calling the respective setters at will, and
19062/// // execute the final call using `doit()`.
19063/// // Values shown here are possibly random and not representative !
19064/// let result = hub.projects().locations_applications_authorized_domains_list("projectsId", "locationsId", "applicationsId")
19065/// .page_token("Lorem")
19066/// .page_size(-17)
19067/// .doit().await;
19068/// # }
19069/// ```
19070pub struct ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
19071where
19072 C: 'a,
19073{
19074 hub: &'a Appengine<C>,
19075 _projects_id: String,
19076 _locations_id: String,
19077 _applications_id: String,
19078 _page_token: Option<String>,
19079 _page_size: Option<i32>,
19080 _delegate: Option<&'a mut dyn common::Delegate>,
19081 _additional_params: HashMap<String, String>,
19082 _scopes: BTreeSet<String>,
19083}
19084
19085impl<'a, C> common::CallBuilder for ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {}
19086
19087impl<'a, C> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
19088where
19089 C: common::Connector,
19090{
19091 /// Perform the operation you have build so far.
19092 pub async fn doit(
19093 mut self,
19094 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
19095 use std::borrow::Cow;
19096 use std::io::{Read, Seek};
19097
19098 use common::{url::Params, ToParts};
19099 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19100
19101 let mut dd = common::DefaultDelegate;
19102 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19103 dlg.begin(common::MethodInfo {
19104 id: "appengine.projects.locations.applications.authorizedDomains.list",
19105 http_method: hyper::Method::GET,
19106 });
19107
19108 for &field in [
19109 "alt",
19110 "projectsId",
19111 "locationsId",
19112 "applicationsId",
19113 "pageToken",
19114 "pageSize",
19115 ]
19116 .iter()
19117 {
19118 if self._additional_params.contains_key(field) {
19119 dlg.finished(false);
19120 return Err(common::Error::FieldClash(field));
19121 }
19122 }
19123
19124 let mut params = Params::with_capacity(7 + self._additional_params.len());
19125 params.push("projectsId", self._projects_id);
19126 params.push("locationsId", self._locations_id);
19127 params.push("applicationsId", self._applications_id);
19128 if let Some(value) = self._page_token.as_ref() {
19129 params.push("pageToken", value);
19130 }
19131 if let Some(value) = self._page_size.as_ref() {
19132 params.push("pageSize", value.to_string());
19133 }
19134
19135 params.extend(self._additional_params.iter());
19136
19137 params.push("alt", "json");
19138 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/authorizedDomains";
19139 if self._scopes.is_empty() {
19140 self._scopes
19141 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
19142 }
19143
19144 #[allow(clippy::single_element_loop)]
19145 for &(find_this, param_name) in [
19146 ("{projectsId}", "projectsId"),
19147 ("{locationsId}", "locationsId"),
19148 ("{applicationsId}", "applicationsId"),
19149 ]
19150 .iter()
19151 {
19152 url = params.uri_replacement(url, param_name, find_this, false);
19153 }
19154 {
19155 let to_remove = ["applicationsId", "locationsId", "projectsId"];
19156 params.remove_params(&to_remove);
19157 }
19158
19159 let url = params.parse_with_url(&url);
19160
19161 loop {
19162 let token = match self
19163 .hub
19164 .auth
19165 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19166 .await
19167 {
19168 Ok(token) => token,
19169 Err(e) => match dlg.token(e) {
19170 Ok(token) => token,
19171 Err(e) => {
19172 dlg.finished(false);
19173 return Err(common::Error::MissingToken(e));
19174 }
19175 },
19176 };
19177 let mut req_result = {
19178 let client = &self.hub.client;
19179 dlg.pre_request();
19180 let mut req_builder = hyper::Request::builder()
19181 .method(hyper::Method::GET)
19182 .uri(url.as_str())
19183 .header(USER_AGENT, self.hub._user_agent.clone());
19184
19185 if let Some(token) = token.as_ref() {
19186 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19187 }
19188
19189 let request = req_builder
19190 .header(CONTENT_LENGTH, 0_u64)
19191 .body(common::to_body::<String>(None));
19192
19193 client.request(request.unwrap()).await
19194 };
19195
19196 match req_result {
19197 Err(err) => {
19198 if let common::Retry::After(d) = dlg.http_error(&err) {
19199 sleep(d).await;
19200 continue;
19201 }
19202 dlg.finished(false);
19203 return Err(common::Error::HttpError(err));
19204 }
19205 Ok(res) => {
19206 let (mut parts, body) = res.into_parts();
19207 let mut body = common::Body::new(body);
19208 if !parts.status.is_success() {
19209 let bytes = common::to_bytes(body).await.unwrap_or_default();
19210 let error = serde_json::from_str(&common::to_string(&bytes));
19211 let response = common::to_response(parts, bytes.into());
19212
19213 if let common::Retry::After(d) =
19214 dlg.http_failure(&response, error.as_ref().ok())
19215 {
19216 sleep(d).await;
19217 continue;
19218 }
19219
19220 dlg.finished(false);
19221
19222 return Err(match error {
19223 Ok(value) => common::Error::BadRequest(value),
19224 _ => common::Error::Failure(response),
19225 });
19226 }
19227 let response = {
19228 let bytes = common::to_bytes(body).await.unwrap_or_default();
19229 let encoded = common::to_string(&bytes);
19230 match serde_json::from_str(&encoded) {
19231 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19232 Err(error) => {
19233 dlg.response_json_decode_error(&encoded, &error);
19234 return Err(common::Error::JsonDecodeError(
19235 encoded.to_string(),
19236 error,
19237 ));
19238 }
19239 }
19240 };
19241
19242 dlg.finished(true);
19243 return Ok(response);
19244 }
19245 }
19246 }
19247 }
19248
19249 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
19250 ///
19251 /// Sets the *projects id* path property to the given value.
19252 ///
19253 /// Even though the property as already been set when instantiating this call,
19254 /// we provide this method for API completeness.
19255 pub fn projects_id(
19256 mut self,
19257 new_value: &str,
19258 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
19259 self._projects_id = new_value.to_string();
19260 self
19261 }
19262 /// Part of `parent`. See documentation of `projectsId`.
19263 ///
19264 /// Sets the *locations id* path property to the given value.
19265 ///
19266 /// Even though the property as already been set when instantiating this call,
19267 /// we provide this method for API completeness.
19268 pub fn locations_id(
19269 mut self,
19270 new_value: &str,
19271 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
19272 self._locations_id = new_value.to_string();
19273 self
19274 }
19275 /// Part of `parent`. See documentation of `projectsId`.
19276 ///
19277 /// Sets the *applications id* path property to the given value.
19278 ///
19279 /// Even though the property as already been set when instantiating this call,
19280 /// we provide this method for API completeness.
19281 pub fn applications_id(
19282 mut self,
19283 new_value: &str,
19284 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
19285 self._applications_id = new_value.to_string();
19286 self
19287 }
19288 /// Continuation token for fetching the next page of results.
19289 ///
19290 /// Sets the *page token* query property to the given value.
19291 pub fn page_token(
19292 mut self,
19293 new_value: &str,
19294 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
19295 self._page_token = Some(new_value.to_string());
19296 self
19297 }
19298 /// Maximum results to return per page.
19299 ///
19300 /// Sets the *page size* query property to the given value.
19301 pub fn page_size(
19302 mut self,
19303 new_value: i32,
19304 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
19305 self._page_size = Some(new_value);
19306 self
19307 }
19308 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19309 /// while executing the actual API request.
19310 ///
19311 /// ````text
19312 /// It should be used to handle progress information, and to implement a certain level of resilience.
19313 /// ````
19314 ///
19315 /// Sets the *delegate* property to the given value.
19316 pub fn delegate(
19317 mut self,
19318 new_value: &'a mut dyn common::Delegate,
19319 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
19320 self._delegate = Some(new_value);
19321 self
19322 }
19323
19324 /// Set any additional parameter of the query string used in the request.
19325 /// It should be used to set parameters which are not yet available through their own
19326 /// setters.
19327 ///
19328 /// Please note that this method must not be used to set any of the known parameters
19329 /// which have their own setter method. If done anyway, the request will fail.
19330 ///
19331 /// # Additional Parameters
19332 ///
19333 /// * *$.xgafv* (query-string) - V1 error format.
19334 /// * *access_token* (query-string) - OAuth access token.
19335 /// * *alt* (query-string) - Data format for response.
19336 /// * *callback* (query-string) - JSONP
19337 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19338 /// * *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.
19339 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19340 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19341 /// * *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.
19342 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19343 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19344 pub fn param<T>(
19345 mut self,
19346 name: T,
19347 value: T,
19348 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
19349 where
19350 T: AsRef<str>,
19351 {
19352 self._additional_params
19353 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19354 self
19355 }
19356
19357 /// Identifies the authorization scope for the method you are building.
19358 ///
19359 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19360 /// [`Scope::CloudPlatformReadOnly`].
19361 ///
19362 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19363 /// tokens for more than one scope.
19364 ///
19365 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19366 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19367 /// sufficient, a read-write scope will do as well.
19368 pub fn add_scope<St>(
19369 mut self,
19370 scope: St,
19371 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
19372 where
19373 St: AsRef<str>,
19374 {
19375 self._scopes.insert(String::from(scope.as_ref()));
19376 self
19377 }
19378 /// Identifies the authorization scope(s) for the method you are building.
19379 ///
19380 /// See [`Self::add_scope()`] for details.
19381 pub fn add_scopes<I, St>(
19382 mut self,
19383 scopes: I,
19384 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
19385 where
19386 I: IntoIterator<Item = St>,
19387 St: AsRef<str>,
19388 {
19389 self._scopes
19390 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19391 self
19392 }
19393
19394 /// Removes all scopes, and no default scope will be used either.
19395 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19396 /// for details).
19397 pub fn clear_scopes(mut self) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
19398 self._scopes.clear();
19399 self
19400 }
19401}
19402
19403/// Maps a domain to an application. A user must be authorized to administer a domain in order to map it to an application. For a list of available authorized domains, see AuthorizedDomains.ListAuthorizedDomains.
19404///
19405/// A builder for the *locations.applications.domainMappings.create* method supported by a *project* resource.
19406/// It is not used directly, but through a [`ProjectMethods`] instance.
19407///
19408/// # Example
19409///
19410/// Instantiate a resource method builder
19411///
19412/// ```test_harness,no_run
19413/// # extern crate hyper;
19414/// # extern crate hyper_rustls;
19415/// # extern crate google_appengine1 as appengine1;
19416/// use appengine1::api::DomainMapping;
19417/// # async fn dox() {
19418/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19419///
19420/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19421/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19422/// # .with_native_roots()
19423/// # .unwrap()
19424/// # .https_only()
19425/// # .enable_http2()
19426/// # .build();
19427///
19428/// # let executor = hyper_util::rt::TokioExecutor::new();
19429/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19430/// # secret,
19431/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19432/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19433/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19434/// # ),
19435/// # ).build().await.unwrap();
19436///
19437/// # let client = hyper_util::client::legacy::Client::builder(
19438/// # hyper_util::rt::TokioExecutor::new()
19439/// # )
19440/// # .build(
19441/// # hyper_rustls::HttpsConnectorBuilder::new()
19442/// # .with_native_roots()
19443/// # .unwrap()
19444/// # .https_or_http()
19445/// # .enable_http2()
19446/// # .build()
19447/// # );
19448/// # let mut hub = Appengine::new(client, auth);
19449/// // As the method needs a request, you would usually fill it with the desired information
19450/// // into the respective structure. Some of the parts shown here might not be applicable !
19451/// // Values shown here are possibly random and not representative !
19452/// let mut req = DomainMapping::default();
19453///
19454/// // You can configure optional parameters by calling the respective setters at will, and
19455/// // execute the final call using `doit()`.
19456/// // Values shown here are possibly random and not representative !
19457/// let result = hub.projects().locations_applications_domain_mappings_create(req, "projectsId", "locationsId", "applicationsId")
19458/// .override_strategy("et")
19459/// .doit().await;
19460/// # }
19461/// ```
19462pub struct ProjectLocationApplicationDomainMappingCreateCall<'a, C>
19463where
19464 C: 'a,
19465{
19466 hub: &'a Appengine<C>,
19467 _request: DomainMapping,
19468 _projects_id: String,
19469 _locations_id: String,
19470 _applications_id: String,
19471 _override_strategy: Option<String>,
19472 _delegate: Option<&'a mut dyn common::Delegate>,
19473 _additional_params: HashMap<String, String>,
19474 _scopes: BTreeSet<String>,
19475}
19476
19477impl<'a, C> common::CallBuilder for ProjectLocationApplicationDomainMappingCreateCall<'a, C> {}
19478
19479impl<'a, C> ProjectLocationApplicationDomainMappingCreateCall<'a, C>
19480where
19481 C: common::Connector,
19482{
19483 /// Perform the operation you have build so far.
19484 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19485 use std::borrow::Cow;
19486 use std::io::{Read, Seek};
19487
19488 use common::{url::Params, ToParts};
19489 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19490
19491 let mut dd = common::DefaultDelegate;
19492 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19493 dlg.begin(common::MethodInfo {
19494 id: "appengine.projects.locations.applications.domainMappings.create",
19495 http_method: hyper::Method::POST,
19496 });
19497
19498 for &field in [
19499 "alt",
19500 "projectsId",
19501 "locationsId",
19502 "applicationsId",
19503 "overrideStrategy",
19504 ]
19505 .iter()
19506 {
19507 if self._additional_params.contains_key(field) {
19508 dlg.finished(false);
19509 return Err(common::Error::FieldClash(field));
19510 }
19511 }
19512
19513 let mut params = Params::with_capacity(7 + self._additional_params.len());
19514 params.push("projectsId", self._projects_id);
19515 params.push("locationsId", self._locations_id);
19516 params.push("applicationsId", self._applications_id);
19517 if let Some(value) = self._override_strategy.as_ref() {
19518 params.push("overrideStrategy", value);
19519 }
19520
19521 params.extend(self._additional_params.iter());
19522
19523 params.push("alt", "json");
19524 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/domainMappings";
19525 if self._scopes.is_empty() {
19526 self._scopes
19527 .insert(Scope::CloudPlatform.as_ref().to_string());
19528 }
19529
19530 #[allow(clippy::single_element_loop)]
19531 for &(find_this, param_name) in [
19532 ("{projectsId}", "projectsId"),
19533 ("{locationsId}", "locationsId"),
19534 ("{applicationsId}", "applicationsId"),
19535 ]
19536 .iter()
19537 {
19538 url = params.uri_replacement(url, param_name, find_this, false);
19539 }
19540 {
19541 let to_remove = ["applicationsId", "locationsId", "projectsId"];
19542 params.remove_params(&to_remove);
19543 }
19544
19545 let url = params.parse_with_url(&url);
19546
19547 let mut json_mime_type = mime::APPLICATION_JSON;
19548 let mut request_value_reader = {
19549 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19550 common::remove_json_null_values(&mut value);
19551 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19552 serde_json::to_writer(&mut dst, &value).unwrap();
19553 dst
19554 };
19555 let request_size = request_value_reader
19556 .seek(std::io::SeekFrom::End(0))
19557 .unwrap();
19558 request_value_reader
19559 .seek(std::io::SeekFrom::Start(0))
19560 .unwrap();
19561
19562 loop {
19563 let token = match self
19564 .hub
19565 .auth
19566 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19567 .await
19568 {
19569 Ok(token) => token,
19570 Err(e) => match dlg.token(e) {
19571 Ok(token) => token,
19572 Err(e) => {
19573 dlg.finished(false);
19574 return Err(common::Error::MissingToken(e));
19575 }
19576 },
19577 };
19578 request_value_reader
19579 .seek(std::io::SeekFrom::Start(0))
19580 .unwrap();
19581 let mut req_result = {
19582 let client = &self.hub.client;
19583 dlg.pre_request();
19584 let mut req_builder = hyper::Request::builder()
19585 .method(hyper::Method::POST)
19586 .uri(url.as_str())
19587 .header(USER_AGENT, self.hub._user_agent.clone());
19588
19589 if let Some(token) = token.as_ref() {
19590 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19591 }
19592
19593 let request = req_builder
19594 .header(CONTENT_TYPE, json_mime_type.to_string())
19595 .header(CONTENT_LENGTH, request_size as u64)
19596 .body(common::to_body(
19597 request_value_reader.get_ref().clone().into(),
19598 ));
19599
19600 client.request(request.unwrap()).await
19601 };
19602
19603 match req_result {
19604 Err(err) => {
19605 if let common::Retry::After(d) = dlg.http_error(&err) {
19606 sleep(d).await;
19607 continue;
19608 }
19609 dlg.finished(false);
19610 return Err(common::Error::HttpError(err));
19611 }
19612 Ok(res) => {
19613 let (mut parts, body) = res.into_parts();
19614 let mut body = common::Body::new(body);
19615 if !parts.status.is_success() {
19616 let bytes = common::to_bytes(body).await.unwrap_or_default();
19617 let error = serde_json::from_str(&common::to_string(&bytes));
19618 let response = common::to_response(parts, bytes.into());
19619
19620 if let common::Retry::After(d) =
19621 dlg.http_failure(&response, error.as_ref().ok())
19622 {
19623 sleep(d).await;
19624 continue;
19625 }
19626
19627 dlg.finished(false);
19628
19629 return Err(match error {
19630 Ok(value) => common::Error::BadRequest(value),
19631 _ => common::Error::Failure(response),
19632 });
19633 }
19634 let response = {
19635 let bytes = common::to_bytes(body).await.unwrap_or_default();
19636 let encoded = common::to_string(&bytes);
19637 match serde_json::from_str(&encoded) {
19638 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19639 Err(error) => {
19640 dlg.response_json_decode_error(&encoded, &error);
19641 return Err(common::Error::JsonDecodeError(
19642 encoded.to_string(),
19643 error,
19644 ));
19645 }
19646 }
19647 };
19648
19649 dlg.finished(true);
19650 return Ok(response);
19651 }
19652 }
19653 }
19654 }
19655
19656 ///
19657 /// Sets the *request* property to the given value.
19658 ///
19659 /// Even though the property as already been set when instantiating this call,
19660 /// we provide this method for API completeness.
19661 pub fn request(
19662 mut self,
19663 new_value: DomainMapping,
19664 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
19665 self._request = new_value;
19666 self
19667 }
19668 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
19669 ///
19670 /// Sets the *projects id* path property to the given value.
19671 ///
19672 /// Even though the property as already been set when instantiating this call,
19673 /// we provide this method for API completeness.
19674 pub fn projects_id(
19675 mut self,
19676 new_value: &str,
19677 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
19678 self._projects_id = new_value.to_string();
19679 self
19680 }
19681 /// Part of `parent`. See documentation of `projectsId`.
19682 ///
19683 /// Sets the *locations id* path property to the given value.
19684 ///
19685 /// Even though the property as already been set when instantiating this call,
19686 /// we provide this method for API completeness.
19687 pub fn locations_id(
19688 mut self,
19689 new_value: &str,
19690 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
19691 self._locations_id = new_value.to_string();
19692 self
19693 }
19694 /// Part of `parent`. See documentation of `projectsId`.
19695 ///
19696 /// Sets the *applications id* path property to the given value.
19697 ///
19698 /// Even though the property as already been set when instantiating this call,
19699 /// we provide this method for API completeness.
19700 pub fn applications_id(
19701 mut self,
19702 new_value: &str,
19703 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
19704 self._applications_id = new_value.to_string();
19705 self
19706 }
19707 /// Whether the domain creation should override any existing mappings for this domain. By default, overrides are rejected.
19708 ///
19709 /// Sets the *override strategy* query property to the given value.
19710 pub fn override_strategy(
19711 mut self,
19712 new_value: &str,
19713 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
19714 self._override_strategy = Some(new_value.to_string());
19715 self
19716 }
19717 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19718 /// while executing the actual API request.
19719 ///
19720 /// ````text
19721 /// It should be used to handle progress information, and to implement a certain level of resilience.
19722 /// ````
19723 ///
19724 /// Sets the *delegate* property to the given value.
19725 pub fn delegate(
19726 mut self,
19727 new_value: &'a mut dyn common::Delegate,
19728 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
19729 self._delegate = Some(new_value);
19730 self
19731 }
19732
19733 /// Set any additional parameter of the query string used in the request.
19734 /// It should be used to set parameters which are not yet available through their own
19735 /// setters.
19736 ///
19737 /// Please note that this method must not be used to set any of the known parameters
19738 /// which have their own setter method. If done anyway, the request will fail.
19739 ///
19740 /// # Additional Parameters
19741 ///
19742 /// * *$.xgafv* (query-string) - V1 error format.
19743 /// * *access_token* (query-string) - OAuth access token.
19744 /// * *alt* (query-string) - Data format for response.
19745 /// * *callback* (query-string) - JSONP
19746 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19747 /// * *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.
19748 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19749 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19750 /// * *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.
19751 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19752 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19753 pub fn param<T>(
19754 mut self,
19755 name: T,
19756 value: T,
19757 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C>
19758 where
19759 T: AsRef<str>,
19760 {
19761 self._additional_params
19762 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19763 self
19764 }
19765
19766 /// Identifies the authorization scope for the method you are building.
19767 ///
19768 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19769 /// [`Scope::CloudPlatform`].
19770 ///
19771 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19772 /// tokens for more than one scope.
19773 ///
19774 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19775 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19776 /// sufficient, a read-write scope will do as well.
19777 pub fn add_scope<St>(
19778 mut self,
19779 scope: St,
19780 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C>
19781 where
19782 St: AsRef<str>,
19783 {
19784 self._scopes.insert(String::from(scope.as_ref()));
19785 self
19786 }
19787 /// Identifies the authorization scope(s) for the method you are building.
19788 ///
19789 /// See [`Self::add_scope()`] for details.
19790 pub fn add_scopes<I, St>(
19791 mut self,
19792 scopes: I,
19793 ) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C>
19794 where
19795 I: IntoIterator<Item = St>,
19796 St: AsRef<str>,
19797 {
19798 self._scopes
19799 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19800 self
19801 }
19802
19803 /// Removes all scopes, and no default scope will be used either.
19804 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19805 /// for details).
19806 pub fn clear_scopes(mut self) -> ProjectLocationApplicationDomainMappingCreateCall<'a, C> {
19807 self._scopes.clear();
19808 self
19809 }
19810}
19811
19812/// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource.
19813///
19814/// A builder for the *locations.applications.domainMappings.delete* method supported by a *project* resource.
19815/// It is not used directly, but through a [`ProjectMethods`] instance.
19816///
19817/// # Example
19818///
19819/// Instantiate a resource method builder
19820///
19821/// ```test_harness,no_run
19822/// # extern crate hyper;
19823/// # extern crate hyper_rustls;
19824/// # extern crate google_appengine1 as appengine1;
19825/// # async fn dox() {
19826/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19827///
19828/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19829/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19830/// # .with_native_roots()
19831/// # .unwrap()
19832/// # .https_only()
19833/// # .enable_http2()
19834/// # .build();
19835///
19836/// # let executor = hyper_util::rt::TokioExecutor::new();
19837/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19838/// # secret,
19839/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19840/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19841/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19842/// # ),
19843/// # ).build().await.unwrap();
19844///
19845/// # let client = hyper_util::client::legacy::Client::builder(
19846/// # hyper_util::rt::TokioExecutor::new()
19847/// # )
19848/// # .build(
19849/// # hyper_rustls::HttpsConnectorBuilder::new()
19850/// # .with_native_roots()
19851/// # .unwrap()
19852/// # .https_or_http()
19853/// # .enable_http2()
19854/// # .build()
19855/// # );
19856/// # let mut hub = Appengine::new(client, auth);
19857/// // You can configure optional parameters by calling the respective setters at will, and
19858/// // execute the final call using `doit()`.
19859/// // Values shown here are possibly random and not representative !
19860/// let result = hub.projects().locations_applications_domain_mappings_delete("projectsId", "locationsId", "applicationsId", "domainMappingsId")
19861/// .doit().await;
19862/// # }
19863/// ```
19864pub struct ProjectLocationApplicationDomainMappingDeleteCall<'a, C>
19865where
19866 C: 'a,
19867{
19868 hub: &'a Appengine<C>,
19869 _projects_id: String,
19870 _locations_id: String,
19871 _applications_id: String,
19872 _domain_mappings_id: String,
19873 _delegate: Option<&'a mut dyn common::Delegate>,
19874 _additional_params: HashMap<String, String>,
19875 _scopes: BTreeSet<String>,
19876}
19877
19878impl<'a, C> common::CallBuilder for ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {}
19879
19880impl<'a, C> ProjectLocationApplicationDomainMappingDeleteCall<'a, C>
19881where
19882 C: common::Connector,
19883{
19884 /// Perform the operation you have build so far.
19885 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19886 use std::borrow::Cow;
19887 use std::io::{Read, Seek};
19888
19889 use common::{url::Params, ToParts};
19890 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19891
19892 let mut dd = common::DefaultDelegate;
19893 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19894 dlg.begin(common::MethodInfo {
19895 id: "appengine.projects.locations.applications.domainMappings.delete",
19896 http_method: hyper::Method::DELETE,
19897 });
19898
19899 for &field in [
19900 "alt",
19901 "projectsId",
19902 "locationsId",
19903 "applicationsId",
19904 "domainMappingsId",
19905 ]
19906 .iter()
19907 {
19908 if self._additional_params.contains_key(field) {
19909 dlg.finished(false);
19910 return Err(common::Error::FieldClash(field));
19911 }
19912 }
19913
19914 let mut params = Params::with_capacity(6 + self._additional_params.len());
19915 params.push("projectsId", self._projects_id);
19916 params.push("locationsId", self._locations_id);
19917 params.push("applicationsId", self._applications_id);
19918 params.push("domainMappingsId", self._domain_mappings_id);
19919
19920 params.extend(self._additional_params.iter());
19921
19922 params.push("alt", "json");
19923 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/domainMappings/{domainMappingsId}";
19924 if self._scopes.is_empty() {
19925 self._scopes
19926 .insert(Scope::CloudPlatform.as_ref().to_string());
19927 }
19928
19929 #[allow(clippy::single_element_loop)]
19930 for &(find_this, param_name) in [
19931 ("{projectsId}", "projectsId"),
19932 ("{locationsId}", "locationsId"),
19933 ("{applicationsId}", "applicationsId"),
19934 ("{domainMappingsId}", "domainMappingsId"),
19935 ]
19936 .iter()
19937 {
19938 url = params.uri_replacement(url, param_name, find_this, false);
19939 }
19940 {
19941 let to_remove = [
19942 "domainMappingsId",
19943 "applicationsId",
19944 "locationsId",
19945 "projectsId",
19946 ];
19947 params.remove_params(&to_remove);
19948 }
19949
19950 let url = params.parse_with_url(&url);
19951
19952 loop {
19953 let token = match self
19954 .hub
19955 .auth
19956 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19957 .await
19958 {
19959 Ok(token) => token,
19960 Err(e) => match dlg.token(e) {
19961 Ok(token) => token,
19962 Err(e) => {
19963 dlg.finished(false);
19964 return Err(common::Error::MissingToken(e));
19965 }
19966 },
19967 };
19968 let mut req_result = {
19969 let client = &self.hub.client;
19970 dlg.pre_request();
19971 let mut req_builder = hyper::Request::builder()
19972 .method(hyper::Method::DELETE)
19973 .uri(url.as_str())
19974 .header(USER_AGENT, self.hub._user_agent.clone());
19975
19976 if let Some(token) = token.as_ref() {
19977 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19978 }
19979
19980 let request = req_builder
19981 .header(CONTENT_LENGTH, 0_u64)
19982 .body(common::to_body::<String>(None));
19983
19984 client.request(request.unwrap()).await
19985 };
19986
19987 match req_result {
19988 Err(err) => {
19989 if let common::Retry::After(d) = dlg.http_error(&err) {
19990 sleep(d).await;
19991 continue;
19992 }
19993 dlg.finished(false);
19994 return Err(common::Error::HttpError(err));
19995 }
19996 Ok(res) => {
19997 let (mut parts, body) = res.into_parts();
19998 let mut body = common::Body::new(body);
19999 if !parts.status.is_success() {
20000 let bytes = common::to_bytes(body).await.unwrap_or_default();
20001 let error = serde_json::from_str(&common::to_string(&bytes));
20002 let response = common::to_response(parts, bytes.into());
20003
20004 if let common::Retry::After(d) =
20005 dlg.http_failure(&response, error.as_ref().ok())
20006 {
20007 sleep(d).await;
20008 continue;
20009 }
20010
20011 dlg.finished(false);
20012
20013 return Err(match error {
20014 Ok(value) => common::Error::BadRequest(value),
20015 _ => common::Error::Failure(response),
20016 });
20017 }
20018 let response = {
20019 let bytes = common::to_bytes(body).await.unwrap_or_default();
20020 let encoded = common::to_string(&bytes);
20021 match serde_json::from_str(&encoded) {
20022 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20023 Err(error) => {
20024 dlg.response_json_decode_error(&encoded, &error);
20025 return Err(common::Error::JsonDecodeError(
20026 encoded.to_string(),
20027 error,
20028 ));
20029 }
20030 }
20031 };
20032
20033 dlg.finished(true);
20034 return Ok(response);
20035 }
20036 }
20037 }
20038 }
20039
20040 /// Part of `name`. Required. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com.
20041 ///
20042 /// Sets the *projects id* path property to the given value.
20043 ///
20044 /// Even though the property as already been set when instantiating this call,
20045 /// we provide this method for API completeness.
20046 pub fn projects_id(
20047 mut self,
20048 new_value: &str,
20049 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {
20050 self._projects_id = new_value.to_string();
20051 self
20052 }
20053 /// Part of `name`. See documentation of `projectsId`.
20054 ///
20055 /// Sets the *locations id* path property to the given value.
20056 ///
20057 /// Even though the property as already been set when instantiating this call,
20058 /// we provide this method for API completeness.
20059 pub fn locations_id(
20060 mut self,
20061 new_value: &str,
20062 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {
20063 self._locations_id = new_value.to_string();
20064 self
20065 }
20066 /// Part of `name`. See documentation of `projectsId`.
20067 ///
20068 /// Sets the *applications id* path property to the given value.
20069 ///
20070 /// Even though the property as already been set when instantiating this call,
20071 /// we provide this method for API completeness.
20072 pub fn applications_id(
20073 mut self,
20074 new_value: &str,
20075 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {
20076 self._applications_id = new_value.to_string();
20077 self
20078 }
20079 /// Part of `name`. See documentation of `projectsId`.
20080 ///
20081 /// Sets the *domain mappings id* path property to the given value.
20082 ///
20083 /// Even though the property as already been set when instantiating this call,
20084 /// we provide this method for API completeness.
20085 pub fn domain_mappings_id(
20086 mut self,
20087 new_value: &str,
20088 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {
20089 self._domain_mappings_id = new_value.to_string();
20090 self
20091 }
20092 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20093 /// while executing the actual API request.
20094 ///
20095 /// ````text
20096 /// It should be used to handle progress information, and to implement a certain level of resilience.
20097 /// ````
20098 ///
20099 /// Sets the *delegate* property to the given value.
20100 pub fn delegate(
20101 mut self,
20102 new_value: &'a mut dyn common::Delegate,
20103 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {
20104 self._delegate = Some(new_value);
20105 self
20106 }
20107
20108 /// Set any additional parameter of the query string used in the request.
20109 /// It should be used to set parameters which are not yet available through their own
20110 /// setters.
20111 ///
20112 /// Please note that this method must not be used to set any of the known parameters
20113 /// which have their own setter method. If done anyway, the request will fail.
20114 ///
20115 /// # Additional Parameters
20116 ///
20117 /// * *$.xgafv* (query-string) - V1 error format.
20118 /// * *access_token* (query-string) - OAuth access token.
20119 /// * *alt* (query-string) - Data format for response.
20120 /// * *callback* (query-string) - JSONP
20121 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20122 /// * *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.
20123 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20124 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20125 /// * *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.
20126 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20127 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20128 pub fn param<T>(
20129 mut self,
20130 name: T,
20131 value: T,
20132 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C>
20133 where
20134 T: AsRef<str>,
20135 {
20136 self._additional_params
20137 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20138 self
20139 }
20140
20141 /// Identifies the authorization scope for the method you are building.
20142 ///
20143 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20144 /// [`Scope::CloudPlatform`].
20145 ///
20146 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20147 /// tokens for more than one scope.
20148 ///
20149 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20150 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20151 /// sufficient, a read-write scope will do as well.
20152 pub fn add_scope<St>(
20153 mut self,
20154 scope: St,
20155 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C>
20156 where
20157 St: AsRef<str>,
20158 {
20159 self._scopes.insert(String::from(scope.as_ref()));
20160 self
20161 }
20162 /// Identifies the authorization scope(s) for the method you are building.
20163 ///
20164 /// See [`Self::add_scope()`] for details.
20165 pub fn add_scopes<I, St>(
20166 mut self,
20167 scopes: I,
20168 ) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C>
20169 where
20170 I: IntoIterator<Item = St>,
20171 St: AsRef<str>,
20172 {
20173 self._scopes
20174 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20175 self
20176 }
20177
20178 /// Removes all scopes, and no default scope will be used either.
20179 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20180 /// for details).
20181 pub fn clear_scopes(mut self) -> ProjectLocationApplicationDomainMappingDeleteCall<'a, C> {
20182 self._scopes.clear();
20183 self
20184 }
20185}
20186
20187/// Gets the specified domain mapping.
20188///
20189/// A builder for the *locations.applications.domainMappings.get* method supported by a *project* resource.
20190/// It is not used directly, but through a [`ProjectMethods`] instance.
20191///
20192/// # Example
20193///
20194/// Instantiate a resource method builder
20195///
20196/// ```test_harness,no_run
20197/// # extern crate hyper;
20198/// # extern crate hyper_rustls;
20199/// # extern crate google_appengine1 as appengine1;
20200/// # async fn dox() {
20201/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20202///
20203/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20204/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20205/// # .with_native_roots()
20206/// # .unwrap()
20207/// # .https_only()
20208/// # .enable_http2()
20209/// # .build();
20210///
20211/// # let executor = hyper_util::rt::TokioExecutor::new();
20212/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20213/// # secret,
20214/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20215/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20216/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20217/// # ),
20218/// # ).build().await.unwrap();
20219///
20220/// # let client = hyper_util::client::legacy::Client::builder(
20221/// # hyper_util::rt::TokioExecutor::new()
20222/// # )
20223/// # .build(
20224/// # hyper_rustls::HttpsConnectorBuilder::new()
20225/// # .with_native_roots()
20226/// # .unwrap()
20227/// # .https_or_http()
20228/// # .enable_http2()
20229/// # .build()
20230/// # );
20231/// # let mut hub = Appengine::new(client, auth);
20232/// // You can configure optional parameters by calling the respective setters at will, and
20233/// // execute the final call using `doit()`.
20234/// // Values shown here are possibly random and not representative !
20235/// let result = hub.projects().locations_applications_domain_mappings_get("projectsId", "locationsId", "applicationsId", "domainMappingsId")
20236/// .doit().await;
20237/// # }
20238/// ```
20239pub struct ProjectLocationApplicationDomainMappingGetCall<'a, C>
20240where
20241 C: 'a,
20242{
20243 hub: &'a Appengine<C>,
20244 _projects_id: String,
20245 _locations_id: String,
20246 _applications_id: String,
20247 _domain_mappings_id: String,
20248 _delegate: Option<&'a mut dyn common::Delegate>,
20249 _additional_params: HashMap<String, String>,
20250 _scopes: BTreeSet<String>,
20251}
20252
20253impl<'a, C> common::CallBuilder for ProjectLocationApplicationDomainMappingGetCall<'a, C> {}
20254
20255impl<'a, C> ProjectLocationApplicationDomainMappingGetCall<'a, C>
20256where
20257 C: common::Connector,
20258{
20259 /// Perform the operation you have build so far.
20260 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
20261 use std::borrow::Cow;
20262 use std::io::{Read, Seek};
20263
20264 use common::{url::Params, ToParts};
20265 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20266
20267 let mut dd = common::DefaultDelegate;
20268 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20269 dlg.begin(common::MethodInfo {
20270 id: "appengine.projects.locations.applications.domainMappings.get",
20271 http_method: hyper::Method::GET,
20272 });
20273
20274 for &field in [
20275 "alt",
20276 "projectsId",
20277 "locationsId",
20278 "applicationsId",
20279 "domainMappingsId",
20280 ]
20281 .iter()
20282 {
20283 if self._additional_params.contains_key(field) {
20284 dlg.finished(false);
20285 return Err(common::Error::FieldClash(field));
20286 }
20287 }
20288
20289 let mut params = Params::with_capacity(6 + self._additional_params.len());
20290 params.push("projectsId", self._projects_id);
20291 params.push("locationsId", self._locations_id);
20292 params.push("applicationsId", self._applications_id);
20293 params.push("domainMappingsId", self._domain_mappings_id);
20294
20295 params.extend(self._additional_params.iter());
20296
20297 params.push("alt", "json");
20298 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/domainMappings/{domainMappingsId}";
20299 if self._scopes.is_empty() {
20300 self._scopes
20301 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
20302 }
20303
20304 #[allow(clippy::single_element_loop)]
20305 for &(find_this, param_name) in [
20306 ("{projectsId}", "projectsId"),
20307 ("{locationsId}", "locationsId"),
20308 ("{applicationsId}", "applicationsId"),
20309 ("{domainMappingsId}", "domainMappingsId"),
20310 ]
20311 .iter()
20312 {
20313 url = params.uri_replacement(url, param_name, find_this, false);
20314 }
20315 {
20316 let to_remove = [
20317 "domainMappingsId",
20318 "applicationsId",
20319 "locationsId",
20320 "projectsId",
20321 ];
20322 params.remove_params(&to_remove);
20323 }
20324
20325 let url = params.parse_with_url(&url);
20326
20327 loop {
20328 let token = match self
20329 .hub
20330 .auth
20331 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20332 .await
20333 {
20334 Ok(token) => token,
20335 Err(e) => match dlg.token(e) {
20336 Ok(token) => token,
20337 Err(e) => {
20338 dlg.finished(false);
20339 return Err(common::Error::MissingToken(e));
20340 }
20341 },
20342 };
20343 let mut req_result = {
20344 let client = &self.hub.client;
20345 dlg.pre_request();
20346 let mut req_builder = hyper::Request::builder()
20347 .method(hyper::Method::GET)
20348 .uri(url.as_str())
20349 .header(USER_AGENT, self.hub._user_agent.clone());
20350
20351 if let Some(token) = token.as_ref() {
20352 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20353 }
20354
20355 let request = req_builder
20356 .header(CONTENT_LENGTH, 0_u64)
20357 .body(common::to_body::<String>(None));
20358
20359 client.request(request.unwrap()).await
20360 };
20361
20362 match req_result {
20363 Err(err) => {
20364 if let common::Retry::After(d) = dlg.http_error(&err) {
20365 sleep(d).await;
20366 continue;
20367 }
20368 dlg.finished(false);
20369 return Err(common::Error::HttpError(err));
20370 }
20371 Ok(res) => {
20372 let (mut parts, body) = res.into_parts();
20373 let mut body = common::Body::new(body);
20374 if !parts.status.is_success() {
20375 let bytes = common::to_bytes(body).await.unwrap_or_default();
20376 let error = serde_json::from_str(&common::to_string(&bytes));
20377 let response = common::to_response(parts, bytes.into());
20378
20379 if let common::Retry::After(d) =
20380 dlg.http_failure(&response, error.as_ref().ok())
20381 {
20382 sleep(d).await;
20383 continue;
20384 }
20385
20386 dlg.finished(false);
20387
20388 return Err(match error {
20389 Ok(value) => common::Error::BadRequest(value),
20390 _ => common::Error::Failure(response),
20391 });
20392 }
20393 let response = {
20394 let bytes = common::to_bytes(body).await.unwrap_or_default();
20395 let encoded = common::to_string(&bytes);
20396 match serde_json::from_str(&encoded) {
20397 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20398 Err(error) => {
20399 dlg.response_json_decode_error(&encoded, &error);
20400 return Err(common::Error::JsonDecodeError(
20401 encoded.to_string(),
20402 error,
20403 ));
20404 }
20405 }
20406 };
20407
20408 dlg.finished(true);
20409 return Ok(response);
20410 }
20411 }
20412 }
20413 }
20414
20415 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/domainMappings/example.com.
20416 ///
20417 /// Sets the *projects id* path property to the given value.
20418 ///
20419 /// Even though the property as already been set when instantiating this call,
20420 /// we provide this method for API completeness.
20421 pub fn projects_id(
20422 mut self,
20423 new_value: &str,
20424 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C> {
20425 self._projects_id = new_value.to_string();
20426 self
20427 }
20428 /// Part of `name`. See documentation of `projectsId`.
20429 ///
20430 /// Sets the *locations id* path property to the given value.
20431 ///
20432 /// Even though the property as already been set when instantiating this call,
20433 /// we provide this method for API completeness.
20434 pub fn locations_id(
20435 mut self,
20436 new_value: &str,
20437 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C> {
20438 self._locations_id = new_value.to_string();
20439 self
20440 }
20441 /// Part of `name`. See documentation of `projectsId`.
20442 ///
20443 /// Sets the *applications id* path property to the given value.
20444 ///
20445 /// Even though the property as already been set when instantiating this call,
20446 /// we provide this method for API completeness.
20447 pub fn applications_id(
20448 mut self,
20449 new_value: &str,
20450 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C> {
20451 self._applications_id = new_value.to_string();
20452 self
20453 }
20454 /// Part of `name`. See documentation of `projectsId`.
20455 ///
20456 /// Sets the *domain mappings id* path property to the given value.
20457 ///
20458 /// Even though the property as already been set when instantiating this call,
20459 /// we provide this method for API completeness.
20460 pub fn domain_mappings_id(
20461 mut self,
20462 new_value: &str,
20463 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C> {
20464 self._domain_mappings_id = new_value.to_string();
20465 self
20466 }
20467 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20468 /// while executing the actual API request.
20469 ///
20470 /// ````text
20471 /// It should be used to handle progress information, and to implement a certain level of resilience.
20472 /// ````
20473 ///
20474 /// Sets the *delegate* property to the given value.
20475 pub fn delegate(
20476 mut self,
20477 new_value: &'a mut dyn common::Delegate,
20478 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C> {
20479 self._delegate = Some(new_value);
20480 self
20481 }
20482
20483 /// Set any additional parameter of the query string used in the request.
20484 /// It should be used to set parameters which are not yet available through their own
20485 /// setters.
20486 ///
20487 /// Please note that this method must not be used to set any of the known parameters
20488 /// which have their own setter method. If done anyway, the request will fail.
20489 ///
20490 /// # Additional Parameters
20491 ///
20492 /// * *$.xgafv* (query-string) - V1 error format.
20493 /// * *access_token* (query-string) - OAuth access token.
20494 /// * *alt* (query-string) - Data format for response.
20495 /// * *callback* (query-string) - JSONP
20496 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20497 /// * *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.
20498 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20499 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20500 /// * *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.
20501 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20502 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20503 pub fn param<T>(
20504 mut self,
20505 name: T,
20506 value: T,
20507 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C>
20508 where
20509 T: AsRef<str>,
20510 {
20511 self._additional_params
20512 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20513 self
20514 }
20515
20516 /// Identifies the authorization scope for the method you are building.
20517 ///
20518 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20519 /// [`Scope::CloudPlatformReadOnly`].
20520 ///
20521 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20522 /// tokens for more than one scope.
20523 ///
20524 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20525 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20526 /// sufficient, a read-write scope will do as well.
20527 pub fn add_scope<St>(
20528 mut self,
20529 scope: St,
20530 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C>
20531 where
20532 St: AsRef<str>,
20533 {
20534 self._scopes.insert(String::from(scope.as_ref()));
20535 self
20536 }
20537 /// Identifies the authorization scope(s) for the method you are building.
20538 ///
20539 /// See [`Self::add_scope()`] for details.
20540 pub fn add_scopes<I, St>(
20541 mut self,
20542 scopes: I,
20543 ) -> ProjectLocationApplicationDomainMappingGetCall<'a, C>
20544 where
20545 I: IntoIterator<Item = St>,
20546 St: AsRef<str>,
20547 {
20548 self._scopes
20549 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20550 self
20551 }
20552
20553 /// Removes all scopes, and no default scope will be used either.
20554 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20555 /// for details).
20556 pub fn clear_scopes(mut self) -> ProjectLocationApplicationDomainMappingGetCall<'a, C> {
20557 self._scopes.clear();
20558 self
20559 }
20560}
20561
20562/// Lists the domain mappings on an application.
20563///
20564/// A builder for the *locations.applications.domainMappings.list* method supported by a *project* resource.
20565/// It is not used directly, but through a [`ProjectMethods`] instance.
20566///
20567/// # Example
20568///
20569/// Instantiate a resource method builder
20570///
20571/// ```test_harness,no_run
20572/// # extern crate hyper;
20573/// # extern crate hyper_rustls;
20574/// # extern crate google_appengine1 as appengine1;
20575/// # async fn dox() {
20576/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20577///
20578/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20579/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20580/// # .with_native_roots()
20581/// # .unwrap()
20582/// # .https_only()
20583/// # .enable_http2()
20584/// # .build();
20585///
20586/// # let executor = hyper_util::rt::TokioExecutor::new();
20587/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20588/// # secret,
20589/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20590/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20591/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20592/// # ),
20593/// # ).build().await.unwrap();
20594///
20595/// # let client = hyper_util::client::legacy::Client::builder(
20596/// # hyper_util::rt::TokioExecutor::new()
20597/// # )
20598/// # .build(
20599/// # hyper_rustls::HttpsConnectorBuilder::new()
20600/// # .with_native_roots()
20601/// # .unwrap()
20602/// # .https_or_http()
20603/// # .enable_http2()
20604/// # .build()
20605/// # );
20606/// # let mut hub = Appengine::new(client, auth);
20607/// // You can configure optional parameters by calling the respective setters at will, and
20608/// // execute the final call using `doit()`.
20609/// // Values shown here are possibly random and not representative !
20610/// let result = hub.projects().locations_applications_domain_mappings_list("projectsId", "locationsId", "applicationsId")
20611/// .page_token("accusam")
20612/// .page_size(-10)
20613/// .doit().await;
20614/// # }
20615/// ```
20616pub struct ProjectLocationApplicationDomainMappingListCall<'a, C>
20617where
20618 C: 'a,
20619{
20620 hub: &'a Appengine<C>,
20621 _projects_id: String,
20622 _locations_id: String,
20623 _applications_id: String,
20624 _page_token: Option<String>,
20625 _page_size: Option<i32>,
20626 _delegate: Option<&'a mut dyn common::Delegate>,
20627 _additional_params: HashMap<String, String>,
20628 _scopes: BTreeSet<String>,
20629}
20630
20631impl<'a, C> common::CallBuilder for ProjectLocationApplicationDomainMappingListCall<'a, C> {}
20632
20633impl<'a, C> ProjectLocationApplicationDomainMappingListCall<'a, C>
20634where
20635 C: common::Connector,
20636{
20637 /// Perform the operation you have build so far.
20638 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainMappingsResponse)> {
20639 use std::borrow::Cow;
20640 use std::io::{Read, Seek};
20641
20642 use common::{url::Params, ToParts};
20643 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20644
20645 let mut dd = common::DefaultDelegate;
20646 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20647 dlg.begin(common::MethodInfo {
20648 id: "appengine.projects.locations.applications.domainMappings.list",
20649 http_method: hyper::Method::GET,
20650 });
20651
20652 for &field in [
20653 "alt",
20654 "projectsId",
20655 "locationsId",
20656 "applicationsId",
20657 "pageToken",
20658 "pageSize",
20659 ]
20660 .iter()
20661 {
20662 if self._additional_params.contains_key(field) {
20663 dlg.finished(false);
20664 return Err(common::Error::FieldClash(field));
20665 }
20666 }
20667
20668 let mut params = Params::with_capacity(7 + self._additional_params.len());
20669 params.push("projectsId", self._projects_id);
20670 params.push("locationsId", self._locations_id);
20671 params.push("applicationsId", self._applications_id);
20672 if let Some(value) = self._page_token.as_ref() {
20673 params.push("pageToken", value);
20674 }
20675 if let Some(value) = self._page_size.as_ref() {
20676 params.push("pageSize", value.to_string());
20677 }
20678
20679 params.extend(self._additional_params.iter());
20680
20681 params.push("alt", "json");
20682 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/domainMappings";
20683 if self._scopes.is_empty() {
20684 self._scopes
20685 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
20686 }
20687
20688 #[allow(clippy::single_element_loop)]
20689 for &(find_this, param_name) in [
20690 ("{projectsId}", "projectsId"),
20691 ("{locationsId}", "locationsId"),
20692 ("{applicationsId}", "applicationsId"),
20693 ]
20694 .iter()
20695 {
20696 url = params.uri_replacement(url, param_name, find_this, false);
20697 }
20698 {
20699 let to_remove = ["applicationsId", "locationsId", "projectsId"];
20700 params.remove_params(&to_remove);
20701 }
20702
20703 let url = params.parse_with_url(&url);
20704
20705 loop {
20706 let token = match self
20707 .hub
20708 .auth
20709 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20710 .await
20711 {
20712 Ok(token) => token,
20713 Err(e) => match dlg.token(e) {
20714 Ok(token) => token,
20715 Err(e) => {
20716 dlg.finished(false);
20717 return Err(common::Error::MissingToken(e));
20718 }
20719 },
20720 };
20721 let mut req_result = {
20722 let client = &self.hub.client;
20723 dlg.pre_request();
20724 let mut req_builder = hyper::Request::builder()
20725 .method(hyper::Method::GET)
20726 .uri(url.as_str())
20727 .header(USER_AGENT, self.hub._user_agent.clone());
20728
20729 if let Some(token) = token.as_ref() {
20730 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20731 }
20732
20733 let request = req_builder
20734 .header(CONTENT_LENGTH, 0_u64)
20735 .body(common::to_body::<String>(None));
20736
20737 client.request(request.unwrap()).await
20738 };
20739
20740 match req_result {
20741 Err(err) => {
20742 if let common::Retry::After(d) = dlg.http_error(&err) {
20743 sleep(d).await;
20744 continue;
20745 }
20746 dlg.finished(false);
20747 return Err(common::Error::HttpError(err));
20748 }
20749 Ok(res) => {
20750 let (mut parts, body) = res.into_parts();
20751 let mut body = common::Body::new(body);
20752 if !parts.status.is_success() {
20753 let bytes = common::to_bytes(body).await.unwrap_or_default();
20754 let error = serde_json::from_str(&common::to_string(&bytes));
20755 let response = common::to_response(parts, bytes.into());
20756
20757 if let common::Retry::After(d) =
20758 dlg.http_failure(&response, error.as_ref().ok())
20759 {
20760 sleep(d).await;
20761 continue;
20762 }
20763
20764 dlg.finished(false);
20765
20766 return Err(match error {
20767 Ok(value) => common::Error::BadRequest(value),
20768 _ => common::Error::Failure(response),
20769 });
20770 }
20771 let response = {
20772 let bytes = common::to_bytes(body).await.unwrap_or_default();
20773 let encoded = common::to_string(&bytes);
20774 match serde_json::from_str(&encoded) {
20775 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20776 Err(error) => {
20777 dlg.response_json_decode_error(&encoded, &error);
20778 return Err(common::Error::JsonDecodeError(
20779 encoded.to_string(),
20780 error,
20781 ));
20782 }
20783 }
20784 };
20785
20786 dlg.finished(true);
20787 return Ok(response);
20788 }
20789 }
20790 }
20791 }
20792
20793 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
20794 ///
20795 /// Sets the *projects id* path property to the given value.
20796 ///
20797 /// Even though the property as already been set when instantiating this call,
20798 /// we provide this method for API completeness.
20799 pub fn projects_id(
20800 mut self,
20801 new_value: &str,
20802 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
20803 self._projects_id = new_value.to_string();
20804 self
20805 }
20806 /// Part of `parent`. See documentation of `projectsId`.
20807 ///
20808 /// Sets the *locations id* path property to the given value.
20809 ///
20810 /// Even though the property as already been set when instantiating this call,
20811 /// we provide this method for API completeness.
20812 pub fn locations_id(
20813 mut self,
20814 new_value: &str,
20815 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
20816 self._locations_id = new_value.to_string();
20817 self
20818 }
20819 /// Part of `parent`. See documentation of `projectsId`.
20820 ///
20821 /// Sets the *applications id* path property to the given value.
20822 ///
20823 /// Even though the property as already been set when instantiating this call,
20824 /// we provide this method for API completeness.
20825 pub fn applications_id(
20826 mut self,
20827 new_value: &str,
20828 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
20829 self._applications_id = new_value.to_string();
20830 self
20831 }
20832 /// Continuation token for fetching the next page of results.
20833 ///
20834 /// Sets the *page token* query property to the given value.
20835 pub fn page_token(
20836 mut self,
20837 new_value: &str,
20838 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
20839 self._page_token = Some(new_value.to_string());
20840 self
20841 }
20842 /// Maximum results to return per page.
20843 ///
20844 /// Sets the *page size* query property to the given value.
20845 pub fn page_size(
20846 mut self,
20847 new_value: i32,
20848 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
20849 self._page_size = Some(new_value);
20850 self
20851 }
20852 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20853 /// while executing the actual API request.
20854 ///
20855 /// ````text
20856 /// It should be used to handle progress information, and to implement a certain level of resilience.
20857 /// ````
20858 ///
20859 /// Sets the *delegate* property to the given value.
20860 pub fn delegate(
20861 mut self,
20862 new_value: &'a mut dyn common::Delegate,
20863 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
20864 self._delegate = Some(new_value);
20865 self
20866 }
20867
20868 /// Set any additional parameter of the query string used in the request.
20869 /// It should be used to set parameters which are not yet available through their own
20870 /// setters.
20871 ///
20872 /// Please note that this method must not be used to set any of the known parameters
20873 /// which have their own setter method. If done anyway, the request will fail.
20874 ///
20875 /// # Additional Parameters
20876 ///
20877 /// * *$.xgafv* (query-string) - V1 error format.
20878 /// * *access_token* (query-string) - OAuth access token.
20879 /// * *alt* (query-string) - Data format for response.
20880 /// * *callback* (query-string) - JSONP
20881 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20882 /// * *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.
20883 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20884 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20885 /// * *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.
20886 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20887 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20888 pub fn param<T>(
20889 mut self,
20890 name: T,
20891 value: T,
20892 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C>
20893 where
20894 T: AsRef<str>,
20895 {
20896 self._additional_params
20897 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20898 self
20899 }
20900
20901 /// Identifies the authorization scope for the method you are building.
20902 ///
20903 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20904 /// [`Scope::CloudPlatformReadOnly`].
20905 ///
20906 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20907 /// tokens for more than one scope.
20908 ///
20909 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20910 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20911 /// sufficient, a read-write scope will do as well.
20912 pub fn add_scope<St>(
20913 mut self,
20914 scope: St,
20915 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C>
20916 where
20917 St: AsRef<str>,
20918 {
20919 self._scopes.insert(String::from(scope.as_ref()));
20920 self
20921 }
20922 /// Identifies the authorization scope(s) for the method you are building.
20923 ///
20924 /// See [`Self::add_scope()`] for details.
20925 pub fn add_scopes<I, St>(
20926 mut self,
20927 scopes: I,
20928 ) -> ProjectLocationApplicationDomainMappingListCall<'a, C>
20929 where
20930 I: IntoIterator<Item = St>,
20931 St: AsRef<str>,
20932 {
20933 self._scopes
20934 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20935 self
20936 }
20937
20938 /// Removes all scopes, and no default scope will be used either.
20939 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20940 /// for details).
20941 pub fn clear_scopes(mut self) -> ProjectLocationApplicationDomainMappingListCall<'a, C> {
20942 self._scopes.clear();
20943 self
20944 }
20945}
20946
20947/// Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update certificate_id to point to an AuthorizedCertificate resource. A user must be authorized to administer the associated domain in order to update a DomainMapping resource.
20948///
20949/// A builder for the *locations.applications.domainMappings.patch* method supported by a *project* resource.
20950/// It is not used directly, but through a [`ProjectMethods`] instance.
20951///
20952/// # Example
20953///
20954/// Instantiate a resource method builder
20955///
20956/// ```test_harness,no_run
20957/// # extern crate hyper;
20958/// # extern crate hyper_rustls;
20959/// # extern crate google_appengine1 as appengine1;
20960/// use appengine1::api::DomainMapping;
20961/// # async fn dox() {
20962/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20963///
20964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20965/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20966/// # .with_native_roots()
20967/// # .unwrap()
20968/// # .https_only()
20969/// # .enable_http2()
20970/// # .build();
20971///
20972/// # let executor = hyper_util::rt::TokioExecutor::new();
20973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20974/// # secret,
20975/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20976/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20977/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20978/// # ),
20979/// # ).build().await.unwrap();
20980///
20981/// # let client = hyper_util::client::legacy::Client::builder(
20982/// # hyper_util::rt::TokioExecutor::new()
20983/// # )
20984/// # .build(
20985/// # hyper_rustls::HttpsConnectorBuilder::new()
20986/// # .with_native_roots()
20987/// # .unwrap()
20988/// # .https_or_http()
20989/// # .enable_http2()
20990/// # .build()
20991/// # );
20992/// # let mut hub = Appengine::new(client, auth);
20993/// // As the method needs a request, you would usually fill it with the desired information
20994/// // into the respective structure. Some of the parts shown here might not be applicable !
20995/// // Values shown here are possibly random and not representative !
20996/// let mut req = DomainMapping::default();
20997///
20998/// // You can configure optional parameters by calling the respective setters at will, and
20999/// // execute the final call using `doit()`.
21000/// // Values shown here are possibly random and not representative !
21001/// let result = hub.projects().locations_applications_domain_mappings_patch(req, "projectsId", "locationsId", "applicationsId", "domainMappingsId")
21002/// .update_mask(FieldMask::new::<&str>(&[]))
21003/// .doit().await;
21004/// # }
21005/// ```
21006pub struct ProjectLocationApplicationDomainMappingPatchCall<'a, C>
21007where
21008 C: 'a,
21009{
21010 hub: &'a Appengine<C>,
21011 _request: DomainMapping,
21012 _projects_id: String,
21013 _locations_id: String,
21014 _applications_id: String,
21015 _domain_mappings_id: String,
21016 _update_mask: Option<common::FieldMask>,
21017 _delegate: Option<&'a mut dyn common::Delegate>,
21018 _additional_params: HashMap<String, String>,
21019 _scopes: BTreeSet<String>,
21020}
21021
21022impl<'a, C> common::CallBuilder for ProjectLocationApplicationDomainMappingPatchCall<'a, C> {}
21023
21024impl<'a, C> ProjectLocationApplicationDomainMappingPatchCall<'a, C>
21025where
21026 C: common::Connector,
21027{
21028 /// Perform the operation you have build so far.
21029 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21030 use std::borrow::Cow;
21031 use std::io::{Read, Seek};
21032
21033 use common::{url::Params, ToParts};
21034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21035
21036 let mut dd = common::DefaultDelegate;
21037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21038 dlg.begin(common::MethodInfo {
21039 id: "appengine.projects.locations.applications.domainMappings.patch",
21040 http_method: hyper::Method::PATCH,
21041 });
21042
21043 for &field in [
21044 "alt",
21045 "projectsId",
21046 "locationsId",
21047 "applicationsId",
21048 "domainMappingsId",
21049 "updateMask",
21050 ]
21051 .iter()
21052 {
21053 if self._additional_params.contains_key(field) {
21054 dlg.finished(false);
21055 return Err(common::Error::FieldClash(field));
21056 }
21057 }
21058
21059 let mut params = Params::with_capacity(8 + self._additional_params.len());
21060 params.push("projectsId", self._projects_id);
21061 params.push("locationsId", self._locations_id);
21062 params.push("applicationsId", self._applications_id);
21063 params.push("domainMappingsId", self._domain_mappings_id);
21064 if let Some(value) = self._update_mask.as_ref() {
21065 params.push("updateMask", value.to_string());
21066 }
21067
21068 params.extend(self._additional_params.iter());
21069
21070 params.push("alt", "json");
21071 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/domainMappings/{domainMappingsId}";
21072 if self._scopes.is_empty() {
21073 self._scopes
21074 .insert(Scope::CloudPlatform.as_ref().to_string());
21075 }
21076
21077 #[allow(clippy::single_element_loop)]
21078 for &(find_this, param_name) in [
21079 ("{projectsId}", "projectsId"),
21080 ("{locationsId}", "locationsId"),
21081 ("{applicationsId}", "applicationsId"),
21082 ("{domainMappingsId}", "domainMappingsId"),
21083 ]
21084 .iter()
21085 {
21086 url = params.uri_replacement(url, param_name, find_this, false);
21087 }
21088 {
21089 let to_remove = [
21090 "domainMappingsId",
21091 "applicationsId",
21092 "locationsId",
21093 "projectsId",
21094 ];
21095 params.remove_params(&to_remove);
21096 }
21097
21098 let url = params.parse_with_url(&url);
21099
21100 let mut json_mime_type = mime::APPLICATION_JSON;
21101 let mut request_value_reader = {
21102 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21103 common::remove_json_null_values(&mut value);
21104 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21105 serde_json::to_writer(&mut dst, &value).unwrap();
21106 dst
21107 };
21108 let request_size = request_value_reader
21109 .seek(std::io::SeekFrom::End(0))
21110 .unwrap();
21111 request_value_reader
21112 .seek(std::io::SeekFrom::Start(0))
21113 .unwrap();
21114
21115 loop {
21116 let token = match self
21117 .hub
21118 .auth
21119 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21120 .await
21121 {
21122 Ok(token) => token,
21123 Err(e) => match dlg.token(e) {
21124 Ok(token) => token,
21125 Err(e) => {
21126 dlg.finished(false);
21127 return Err(common::Error::MissingToken(e));
21128 }
21129 },
21130 };
21131 request_value_reader
21132 .seek(std::io::SeekFrom::Start(0))
21133 .unwrap();
21134 let mut req_result = {
21135 let client = &self.hub.client;
21136 dlg.pre_request();
21137 let mut req_builder = hyper::Request::builder()
21138 .method(hyper::Method::PATCH)
21139 .uri(url.as_str())
21140 .header(USER_AGENT, self.hub._user_agent.clone());
21141
21142 if let Some(token) = token.as_ref() {
21143 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21144 }
21145
21146 let request = req_builder
21147 .header(CONTENT_TYPE, json_mime_type.to_string())
21148 .header(CONTENT_LENGTH, request_size as u64)
21149 .body(common::to_body(
21150 request_value_reader.get_ref().clone().into(),
21151 ));
21152
21153 client.request(request.unwrap()).await
21154 };
21155
21156 match req_result {
21157 Err(err) => {
21158 if let common::Retry::After(d) = dlg.http_error(&err) {
21159 sleep(d).await;
21160 continue;
21161 }
21162 dlg.finished(false);
21163 return Err(common::Error::HttpError(err));
21164 }
21165 Ok(res) => {
21166 let (mut parts, body) = res.into_parts();
21167 let mut body = common::Body::new(body);
21168 if !parts.status.is_success() {
21169 let bytes = common::to_bytes(body).await.unwrap_or_default();
21170 let error = serde_json::from_str(&common::to_string(&bytes));
21171 let response = common::to_response(parts, bytes.into());
21172
21173 if let common::Retry::After(d) =
21174 dlg.http_failure(&response, error.as_ref().ok())
21175 {
21176 sleep(d).await;
21177 continue;
21178 }
21179
21180 dlg.finished(false);
21181
21182 return Err(match error {
21183 Ok(value) => common::Error::BadRequest(value),
21184 _ => common::Error::Failure(response),
21185 });
21186 }
21187 let response = {
21188 let bytes = common::to_bytes(body).await.unwrap_or_default();
21189 let encoded = common::to_string(&bytes);
21190 match serde_json::from_str(&encoded) {
21191 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21192 Err(error) => {
21193 dlg.response_json_decode_error(&encoded, &error);
21194 return Err(common::Error::JsonDecodeError(
21195 encoded.to_string(),
21196 error,
21197 ));
21198 }
21199 }
21200 };
21201
21202 dlg.finished(true);
21203 return Ok(response);
21204 }
21205 }
21206 }
21207 }
21208
21209 ///
21210 /// Sets the *request* property to the given value.
21211 ///
21212 /// Even though the property as already been set when instantiating this call,
21213 /// we provide this method for API completeness.
21214 pub fn request(
21215 mut self,
21216 new_value: DomainMapping,
21217 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21218 self._request = new_value;
21219 self
21220 }
21221 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/domainMappings/example.com.
21222 ///
21223 /// Sets the *projects id* path property to the given value.
21224 ///
21225 /// Even though the property as already been set when instantiating this call,
21226 /// we provide this method for API completeness.
21227 pub fn projects_id(
21228 mut self,
21229 new_value: &str,
21230 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21231 self._projects_id = new_value.to_string();
21232 self
21233 }
21234 /// Part of `name`. See documentation of `projectsId`.
21235 ///
21236 /// Sets the *locations id* path property to the given value.
21237 ///
21238 /// Even though the property as already been set when instantiating this call,
21239 /// we provide this method for API completeness.
21240 pub fn locations_id(
21241 mut self,
21242 new_value: &str,
21243 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21244 self._locations_id = new_value.to_string();
21245 self
21246 }
21247 /// Part of `name`. See documentation of `projectsId`.
21248 ///
21249 /// Sets the *applications id* path property to the given value.
21250 ///
21251 /// Even though the property as already been set when instantiating this call,
21252 /// we provide this method for API completeness.
21253 pub fn applications_id(
21254 mut self,
21255 new_value: &str,
21256 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21257 self._applications_id = new_value.to_string();
21258 self
21259 }
21260 /// Part of `name`. See documentation of `projectsId`.
21261 ///
21262 /// Sets the *domain mappings id* path property to the given value.
21263 ///
21264 /// Even though the property as already been set when instantiating this call,
21265 /// we provide this method for API completeness.
21266 pub fn domain_mappings_id(
21267 mut self,
21268 new_value: &str,
21269 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21270 self._domain_mappings_id = new_value.to_string();
21271 self
21272 }
21273 /// Required. Standard field mask for the set of fields to be updated.
21274 ///
21275 /// Sets the *update mask* query property to the given value.
21276 pub fn update_mask(
21277 mut self,
21278 new_value: common::FieldMask,
21279 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21280 self._update_mask = Some(new_value);
21281 self
21282 }
21283 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21284 /// while executing the actual API request.
21285 ///
21286 /// ````text
21287 /// It should be used to handle progress information, and to implement a certain level of resilience.
21288 /// ````
21289 ///
21290 /// Sets the *delegate* property to the given value.
21291 pub fn delegate(
21292 mut self,
21293 new_value: &'a mut dyn common::Delegate,
21294 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21295 self._delegate = Some(new_value);
21296 self
21297 }
21298
21299 /// Set any additional parameter of the query string used in the request.
21300 /// It should be used to set parameters which are not yet available through their own
21301 /// setters.
21302 ///
21303 /// Please note that this method must not be used to set any of the known parameters
21304 /// which have their own setter method. If done anyway, the request will fail.
21305 ///
21306 /// # Additional Parameters
21307 ///
21308 /// * *$.xgafv* (query-string) - V1 error format.
21309 /// * *access_token* (query-string) - OAuth access token.
21310 /// * *alt* (query-string) - Data format for response.
21311 /// * *callback* (query-string) - JSONP
21312 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21313 /// * *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.
21314 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21315 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21316 /// * *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.
21317 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21318 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21319 pub fn param<T>(
21320 mut self,
21321 name: T,
21322 value: T,
21323 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C>
21324 where
21325 T: AsRef<str>,
21326 {
21327 self._additional_params
21328 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21329 self
21330 }
21331
21332 /// Identifies the authorization scope for the method you are building.
21333 ///
21334 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21335 /// [`Scope::CloudPlatform`].
21336 ///
21337 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21338 /// tokens for more than one scope.
21339 ///
21340 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21341 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21342 /// sufficient, a read-write scope will do as well.
21343 pub fn add_scope<St>(
21344 mut self,
21345 scope: St,
21346 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C>
21347 where
21348 St: AsRef<str>,
21349 {
21350 self._scopes.insert(String::from(scope.as_ref()));
21351 self
21352 }
21353 /// Identifies the authorization scope(s) for the method you are building.
21354 ///
21355 /// See [`Self::add_scope()`] for details.
21356 pub fn add_scopes<I, St>(
21357 mut self,
21358 scopes: I,
21359 ) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C>
21360 where
21361 I: IntoIterator<Item = St>,
21362 St: AsRef<str>,
21363 {
21364 self._scopes
21365 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21366 self
21367 }
21368
21369 /// Removes all scopes, and no default scope will be used either.
21370 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21371 /// for details).
21372 pub fn clear_scopes(mut self) -> ProjectLocationApplicationDomainMappingPatchCall<'a, C> {
21373 self._scopes.clear();
21374 self
21375 }
21376}
21377
21378/// Deletes an existing Version resource.
21379///
21380/// A builder for the *locations.applications.services.versions.delete* method supported by a *project* resource.
21381/// It is not used directly, but through a [`ProjectMethods`] instance.
21382///
21383/// # Example
21384///
21385/// Instantiate a resource method builder
21386///
21387/// ```test_harness,no_run
21388/// # extern crate hyper;
21389/// # extern crate hyper_rustls;
21390/// # extern crate google_appengine1 as appengine1;
21391/// # async fn dox() {
21392/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21393///
21394/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21395/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21396/// # .with_native_roots()
21397/// # .unwrap()
21398/// # .https_only()
21399/// # .enable_http2()
21400/// # .build();
21401///
21402/// # let executor = hyper_util::rt::TokioExecutor::new();
21403/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21404/// # secret,
21405/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21406/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21407/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21408/// # ),
21409/// # ).build().await.unwrap();
21410///
21411/// # let client = hyper_util::client::legacy::Client::builder(
21412/// # hyper_util::rt::TokioExecutor::new()
21413/// # )
21414/// # .build(
21415/// # hyper_rustls::HttpsConnectorBuilder::new()
21416/// # .with_native_roots()
21417/// # .unwrap()
21418/// # .https_or_http()
21419/// # .enable_http2()
21420/// # .build()
21421/// # );
21422/// # let mut hub = Appengine::new(client, auth);
21423/// // You can configure optional parameters by calling the respective setters at will, and
21424/// // execute the final call using `doit()`.
21425/// // Values shown here are possibly random and not representative !
21426/// let result = hub.projects().locations_applications_services_versions_delete("projectsId", "locationsId", "applicationsId", "servicesId", "versionsId")
21427/// .doit().await;
21428/// # }
21429/// ```
21430pub struct ProjectLocationApplicationServiceVersionDeleteCall<'a, C>
21431where
21432 C: 'a,
21433{
21434 hub: &'a Appengine<C>,
21435 _projects_id: String,
21436 _locations_id: String,
21437 _applications_id: String,
21438 _services_id: String,
21439 _versions_id: String,
21440 _delegate: Option<&'a mut dyn common::Delegate>,
21441 _additional_params: HashMap<String, String>,
21442 _scopes: BTreeSet<String>,
21443}
21444
21445impl<'a, C> common::CallBuilder for ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {}
21446
21447impl<'a, C> ProjectLocationApplicationServiceVersionDeleteCall<'a, C>
21448where
21449 C: common::Connector,
21450{
21451 /// Perform the operation you have build so far.
21452 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21453 use std::borrow::Cow;
21454 use std::io::{Read, Seek};
21455
21456 use common::{url::Params, ToParts};
21457 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21458
21459 let mut dd = common::DefaultDelegate;
21460 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21461 dlg.begin(common::MethodInfo {
21462 id: "appengine.projects.locations.applications.services.versions.delete",
21463 http_method: hyper::Method::DELETE,
21464 });
21465
21466 for &field in [
21467 "alt",
21468 "projectsId",
21469 "locationsId",
21470 "applicationsId",
21471 "servicesId",
21472 "versionsId",
21473 ]
21474 .iter()
21475 {
21476 if self._additional_params.contains_key(field) {
21477 dlg.finished(false);
21478 return Err(common::Error::FieldClash(field));
21479 }
21480 }
21481
21482 let mut params = Params::with_capacity(7 + self._additional_params.len());
21483 params.push("projectsId", self._projects_id);
21484 params.push("locationsId", self._locations_id);
21485 params.push("applicationsId", self._applications_id);
21486 params.push("servicesId", self._services_id);
21487 params.push("versionsId", self._versions_id);
21488
21489 params.extend(self._additional_params.iter());
21490
21491 params.push("alt", "json");
21492 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/services/{servicesId}/versions/{versionsId}";
21493 if self._scopes.is_empty() {
21494 self._scopes
21495 .insert(Scope::CloudPlatform.as_ref().to_string());
21496 }
21497
21498 #[allow(clippy::single_element_loop)]
21499 for &(find_this, param_name) in [
21500 ("{projectsId}", "projectsId"),
21501 ("{locationsId}", "locationsId"),
21502 ("{applicationsId}", "applicationsId"),
21503 ("{servicesId}", "servicesId"),
21504 ("{versionsId}", "versionsId"),
21505 ]
21506 .iter()
21507 {
21508 url = params.uri_replacement(url, param_name, find_this, false);
21509 }
21510 {
21511 let to_remove = [
21512 "versionsId",
21513 "servicesId",
21514 "applicationsId",
21515 "locationsId",
21516 "projectsId",
21517 ];
21518 params.remove_params(&to_remove);
21519 }
21520
21521 let url = params.parse_with_url(&url);
21522
21523 loop {
21524 let token = match self
21525 .hub
21526 .auth
21527 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21528 .await
21529 {
21530 Ok(token) => token,
21531 Err(e) => match dlg.token(e) {
21532 Ok(token) => token,
21533 Err(e) => {
21534 dlg.finished(false);
21535 return Err(common::Error::MissingToken(e));
21536 }
21537 },
21538 };
21539 let mut req_result = {
21540 let client = &self.hub.client;
21541 dlg.pre_request();
21542 let mut req_builder = hyper::Request::builder()
21543 .method(hyper::Method::DELETE)
21544 .uri(url.as_str())
21545 .header(USER_AGENT, self.hub._user_agent.clone());
21546
21547 if let Some(token) = token.as_ref() {
21548 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21549 }
21550
21551 let request = req_builder
21552 .header(CONTENT_LENGTH, 0_u64)
21553 .body(common::to_body::<String>(None));
21554
21555 client.request(request.unwrap()).await
21556 };
21557
21558 match req_result {
21559 Err(err) => {
21560 if let common::Retry::After(d) = dlg.http_error(&err) {
21561 sleep(d).await;
21562 continue;
21563 }
21564 dlg.finished(false);
21565 return Err(common::Error::HttpError(err));
21566 }
21567 Ok(res) => {
21568 let (mut parts, body) = res.into_parts();
21569 let mut body = common::Body::new(body);
21570 if !parts.status.is_success() {
21571 let bytes = common::to_bytes(body).await.unwrap_or_default();
21572 let error = serde_json::from_str(&common::to_string(&bytes));
21573 let response = common::to_response(parts, bytes.into());
21574
21575 if let common::Retry::After(d) =
21576 dlg.http_failure(&response, error.as_ref().ok())
21577 {
21578 sleep(d).await;
21579 continue;
21580 }
21581
21582 dlg.finished(false);
21583
21584 return Err(match error {
21585 Ok(value) => common::Error::BadRequest(value),
21586 _ => common::Error::Failure(response),
21587 });
21588 }
21589 let response = {
21590 let bytes = common::to_bytes(body).await.unwrap_or_default();
21591 let encoded = common::to_string(&bytes);
21592 match serde_json::from_str(&encoded) {
21593 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21594 Err(error) => {
21595 dlg.response_json_decode_error(&encoded, &error);
21596 return Err(common::Error::JsonDecodeError(
21597 encoded.to_string(),
21598 error,
21599 ));
21600 }
21601 }
21602 };
21603
21604 dlg.finished(true);
21605 return Ok(response);
21606 }
21607 }
21608 }
21609 }
21610
21611 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
21612 ///
21613 /// Sets the *projects id* path property to the given value.
21614 ///
21615 /// Even though the property as already been set when instantiating this call,
21616 /// we provide this method for API completeness.
21617 pub fn projects_id(
21618 mut self,
21619 new_value: &str,
21620 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
21621 self._projects_id = new_value.to_string();
21622 self
21623 }
21624 /// Part of `name`. See documentation of `projectsId`.
21625 ///
21626 /// Sets the *locations id* path property to the given value.
21627 ///
21628 /// Even though the property as already been set when instantiating this call,
21629 /// we provide this method for API completeness.
21630 pub fn locations_id(
21631 mut self,
21632 new_value: &str,
21633 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
21634 self._locations_id = new_value.to_string();
21635 self
21636 }
21637 /// Part of `name`. See documentation of `projectsId`.
21638 ///
21639 /// Sets the *applications id* path property to the given value.
21640 ///
21641 /// Even though the property as already been set when instantiating this call,
21642 /// we provide this method for API completeness.
21643 pub fn applications_id(
21644 mut self,
21645 new_value: &str,
21646 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
21647 self._applications_id = new_value.to_string();
21648 self
21649 }
21650 /// Part of `name`. See documentation of `projectsId`.
21651 ///
21652 /// Sets the *services id* path property to the given value.
21653 ///
21654 /// Even though the property as already been set when instantiating this call,
21655 /// we provide this method for API completeness.
21656 pub fn services_id(
21657 mut self,
21658 new_value: &str,
21659 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
21660 self._services_id = new_value.to_string();
21661 self
21662 }
21663 /// Part of `name`. See documentation of `projectsId`.
21664 ///
21665 /// Sets the *versions id* path property to the given value.
21666 ///
21667 /// Even though the property as already been set when instantiating this call,
21668 /// we provide this method for API completeness.
21669 pub fn versions_id(
21670 mut self,
21671 new_value: &str,
21672 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
21673 self._versions_id = new_value.to_string();
21674 self
21675 }
21676 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21677 /// while executing the actual API request.
21678 ///
21679 /// ````text
21680 /// It should be used to handle progress information, and to implement a certain level of resilience.
21681 /// ````
21682 ///
21683 /// Sets the *delegate* property to the given value.
21684 pub fn delegate(
21685 mut self,
21686 new_value: &'a mut dyn common::Delegate,
21687 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
21688 self._delegate = Some(new_value);
21689 self
21690 }
21691
21692 /// Set any additional parameter of the query string used in the request.
21693 /// It should be used to set parameters which are not yet available through their own
21694 /// setters.
21695 ///
21696 /// Please note that this method must not be used to set any of the known parameters
21697 /// which have their own setter method. If done anyway, the request will fail.
21698 ///
21699 /// # Additional Parameters
21700 ///
21701 /// * *$.xgafv* (query-string) - V1 error format.
21702 /// * *access_token* (query-string) - OAuth access token.
21703 /// * *alt* (query-string) - Data format for response.
21704 /// * *callback* (query-string) - JSONP
21705 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21706 /// * *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.
21707 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21708 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21709 /// * *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.
21710 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21711 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21712 pub fn param<T>(
21713 mut self,
21714 name: T,
21715 value: T,
21716 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C>
21717 where
21718 T: AsRef<str>,
21719 {
21720 self._additional_params
21721 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21722 self
21723 }
21724
21725 /// Identifies the authorization scope for the method you are building.
21726 ///
21727 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21728 /// [`Scope::CloudPlatform`].
21729 ///
21730 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21731 /// tokens for more than one scope.
21732 ///
21733 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21734 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21735 /// sufficient, a read-write scope will do as well.
21736 pub fn add_scope<St>(
21737 mut self,
21738 scope: St,
21739 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C>
21740 where
21741 St: AsRef<str>,
21742 {
21743 self._scopes.insert(String::from(scope.as_ref()));
21744 self
21745 }
21746 /// Identifies the authorization scope(s) for the method you are building.
21747 ///
21748 /// See [`Self::add_scope()`] for details.
21749 pub fn add_scopes<I, St>(
21750 mut self,
21751 scopes: I,
21752 ) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C>
21753 where
21754 I: IntoIterator<Item = St>,
21755 St: AsRef<str>,
21756 {
21757 self._scopes
21758 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21759 self
21760 }
21761
21762 /// Removes all scopes, and no default scope will be used either.
21763 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21764 /// for details).
21765 pub fn clear_scopes(mut self) -> ProjectLocationApplicationServiceVersionDeleteCall<'a, C> {
21766 self._scopes.clear();
21767 self
21768 }
21769}
21770
21771/// Exports a user image to Artifact Registry.
21772///
21773/// A builder for the *locations.applications.services.versions.exportAppImage* method supported by a *project* resource.
21774/// It is not used directly, but through a [`ProjectMethods`] instance.
21775///
21776/// # Example
21777///
21778/// Instantiate a resource method builder
21779///
21780/// ```test_harness,no_run
21781/// # extern crate hyper;
21782/// # extern crate hyper_rustls;
21783/// # extern crate google_appengine1 as appengine1;
21784/// use appengine1::api::ExportAppImageRequest;
21785/// # async fn dox() {
21786/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21787///
21788/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21789/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21790/// # .with_native_roots()
21791/// # .unwrap()
21792/// # .https_only()
21793/// # .enable_http2()
21794/// # .build();
21795///
21796/// # let executor = hyper_util::rt::TokioExecutor::new();
21797/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21798/// # secret,
21799/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21800/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21801/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21802/// # ),
21803/// # ).build().await.unwrap();
21804///
21805/// # let client = hyper_util::client::legacy::Client::builder(
21806/// # hyper_util::rt::TokioExecutor::new()
21807/// # )
21808/// # .build(
21809/// # hyper_rustls::HttpsConnectorBuilder::new()
21810/// # .with_native_roots()
21811/// # .unwrap()
21812/// # .https_or_http()
21813/// # .enable_http2()
21814/// # .build()
21815/// # );
21816/// # let mut hub = Appengine::new(client, auth);
21817/// // As the method needs a request, you would usually fill it with the desired information
21818/// // into the respective structure. Some of the parts shown here might not be applicable !
21819/// // Values shown here are possibly random and not representative !
21820/// let mut req = ExportAppImageRequest::default();
21821///
21822/// // You can configure optional parameters by calling the respective setters at will, and
21823/// // execute the final call using `doit()`.
21824/// // Values shown here are possibly random and not representative !
21825/// let result = hub.projects().locations_applications_services_versions_export_app_image(req, "projectsId", "locationsId", "applicationsId", "servicesId", "versionsId")
21826/// .doit().await;
21827/// # }
21828/// ```
21829pub struct ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C>
21830where
21831 C: 'a,
21832{
21833 hub: &'a Appengine<C>,
21834 _request: ExportAppImageRequest,
21835 _projects_id: String,
21836 _locations_id: String,
21837 _applications_id: String,
21838 _services_id: String,
21839 _versions_id: String,
21840 _delegate: Option<&'a mut dyn common::Delegate>,
21841 _additional_params: HashMap<String, String>,
21842 _scopes: BTreeSet<String>,
21843}
21844
21845impl<'a, C> common::CallBuilder
21846 for ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C>
21847{
21848}
21849
21850impl<'a, C> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C>
21851where
21852 C: common::Connector,
21853{
21854 /// Perform the operation you have build so far.
21855 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21856 use std::borrow::Cow;
21857 use std::io::{Read, Seek};
21858
21859 use common::{url::Params, ToParts};
21860 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21861
21862 let mut dd = common::DefaultDelegate;
21863 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21864 dlg.begin(common::MethodInfo {
21865 id: "appengine.projects.locations.applications.services.versions.exportAppImage",
21866 http_method: hyper::Method::POST,
21867 });
21868
21869 for &field in [
21870 "alt",
21871 "projectsId",
21872 "locationsId",
21873 "applicationsId",
21874 "servicesId",
21875 "versionsId",
21876 ]
21877 .iter()
21878 {
21879 if self._additional_params.contains_key(field) {
21880 dlg.finished(false);
21881 return Err(common::Error::FieldClash(field));
21882 }
21883 }
21884
21885 let mut params = Params::with_capacity(8 + self._additional_params.len());
21886 params.push("projectsId", self._projects_id);
21887 params.push("locationsId", self._locations_id);
21888 params.push("applicationsId", self._applications_id);
21889 params.push("servicesId", self._services_id);
21890 params.push("versionsId", self._versions_id);
21891
21892 params.extend(self._additional_params.iter());
21893
21894 params.push("alt", "json");
21895 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/services/{servicesId}/versions/{versionsId}:exportAppImage";
21896 if self._scopes.is_empty() {
21897 self._scopes
21898 .insert(Scope::CloudPlatform.as_ref().to_string());
21899 }
21900
21901 #[allow(clippy::single_element_loop)]
21902 for &(find_this, param_name) in [
21903 ("{projectsId}", "projectsId"),
21904 ("{locationsId}", "locationsId"),
21905 ("{applicationsId}", "applicationsId"),
21906 ("{servicesId}", "servicesId"),
21907 ("{versionsId}", "versionsId"),
21908 ]
21909 .iter()
21910 {
21911 url = params.uri_replacement(url, param_name, find_this, false);
21912 }
21913 {
21914 let to_remove = [
21915 "versionsId",
21916 "servicesId",
21917 "applicationsId",
21918 "locationsId",
21919 "projectsId",
21920 ];
21921 params.remove_params(&to_remove);
21922 }
21923
21924 let url = params.parse_with_url(&url);
21925
21926 let mut json_mime_type = mime::APPLICATION_JSON;
21927 let mut request_value_reader = {
21928 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21929 common::remove_json_null_values(&mut value);
21930 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21931 serde_json::to_writer(&mut dst, &value).unwrap();
21932 dst
21933 };
21934 let request_size = request_value_reader
21935 .seek(std::io::SeekFrom::End(0))
21936 .unwrap();
21937 request_value_reader
21938 .seek(std::io::SeekFrom::Start(0))
21939 .unwrap();
21940
21941 loop {
21942 let token = match self
21943 .hub
21944 .auth
21945 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21946 .await
21947 {
21948 Ok(token) => token,
21949 Err(e) => match dlg.token(e) {
21950 Ok(token) => token,
21951 Err(e) => {
21952 dlg.finished(false);
21953 return Err(common::Error::MissingToken(e));
21954 }
21955 },
21956 };
21957 request_value_reader
21958 .seek(std::io::SeekFrom::Start(0))
21959 .unwrap();
21960 let mut req_result = {
21961 let client = &self.hub.client;
21962 dlg.pre_request();
21963 let mut req_builder = hyper::Request::builder()
21964 .method(hyper::Method::POST)
21965 .uri(url.as_str())
21966 .header(USER_AGENT, self.hub._user_agent.clone());
21967
21968 if let Some(token) = token.as_ref() {
21969 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21970 }
21971
21972 let request = req_builder
21973 .header(CONTENT_TYPE, json_mime_type.to_string())
21974 .header(CONTENT_LENGTH, request_size as u64)
21975 .body(common::to_body(
21976 request_value_reader.get_ref().clone().into(),
21977 ));
21978
21979 client.request(request.unwrap()).await
21980 };
21981
21982 match req_result {
21983 Err(err) => {
21984 if let common::Retry::After(d) = dlg.http_error(&err) {
21985 sleep(d).await;
21986 continue;
21987 }
21988 dlg.finished(false);
21989 return Err(common::Error::HttpError(err));
21990 }
21991 Ok(res) => {
21992 let (mut parts, body) = res.into_parts();
21993 let mut body = common::Body::new(body);
21994 if !parts.status.is_success() {
21995 let bytes = common::to_bytes(body).await.unwrap_or_default();
21996 let error = serde_json::from_str(&common::to_string(&bytes));
21997 let response = common::to_response(parts, bytes.into());
21998
21999 if let common::Retry::After(d) =
22000 dlg.http_failure(&response, error.as_ref().ok())
22001 {
22002 sleep(d).await;
22003 continue;
22004 }
22005
22006 dlg.finished(false);
22007
22008 return Err(match error {
22009 Ok(value) => common::Error::BadRequest(value),
22010 _ => common::Error::Failure(response),
22011 });
22012 }
22013 let response = {
22014 let bytes = common::to_bytes(body).await.unwrap_or_default();
22015 let encoded = common::to_string(&bytes);
22016 match serde_json::from_str(&encoded) {
22017 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22018 Err(error) => {
22019 dlg.response_json_decode_error(&encoded, &error);
22020 return Err(common::Error::JsonDecodeError(
22021 encoded.to_string(),
22022 error,
22023 ));
22024 }
22025 }
22026 };
22027
22028 dlg.finished(true);
22029 return Ok(response);
22030 }
22031 }
22032 }
22033 }
22034
22035 ///
22036 /// Sets the *request* property to the given value.
22037 ///
22038 /// Even though the property as already been set when instantiating this call,
22039 /// we provide this method for API completeness.
22040 pub fn request(
22041 mut self,
22042 new_value: ExportAppImageRequest,
22043 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22044 self._request = new_value;
22045 self
22046 }
22047 /// Part of `name`. Required. Name of the App Engine version resource. Format: apps/{app}/services/{service}/versions/{version}
22048 ///
22049 /// Sets the *projects id* path property to the given value.
22050 ///
22051 /// Even though the property as already been set when instantiating this call,
22052 /// we provide this method for API completeness.
22053 pub fn projects_id(
22054 mut self,
22055 new_value: &str,
22056 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22057 self._projects_id = new_value.to_string();
22058 self
22059 }
22060 /// Part of `name`. See documentation of `projectsId`.
22061 ///
22062 /// Sets the *locations id* path property to the given value.
22063 ///
22064 /// Even though the property as already been set when instantiating this call,
22065 /// we provide this method for API completeness.
22066 pub fn locations_id(
22067 mut self,
22068 new_value: &str,
22069 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22070 self._locations_id = new_value.to_string();
22071 self
22072 }
22073 /// Part of `name`. See documentation of `projectsId`.
22074 ///
22075 /// Sets the *applications id* path property to the given value.
22076 ///
22077 /// Even though the property as already been set when instantiating this call,
22078 /// we provide this method for API completeness.
22079 pub fn applications_id(
22080 mut self,
22081 new_value: &str,
22082 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22083 self._applications_id = new_value.to_string();
22084 self
22085 }
22086 /// Part of `name`. See documentation of `projectsId`.
22087 ///
22088 /// Sets the *services id* path property to the given value.
22089 ///
22090 /// Even though the property as already been set when instantiating this call,
22091 /// we provide this method for API completeness.
22092 pub fn services_id(
22093 mut self,
22094 new_value: &str,
22095 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22096 self._services_id = new_value.to_string();
22097 self
22098 }
22099 /// Part of `name`. See documentation of `projectsId`.
22100 ///
22101 /// Sets the *versions id* path property to the given value.
22102 ///
22103 /// Even though the property as already been set when instantiating this call,
22104 /// we provide this method for API completeness.
22105 pub fn versions_id(
22106 mut self,
22107 new_value: &str,
22108 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22109 self._versions_id = new_value.to_string();
22110 self
22111 }
22112 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22113 /// while executing the actual API request.
22114 ///
22115 /// ````text
22116 /// It should be used to handle progress information, and to implement a certain level of resilience.
22117 /// ````
22118 ///
22119 /// Sets the *delegate* property to the given value.
22120 pub fn delegate(
22121 mut self,
22122 new_value: &'a mut dyn common::Delegate,
22123 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22124 self._delegate = Some(new_value);
22125 self
22126 }
22127
22128 /// Set any additional parameter of the query string used in the request.
22129 /// It should be used to set parameters which are not yet available through their own
22130 /// setters.
22131 ///
22132 /// Please note that this method must not be used to set any of the known parameters
22133 /// which have their own setter method. If done anyway, the request will fail.
22134 ///
22135 /// # Additional Parameters
22136 ///
22137 /// * *$.xgafv* (query-string) - V1 error format.
22138 /// * *access_token* (query-string) - OAuth access token.
22139 /// * *alt* (query-string) - Data format for response.
22140 /// * *callback* (query-string) - JSONP
22141 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22142 /// * *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.
22143 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22144 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22145 /// * *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.
22146 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22147 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22148 pub fn param<T>(
22149 mut self,
22150 name: T,
22151 value: T,
22152 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C>
22153 where
22154 T: AsRef<str>,
22155 {
22156 self._additional_params
22157 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22158 self
22159 }
22160
22161 /// Identifies the authorization scope for the method you are building.
22162 ///
22163 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22164 /// [`Scope::CloudPlatform`].
22165 ///
22166 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22167 /// tokens for more than one scope.
22168 ///
22169 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22170 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22171 /// sufficient, a read-write scope will do as well.
22172 pub fn add_scope<St>(
22173 mut self,
22174 scope: St,
22175 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C>
22176 where
22177 St: AsRef<str>,
22178 {
22179 self._scopes.insert(String::from(scope.as_ref()));
22180 self
22181 }
22182 /// Identifies the authorization scope(s) for the method you are building.
22183 ///
22184 /// See [`Self::add_scope()`] for details.
22185 pub fn add_scopes<I, St>(
22186 mut self,
22187 scopes: I,
22188 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C>
22189 where
22190 I: IntoIterator<Item = St>,
22191 St: AsRef<str>,
22192 {
22193 self._scopes
22194 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22195 self
22196 }
22197
22198 /// Removes all scopes, and no default scope will be used either.
22199 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22200 /// for details).
22201 pub fn clear_scopes(
22202 mut self,
22203 ) -> ProjectLocationApplicationServiceVersionExportAppImageCall<'a, C> {
22204 self._scopes.clear();
22205 self
22206 }
22207}
22208
22209/// 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:Standard environment instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class)automatic scaling in the standard environment: automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automaticScaling.standard_scheduler_settings.max_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.min_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_cpu_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) automaticScaling.standard_scheduler_settings.target_throughput_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings)basic scaling or manual scaling in the standard environment: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)Flexible environment serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status)automatic scaling in the flexible environment: automatic_scaling.min_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.max_total_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cool_down_period_sec (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) automatic_scaling.cpu_utilization.target_utilization (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling)manual scaling in the flexible environment: manual_scaling.instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling)
22210///
22211/// A builder for the *locations.applications.services.versions.patch* method supported by a *project* resource.
22212/// It is not used directly, but through a [`ProjectMethods`] instance.
22213///
22214/// # Example
22215///
22216/// Instantiate a resource method builder
22217///
22218/// ```test_harness,no_run
22219/// # extern crate hyper;
22220/// # extern crate hyper_rustls;
22221/// # extern crate google_appengine1 as appengine1;
22222/// use appengine1::api::Version;
22223/// # async fn dox() {
22224/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22225///
22226/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22227/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22228/// # .with_native_roots()
22229/// # .unwrap()
22230/// # .https_only()
22231/// # .enable_http2()
22232/// # .build();
22233///
22234/// # let executor = hyper_util::rt::TokioExecutor::new();
22235/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22236/// # secret,
22237/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22238/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22239/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22240/// # ),
22241/// # ).build().await.unwrap();
22242///
22243/// # let client = hyper_util::client::legacy::Client::builder(
22244/// # hyper_util::rt::TokioExecutor::new()
22245/// # )
22246/// # .build(
22247/// # hyper_rustls::HttpsConnectorBuilder::new()
22248/// # .with_native_roots()
22249/// # .unwrap()
22250/// # .https_or_http()
22251/// # .enable_http2()
22252/// # .build()
22253/// # );
22254/// # let mut hub = Appengine::new(client, auth);
22255/// // As the method needs a request, you would usually fill it with the desired information
22256/// // into the respective structure. Some of the parts shown here might not be applicable !
22257/// // Values shown here are possibly random and not representative !
22258/// let mut req = Version::default();
22259///
22260/// // You can configure optional parameters by calling the respective setters at will, and
22261/// // execute the final call using `doit()`.
22262/// // Values shown here are possibly random and not representative !
22263/// let result = hub.projects().locations_applications_services_versions_patch(req, "projectsId", "locationsId", "applicationsId", "servicesId", "versionsId")
22264/// .update_mask(FieldMask::new::<&str>(&[]))
22265/// .doit().await;
22266/// # }
22267/// ```
22268pub struct ProjectLocationApplicationServiceVersionPatchCall<'a, C>
22269where
22270 C: 'a,
22271{
22272 hub: &'a Appengine<C>,
22273 _request: Version,
22274 _projects_id: String,
22275 _locations_id: String,
22276 _applications_id: String,
22277 _services_id: String,
22278 _versions_id: String,
22279 _update_mask: Option<common::FieldMask>,
22280 _delegate: Option<&'a mut dyn common::Delegate>,
22281 _additional_params: HashMap<String, String>,
22282 _scopes: BTreeSet<String>,
22283}
22284
22285impl<'a, C> common::CallBuilder for ProjectLocationApplicationServiceVersionPatchCall<'a, C> {}
22286
22287impl<'a, C> ProjectLocationApplicationServiceVersionPatchCall<'a, C>
22288where
22289 C: common::Connector,
22290{
22291 /// Perform the operation you have build so far.
22292 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22293 use std::borrow::Cow;
22294 use std::io::{Read, Seek};
22295
22296 use common::{url::Params, ToParts};
22297 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22298
22299 let mut dd = common::DefaultDelegate;
22300 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22301 dlg.begin(common::MethodInfo {
22302 id: "appengine.projects.locations.applications.services.versions.patch",
22303 http_method: hyper::Method::PATCH,
22304 });
22305
22306 for &field in [
22307 "alt",
22308 "projectsId",
22309 "locationsId",
22310 "applicationsId",
22311 "servicesId",
22312 "versionsId",
22313 "updateMask",
22314 ]
22315 .iter()
22316 {
22317 if self._additional_params.contains_key(field) {
22318 dlg.finished(false);
22319 return Err(common::Error::FieldClash(field));
22320 }
22321 }
22322
22323 let mut params = Params::with_capacity(9 + self._additional_params.len());
22324 params.push("projectsId", self._projects_id);
22325 params.push("locationsId", self._locations_id);
22326 params.push("applicationsId", self._applications_id);
22327 params.push("servicesId", self._services_id);
22328 params.push("versionsId", self._versions_id);
22329 if let Some(value) = self._update_mask.as_ref() {
22330 params.push("updateMask", value.to_string());
22331 }
22332
22333 params.extend(self._additional_params.iter());
22334
22335 params.push("alt", "json");
22336 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/services/{servicesId}/versions/{versionsId}";
22337 if self._scopes.is_empty() {
22338 self._scopes
22339 .insert(Scope::CloudPlatform.as_ref().to_string());
22340 }
22341
22342 #[allow(clippy::single_element_loop)]
22343 for &(find_this, param_name) in [
22344 ("{projectsId}", "projectsId"),
22345 ("{locationsId}", "locationsId"),
22346 ("{applicationsId}", "applicationsId"),
22347 ("{servicesId}", "servicesId"),
22348 ("{versionsId}", "versionsId"),
22349 ]
22350 .iter()
22351 {
22352 url = params.uri_replacement(url, param_name, find_this, false);
22353 }
22354 {
22355 let to_remove = [
22356 "versionsId",
22357 "servicesId",
22358 "applicationsId",
22359 "locationsId",
22360 "projectsId",
22361 ];
22362 params.remove_params(&to_remove);
22363 }
22364
22365 let url = params.parse_with_url(&url);
22366
22367 let mut json_mime_type = mime::APPLICATION_JSON;
22368 let mut request_value_reader = {
22369 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22370 common::remove_json_null_values(&mut value);
22371 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22372 serde_json::to_writer(&mut dst, &value).unwrap();
22373 dst
22374 };
22375 let request_size = request_value_reader
22376 .seek(std::io::SeekFrom::End(0))
22377 .unwrap();
22378 request_value_reader
22379 .seek(std::io::SeekFrom::Start(0))
22380 .unwrap();
22381
22382 loop {
22383 let token = match self
22384 .hub
22385 .auth
22386 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22387 .await
22388 {
22389 Ok(token) => token,
22390 Err(e) => match dlg.token(e) {
22391 Ok(token) => token,
22392 Err(e) => {
22393 dlg.finished(false);
22394 return Err(common::Error::MissingToken(e));
22395 }
22396 },
22397 };
22398 request_value_reader
22399 .seek(std::io::SeekFrom::Start(0))
22400 .unwrap();
22401 let mut req_result = {
22402 let client = &self.hub.client;
22403 dlg.pre_request();
22404 let mut req_builder = hyper::Request::builder()
22405 .method(hyper::Method::PATCH)
22406 .uri(url.as_str())
22407 .header(USER_AGENT, self.hub._user_agent.clone());
22408
22409 if let Some(token) = token.as_ref() {
22410 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22411 }
22412
22413 let request = req_builder
22414 .header(CONTENT_TYPE, json_mime_type.to_string())
22415 .header(CONTENT_LENGTH, request_size as u64)
22416 .body(common::to_body(
22417 request_value_reader.get_ref().clone().into(),
22418 ));
22419
22420 client.request(request.unwrap()).await
22421 };
22422
22423 match req_result {
22424 Err(err) => {
22425 if let common::Retry::After(d) = dlg.http_error(&err) {
22426 sleep(d).await;
22427 continue;
22428 }
22429 dlg.finished(false);
22430 return Err(common::Error::HttpError(err));
22431 }
22432 Ok(res) => {
22433 let (mut parts, body) = res.into_parts();
22434 let mut body = common::Body::new(body);
22435 if !parts.status.is_success() {
22436 let bytes = common::to_bytes(body).await.unwrap_or_default();
22437 let error = serde_json::from_str(&common::to_string(&bytes));
22438 let response = common::to_response(parts, bytes.into());
22439
22440 if let common::Retry::After(d) =
22441 dlg.http_failure(&response, error.as_ref().ok())
22442 {
22443 sleep(d).await;
22444 continue;
22445 }
22446
22447 dlg.finished(false);
22448
22449 return Err(match error {
22450 Ok(value) => common::Error::BadRequest(value),
22451 _ => common::Error::Failure(response),
22452 });
22453 }
22454 let response = {
22455 let bytes = common::to_bytes(body).await.unwrap_or_default();
22456 let encoded = common::to_string(&bytes);
22457 match serde_json::from_str(&encoded) {
22458 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22459 Err(error) => {
22460 dlg.response_json_decode_error(&encoded, &error);
22461 return Err(common::Error::JsonDecodeError(
22462 encoded.to_string(),
22463 error,
22464 ));
22465 }
22466 }
22467 };
22468
22469 dlg.finished(true);
22470 return Ok(response);
22471 }
22472 }
22473 }
22474 }
22475
22476 ///
22477 /// Sets the *request* property to the given value.
22478 ///
22479 /// Even though the property as already been set when instantiating this call,
22480 /// we provide this method for API completeness.
22481 pub fn request(
22482 mut self,
22483 new_value: Version,
22484 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22485 self._request = new_value;
22486 self
22487 }
22488 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default/versions/1.
22489 ///
22490 /// Sets the *projects id* path property to the given value.
22491 ///
22492 /// Even though the property as already been set when instantiating this call,
22493 /// we provide this method for API completeness.
22494 pub fn projects_id(
22495 mut self,
22496 new_value: &str,
22497 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22498 self._projects_id = new_value.to_string();
22499 self
22500 }
22501 /// Part of `name`. See documentation of `projectsId`.
22502 ///
22503 /// Sets the *locations id* path property to the given value.
22504 ///
22505 /// Even though the property as already been set when instantiating this call,
22506 /// we provide this method for API completeness.
22507 pub fn locations_id(
22508 mut self,
22509 new_value: &str,
22510 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22511 self._locations_id = new_value.to_string();
22512 self
22513 }
22514 /// Part of `name`. See documentation of `projectsId`.
22515 ///
22516 /// Sets the *applications id* path property to the given value.
22517 ///
22518 /// Even though the property as already been set when instantiating this call,
22519 /// we provide this method for API completeness.
22520 pub fn applications_id(
22521 mut self,
22522 new_value: &str,
22523 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22524 self._applications_id = new_value.to_string();
22525 self
22526 }
22527 /// Part of `name`. See documentation of `projectsId`.
22528 ///
22529 /// Sets the *services id* path property to the given value.
22530 ///
22531 /// Even though the property as already been set when instantiating this call,
22532 /// we provide this method for API completeness.
22533 pub fn services_id(
22534 mut self,
22535 new_value: &str,
22536 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22537 self._services_id = new_value.to_string();
22538 self
22539 }
22540 /// Part of `name`. See documentation of `projectsId`.
22541 ///
22542 /// Sets the *versions id* path property to the given value.
22543 ///
22544 /// Even though the property as already been set when instantiating this call,
22545 /// we provide this method for API completeness.
22546 pub fn versions_id(
22547 mut self,
22548 new_value: &str,
22549 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22550 self._versions_id = new_value.to_string();
22551 self
22552 }
22553 /// Standard field mask for the set of fields to be updated.
22554 ///
22555 /// Sets the *update mask* query property to the given value.
22556 pub fn update_mask(
22557 mut self,
22558 new_value: common::FieldMask,
22559 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22560 self._update_mask = Some(new_value);
22561 self
22562 }
22563 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22564 /// while executing the actual API request.
22565 ///
22566 /// ````text
22567 /// It should be used to handle progress information, and to implement a certain level of resilience.
22568 /// ````
22569 ///
22570 /// Sets the *delegate* property to the given value.
22571 pub fn delegate(
22572 mut self,
22573 new_value: &'a mut dyn common::Delegate,
22574 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22575 self._delegate = Some(new_value);
22576 self
22577 }
22578
22579 /// Set any additional parameter of the query string used in the request.
22580 /// It should be used to set parameters which are not yet available through their own
22581 /// setters.
22582 ///
22583 /// Please note that this method must not be used to set any of the known parameters
22584 /// which have their own setter method. If done anyway, the request will fail.
22585 ///
22586 /// # Additional Parameters
22587 ///
22588 /// * *$.xgafv* (query-string) - V1 error format.
22589 /// * *access_token* (query-string) - OAuth access token.
22590 /// * *alt* (query-string) - Data format for response.
22591 /// * *callback* (query-string) - JSONP
22592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22593 /// * *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.
22594 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22595 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22596 /// * *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.
22597 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22598 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22599 pub fn param<T>(
22600 mut self,
22601 name: T,
22602 value: T,
22603 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C>
22604 where
22605 T: AsRef<str>,
22606 {
22607 self._additional_params
22608 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22609 self
22610 }
22611
22612 /// Identifies the authorization scope for the method you are building.
22613 ///
22614 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22615 /// [`Scope::CloudPlatform`].
22616 ///
22617 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22618 /// tokens for more than one scope.
22619 ///
22620 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22621 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22622 /// sufficient, a read-write scope will do as well.
22623 pub fn add_scope<St>(
22624 mut self,
22625 scope: St,
22626 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C>
22627 where
22628 St: AsRef<str>,
22629 {
22630 self._scopes.insert(String::from(scope.as_ref()));
22631 self
22632 }
22633 /// Identifies the authorization scope(s) for the method you are building.
22634 ///
22635 /// See [`Self::add_scope()`] for details.
22636 pub fn add_scopes<I, St>(
22637 mut self,
22638 scopes: I,
22639 ) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C>
22640 where
22641 I: IntoIterator<Item = St>,
22642 St: AsRef<str>,
22643 {
22644 self._scopes
22645 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22646 self
22647 }
22648
22649 /// Removes all scopes, and no default scope will be used either.
22650 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22651 /// for details).
22652 pub fn clear_scopes(mut self) -> ProjectLocationApplicationServiceVersionPatchCall<'a, C> {
22653 self._scopes.clear();
22654 self
22655 }
22656}
22657
22658/// Deletes the specified service and all enclosed versions.
22659///
22660/// A builder for the *locations.applications.services.delete* method supported by a *project* resource.
22661/// It is not used directly, but through a [`ProjectMethods`] instance.
22662///
22663/// # Example
22664///
22665/// Instantiate a resource method builder
22666///
22667/// ```test_harness,no_run
22668/// # extern crate hyper;
22669/// # extern crate hyper_rustls;
22670/// # extern crate google_appengine1 as appengine1;
22671/// # async fn dox() {
22672/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22673///
22674/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22675/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22676/// # .with_native_roots()
22677/// # .unwrap()
22678/// # .https_only()
22679/// # .enable_http2()
22680/// # .build();
22681///
22682/// # let executor = hyper_util::rt::TokioExecutor::new();
22683/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22684/// # secret,
22685/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22686/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22687/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22688/// # ),
22689/// # ).build().await.unwrap();
22690///
22691/// # let client = hyper_util::client::legacy::Client::builder(
22692/// # hyper_util::rt::TokioExecutor::new()
22693/// # )
22694/// # .build(
22695/// # hyper_rustls::HttpsConnectorBuilder::new()
22696/// # .with_native_roots()
22697/// # .unwrap()
22698/// # .https_or_http()
22699/// # .enable_http2()
22700/// # .build()
22701/// # );
22702/// # let mut hub = Appengine::new(client, auth);
22703/// // You can configure optional parameters by calling the respective setters at will, and
22704/// // execute the final call using `doit()`.
22705/// // Values shown here are possibly random and not representative !
22706/// let result = hub.projects().locations_applications_services_delete("projectsId", "locationsId", "applicationsId", "servicesId")
22707/// .doit().await;
22708/// # }
22709/// ```
22710pub struct ProjectLocationApplicationServiceDeleteCall<'a, C>
22711where
22712 C: 'a,
22713{
22714 hub: &'a Appengine<C>,
22715 _projects_id: String,
22716 _locations_id: String,
22717 _applications_id: String,
22718 _services_id: String,
22719 _delegate: Option<&'a mut dyn common::Delegate>,
22720 _additional_params: HashMap<String, String>,
22721 _scopes: BTreeSet<String>,
22722}
22723
22724impl<'a, C> common::CallBuilder for ProjectLocationApplicationServiceDeleteCall<'a, C> {}
22725
22726impl<'a, C> ProjectLocationApplicationServiceDeleteCall<'a, C>
22727where
22728 C: common::Connector,
22729{
22730 /// Perform the operation you have build so far.
22731 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22732 use std::borrow::Cow;
22733 use std::io::{Read, Seek};
22734
22735 use common::{url::Params, ToParts};
22736 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22737
22738 let mut dd = common::DefaultDelegate;
22739 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22740 dlg.begin(common::MethodInfo {
22741 id: "appengine.projects.locations.applications.services.delete",
22742 http_method: hyper::Method::DELETE,
22743 });
22744
22745 for &field in [
22746 "alt",
22747 "projectsId",
22748 "locationsId",
22749 "applicationsId",
22750 "servicesId",
22751 ]
22752 .iter()
22753 {
22754 if self._additional_params.contains_key(field) {
22755 dlg.finished(false);
22756 return Err(common::Error::FieldClash(field));
22757 }
22758 }
22759
22760 let mut params = Params::with_capacity(6 + self._additional_params.len());
22761 params.push("projectsId", self._projects_id);
22762 params.push("locationsId", self._locations_id);
22763 params.push("applicationsId", self._applications_id);
22764 params.push("servicesId", self._services_id);
22765
22766 params.extend(self._additional_params.iter());
22767
22768 params.push("alt", "json");
22769 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/services/{servicesId}";
22770 if self._scopes.is_empty() {
22771 self._scopes
22772 .insert(Scope::CloudPlatform.as_ref().to_string());
22773 }
22774
22775 #[allow(clippy::single_element_loop)]
22776 for &(find_this, param_name) in [
22777 ("{projectsId}", "projectsId"),
22778 ("{locationsId}", "locationsId"),
22779 ("{applicationsId}", "applicationsId"),
22780 ("{servicesId}", "servicesId"),
22781 ]
22782 .iter()
22783 {
22784 url = params.uri_replacement(url, param_name, find_this, false);
22785 }
22786 {
22787 let to_remove = ["servicesId", "applicationsId", "locationsId", "projectsId"];
22788 params.remove_params(&to_remove);
22789 }
22790
22791 let url = params.parse_with_url(&url);
22792
22793 loop {
22794 let token = match self
22795 .hub
22796 .auth
22797 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22798 .await
22799 {
22800 Ok(token) => token,
22801 Err(e) => match dlg.token(e) {
22802 Ok(token) => token,
22803 Err(e) => {
22804 dlg.finished(false);
22805 return Err(common::Error::MissingToken(e));
22806 }
22807 },
22808 };
22809 let mut req_result = {
22810 let client = &self.hub.client;
22811 dlg.pre_request();
22812 let mut req_builder = hyper::Request::builder()
22813 .method(hyper::Method::DELETE)
22814 .uri(url.as_str())
22815 .header(USER_AGENT, self.hub._user_agent.clone());
22816
22817 if let Some(token) = token.as_ref() {
22818 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22819 }
22820
22821 let request = req_builder
22822 .header(CONTENT_LENGTH, 0_u64)
22823 .body(common::to_body::<String>(None));
22824
22825 client.request(request.unwrap()).await
22826 };
22827
22828 match req_result {
22829 Err(err) => {
22830 if let common::Retry::After(d) = dlg.http_error(&err) {
22831 sleep(d).await;
22832 continue;
22833 }
22834 dlg.finished(false);
22835 return Err(common::Error::HttpError(err));
22836 }
22837 Ok(res) => {
22838 let (mut parts, body) = res.into_parts();
22839 let mut body = common::Body::new(body);
22840 if !parts.status.is_success() {
22841 let bytes = common::to_bytes(body).await.unwrap_or_default();
22842 let error = serde_json::from_str(&common::to_string(&bytes));
22843 let response = common::to_response(parts, bytes.into());
22844
22845 if let common::Retry::After(d) =
22846 dlg.http_failure(&response, error.as_ref().ok())
22847 {
22848 sleep(d).await;
22849 continue;
22850 }
22851
22852 dlg.finished(false);
22853
22854 return Err(match error {
22855 Ok(value) => common::Error::BadRequest(value),
22856 _ => common::Error::Failure(response),
22857 });
22858 }
22859 let response = {
22860 let bytes = common::to_bytes(body).await.unwrap_or_default();
22861 let encoded = common::to_string(&bytes);
22862 match serde_json::from_str(&encoded) {
22863 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22864 Err(error) => {
22865 dlg.response_json_decode_error(&encoded, &error);
22866 return Err(common::Error::JsonDecodeError(
22867 encoded.to_string(),
22868 error,
22869 ));
22870 }
22871 }
22872 };
22873
22874 dlg.finished(true);
22875 return Ok(response);
22876 }
22877 }
22878 }
22879 }
22880
22881 /// Part of `name`. Required. Name of the resource requested. Example: apps/myapp/services/default.
22882 ///
22883 /// Sets the *projects id* path property to the given value.
22884 ///
22885 /// Even though the property as already been set when instantiating this call,
22886 /// we provide this method for API completeness.
22887 pub fn projects_id(
22888 mut self,
22889 new_value: &str,
22890 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C> {
22891 self._projects_id = new_value.to_string();
22892 self
22893 }
22894 /// Part of `name`. See documentation of `projectsId`.
22895 ///
22896 /// Sets the *locations id* path property to the given value.
22897 ///
22898 /// Even though the property as already been set when instantiating this call,
22899 /// we provide this method for API completeness.
22900 pub fn locations_id(
22901 mut self,
22902 new_value: &str,
22903 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C> {
22904 self._locations_id = new_value.to_string();
22905 self
22906 }
22907 /// Part of `name`. See documentation of `projectsId`.
22908 ///
22909 /// Sets the *applications id* path property to the given value.
22910 ///
22911 /// Even though the property as already been set when instantiating this call,
22912 /// we provide this method for API completeness.
22913 pub fn applications_id(
22914 mut self,
22915 new_value: &str,
22916 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C> {
22917 self._applications_id = new_value.to_string();
22918 self
22919 }
22920 /// Part of `name`. See documentation of `projectsId`.
22921 ///
22922 /// Sets the *services id* path property to the given value.
22923 ///
22924 /// Even though the property as already been set when instantiating this call,
22925 /// we provide this method for API completeness.
22926 pub fn services_id(
22927 mut self,
22928 new_value: &str,
22929 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C> {
22930 self._services_id = new_value.to_string();
22931 self
22932 }
22933 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22934 /// while executing the actual API request.
22935 ///
22936 /// ````text
22937 /// It should be used to handle progress information, and to implement a certain level of resilience.
22938 /// ````
22939 ///
22940 /// Sets the *delegate* property to the given value.
22941 pub fn delegate(
22942 mut self,
22943 new_value: &'a mut dyn common::Delegate,
22944 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C> {
22945 self._delegate = Some(new_value);
22946 self
22947 }
22948
22949 /// Set any additional parameter of the query string used in the request.
22950 /// It should be used to set parameters which are not yet available through their own
22951 /// setters.
22952 ///
22953 /// Please note that this method must not be used to set any of the known parameters
22954 /// which have their own setter method. If done anyway, the request will fail.
22955 ///
22956 /// # Additional Parameters
22957 ///
22958 /// * *$.xgafv* (query-string) - V1 error format.
22959 /// * *access_token* (query-string) - OAuth access token.
22960 /// * *alt* (query-string) - Data format for response.
22961 /// * *callback* (query-string) - JSONP
22962 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22963 /// * *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.
22964 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22965 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22966 /// * *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.
22967 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22968 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22969 pub fn param<T>(
22970 mut self,
22971 name: T,
22972 value: T,
22973 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C>
22974 where
22975 T: AsRef<str>,
22976 {
22977 self._additional_params
22978 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22979 self
22980 }
22981
22982 /// Identifies the authorization scope for the method you are building.
22983 ///
22984 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22985 /// [`Scope::CloudPlatform`].
22986 ///
22987 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22988 /// tokens for more than one scope.
22989 ///
22990 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22991 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22992 /// sufficient, a read-write scope will do as well.
22993 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationApplicationServiceDeleteCall<'a, C>
22994 where
22995 St: AsRef<str>,
22996 {
22997 self._scopes.insert(String::from(scope.as_ref()));
22998 self
22999 }
23000 /// Identifies the authorization scope(s) for the method you are building.
23001 ///
23002 /// See [`Self::add_scope()`] for details.
23003 pub fn add_scopes<I, St>(
23004 mut self,
23005 scopes: I,
23006 ) -> ProjectLocationApplicationServiceDeleteCall<'a, C>
23007 where
23008 I: IntoIterator<Item = St>,
23009 St: AsRef<str>,
23010 {
23011 self._scopes
23012 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23013 self
23014 }
23015
23016 /// Removes all scopes, and no default scope will be used either.
23017 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23018 /// for details).
23019 pub fn clear_scopes(mut self) -> ProjectLocationApplicationServiceDeleteCall<'a, C> {
23020 self._scopes.clear();
23021 self
23022 }
23023}
23024
23025/// Updates the configuration of the specified service.
23026///
23027/// A builder for the *locations.applications.services.patch* method supported by a *project* resource.
23028/// It is not used directly, but through a [`ProjectMethods`] instance.
23029///
23030/// # Example
23031///
23032/// Instantiate a resource method builder
23033///
23034/// ```test_harness,no_run
23035/// # extern crate hyper;
23036/// # extern crate hyper_rustls;
23037/// # extern crate google_appengine1 as appengine1;
23038/// use appengine1::api::Service;
23039/// # async fn dox() {
23040/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23041///
23042/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23043/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23044/// # .with_native_roots()
23045/// # .unwrap()
23046/// # .https_only()
23047/// # .enable_http2()
23048/// # .build();
23049///
23050/// # let executor = hyper_util::rt::TokioExecutor::new();
23051/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23052/// # secret,
23053/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23054/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23055/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23056/// # ),
23057/// # ).build().await.unwrap();
23058///
23059/// # let client = hyper_util::client::legacy::Client::builder(
23060/// # hyper_util::rt::TokioExecutor::new()
23061/// # )
23062/// # .build(
23063/// # hyper_rustls::HttpsConnectorBuilder::new()
23064/// # .with_native_roots()
23065/// # .unwrap()
23066/// # .https_or_http()
23067/// # .enable_http2()
23068/// # .build()
23069/// # );
23070/// # let mut hub = Appengine::new(client, auth);
23071/// // As the method needs a request, you would usually fill it with the desired information
23072/// // into the respective structure. Some of the parts shown here might not be applicable !
23073/// // Values shown here are possibly random and not representative !
23074/// let mut req = Service::default();
23075///
23076/// // You can configure optional parameters by calling the respective setters at will, and
23077/// // execute the final call using `doit()`.
23078/// // Values shown here are possibly random and not representative !
23079/// let result = hub.projects().locations_applications_services_patch(req, "projectsId", "locationsId", "applicationsId", "servicesId")
23080/// .update_mask(FieldMask::new::<&str>(&[]))
23081/// .migrate_traffic(true)
23082/// .doit().await;
23083/// # }
23084/// ```
23085pub struct ProjectLocationApplicationServicePatchCall<'a, C>
23086where
23087 C: 'a,
23088{
23089 hub: &'a Appengine<C>,
23090 _request: Service,
23091 _projects_id: String,
23092 _locations_id: String,
23093 _applications_id: String,
23094 _services_id: String,
23095 _update_mask: Option<common::FieldMask>,
23096 _migrate_traffic: Option<bool>,
23097 _delegate: Option<&'a mut dyn common::Delegate>,
23098 _additional_params: HashMap<String, String>,
23099 _scopes: BTreeSet<String>,
23100}
23101
23102impl<'a, C> common::CallBuilder for ProjectLocationApplicationServicePatchCall<'a, C> {}
23103
23104impl<'a, C> ProjectLocationApplicationServicePatchCall<'a, C>
23105where
23106 C: common::Connector,
23107{
23108 /// Perform the operation you have build so far.
23109 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23110 use std::borrow::Cow;
23111 use std::io::{Read, Seek};
23112
23113 use common::{url::Params, ToParts};
23114 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23115
23116 let mut dd = common::DefaultDelegate;
23117 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23118 dlg.begin(common::MethodInfo {
23119 id: "appengine.projects.locations.applications.services.patch",
23120 http_method: hyper::Method::PATCH,
23121 });
23122
23123 for &field in [
23124 "alt",
23125 "projectsId",
23126 "locationsId",
23127 "applicationsId",
23128 "servicesId",
23129 "updateMask",
23130 "migrateTraffic",
23131 ]
23132 .iter()
23133 {
23134 if self._additional_params.contains_key(field) {
23135 dlg.finished(false);
23136 return Err(common::Error::FieldClash(field));
23137 }
23138 }
23139
23140 let mut params = Params::with_capacity(9 + self._additional_params.len());
23141 params.push("projectsId", self._projects_id);
23142 params.push("locationsId", self._locations_id);
23143 params.push("applicationsId", self._applications_id);
23144 params.push("servicesId", self._services_id);
23145 if let Some(value) = self._update_mask.as_ref() {
23146 params.push("updateMask", value.to_string());
23147 }
23148 if let Some(value) = self._migrate_traffic.as_ref() {
23149 params.push("migrateTraffic", value.to_string());
23150 }
23151
23152 params.extend(self._additional_params.iter());
23153
23154 params.push("alt", "json");
23155 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/services/{servicesId}";
23156 if self._scopes.is_empty() {
23157 self._scopes
23158 .insert(Scope::CloudPlatform.as_ref().to_string());
23159 }
23160
23161 #[allow(clippy::single_element_loop)]
23162 for &(find_this, param_name) in [
23163 ("{projectsId}", "projectsId"),
23164 ("{locationsId}", "locationsId"),
23165 ("{applicationsId}", "applicationsId"),
23166 ("{servicesId}", "servicesId"),
23167 ]
23168 .iter()
23169 {
23170 url = params.uri_replacement(url, param_name, find_this, false);
23171 }
23172 {
23173 let to_remove = ["servicesId", "applicationsId", "locationsId", "projectsId"];
23174 params.remove_params(&to_remove);
23175 }
23176
23177 let url = params.parse_with_url(&url);
23178
23179 let mut json_mime_type = mime::APPLICATION_JSON;
23180 let mut request_value_reader = {
23181 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23182 common::remove_json_null_values(&mut value);
23183 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23184 serde_json::to_writer(&mut dst, &value).unwrap();
23185 dst
23186 };
23187 let request_size = request_value_reader
23188 .seek(std::io::SeekFrom::End(0))
23189 .unwrap();
23190 request_value_reader
23191 .seek(std::io::SeekFrom::Start(0))
23192 .unwrap();
23193
23194 loop {
23195 let token = match self
23196 .hub
23197 .auth
23198 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23199 .await
23200 {
23201 Ok(token) => token,
23202 Err(e) => match dlg.token(e) {
23203 Ok(token) => token,
23204 Err(e) => {
23205 dlg.finished(false);
23206 return Err(common::Error::MissingToken(e));
23207 }
23208 },
23209 };
23210 request_value_reader
23211 .seek(std::io::SeekFrom::Start(0))
23212 .unwrap();
23213 let mut req_result = {
23214 let client = &self.hub.client;
23215 dlg.pre_request();
23216 let mut req_builder = hyper::Request::builder()
23217 .method(hyper::Method::PATCH)
23218 .uri(url.as_str())
23219 .header(USER_AGENT, self.hub._user_agent.clone());
23220
23221 if let Some(token) = token.as_ref() {
23222 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23223 }
23224
23225 let request = req_builder
23226 .header(CONTENT_TYPE, json_mime_type.to_string())
23227 .header(CONTENT_LENGTH, request_size as u64)
23228 .body(common::to_body(
23229 request_value_reader.get_ref().clone().into(),
23230 ));
23231
23232 client.request(request.unwrap()).await
23233 };
23234
23235 match req_result {
23236 Err(err) => {
23237 if let common::Retry::After(d) = dlg.http_error(&err) {
23238 sleep(d).await;
23239 continue;
23240 }
23241 dlg.finished(false);
23242 return Err(common::Error::HttpError(err));
23243 }
23244 Ok(res) => {
23245 let (mut parts, body) = res.into_parts();
23246 let mut body = common::Body::new(body);
23247 if !parts.status.is_success() {
23248 let bytes = common::to_bytes(body).await.unwrap_or_default();
23249 let error = serde_json::from_str(&common::to_string(&bytes));
23250 let response = common::to_response(parts, bytes.into());
23251
23252 if let common::Retry::After(d) =
23253 dlg.http_failure(&response, error.as_ref().ok())
23254 {
23255 sleep(d).await;
23256 continue;
23257 }
23258
23259 dlg.finished(false);
23260
23261 return Err(match error {
23262 Ok(value) => common::Error::BadRequest(value),
23263 _ => common::Error::Failure(response),
23264 });
23265 }
23266 let response = {
23267 let bytes = common::to_bytes(body).await.unwrap_or_default();
23268 let encoded = common::to_string(&bytes);
23269 match serde_json::from_str(&encoded) {
23270 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23271 Err(error) => {
23272 dlg.response_json_decode_error(&encoded, &error);
23273 return Err(common::Error::JsonDecodeError(
23274 encoded.to_string(),
23275 error,
23276 ));
23277 }
23278 }
23279 };
23280
23281 dlg.finished(true);
23282 return Ok(response);
23283 }
23284 }
23285 }
23286 }
23287
23288 ///
23289 /// Sets the *request* property to the given value.
23290 ///
23291 /// Even though the property as already been set when instantiating this call,
23292 /// we provide this method for API completeness.
23293 pub fn request(
23294 mut self,
23295 new_value: Service,
23296 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23297 self._request = new_value;
23298 self
23299 }
23300 /// Part of `name`. Required. Name of the resource to update. Example: apps/myapp/services/default.
23301 ///
23302 /// Sets the *projects id* path property to the given value.
23303 ///
23304 /// Even though the property as already been set when instantiating this call,
23305 /// we provide this method for API completeness.
23306 pub fn projects_id(
23307 mut self,
23308 new_value: &str,
23309 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23310 self._projects_id = new_value.to_string();
23311 self
23312 }
23313 /// Part of `name`. See documentation of `projectsId`.
23314 ///
23315 /// Sets the *locations id* path property to the given value.
23316 ///
23317 /// Even though the property as already been set when instantiating this call,
23318 /// we provide this method for API completeness.
23319 pub fn locations_id(
23320 mut self,
23321 new_value: &str,
23322 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23323 self._locations_id = new_value.to_string();
23324 self
23325 }
23326 /// Part of `name`. See documentation of `projectsId`.
23327 ///
23328 /// Sets the *applications id* path property to the given value.
23329 ///
23330 /// Even though the property as already been set when instantiating this call,
23331 /// we provide this method for API completeness.
23332 pub fn applications_id(
23333 mut self,
23334 new_value: &str,
23335 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23336 self._applications_id = new_value.to_string();
23337 self
23338 }
23339 /// Part of `name`. See documentation of `projectsId`.
23340 ///
23341 /// Sets the *services id* path property to the given value.
23342 ///
23343 /// Even though the property as already been set when instantiating this call,
23344 /// we provide this method for API completeness.
23345 pub fn services_id(
23346 mut self,
23347 new_value: &str,
23348 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23349 self._services_id = new_value.to_string();
23350 self
23351 }
23352 /// Required. Standard field mask for the set of fields to be updated.
23353 ///
23354 /// Sets the *update mask* query property to the given value.
23355 pub fn update_mask(
23356 mut self,
23357 new_value: common::FieldMask,
23358 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23359 self._update_mask = Some(new_value);
23360 self
23361 }
23362 /// 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/v1/apps.services.versions#InboundServiceType) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#AutomaticScaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#ShardBy) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).
23363 ///
23364 /// Sets the *migrate traffic* query property to the given value.
23365 pub fn migrate_traffic(
23366 mut self,
23367 new_value: bool,
23368 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23369 self._migrate_traffic = Some(new_value);
23370 self
23371 }
23372 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23373 /// while executing the actual API request.
23374 ///
23375 /// ````text
23376 /// It should be used to handle progress information, and to implement a certain level of resilience.
23377 /// ````
23378 ///
23379 /// Sets the *delegate* property to the given value.
23380 pub fn delegate(
23381 mut self,
23382 new_value: &'a mut dyn common::Delegate,
23383 ) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23384 self._delegate = Some(new_value);
23385 self
23386 }
23387
23388 /// Set any additional parameter of the query string used in the request.
23389 /// It should be used to set parameters which are not yet available through their own
23390 /// setters.
23391 ///
23392 /// Please note that this method must not be used to set any of the known parameters
23393 /// which have their own setter method. If done anyway, the request will fail.
23394 ///
23395 /// # Additional Parameters
23396 ///
23397 /// * *$.xgafv* (query-string) - V1 error format.
23398 /// * *access_token* (query-string) - OAuth access token.
23399 /// * *alt* (query-string) - Data format for response.
23400 /// * *callback* (query-string) - JSONP
23401 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23402 /// * *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.
23403 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23404 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23405 /// * *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.
23406 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23407 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23408 pub fn param<T>(
23409 mut self,
23410 name: T,
23411 value: T,
23412 ) -> ProjectLocationApplicationServicePatchCall<'a, C>
23413 where
23414 T: AsRef<str>,
23415 {
23416 self._additional_params
23417 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23418 self
23419 }
23420
23421 /// Identifies the authorization scope for the method you are building.
23422 ///
23423 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23424 /// [`Scope::CloudPlatform`].
23425 ///
23426 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23427 /// tokens for more than one scope.
23428 ///
23429 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23430 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23431 /// sufficient, a read-write scope will do as well.
23432 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationApplicationServicePatchCall<'a, C>
23433 where
23434 St: AsRef<str>,
23435 {
23436 self._scopes.insert(String::from(scope.as_ref()));
23437 self
23438 }
23439 /// Identifies the authorization scope(s) for the method you are building.
23440 ///
23441 /// See [`Self::add_scope()`] for details.
23442 pub fn add_scopes<I, St>(
23443 mut self,
23444 scopes: I,
23445 ) -> ProjectLocationApplicationServicePatchCall<'a, C>
23446 where
23447 I: IntoIterator<Item = St>,
23448 St: AsRef<str>,
23449 {
23450 self._scopes
23451 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23452 self
23453 }
23454
23455 /// Removes all scopes, and no default scope will be used either.
23456 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23457 /// for details).
23458 pub fn clear_scopes(mut self) -> ProjectLocationApplicationServicePatchCall<'a, C> {
23459 self._scopes.clear();
23460 self
23461 }
23462}
23463
23464/// Updates the specified Application resource. You can update the following fields: auth_domain - Google authentication domain for controlling user access to the application. default_cookie_expiration - Cookie expiration policy for the application. iap - Identity-Aware Proxy properties for the application.
23465///
23466/// A builder for the *locations.applications.patch* method supported by a *project* resource.
23467/// It is not used directly, but through a [`ProjectMethods`] instance.
23468///
23469/// # Example
23470///
23471/// Instantiate a resource method builder
23472///
23473/// ```test_harness,no_run
23474/// # extern crate hyper;
23475/// # extern crate hyper_rustls;
23476/// # extern crate google_appengine1 as appengine1;
23477/// use appengine1::api::Application;
23478/// # async fn dox() {
23479/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23480///
23481/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23482/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23483/// # .with_native_roots()
23484/// # .unwrap()
23485/// # .https_only()
23486/// # .enable_http2()
23487/// # .build();
23488///
23489/// # let executor = hyper_util::rt::TokioExecutor::new();
23490/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23491/// # secret,
23492/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23493/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23494/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23495/// # ),
23496/// # ).build().await.unwrap();
23497///
23498/// # let client = hyper_util::client::legacy::Client::builder(
23499/// # hyper_util::rt::TokioExecutor::new()
23500/// # )
23501/// # .build(
23502/// # hyper_rustls::HttpsConnectorBuilder::new()
23503/// # .with_native_roots()
23504/// # .unwrap()
23505/// # .https_or_http()
23506/// # .enable_http2()
23507/// # .build()
23508/// # );
23509/// # let mut hub = Appengine::new(client, auth);
23510/// // As the method needs a request, you would usually fill it with the desired information
23511/// // into the respective structure. Some of the parts shown here might not be applicable !
23512/// // Values shown here are possibly random and not representative !
23513/// let mut req = Application::default();
23514///
23515/// // You can configure optional parameters by calling the respective setters at will, and
23516/// // execute the final call using `doit()`.
23517/// // Values shown here are possibly random and not representative !
23518/// let result = hub.projects().locations_applications_patch(req, "projectsId", "locationsId", "applicationsId")
23519/// .update_mask(FieldMask::new::<&str>(&[]))
23520/// .doit().await;
23521/// # }
23522/// ```
23523pub struct ProjectLocationApplicationPatchCall<'a, C>
23524where
23525 C: 'a,
23526{
23527 hub: &'a Appengine<C>,
23528 _request: Application,
23529 _projects_id: String,
23530 _locations_id: String,
23531 _applications_id: String,
23532 _update_mask: Option<common::FieldMask>,
23533 _delegate: Option<&'a mut dyn common::Delegate>,
23534 _additional_params: HashMap<String, String>,
23535 _scopes: BTreeSet<String>,
23536}
23537
23538impl<'a, C> common::CallBuilder for ProjectLocationApplicationPatchCall<'a, C> {}
23539
23540impl<'a, C> ProjectLocationApplicationPatchCall<'a, C>
23541where
23542 C: common::Connector,
23543{
23544 /// Perform the operation you have build so far.
23545 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23546 use std::borrow::Cow;
23547 use std::io::{Read, Seek};
23548
23549 use common::{url::Params, ToParts};
23550 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23551
23552 let mut dd = common::DefaultDelegate;
23553 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23554 dlg.begin(common::MethodInfo {
23555 id: "appengine.projects.locations.applications.patch",
23556 http_method: hyper::Method::PATCH,
23557 });
23558
23559 for &field in [
23560 "alt",
23561 "projectsId",
23562 "locationsId",
23563 "applicationsId",
23564 "updateMask",
23565 ]
23566 .iter()
23567 {
23568 if self._additional_params.contains_key(field) {
23569 dlg.finished(false);
23570 return Err(common::Error::FieldClash(field));
23571 }
23572 }
23573
23574 let mut params = Params::with_capacity(7 + self._additional_params.len());
23575 params.push("projectsId", self._projects_id);
23576 params.push("locationsId", self._locations_id);
23577 params.push("applicationsId", self._applications_id);
23578 if let Some(value) = self._update_mask.as_ref() {
23579 params.push("updateMask", value.to_string());
23580 }
23581
23582 params.extend(self._additional_params.iter());
23583
23584 params.push("alt", "json");
23585 let mut url = self.hub._base_url.clone()
23586 + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}";
23587 if self._scopes.is_empty() {
23588 self._scopes
23589 .insert(Scope::CloudPlatform.as_ref().to_string());
23590 }
23591
23592 #[allow(clippy::single_element_loop)]
23593 for &(find_this, param_name) in [
23594 ("{projectsId}", "projectsId"),
23595 ("{locationsId}", "locationsId"),
23596 ("{applicationsId}", "applicationsId"),
23597 ]
23598 .iter()
23599 {
23600 url = params.uri_replacement(url, param_name, find_this, false);
23601 }
23602 {
23603 let to_remove = ["applicationsId", "locationsId", "projectsId"];
23604 params.remove_params(&to_remove);
23605 }
23606
23607 let url = params.parse_with_url(&url);
23608
23609 let mut json_mime_type = mime::APPLICATION_JSON;
23610 let mut request_value_reader = {
23611 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23612 common::remove_json_null_values(&mut value);
23613 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23614 serde_json::to_writer(&mut dst, &value).unwrap();
23615 dst
23616 };
23617 let request_size = request_value_reader
23618 .seek(std::io::SeekFrom::End(0))
23619 .unwrap();
23620 request_value_reader
23621 .seek(std::io::SeekFrom::Start(0))
23622 .unwrap();
23623
23624 loop {
23625 let token = match self
23626 .hub
23627 .auth
23628 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23629 .await
23630 {
23631 Ok(token) => token,
23632 Err(e) => match dlg.token(e) {
23633 Ok(token) => token,
23634 Err(e) => {
23635 dlg.finished(false);
23636 return Err(common::Error::MissingToken(e));
23637 }
23638 },
23639 };
23640 request_value_reader
23641 .seek(std::io::SeekFrom::Start(0))
23642 .unwrap();
23643 let mut req_result = {
23644 let client = &self.hub.client;
23645 dlg.pre_request();
23646 let mut req_builder = hyper::Request::builder()
23647 .method(hyper::Method::PATCH)
23648 .uri(url.as_str())
23649 .header(USER_AGENT, self.hub._user_agent.clone());
23650
23651 if let Some(token) = token.as_ref() {
23652 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23653 }
23654
23655 let request = req_builder
23656 .header(CONTENT_TYPE, json_mime_type.to_string())
23657 .header(CONTENT_LENGTH, request_size as u64)
23658 .body(common::to_body(
23659 request_value_reader.get_ref().clone().into(),
23660 ));
23661
23662 client.request(request.unwrap()).await
23663 };
23664
23665 match req_result {
23666 Err(err) => {
23667 if let common::Retry::After(d) = dlg.http_error(&err) {
23668 sleep(d).await;
23669 continue;
23670 }
23671 dlg.finished(false);
23672 return Err(common::Error::HttpError(err));
23673 }
23674 Ok(res) => {
23675 let (mut parts, body) = res.into_parts();
23676 let mut body = common::Body::new(body);
23677 if !parts.status.is_success() {
23678 let bytes = common::to_bytes(body).await.unwrap_or_default();
23679 let error = serde_json::from_str(&common::to_string(&bytes));
23680 let response = common::to_response(parts, bytes.into());
23681
23682 if let common::Retry::After(d) =
23683 dlg.http_failure(&response, error.as_ref().ok())
23684 {
23685 sleep(d).await;
23686 continue;
23687 }
23688
23689 dlg.finished(false);
23690
23691 return Err(match error {
23692 Ok(value) => common::Error::BadRequest(value),
23693 _ => common::Error::Failure(response),
23694 });
23695 }
23696 let response = {
23697 let bytes = common::to_bytes(body).await.unwrap_or_default();
23698 let encoded = common::to_string(&bytes);
23699 match serde_json::from_str(&encoded) {
23700 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23701 Err(error) => {
23702 dlg.response_json_decode_error(&encoded, &error);
23703 return Err(common::Error::JsonDecodeError(
23704 encoded.to_string(),
23705 error,
23706 ));
23707 }
23708 }
23709 };
23710
23711 dlg.finished(true);
23712 return Ok(response);
23713 }
23714 }
23715 }
23716 }
23717
23718 ///
23719 /// Sets the *request* property to the given value.
23720 ///
23721 /// Even though the property as already been set when instantiating this call,
23722 /// we provide this method for API completeness.
23723 pub fn request(mut self, new_value: Application) -> ProjectLocationApplicationPatchCall<'a, C> {
23724 self._request = new_value;
23725 self
23726 }
23727 /// Part of `name`. Required. Name of the Application resource to update. Example: apps/myapp.
23728 ///
23729 /// Sets the *projects id* path property to the given value.
23730 ///
23731 /// Even though the property as already been set when instantiating this call,
23732 /// we provide this method for API completeness.
23733 pub fn projects_id(mut self, new_value: &str) -> ProjectLocationApplicationPatchCall<'a, C> {
23734 self._projects_id = new_value.to_string();
23735 self
23736 }
23737 /// Part of `name`. See documentation of `projectsId`.
23738 ///
23739 /// Sets the *locations id* path property to the given value.
23740 ///
23741 /// Even though the property as already been set when instantiating this call,
23742 /// we provide this method for API completeness.
23743 pub fn locations_id(mut self, new_value: &str) -> ProjectLocationApplicationPatchCall<'a, C> {
23744 self._locations_id = new_value.to_string();
23745 self
23746 }
23747 /// Part of `name`. See documentation of `projectsId`.
23748 ///
23749 /// Sets the *applications id* path property to the given value.
23750 ///
23751 /// Even though the property as already been set when instantiating this call,
23752 /// we provide this method for API completeness.
23753 pub fn applications_id(
23754 mut self,
23755 new_value: &str,
23756 ) -> ProjectLocationApplicationPatchCall<'a, C> {
23757 self._applications_id = new_value.to_string();
23758 self
23759 }
23760 /// Required. Standard field mask for the set of fields to be updated.
23761 ///
23762 /// Sets the *update mask* query property to the given value.
23763 pub fn update_mask(
23764 mut self,
23765 new_value: common::FieldMask,
23766 ) -> ProjectLocationApplicationPatchCall<'a, C> {
23767 self._update_mask = Some(new_value);
23768 self
23769 }
23770 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23771 /// while executing the actual API request.
23772 ///
23773 /// ````text
23774 /// It should be used to handle progress information, and to implement a certain level of resilience.
23775 /// ````
23776 ///
23777 /// Sets the *delegate* property to the given value.
23778 pub fn delegate(
23779 mut self,
23780 new_value: &'a mut dyn common::Delegate,
23781 ) -> ProjectLocationApplicationPatchCall<'a, C> {
23782 self._delegate = Some(new_value);
23783 self
23784 }
23785
23786 /// Set any additional parameter of the query string used in the request.
23787 /// It should be used to set parameters which are not yet available through their own
23788 /// setters.
23789 ///
23790 /// Please note that this method must not be used to set any of the known parameters
23791 /// which have their own setter method. If done anyway, the request will fail.
23792 ///
23793 /// # Additional Parameters
23794 ///
23795 /// * *$.xgafv* (query-string) - V1 error format.
23796 /// * *access_token* (query-string) - OAuth access token.
23797 /// * *alt* (query-string) - Data format for response.
23798 /// * *callback* (query-string) - JSONP
23799 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23800 /// * *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.
23801 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23802 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23803 /// * *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.
23804 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23805 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23806 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationApplicationPatchCall<'a, C>
23807 where
23808 T: AsRef<str>,
23809 {
23810 self._additional_params
23811 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23812 self
23813 }
23814
23815 /// Identifies the authorization scope for the method you are building.
23816 ///
23817 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23818 /// [`Scope::CloudPlatform`].
23819 ///
23820 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23821 /// tokens for more than one scope.
23822 ///
23823 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23824 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23825 /// sufficient, a read-write scope will do as well.
23826 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationApplicationPatchCall<'a, C>
23827 where
23828 St: AsRef<str>,
23829 {
23830 self._scopes.insert(String::from(scope.as_ref()));
23831 self
23832 }
23833 /// Identifies the authorization scope(s) for the method you are building.
23834 ///
23835 /// See [`Self::add_scope()`] for details.
23836 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationApplicationPatchCall<'a, C>
23837 where
23838 I: IntoIterator<Item = St>,
23839 St: AsRef<str>,
23840 {
23841 self._scopes
23842 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23843 self
23844 }
23845
23846 /// Removes all scopes, and no default scope will be used either.
23847 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23848 /// for details).
23849 pub fn clear_scopes(mut self) -> ProjectLocationApplicationPatchCall<'a, C> {
23850 self._scopes.clear();
23851 self
23852 }
23853}