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::DebugInstanceRequest;
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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
73/// secret,
74/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http1()
86/// .build()
87/// );
88/// let mut hub = Appengine::new(client, auth);
89/// // As the method needs a request, you would usually fill it with the desired information
90/// // into the respective structure. Some of the parts shown here might not be applicable !
91/// // Values shown here are possibly random and not representative !
92/// let mut req = DebugInstanceRequest::default();
93///
94/// // You can configure optional parameters by calling the respective setters at will, and
95/// // execute the final call using `doit()`.
96/// // Values shown here are possibly random and not representative !
97/// let result = hub.apps().services_versions_instances_debug(req, "appsId", "servicesId", "versionsId", "instancesId")
98/// .doit().await;
99///
100/// match result {
101/// Err(e) => match e {
102/// // The Error enum provides details about what exactly happened.
103/// // You can also just use its `Debug`, `Display` or `Error` traits
104/// Error::HttpError(_)
105/// |Error::Io(_)
106/// |Error::MissingAPIKey
107/// |Error::MissingToken(_)
108/// |Error::Cancelled
109/// |Error::UploadSizeLimitExceeded(_, _)
110/// |Error::Failure(_)
111/// |Error::BadRequest(_)
112/// |Error::FieldClash(_)
113/// |Error::JsonDecodeError(_, _) => println!("{}", e),
114/// },
115/// Ok(res) => println!("Success: {:?}", res),
116/// }
117/// # }
118/// ```
119#[derive(Clone)]
120pub struct Appengine<C> {
121 pub client: common::Client<C>,
122 pub auth: Box<dyn common::GetToken>,
123 _user_agent: String,
124 _base_url: String,
125 _root_url: String,
126}
127
128impl<C> common::Hub for Appengine<C> {}
129
130impl<'a, C> Appengine<C> {
131 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Appengine<C> {
132 Appengine {
133 client,
134 auth: Box::new(auth),
135 _user_agent: "google-api-rust-client/6.0.0".to_string(),
136 _base_url: "https://appengine.googleapis.com/".to_string(),
137 _root_url: "https://appengine.googleapis.com/".to_string(),
138 }
139 }
140
141 pub fn apps(&'a self) -> AppMethods<'a, C> {
142 AppMethods { hub: self }
143 }
144 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
145 ProjectMethods { hub: self }
146 }
147
148 /// Set the user-agent header field to use in all requests to the server.
149 /// It defaults to `google-api-rust-client/6.0.0`.
150 ///
151 /// Returns the previously set user-agent.
152 pub fn user_agent(&mut self, agent_name: String) -> String {
153 std::mem::replace(&mut self._user_agent, agent_name)
154 }
155
156 /// Set the base url to use in all requests to the server.
157 /// It defaults to `https://appengine.googleapis.com/`.
158 ///
159 /// Returns the previously set base url.
160 pub fn base_url(&mut self, new_base_url: String) -> String {
161 std::mem::replace(&mut self._base_url, new_base_url)
162 }
163
164 /// Set the root url to use in all requests to the server.
165 /// It defaults to `https://appengine.googleapis.com/`.
166 ///
167 /// Returns the previously set root url.
168 pub fn root_url(&mut self, new_root_url: String) -> String {
169 std::mem::replace(&mut self._root_url, new_root_url)
170 }
171}
172
173// ############
174// SCHEMAS ###
175// ##########
176/// Google Cloud Endpoints (https://cloud.google.com/endpoints) configuration for API handlers.
177///
178/// This type is not used in any activity, and only used as *part* of another schema.
179///
180#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
181#[serde_with::serde_as]
182#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
183pub struct ApiConfigHandler {
184 /// Action to take when users access resources that require authentication. Defaults to redirect.
185 #[serde(rename = "authFailAction")]
186 pub auth_fail_action: Option<String>,
187 /// Level of login required to access this resource. Defaults to optional.
188 pub login: Option<String>,
189 /// Path to the script from the application root directory.
190 pub script: Option<String>,
191 /// Security (HTTPS) enforcement for this URL.
192 #[serde(rename = "securityLevel")]
193 pub security_level: Option<String>,
194 /// URL to serve the endpoint at.
195 pub url: Option<String>,
196}
197
198impl common::Part for ApiConfigHandler {}
199
200/// Uses Google Cloud Endpoints to handle requests.
201///
202/// This type is not used in any activity, and only used as *part* of another schema.
203///
204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
205#[serde_with::serde_as]
206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
207pub struct ApiEndpointHandler {
208 /// Path to the script from the application root directory.
209 #[serde(rename = "scriptPath")]
210 pub script_path: Option<String>,
211}
212
213impl common::Part for ApiEndpointHandler {}
214
215/// An Application resource contains the top-level configuration of an App Engine application.
216///
217/// # Activities
218///
219/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
220/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
221///
222/// * [create apps](AppCreateCall) (request)
223/// * [get apps](AppGetCall) (response)
224/// * [patch apps](AppPatchCall) (request)
225#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
226#[serde_with::serde_as]
227#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
228pub struct Application {
229 /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account.
230 #[serde(rename = "authDomain")]
231 pub auth_domain: Option<String>,
232 /// 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
233 #[serde(rename = "codeBucket")]
234 pub code_bucket: Option<String>,
235 /// The type of the Cloud Firestore or Cloud Datastore database associated with this application.
236 #[serde(rename = "databaseType")]
237 pub database_type: Option<String>,
238 /// Output only. Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly
239 #[serde(rename = "defaultBucket")]
240 pub default_bucket: Option<String>,
241 /// Cookie expiration policy for this application.
242 #[serde(rename = "defaultCookieExpiration")]
243 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
244 pub default_cookie_expiration: Option<chrono::Duration>,
245 /// Output only. Hostname used to reach this application, as resolved by App Engine.@OutputOnly
246 #[serde(rename = "defaultHostname")]
247 pub default_hostname: Option<String>,
248 /// 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.
249 #[serde(rename = "dispatchRules")]
250 pub dispatch_rules: Option<Vec<UrlDispatchRule>>,
251 /// The feature specific settings to be used in the application.
252 #[serde(rename = "featureSettings")]
253 pub feature_settings: Option<FeatureSettings>,
254 /// Output only. The Google Container Registry domain used for storing managed build docker images for this application.
255 #[serde(rename = "gcrDomain")]
256 pub gcr_domain: Option<String>,
257 /// Additional Google Generated Customer Metadata, this field won't be provided by default and can be requested by setting the IncludeExtraData field in GetApplicationRequest
258 #[serde(rename = "generatedCustomerMetadata")]
259 pub generated_customer_metadata: Option<HashMap<String, serde_json::Value>>,
260 /// no description provided
261 pub iap: Option<IdentityAwareProxy>,
262 /// 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.
263 pub id: Option<String>,
264 /// 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).
265 #[serde(rename = "locationId")]
266 pub location_id: Option<String>,
267 /// Output only. Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly
268 pub name: Option<String>,
269 /// 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.
270 #[serde(rename = "serviceAccount")]
271 pub service_account: Option<String>,
272 /// Serving status of this application.
273 #[serde(rename = "servingStatus")]
274 pub serving_status: Option<String>,
275}
276
277impl common::RequestValue for Application {}
278impl common::ResponseResult for Application {}
279
280/// 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.
281///
282/// # Activities
283///
284/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
285/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
286///
287/// * [authorized certificates create apps](AppAuthorizedCertificateCreateCall) (request|response)
288/// * [authorized certificates get apps](AppAuthorizedCertificateGetCall) (response)
289/// * [authorized certificates patch apps](AppAuthorizedCertificatePatchCall) (request|response)
290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
291#[serde_with::serde_as]
292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
293pub struct AuthorizedCertificate {
294 /// The SSL certificate serving the AuthorizedCertificate resource. This must be obtained independently from a certificate authority.
295 #[serde(rename = "certificateRawData")]
296 pub certificate_raw_data: Option<CertificateRawData>,
297 /// The user-specified display name of the certificate. This is not guaranteed to be unique. Example: My Certificate.
298 #[serde(rename = "displayName")]
299 pub display_name: Option<String>,
300 /// 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
301 #[serde(rename = "domainMappingsCount")]
302 pub domain_mappings_count: Option<i32>,
303 /// Topmost applicable domains of this certificate. This certificate applies to these domains and their subdomains. Example: example.com.@OutputOnly
304 #[serde(rename = "domainNames")]
305 pub domain_names: Option<Vec<String>>,
306 /// 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
307 #[serde(rename = "expireTime")]
308 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
309 /// Relative name of the certificate. This is a unique value autogenerated on AuthorizedCertificate resource creation. Example: 12345.@OutputOnly
310 pub id: Option<String>,
311 /// 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
312 #[serde(rename = "managedCertificate")]
313 pub managed_certificate: Option<ManagedCertificate>,
314 /// Full path to the AuthorizedCertificate resource in the API. Example: apps/myapp/authorizedCertificates/12345.@OutputOnly
315 pub name: Option<String>,
316 /// 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
317 #[serde(rename = "visibleDomainMappings")]
318 pub visible_domain_mappings: Option<Vec<String>>,
319}
320
321impl common::RequestValue for AuthorizedCertificate {}
322impl common::ResponseResult for AuthorizedCertificate {}
323
324/// 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).
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct AuthorizedDomain {
332 /// Fully qualified domain name of the domain authorized for use. Example: example.com.
333 pub id: Option<String>,
334 /// Full path to the AuthorizedDomain resource in the API. Example: apps/myapp/authorizedDomains/example.com.@OutputOnly
335 pub name: Option<String>,
336}
337
338impl common::Part for AuthorizedDomain {}
339
340/// Automatic scaling is based on request rate, response latencies, and other application metrics.
341///
342/// This type is not used in any activity, and only used as *part* of another schema.
343///
344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
345#[serde_with::serde_as]
346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
347pub struct AutomaticScaling {
348 /// 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.
349 #[serde(rename = "coolDownPeriod")]
350 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
351 pub cool_down_period: Option<chrono::Duration>,
352 /// Target scaling by CPU usage.
353 #[serde(rename = "cpuUtilization")]
354 pub cpu_utilization: Option<CpuUtilization>,
355 /// Target scaling by disk usage.
356 #[serde(rename = "diskUtilization")]
357 pub disk_utilization: Option<DiskUtilization>,
358 /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value.
359 #[serde(rename = "maxConcurrentRequests")]
360 pub max_concurrent_requests: Option<i32>,
361 /// Maximum number of idle instances that should be maintained for this version.
362 #[serde(rename = "maxIdleInstances")]
363 pub max_idle_instances: Option<i32>,
364 /// Maximum amount of time that a request should wait in the pending queue before starting a new instance to handle it.
365 #[serde(rename = "maxPendingLatency")]
366 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
367 pub max_pending_latency: Option<chrono::Duration>,
368 /// Maximum number of instances that should be started to handle requests for this version.
369 #[serde(rename = "maxTotalInstances")]
370 pub max_total_instances: Option<i32>,
371 /// Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a service.
372 #[serde(rename = "minIdleInstances")]
373 pub min_idle_instances: Option<i32>,
374 /// Minimum amount of time a request should wait in the pending queue before starting a new instance to handle it.
375 #[serde(rename = "minPendingLatency")]
376 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
377 pub min_pending_latency: Option<chrono::Duration>,
378 /// Minimum number of running instances that should be maintained for this version.
379 #[serde(rename = "minTotalInstances")]
380 pub min_total_instances: Option<i32>,
381 /// Target scaling by network usage.
382 #[serde(rename = "networkUtilization")]
383 pub network_utilization: Option<NetworkUtilization>,
384 /// Target scaling by request utilization.
385 #[serde(rename = "requestUtilization")]
386 pub request_utilization: Option<RequestUtilization>,
387 /// Scheduler settings for standard environment.
388 #[serde(rename = "standardSchedulerSettings")]
389 pub standard_scheduler_settings: Option<StandardSchedulerSettings>,
390}
391
392impl common::Part for AutomaticScaling {}
393
394/// 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.
395///
396/// This type is not used in any activity, and only used as *part* of another schema.
397///
398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
399#[serde_with::serde_as]
400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
401pub struct BasicScaling {
402 /// Duration of time after the last request that an instance must wait before the instance is shut down.
403 #[serde(rename = "idleTimeout")]
404 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
405 pub idle_timeout: Option<chrono::Duration>,
406 /// Maximum number of instances to create for this version.
407 #[serde(rename = "maxInstances")]
408 pub max_instances: Option<i32>,
409}
410
411impl common::Part for BasicScaling {}
412
413/// Request message for Firewall.BatchUpdateIngressRules.
414///
415/// # Activities
416///
417/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
418/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
419///
420/// * [firewall ingress rules batch update apps](AppFirewallIngressRuleBatchUpdateCall) (request)
421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
422#[serde_with::serde_as]
423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
424pub struct BatchUpdateIngressRulesRequest {
425 /// A list of FirewallRules to replace the existing set.
426 #[serde(rename = "ingressRules")]
427 pub ingress_rules: Option<Vec<FirewallRule>>,
428}
429
430impl common::RequestValue for BatchUpdateIngressRulesRequest {}
431
432/// Response message for Firewall.UpdateAllIngressRules.
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) (response)
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct BatchUpdateIngressRulesResponse {
444 /// The full list of ingress FirewallRules for this application.
445 #[serde(rename = "ingressRules")]
446 pub ingress_rules: Option<Vec<FirewallRule>>,
447}
448
449impl common::ResponseResult for BatchUpdateIngressRulesResponse {}
450
451/// An SSL certificate obtained from a certificate authority.
452///
453/// This type is not used in any activity, and only used as *part* of another schema.
454///
455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
456#[serde_with::serde_as]
457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
458pub struct CertificateRawData {
459 /// 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
460 #[serde(rename = "privateKey")]
461 pub private_key: Option<String>,
462 /// 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-----
463 #[serde(rename = "publicCertificate")]
464 pub public_certificate: Option<String>,
465}
466
467impl common::Part for CertificateRawData {}
468
469/// 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.
470///
471/// This type is not used in any activity, and only used as *part* of another schema.
472///
473#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
474#[serde_with::serde_as]
475#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
476pub struct CloudBuildOptions {
477 /// 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.
478 #[serde(rename = "appYamlPath")]
479 pub app_yaml_path: Option<String>,
480 /// The Cloud Build timeout used as part of any dependent builds performed by version creation. Defaults to 10 minutes.
481 #[serde(rename = "cloudBuildTimeout")]
482 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
483 pub cloud_build_timeout: Option<chrono::Duration>,
484}
485
486impl common::Part for CloudBuildOptions {}
487
488/// 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.
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 ContainerInfo {
496 /// 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"
497 pub image: Option<String>,
498}
499
500impl common::Part for ContainerInfo {}
501
502/// Target scaling by CPU usage.
503///
504/// This type is not used in any activity, and only used as *part* of another schema.
505///
506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
507#[serde_with::serde_as]
508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
509pub struct CpuUtilization {
510 /// Period of time over which CPU utilization is calculated.
511 #[serde(rename = "aggregationWindowLength")]
512 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
513 pub aggregation_window_length: Option<chrono::Duration>,
514 /// Target CPU utilization ratio to maintain when scaling. Must be between 0 and 1.
515 #[serde(rename = "targetUtilization")]
516 pub target_utilization: Option<f64>,
517}
518
519impl common::Part for CpuUtilization {}
520
521/// 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
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 Date {
529 /// 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.
530 pub day: Option<i32>,
531 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
532 pub month: Option<i32>,
533 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
534 pub year: Option<i32>,
535}
536
537impl common::Part for Date {}
538
539/// Request message for Instances.DebugInstance.
540///
541/// # Activities
542///
543/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
544/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
545///
546/// * [services versions instances debug apps](AppServiceVersionInstanceDebugCall) (request)
547#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
548#[serde_with::serde_as]
549#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
550pub struct DebugInstanceRequest {
551 /// 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).
552 #[serde(rename = "sshKey")]
553 pub ssh_key: Option<String>,
554}
555
556impl common::RequestValue for DebugInstanceRequest {}
557
558/// Code and application artifacts used to deploy a version to App Engine.
559///
560/// This type is not used in any activity, and only used as *part* of another schema.
561///
562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
563#[serde_with::serde_as]
564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
565pub struct Deployment {
566 /// 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.
567 #[serde(rename = "cloudBuildOptions")]
568 pub cloud_build_options: Option<CloudBuildOptions>,
569 /// The Docker image for the container that runs the version. Only applicable for instances running in the App Engine flexible environment.
570 pub container: Option<ContainerInfo>,
571 /// 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.
572 pub files: Option<HashMap<String, FileInfo>>,
573 /// The zip file for this deployment, if this is a zip deployment.
574 pub zip: Option<ZipInfo>,
575}
576
577impl common::Part for Deployment {}
578
579/// Target scaling by disk usage. Only applicable in the App Engine flexible environment.
580///
581/// This type is not used in any activity, and only used as *part* of another schema.
582///
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct DiskUtilization {
587 /// Target bytes read per second.
588 #[serde(rename = "targetReadBytesPerSecond")]
589 pub target_read_bytes_per_second: Option<i32>,
590 /// Target ops read per seconds.
591 #[serde(rename = "targetReadOpsPerSecond")]
592 pub target_read_ops_per_second: Option<i32>,
593 /// Target bytes written per second.
594 #[serde(rename = "targetWriteBytesPerSecond")]
595 pub target_write_bytes_per_second: Option<i32>,
596 /// Target ops written per second.
597 #[serde(rename = "targetWriteOpsPerSecond")]
598 pub target_write_ops_per_second: Option<i32>,
599}
600
601impl common::Part for DiskUtilization {}
602
603/// A domain serving an App Engine application.
604///
605/// # Activities
606///
607/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
608/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
609///
610/// * [domain mappings create apps](AppDomainMappingCreateCall) (request)
611/// * [domain mappings get apps](AppDomainMappingGetCall) (response)
612/// * [domain mappings patch apps](AppDomainMappingPatchCall) (request)
613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
614#[serde_with::serde_as]
615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
616pub struct DomainMapping {
617 /// Relative name of the domain serving the application. Example: example.com.
618 pub id: Option<String>,
619 /// Full path to the DomainMapping resource in the API. Example: apps/myapp/domainMapping/example.com.@OutputOnly
620 pub name: Option<String>,
621 /// 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
622 #[serde(rename = "resourceRecords")]
623 pub resource_records: Option<Vec<ResourceRecord>>,
624 /// SSL configuration for this domain. If unconfigured, this domain will not serve with SSL.
625 #[serde(rename = "sslSettings")]
626 pub ssl_settings: Option<SslSettings>,
627}
628
629impl common::RequestValue for DomainMapping {}
630impl common::ResponseResult for DomainMapping {}
631
632/// 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); }
633///
634/// # Activities
635///
636/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
637/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
638///
639/// * [authorized certificates delete apps](AppAuthorizedCertificateDeleteCall) (response)
640/// * [firewall ingress rules delete apps](AppFirewallIngressRuleDeleteCall) (response)
641#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
642#[serde_with::serde_as]
643#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
644pub struct Empty {
645 _never_set: Option<bool>,
646}
647
648impl common::ResponseResult for Empty {}
649
650/// 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).
651///
652/// This type is not used in any activity, and only used as *part* of another schema.
653///
654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
655#[serde_with::serde_as]
656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
657pub struct EndpointsApiService {
658 /// 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.
659 #[serde(rename = "configId")]
660 pub config_id: Option<String>,
661 /// Enable or disable trace sampling. By default, this is set to false for enabled.
662 #[serde(rename = "disableTraceSampling")]
663 pub disable_trace_sampling: Option<bool>,
664 /// Endpoints service name which is the name of the "service" resource in the Service Management API. For example "myapi.endpoints.myproject.cloud.goog"
665 pub name: Option<String>,
666 /// Endpoints rollout strategy. If FIXED, config_id must be specified. If MANAGED, config_id must be omitted.
667 #[serde(rename = "rolloutStrategy")]
668 pub rollout_strategy: Option<String>,
669}
670
671impl common::Part for EndpointsApiService {}
672
673/// The entrypoint for the application.
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 Entrypoint {
681 /// The format should be a shell command that can be fed to bash -c.
682 pub shell: Option<String>,
683}
684
685impl common::Part for Entrypoint {}
686
687/// Custom static error page to be served when an error occurs.
688///
689/// This type is not used in any activity, and only used as *part* of another schema.
690///
691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
692#[serde_with::serde_as]
693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
694pub struct ErrorHandler {
695 /// Error condition this handler applies to.
696 #[serde(rename = "errorCode")]
697 pub error_code: Option<String>,
698 /// MIME type of file. Defaults to text/html.
699 #[serde(rename = "mimeType")]
700 pub mime_type: Option<String>,
701 /// Static file content to be served for this error.
702 #[serde(rename = "staticFile")]
703 pub static_file: Option<String>,
704}
705
706impl common::Part for ErrorHandler {}
707
708/// The feature specific settings to be used in the application. These define behaviors that are user configurable.
709///
710/// This type is not used in any activity, and only used as *part* of another schema.
711///
712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
713#[serde_with::serde_as]
714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
715pub struct FeatureSettings {
716 /// 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.
717 #[serde(rename = "splitHealthChecks")]
718 pub split_health_checks: Option<bool>,
719 /// If true, use Container-Optimized OS (https://cloud.google.com/container-optimized-os/) base image for VMs, rather than a base Debian image.
720 #[serde(rename = "useContainerOptimizedOs")]
721 pub use_container_optimized_os: Option<bool>,
722}
723
724impl common::Part for FeatureSettings {}
725
726/// Single source file that is part of the version to be deployed. Each source file that is deployed must be specified separately.
727///
728/// This type is not used in any activity, and only used as *part* of another schema.
729///
730#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
731#[serde_with::serde_as]
732#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
733pub struct FileInfo {
734 /// The MIME type of the file.Defaults to the value from Google Cloud Storage.
735 #[serde(rename = "mimeType")]
736 pub mime_type: Option<String>,
737 /// The SHA1 hash of the file, in hex.
738 #[serde(rename = "sha1Sum")]
739 pub sha1_sum: Option<String>,
740 /// 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//'.
741 #[serde(rename = "sourceUrl")]
742 pub source_url: Option<String>,
743}
744
745impl common::Part for FileInfo {}
746
747/// A single firewall rule that is evaluated against incoming traffic and provides an action to take on matched requests.
748///
749/// # Activities
750///
751/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
752/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
753///
754/// * [firewall ingress rules create apps](AppFirewallIngressRuleCreateCall) (request|response)
755/// * [firewall ingress rules get apps](AppFirewallIngressRuleGetCall) (response)
756/// * [firewall ingress rules patch apps](AppFirewallIngressRulePatchCall) (request|response)
757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
758#[serde_with::serde_as]
759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
760pub struct FirewallRule {
761 /// The action to take on matched requests.
762 pub action: Option<String>,
763 /// An optional string description of this rule. This field has a maximum length of 400 characters.
764 pub description: Option<String>,
765 /// 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.
766 pub priority: Option<i32>,
767 /// 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.
768 #[serde(rename = "sourceRange")]
769 pub source_range: Option<String>,
770}
771
772impl common::RequestValue for FirewallRule {}
773impl common::ResponseResult for FirewallRule {}
774
775/// Runtime settings for the App Engine flexible environment.
776///
777/// This type is not used in any activity, and only used as *part* of another schema.
778///
779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
780#[serde_with::serde_as]
781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
782pub struct FlexibleRuntimeSettings {
783 /// The operating system of the application runtime.
784 #[serde(rename = "operatingSystem")]
785 pub operating_system: Option<String>,
786 /// The runtime version of an App Engine flexible application.
787 #[serde(rename = "runtimeVersion")]
788 pub runtime_version: Option<String>,
789}
790
791impl common::Part for FlexibleRuntimeSettings {}
792
793/// Health checking configuration for VM instances. Unhealthy instances are killed and replaced with new instances. Only applicable for instances in App Engine flexible environment.
794///
795/// This type is not used in any activity, and only used as *part* of another schema.
796///
797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
798#[serde_with::serde_as]
799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
800pub struct HealthCheck {
801 /// Interval between health checks.
802 #[serde(rename = "checkInterval")]
803 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
804 pub check_interval: Option<chrono::Duration>,
805 /// Whether to explicitly disable health checks for this instance.
806 #[serde(rename = "disableHealthCheck")]
807 pub disable_health_check: Option<bool>,
808 /// Number of consecutive successful health checks required before receiving traffic.
809 #[serde(rename = "healthyThreshold")]
810 pub healthy_threshold: Option<u32>,
811 /// Host header to send when performing an HTTP health check. Example: "myapp.appspot.com"
812 pub host: Option<String>,
813 /// Number of consecutive failed health checks required before an instance is restarted.
814 #[serde(rename = "restartThreshold")]
815 pub restart_threshold: Option<u32>,
816 /// Time before the health check is considered failed.
817 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
818 pub timeout: Option<chrono::Duration>,
819 /// Number of consecutive failed health checks required before removing traffic.
820 #[serde(rename = "unhealthyThreshold")]
821 pub unhealthy_threshold: Option<u32>,
822}
823
824impl common::Part for HealthCheck {}
825
826/// Identity-Aware Proxy
827///
828/// This type is not used in any activity, and only used as *part* of another schema.
829///
830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
831#[serde_with::serde_as]
832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
833pub struct IdentityAwareProxy {
834 /// 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.
835 pub enabled: Option<bool>,
836 /// OAuth2 client ID to use for the authentication flow.
837 #[serde(rename = "oauth2ClientId")]
838 pub oauth2_client_id: Option<String>,
839 /// 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
840 #[serde(rename = "oauth2ClientSecret")]
841 pub oauth2_client_secret: Option<String>,
842 /// Output only. Hex-encoded SHA-256 hash of the client secret.@OutputOnly
843 #[serde(rename = "oauth2ClientSecretSha256")]
844 pub oauth2_client_secret_sha256: Option<String>,
845}
846
847impl common::Part for IdentityAwareProxy {}
848
849/// An Instance resource is the computing unit that App Engine uses to automatically scale an application.
850///
851/// # Activities
852///
853/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
854/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
855///
856/// * [services versions instances get apps](AppServiceVersionInstanceGetCall) (response)
857#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
858#[serde_with::serde_as]
859#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
860pub struct Instance {
861 /// Output only. App Engine release this instance is running on.
862 #[serde(rename = "appEngineRelease")]
863 pub app_engine_release: Option<String>,
864 /// Output only. Availability of the instance.
865 pub availability: Option<String>,
866 /// Output only. Average latency (ms) over the last minute.
867 #[serde(rename = "averageLatency")]
868 pub average_latency: Option<i32>,
869 /// Output only. Number of errors since this instance was started.
870 pub errors: Option<i32>,
871 /// Output only. Relative name of the instance within the version. Example: instance-1.
872 pub id: Option<String>,
873 /// Output only. Total memory in use (bytes).
874 #[serde(rename = "memoryUsage")]
875 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
876 pub memory_usage: Option<i64>,
877 /// Output only. Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
878 pub name: Option<String>,
879 /// Output only. Average queries per second (QPS) over the last minute.
880 pub qps: Option<f32>,
881 /// Output only. Number of requests since this instance was started.
882 pub requests: Option<i32>,
883 /// Output only. Time that this instance was started.@OutputOnly
884 #[serde(rename = "startTime")]
885 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
886 /// Output only. Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.
887 #[serde(rename = "vmDebugEnabled")]
888 pub vm_debug_enabled: Option<bool>,
889 /// Output only. Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.
890 #[serde(rename = "vmId")]
891 pub vm_id: Option<String>,
892 /// Output only. The IP address of this instance. Only applicable for instances in App Engine flexible environment.
893 #[serde(rename = "vmIp")]
894 pub vm_ip: Option<String>,
895 /// Output only. The liveness health check of this instance. Only applicable for instances in App Engine flexible environment.
896 #[serde(rename = "vmLiveness")]
897 pub vm_liveness: Option<String>,
898 /// Output only. Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.
899 #[serde(rename = "vmName")]
900 pub vm_name: Option<String>,
901 /// Output only. Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.
902 #[serde(rename = "vmStatus")]
903 pub vm_status: Option<String>,
904 /// Output only. Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.
905 #[serde(rename = "vmZoneName")]
906 pub vm_zone_name: Option<String>,
907}
908
909impl common::ResponseResult for Instance {}
910
911/// Third-party Python runtime library that is required by the application.
912///
913/// This type is not used in any activity, and only used as *part* of another schema.
914///
915#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
916#[serde_with::serde_as]
917#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
918pub struct Library {
919 /// Name of the library. Example: "django".
920 pub name: Option<String>,
921 /// Version of the library to select, or "latest".
922 pub version: Option<String>,
923}
924
925impl common::Part for Library {}
926
927/// Response message for AuthorizedCertificates.ListAuthorizedCertificates.
928///
929/// # Activities
930///
931/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
932/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
933///
934/// * [authorized certificates list apps](AppAuthorizedCertificateListCall) (response)
935#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
936#[serde_with::serde_as]
937#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
938pub struct ListAuthorizedCertificatesResponse {
939 /// The SSL certificates the user is authorized to administer.
940 pub certificates: Option<Vec<AuthorizedCertificate>>,
941 /// Continuation token for fetching the next page of results.
942 #[serde(rename = "nextPageToken")]
943 pub next_page_token: Option<String>,
944}
945
946impl common::ResponseResult for ListAuthorizedCertificatesResponse {}
947
948/// Response message for AuthorizedDomains.ListAuthorizedDomains.
949///
950/// # Activities
951///
952/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
953/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
954///
955/// * [authorized domains list apps](AppAuthorizedDomainListCall) (response)
956/// * [locations applications authorized domains list projects](ProjectLocationApplicationAuthorizedDomainListCall) (response)
957#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
958#[serde_with::serde_as]
959#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
960pub struct ListAuthorizedDomainsResponse {
961 /// The authorized domains belonging to the user.
962 pub domains: Option<Vec<AuthorizedDomain>>,
963 /// Continuation token for fetching the next page of results.
964 #[serde(rename = "nextPageToken")]
965 pub next_page_token: Option<String>,
966}
967
968impl common::ResponseResult for ListAuthorizedDomainsResponse {}
969
970/// Response message for DomainMappings.ListDomainMappings.
971///
972/// # Activities
973///
974/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
975/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
976///
977/// * [domain mappings list apps](AppDomainMappingListCall) (response)
978#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
979#[serde_with::serde_as]
980#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
981pub struct ListDomainMappingsResponse {
982 /// The domain mappings for the application.
983 #[serde(rename = "domainMappings")]
984 pub domain_mappings: Option<Vec<DomainMapping>>,
985 /// Continuation token for fetching the next page of results.
986 #[serde(rename = "nextPageToken")]
987 pub next_page_token: Option<String>,
988}
989
990impl common::ResponseResult for ListDomainMappingsResponse {}
991
992/// Response message for Firewall.ListIngressRules.
993///
994/// # Activities
995///
996/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
997/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
998///
999/// * [firewall ingress rules list apps](AppFirewallIngressRuleListCall) (response)
1000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1001#[serde_with::serde_as]
1002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1003pub struct ListIngressRulesResponse {
1004 /// The ingress FirewallRules for this application.
1005 #[serde(rename = "ingressRules")]
1006 pub ingress_rules: Option<Vec<FirewallRule>>,
1007 /// Continuation token for fetching the next page of results.
1008 #[serde(rename = "nextPageToken")]
1009 pub next_page_token: Option<String>,
1010}
1011
1012impl common::ResponseResult for ListIngressRulesResponse {}
1013
1014/// Response message for Instances.ListInstances.
1015///
1016/// # Activities
1017///
1018/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1019/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1020///
1021/// * [services versions instances list apps](AppServiceVersionInstanceListCall) (response)
1022#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1023#[serde_with::serde_as]
1024#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1025pub struct ListInstancesResponse {
1026 /// The instances belonging to the requested version.
1027 pub instances: Option<Vec<Instance>>,
1028 /// Continuation token for fetching the next page of results.
1029 #[serde(rename = "nextPageToken")]
1030 pub next_page_token: Option<String>,
1031}
1032
1033impl common::ResponseResult for ListInstancesResponse {}
1034
1035/// The response message for Locations.ListLocations.
1036///
1037/// # Activities
1038///
1039/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1040/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1041///
1042/// * [locations list apps](AppLocationListCall) (response)
1043#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1044#[serde_with::serde_as]
1045#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1046pub struct ListLocationsResponse {
1047 /// A list of locations that matches the specified filter in the request.
1048 pub locations: Option<Vec<Location>>,
1049 /// The standard List next-page token.
1050 #[serde(rename = "nextPageToken")]
1051 pub next_page_token: Option<String>,
1052}
1053
1054impl common::ResponseResult for ListLocationsResponse {}
1055
1056/// The response message for Operations.ListOperations.
1057///
1058/// # Activities
1059///
1060/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1061/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1062///
1063/// * [operations list apps](AppOperationListCall) (response)
1064#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1065#[serde_with::serde_as]
1066#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1067pub struct ListOperationsResponse {
1068 /// The standard List next-page token.
1069 #[serde(rename = "nextPageToken")]
1070 pub next_page_token: Option<String>,
1071 /// A list of operations that matches the specified filter in the request.
1072 pub operations: Option<Vec<Operation>>,
1073}
1074
1075impl common::ResponseResult for ListOperationsResponse {}
1076
1077/// Response message for Applications.ListRuntimes.
1078///
1079/// # Activities
1080///
1081/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1082/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1083///
1084/// * [list runtimes apps](AppListRuntimeCall) (response)
1085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1086#[serde_with::serde_as]
1087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1088pub struct ListRuntimesResponse {
1089 /// Continuation token for fetching the next page of results.
1090 #[serde(rename = "nextPageToken")]
1091 pub next_page_token: Option<String>,
1092 /// The runtimes available to the requested application.
1093 pub runtimes: Option<Vec<Runtime>>,
1094}
1095
1096impl common::ResponseResult for ListRuntimesResponse {}
1097
1098/// Response message for Services.ListServices.
1099///
1100/// # Activities
1101///
1102/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1103/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1104///
1105/// * [services list apps](AppServiceListCall) (response)
1106#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1107#[serde_with::serde_as]
1108#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1109pub struct ListServicesResponse {
1110 /// Continuation token for fetching the next page of results.
1111 #[serde(rename = "nextPageToken")]
1112 pub next_page_token: Option<String>,
1113 /// The services belonging to the requested application.
1114 pub services: Option<Vec<Service>>,
1115}
1116
1117impl common::ResponseResult for ListServicesResponse {}
1118
1119/// Response message for Versions.ListVersions.
1120///
1121/// # Activities
1122///
1123/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1124/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1125///
1126/// * [services versions list apps](AppServiceVersionListCall) (response)
1127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1128#[serde_with::serde_as]
1129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1130pub struct ListVersionsResponse {
1131 /// Continuation token for fetching the next page of results.
1132 #[serde(rename = "nextPageToken")]
1133 pub next_page_token: Option<String>,
1134 /// The versions belonging to the requested service.
1135 pub versions: Option<Vec<Version>>,
1136}
1137
1138impl common::ResponseResult for ListVersionsResponse {}
1139
1140/// Health checking configuration for VM instances. Unhealthy instances are killed and replaced with new instances.
1141///
1142/// This type is not used in any activity, and only used as *part* of another schema.
1143///
1144#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1145#[serde_with::serde_as]
1146#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1147pub struct LivenessCheck {
1148 /// Interval between health checks.
1149 #[serde(rename = "checkInterval")]
1150 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1151 pub check_interval: Option<chrono::Duration>,
1152 /// Number of consecutive failed checks required before considering the VM unhealthy.
1153 #[serde(rename = "failureThreshold")]
1154 pub failure_threshold: Option<u32>,
1155 /// Host header to send when performing a HTTP Liveness check. Example: "myapp.appspot.com"
1156 pub host: Option<String>,
1157 /// The initial delay before starting to execute the checks.
1158 #[serde(rename = "initialDelay")]
1159 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1160 pub initial_delay: Option<chrono::Duration>,
1161 /// The request path.
1162 pub path: Option<String>,
1163 /// Number of consecutive successful checks required before considering the VM healthy.
1164 #[serde(rename = "successThreshold")]
1165 pub success_threshold: Option<u32>,
1166 /// Time before the check is considered failed.
1167 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1168 pub timeout: Option<chrono::Duration>,
1169}
1170
1171impl common::Part for LivenessCheck {}
1172
1173/// A resource that represents a Google Cloud location.
1174///
1175/// # Activities
1176///
1177/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1178/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1179///
1180/// * [locations get apps](AppLocationGetCall) (response)
1181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1182#[serde_with::serde_as]
1183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1184pub struct Location {
1185 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1186 #[serde(rename = "displayName")]
1187 pub display_name: Option<String>,
1188 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1189 pub labels: Option<HashMap<String, String>>,
1190 /// The canonical id for this location. For example: "us-east1".
1191 #[serde(rename = "locationId")]
1192 pub location_id: Option<String>,
1193 /// Service-specific metadata. For example the available capacity at the given location.
1194 pub metadata: Option<HashMap<String, serde_json::Value>>,
1195 /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1"
1196 pub name: Option<String>,
1197}
1198
1199impl common::ResponseResult for Location {}
1200
1201/// A certificate managed by App Engine.
1202///
1203/// This type is not used in any activity, and only used as *part* of another schema.
1204///
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct ManagedCertificate {
1209 /// 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
1210 #[serde(rename = "lastRenewalTime")]
1211 pub last_renewal_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1212 /// Status of certificate management. Refers to the most recent certificate acquisition or renewal attempt.@OutputOnly
1213 pub status: Option<String>,
1214}
1215
1216impl common::Part for ManagedCertificate {}
1217
1218/// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time.
1219///
1220/// This type is not used in any activity, and only used as *part* of another schema.
1221///
1222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1223#[serde_with::serde_as]
1224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1225pub struct ManualScaling {
1226 /// 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.
1227 pub instances: Option<i32>,
1228}
1229
1230impl common::Part for ManualScaling {}
1231
1232/// Extra network settings. Only applicable in the App Engine flexible environment.
1233///
1234/// This type is not used in any activity, and only used as *part* of another schema.
1235///
1236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1237#[serde_with::serde_as]
1238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1239pub struct Network {
1240 /// List of ports, or port pairs, to forward from the virtual machine to the application container. Only applicable in the App Engine flexible environment.
1241 #[serde(rename = "forwardedPorts")]
1242 pub forwarded_ports: Option<Vec<String>>,
1243 /// The IP mode for instances. Only applicable in the App Engine flexible environment.
1244 #[serde(rename = "instanceIpMode")]
1245 pub instance_ip_mode: Option<String>,
1246 /// Tag to apply to the instance during creation. Only applicable in the App Engine flexible environment.
1247 #[serde(rename = "instanceTag")]
1248 pub instance_tag: Option<String>,
1249 /// Google Compute Engine network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default.
1250 pub name: Option<String>,
1251 /// Enable session affinity. Only applicable in the App Engine flexible environment.
1252 #[serde(rename = "sessionAffinity")]
1253 pub session_affinity: Option<bool>,
1254 /// 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.
1255 #[serde(rename = "subnetworkName")]
1256 pub subnetwork_name: Option<String>,
1257}
1258
1259impl common::Part for Network {}
1260
1261/// A NetworkSettings resource is a container for ingress settings for a version or service.
1262///
1263/// This type is not used in any activity, and only used as *part* of another schema.
1264///
1265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1266#[serde_with::serde_as]
1267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1268pub struct NetworkSettings {
1269 /// The ingress settings for version or service.
1270 #[serde(rename = "ingressTrafficAllowed")]
1271 pub ingress_traffic_allowed: Option<String>,
1272}
1273
1274impl common::Part for NetworkSettings {}
1275
1276/// Target scaling by network usage. Only applicable in the App Engine flexible environment.
1277///
1278/// This type is not used in any activity, and only used as *part* of another schema.
1279///
1280#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1281#[serde_with::serde_as]
1282#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1283pub struct NetworkUtilization {
1284 /// Target bytes received per second.
1285 #[serde(rename = "targetReceivedBytesPerSecond")]
1286 pub target_received_bytes_per_second: Option<i32>,
1287 /// Target packets received per second.
1288 #[serde(rename = "targetReceivedPacketsPerSecond")]
1289 pub target_received_packets_per_second: Option<i32>,
1290 /// Target bytes sent per second.
1291 #[serde(rename = "targetSentBytesPerSecond")]
1292 pub target_sent_bytes_per_second: Option<i32>,
1293 /// Target packets sent per second.
1294 #[serde(rename = "targetSentPacketsPerSecond")]
1295 pub target_sent_packets_per_second: Option<i32>,
1296}
1297
1298impl common::Part for NetworkUtilization {}
1299
1300/// This resource represents a long-running operation that is the result of a network API call.
1301///
1302/// # Activities
1303///
1304/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1305/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1306///
1307/// * [domain mappings create apps](AppDomainMappingCreateCall) (response)
1308/// * [domain mappings delete apps](AppDomainMappingDeleteCall) (response)
1309/// * [domain mappings patch apps](AppDomainMappingPatchCall) (response)
1310/// * [operations get apps](AppOperationGetCall) (response)
1311/// * [services versions instances debug apps](AppServiceVersionInstanceDebugCall) (response)
1312/// * [services versions instances delete apps](AppServiceVersionInstanceDeleteCall) (response)
1313/// * [services versions create apps](AppServiceVersionCreateCall) (response)
1314/// * [services versions delete apps](AppServiceVersionDeleteCall) (response)
1315/// * [services versions patch apps](AppServiceVersionPatchCall) (response)
1316/// * [services delete apps](AppServiceDeleteCall) (response)
1317/// * [services patch apps](AppServicePatchCall) (response)
1318/// * [create apps](AppCreateCall) (response)
1319/// * [patch apps](AppPatchCall) (response)
1320/// * [repair apps](AppRepairCall) (response)
1321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1322#[serde_with::serde_as]
1323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1324pub struct Operation {
1325 /// 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.
1326 pub done: Option<bool>,
1327 /// The error result of the operation in case of failure or cancellation.
1328 pub error: Option<Status>,
1329 /// 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.
1330 pub metadata: Option<HashMap<String, serde_json::Value>>,
1331 /// 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}.
1332 pub name: Option<String>,
1333 /// 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.
1334 pub response: Option<HashMap<String, serde_json::Value>>,
1335}
1336
1337impl common::ResponseResult for Operation {}
1338
1339/// Readiness checking configuration for VM instances. Unhealthy instances are removed from traffic rotation.
1340///
1341/// This type is not used in any activity, and only used as *part* of another schema.
1342///
1343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1344#[serde_with::serde_as]
1345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1346pub struct ReadinessCheck {
1347 /// A maximum time limit on application initialization, measured from moment the application successfully replies to a healthcheck until it is ready to serve traffic.
1348 #[serde(rename = "appStartTimeout")]
1349 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1350 pub app_start_timeout: Option<chrono::Duration>,
1351 /// Interval between health checks.
1352 #[serde(rename = "checkInterval")]
1353 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1354 pub check_interval: Option<chrono::Duration>,
1355 /// Number of consecutive failed checks required before removing traffic.
1356 #[serde(rename = "failureThreshold")]
1357 pub failure_threshold: Option<u32>,
1358 /// Host header to send when performing a HTTP Readiness check. Example: "myapp.appspot.com"
1359 pub host: Option<String>,
1360 /// The request path.
1361 pub path: Option<String>,
1362 /// Number of consecutive successful checks required before receiving traffic.
1363 #[serde(rename = "successThreshold")]
1364 pub success_threshold: Option<u32>,
1365 /// Time before the check is considered failed.
1366 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1367 pub timeout: Option<chrono::Duration>,
1368}
1369
1370impl common::Part for ReadinessCheck {}
1371
1372/// Request message for ‘Applications.RepairApplication’.
1373///
1374/// # Activities
1375///
1376/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1377/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1378///
1379/// * [repair apps](AppRepairCall) (request)
1380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1381#[serde_with::serde_as]
1382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1383pub struct RepairApplicationRequest {
1384 _never_set: Option<bool>,
1385}
1386
1387impl common::RequestValue for RepairApplicationRequest {}
1388
1389/// Target scaling by request utilization. Only applicable in the App Engine flexible environment.
1390///
1391/// This type is not used in any activity, and only used as *part* of another schema.
1392///
1393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1394#[serde_with::serde_as]
1395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1396pub struct RequestUtilization {
1397 /// Target number of concurrent requests.
1398 #[serde(rename = "targetConcurrentRequests")]
1399 pub target_concurrent_requests: Option<i32>,
1400 /// Target requests per second.
1401 #[serde(rename = "targetRequestCountPerSecond")]
1402 pub target_request_count_per_second: Option<i32>,
1403}
1404
1405impl common::Part for RequestUtilization {}
1406
1407/// A DNS resource record.
1408///
1409/// This type is not used in any activity, and only used as *part* of another schema.
1410///
1411#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1412#[serde_with::serde_as]
1413#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1414pub struct ResourceRecord {
1415 /// Relative name of the object affected by this record. Only applicable for CNAME records. Example: 'www'.
1416 pub name: Option<String>,
1417 /// Data for this record. Values vary by record type, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).
1418 pub rrdata: Option<String>,
1419 /// Resource record type. Example: AAAA.
1420 #[serde(rename = "type")]
1421 pub type_: Option<String>,
1422}
1423
1424impl common::Part for ResourceRecord {}
1425
1426/// Machine resources for a version.
1427///
1428/// This type is not used in any activity, and only used as *part* of another schema.
1429///
1430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1431#[serde_with::serde_as]
1432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1433pub struct Resources {
1434 /// Number of CPU cores needed.
1435 pub cpu: Option<f64>,
1436 /// Disk size (GB) needed.
1437 #[serde(rename = "diskGb")]
1438 pub disk_gb: Option<f64>,
1439 /// 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
1440 #[serde(rename = "kmsKeyReference")]
1441 pub kms_key_reference: Option<String>,
1442 /// Memory (GB) needed.
1443 #[serde(rename = "memoryGb")]
1444 pub memory_gb: Option<f64>,
1445 /// User specified volumes.
1446 pub volumes: Option<Vec<Volume>>,
1447}
1448
1449impl common::Part for Resources {}
1450
1451/// Runtime versions for App Engine.
1452///
1453/// This type is not used in any activity, and only used as *part* of another schema.
1454///
1455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1456#[serde_with::serde_as]
1457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1458pub struct Runtime {
1459 /// Date when Runtime is decommissioned.
1460 #[serde(rename = "decommissionedDate")]
1461 pub decommissioned_date: Option<Date>,
1462 /// Date when Runtime is deprecated.
1463 #[serde(rename = "deprecationDate")]
1464 pub deprecation_date: Option<Date>,
1465 /// User-friendly display name, e.g. 'Node.js 12', etc.
1466 #[serde(rename = "displayName")]
1467 pub display_name: Option<String>,
1468 /// Date when Runtime is end of support.
1469 #[serde(rename = "endOfSupportDate")]
1470 pub end_of_support_date: Option<Date>,
1471 /// The environment of the runtime.
1472 pub environment: Option<String>,
1473 /// The name of the runtime, e.g., 'go113', 'nodejs12', etc.
1474 pub name: Option<String>,
1475 /// The stage of life this runtime is in, e.g., BETA, GA, etc.
1476 pub stage: Option<String>,
1477 /// Supported operating systems for the runtime, e.g., 'ubuntu22', etc.
1478 #[serde(rename = "supportedOperatingSystems")]
1479 pub supported_operating_systems: Option<Vec<String>>,
1480 /// Warning messages, e.g., a deprecation warning.
1481 pub warnings: Option<Vec<String>>,
1482}
1483
1484impl common::Part for Runtime {}
1485
1486/// Executes a script to handle the request that matches the URL pattern.
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 ScriptHandler {
1494 /// Path to the script from the application root directory.
1495 #[serde(rename = "scriptPath")]
1496 pub script_path: Option<String>,
1497}
1498
1499impl common::Part for ScriptHandler {}
1500
1501/// 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.
1502///
1503/// # Activities
1504///
1505/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1506/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1507///
1508/// * [services get apps](AppServiceGetCall) (response)
1509/// * [services patch apps](AppServicePatchCall) (request)
1510#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1511#[serde_with::serde_as]
1512#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1513pub struct Service {
1514 /// Additional Google Generated Customer Metadata, this field won't be provided by default and can be requested by setting the IncludeExtraData field in GetServiceRequest
1515 #[serde(rename = "generatedCustomerMetadata")]
1516 pub generated_customer_metadata: Option<HashMap<String, serde_json::Value>>,
1517 /// Relative name of the service within the application. Example: default.@OutputOnly
1518 pub id: Option<String>,
1519 /// 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.
1520 pub labels: Option<HashMap<String, String>>,
1521 /// Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly
1522 pub name: Option<String>,
1523 /// Ingress settings for this service. Will apply to all versions.
1524 #[serde(rename = "networkSettings")]
1525 pub network_settings: Option<NetworkSettings>,
1526 /// Mapping that defines fractional HTTP traffic diversion to different versions within the service.
1527 pub split: Option<TrafficSplit>,
1528}
1529
1530impl common::RequestValue for Service {}
1531impl common::ResponseResult for Service {}
1532
1533/// SSL configuration for a DomainMapping resource.
1534///
1535/// This type is not used in any activity, and only used as *part* of another schema.
1536///
1537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1538#[serde_with::serde_as]
1539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1540pub struct SslSettings {
1541 /// 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.
1542 #[serde(rename = "certificateId")]
1543 pub certificate_id: Option<String>,
1544 /// 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
1545 #[serde(rename = "pendingManagedCertificateId")]
1546 pub pending_managed_certificate_id: Option<String>,
1547 /// 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.
1548 #[serde(rename = "sslManagementType")]
1549 pub ssl_management_type: Option<String>,
1550}
1551
1552impl common::Part for SslSettings {}
1553
1554/// Scheduler settings for standard environment.
1555///
1556/// This type is not used in any activity, and only used as *part* of another schema.
1557///
1558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1559#[serde_with::serde_as]
1560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1561pub struct StandardSchedulerSettings {
1562 /// Maximum number of instances to run for this version. Set to zero to disable max_instances configuration.
1563 #[serde(rename = "maxInstances")]
1564 pub max_instances: Option<i32>,
1565 /// Minimum number of instances to run for this version. Set to zero to disable min_instances configuration.
1566 #[serde(rename = "minInstances")]
1567 pub min_instances: Option<i32>,
1568 /// Target CPU utilization ratio to maintain when scaling.
1569 #[serde(rename = "targetCpuUtilization")]
1570 pub target_cpu_utilization: Option<f64>,
1571 /// Target throughput utilization ratio to maintain when scaling
1572 #[serde(rename = "targetThroughputUtilization")]
1573 pub target_throughput_utilization: Option<f64>,
1574}
1575
1576impl common::Part for StandardSchedulerSettings {}
1577
1578/// 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.
1579///
1580/// This type is not used in any activity, and only used as *part* of another schema.
1581///
1582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1583#[serde_with::serde_as]
1584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1585pub struct StaticFilesHandler {
1586 /// 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.
1587 #[serde(rename = "applicationReadable")]
1588 pub application_readable: Option<bool>,
1589 /// Time a static file served by this handler should be cached by web proxies and browsers.
1590 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1591 pub expiration: Option<chrono::Duration>,
1592 /// HTTP headers to use for all responses from these URLs.
1593 #[serde(rename = "httpHeaders")]
1594 pub http_headers: Option<HashMap<String, String>>,
1595 /// 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.
1596 #[serde(rename = "mimeType")]
1597 pub mime_type: Option<String>,
1598 /// 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.
1599 pub path: Option<String>,
1600 /// Whether this handler should match the request if the file referenced by the handler does not exist.
1601 #[serde(rename = "requireMatchingFile")]
1602 pub require_matching_file: Option<bool>,
1603 /// Regular expression that matches the file paths for all files that should be referenced by this handler.
1604 #[serde(rename = "uploadPathRegex")]
1605 pub upload_path_regex: Option<String>,
1606}
1607
1608impl common::Part for StaticFilesHandler {}
1609
1610/// 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).
1611///
1612/// This type is not used in any activity, and only used as *part* of another schema.
1613///
1614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1615#[serde_with::serde_as]
1616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1617pub struct Status {
1618 /// The status code, which should be an enum value of google.rpc.Code.
1619 pub code: Option<i32>,
1620 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1621 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1622 /// 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.
1623 pub message: Option<String>,
1624}
1625
1626impl common::Part for Status {}
1627
1628/// Traffic routing configuration for versions within a single service. Traffic splits define how traffic directed to the service is assigned to versions.
1629///
1630/// This type is not used in any activity, and only used as *part* of another schema.
1631///
1632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1633#[serde_with::serde_as]
1634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1635pub struct TrafficSplit {
1636 /// 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.
1637 pub allocations: Option<HashMap<String, f64>>,
1638 /// 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.
1639 #[serde(rename = "shardBy")]
1640 pub shard_by: Option<String>,
1641}
1642
1643impl common::Part for TrafficSplit {}
1644
1645/// Rules to match an HTTP request and dispatch that request to a service.
1646///
1647/// This type is not used in any activity, and only used as *part* of another schema.
1648///
1649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1650#[serde_with::serde_as]
1651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1652pub struct UrlDispatchRule {
1653 /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*".
1654 pub domain: Option<String>,
1655 /// 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.
1656 pub path: Option<String>,
1657 /// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default.
1658 pub service: Option<String>,
1659}
1660
1661impl common::Part for UrlDispatchRule {}
1662
1663/// 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.
1664///
1665/// This type is not used in any activity, and only used as *part* of another schema.
1666///
1667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1668#[serde_with::serde_as]
1669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1670pub struct UrlMap {
1671 /// Uses API Endpoints to handle requests.
1672 #[serde(rename = "apiEndpoint")]
1673 pub api_endpoint: Option<ApiEndpointHandler>,
1674 /// Action to take when users access resources that require authentication. Defaults to redirect.
1675 #[serde(rename = "authFailAction")]
1676 pub auth_fail_action: Option<String>,
1677 /// Level of login required to access this resource. Not supported for Node.js in the App Engine standard environment.
1678 pub login: Option<String>,
1679 /// 30x code to use when performing redirects for the secure field. Defaults to 302.
1680 #[serde(rename = "redirectHttpResponseCode")]
1681 pub redirect_http_response_code: Option<String>,
1682 /// 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".
1683 pub script: Option<ScriptHandler>,
1684 /// Security (HTTPS) enforcement for this URL.
1685 #[serde(rename = "securityLevel")]
1686 pub security_level: Option<String>,
1687 /// Returns the contents of a file, such as an image, as the response.
1688 #[serde(rename = "staticFiles")]
1689 pub static_files: Option<StaticFilesHandler>,
1690 /// 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.
1691 #[serde(rename = "urlRegex")]
1692 pub url_regex: Option<String>,
1693}
1694
1695impl common::Part for UrlMap {}
1696
1697/// A Version resource is a specific set of source code and configuration files that are deployed into a service.
1698///
1699/// # Activities
1700///
1701/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1702/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1703///
1704/// * [services versions create apps](AppServiceVersionCreateCall) (request)
1705/// * [services versions get apps](AppServiceVersionGetCall) (response)
1706/// * [services versions patch apps](AppServiceVersionPatchCall) (request)
1707#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1708#[serde_with::serde_as]
1709#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1710pub struct Version {
1711 /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/endpoints).Only returned in GET requests if view=FULL is set.
1712 #[serde(rename = "apiConfig")]
1713 pub api_config: Option<ApiConfigHandler>,
1714 /// Allows App Engine second generation runtimes to access the legacy bundled services.
1715 #[serde(rename = "appEngineApis")]
1716 pub app_engine_apis: Option<bool>,
1717 /// 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.
1718 #[serde(rename = "automaticScaling")]
1719 pub automatic_scaling: Option<AutomaticScaling>,
1720 /// 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.
1721 #[serde(rename = "basicScaling")]
1722 pub basic_scaling: Option<BasicScaling>,
1723 /// Metadata settings that are supplied to this version to enable beta runtime features.
1724 #[serde(rename = "betaSettings")]
1725 pub beta_settings: Option<HashMap<String, String>>,
1726 /// Environment variables available to the build environment.Only returned in GET requests if view=FULL is set.
1727 #[serde(rename = "buildEnvVariables")]
1728 pub build_env_variables: Option<HashMap<String, String>>,
1729 /// Time that this version was created.@OutputOnly
1730 #[serde(rename = "createTime")]
1731 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1732 /// Email address of the user who created this version.@OutputOnly
1733 #[serde(rename = "createdBy")]
1734 pub created_by: Option<String>,
1735 /// 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.
1736 #[serde(rename = "defaultExpiration")]
1737 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1738 pub default_expiration: Option<chrono::Duration>,
1739 /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set.
1740 pub deployment: Option<Deployment>,
1741 /// Total size in bytes of all the files that are included in this version and currently hosted on the App Engine disk.@OutputOnly
1742 #[serde(rename = "diskUsageBytes")]
1743 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1744 pub disk_usage_bytes: Option<i64>,
1745 /// 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.
1746 #[serde(rename = "endpointsApiService")]
1747 pub endpoints_api_service: Option<EndpointsApiService>,
1748 /// The entrypoint for the application.
1749 pub entrypoint: Option<Entrypoint>,
1750 /// App Engine execution environment for this version.Defaults to standard.
1751 pub env: Option<String>,
1752 /// Environment variables available to the application.Only returned in GET requests if view=FULL is set.
1753 #[serde(rename = "envVariables")]
1754 pub env_variables: Option<HashMap<String, String>>,
1755 /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set.
1756 #[serde(rename = "errorHandlers")]
1757 pub error_handlers: Option<Vec<ErrorHandler>>,
1758 /// Settings for App Engine flexible runtimes.
1759 #[serde(rename = "flexibleRuntimeSettings")]
1760 pub flexible_runtime_settings: Option<FlexibleRuntimeSettings>,
1761 /// Additional Google Generated Customer Metadata, this field won't be provided by default and can be requested by setting the IncludeExtraData field in GetVersionRequest
1762 #[serde(rename = "generatedCustomerMetadata")]
1763 pub generated_customer_metadata: Option<HashMap<String, serde_json::Value>>,
1764 /// 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.
1765 pub handlers: Option<Vec<UrlMap>>,
1766 /// Configures health checking for instances. Unhealthy instances are stopped and replaced with new instances. Only applicable in the App Engine flexible environment.
1767 #[serde(rename = "healthCheck")]
1768 pub health_check: Option<HealthCheck>,
1769 /// 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-".
1770 pub id: Option<String>,
1771 /// Before an application can receive email or XMPP messages, the application must be configured to enable the service.
1772 #[serde(rename = "inboundServices")]
1773 pub inbound_services: Option<Vec<String>>,
1774 /// 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.
1775 #[serde(rename = "instanceClass")]
1776 pub instance_class: Option<String>,
1777 /// Configuration for third-party Python runtime libraries that are required by the application.Only returned in GET requests if view=FULL is set.
1778 pub libraries: Option<Vec<Library>>,
1779 /// Configures liveness health checking for instances. Unhealthy instances are stopped and replaced with new instances
1780 #[serde(rename = "livenessCheck")]
1781 pub liveness_check: Option<LivenessCheck>,
1782 /// 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".
1783 #[serde(rename = "manualScaling")]
1784 pub manual_scaling: Option<ManualScaling>,
1785 /// Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly
1786 pub name: Option<String>,
1787 /// Extra network settings. Only applicable in the App Engine flexible environment.
1788 pub network: Option<Network>,
1789 /// 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.
1790 #[serde(rename = "nobuildFilesRegex")]
1791 pub nobuild_files_regex: Option<String>,
1792 /// Configures readiness health checking for instances. Unhealthy instances are not put into the backend traffic rotation.
1793 #[serde(rename = "readinessCheck")]
1794 pub readiness_check: Option<ReadinessCheck>,
1795 /// Machine resources for this version. Only applicable in the App Engine flexible environment.
1796 pub resources: Option<Resources>,
1797 /// Desired runtime. Example: python27.
1798 pub runtime: Option<String>,
1799 /// 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
1800 #[serde(rename = "runtimeApiVersion")]
1801 pub runtime_api_version: Option<String>,
1802 /// The channel of the runtime to use. Only available for some runtimes. Defaults to the default channel.
1803 #[serde(rename = "runtimeChannel")]
1804 pub runtime_channel: Option<String>,
1805 /// The path or name of the app's main executable.
1806 #[serde(rename = "runtimeMainExecutablePath")]
1807 pub runtime_main_executable_path: Option<String>,
1808 /// 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.
1809 #[serde(rename = "serviceAccount")]
1810 pub service_account: Option<String>,
1811 /// 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.
1812 #[serde(rename = "servingStatus")]
1813 pub serving_status: Option<String>,
1814 /// Whether multiple requests can be dispatched to this version at once.
1815 pub threadsafe: Option<bool>,
1816 /// Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com"@OutputOnly
1817 #[serde(rename = "versionUrl")]
1818 pub version_url: Option<String>,
1819 /// Whether to deploy this version in a container on a virtual machine.
1820 pub vm: Option<bool>,
1821 /// Enables VPC connectivity for standard apps.
1822 #[serde(rename = "vpcAccessConnector")]
1823 pub vpc_access_connector: Option<VpcAccessConnector>,
1824 /// The Google Compute Engine zones that are supported by this version in the App Engine flexible environment. Deprecated.
1825 pub zones: Option<Vec<String>>,
1826}
1827
1828impl common::RequestValue for Version {}
1829impl common::ResponseResult for Version {}
1830
1831/// Volumes mounted within the app container. Only applicable in the App Engine flexible environment.
1832///
1833/// This type is not used in any activity, and only used as *part* of another schema.
1834///
1835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1836#[serde_with::serde_as]
1837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1838pub struct Volume {
1839 /// Unique name for the volume.
1840 pub name: Option<String>,
1841 /// Volume size in gigabytes.
1842 #[serde(rename = "sizeGb")]
1843 pub size_gb: Option<f64>,
1844 /// Underlying volume type, e.g. 'tmpfs'.
1845 #[serde(rename = "volumeType")]
1846 pub volume_type: Option<String>,
1847}
1848
1849impl common::Part for Volume {}
1850
1851/// VPC access connector specification.
1852///
1853/// This type is not used in any activity, and only used as *part* of another schema.
1854///
1855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1856#[serde_with::serde_as]
1857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1858pub struct VpcAccessConnector {
1859 /// The egress setting for the connector, controlling what traffic is diverted through it.
1860 #[serde(rename = "egressSetting")]
1861 pub egress_setting: Option<String>,
1862 /// Full Serverless VPC Access Connector name e.g. projects/my-project/locations/us-central1/connectors/c1.
1863 pub name: Option<String>,
1864}
1865
1866impl common::Part for VpcAccessConnector {}
1867
1868/// The zip file information for a zip deployment.
1869///
1870/// This type is not used in any activity, and only used as *part* of another schema.
1871///
1872#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1873#[serde_with::serde_as]
1874#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1875pub struct ZipInfo {
1876 /// 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.
1877 #[serde(rename = "filesCount")]
1878 pub files_count: Option<i32>,
1879 /// 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//'.
1880 #[serde(rename = "sourceUrl")]
1881 pub source_url: Option<String>,
1882}
1883
1884impl common::Part for ZipInfo {}
1885
1886// ###################
1887// MethodBuilders ###
1888// #################
1889
1890/// A builder providing access to all methods supported on *app* resources.
1891/// It is not used directly, but through the [`Appengine`] hub.
1892///
1893/// # Example
1894///
1895/// Instantiate a resource builder
1896///
1897/// ```test_harness,no_run
1898/// extern crate hyper;
1899/// extern crate hyper_rustls;
1900/// extern crate google_appengine1 as appengine1;
1901///
1902/// # async fn dox() {
1903/// use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1904///
1905/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1906/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1907/// secret,
1908/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1909/// ).build().await.unwrap();
1910///
1911/// let client = hyper_util::client::legacy::Client::builder(
1912/// hyper_util::rt::TokioExecutor::new()
1913/// )
1914/// .build(
1915/// hyper_rustls::HttpsConnectorBuilder::new()
1916/// .with_native_roots()
1917/// .unwrap()
1918/// .https_or_http()
1919/// .enable_http1()
1920/// .build()
1921/// );
1922/// let mut hub = Appengine::new(client, auth);
1923/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1924/// // 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_get(...)`, `services_versions_instances_debug(...)`, `services_versions_instances_delete(...)`, `services_versions_instances_get(...)`, `services_versions_instances_list(...)`, `services_versions_list(...)` and `services_versions_patch(...)`
1925/// // to build up your call.
1926/// let rb = hub.apps();
1927/// # }
1928/// ```
1929pub struct AppMethods<'a, C>
1930where
1931 C: 'a,
1932{
1933 hub: &'a Appengine<C>,
1934}
1935
1936impl<'a, C> common::MethodsBuilder for AppMethods<'a, C> {}
1937
1938impl<'a, C> AppMethods<'a, C> {
1939 /// Create a builder to help you perform the following task:
1940 ///
1941 /// Uploads the specified SSL certificate.
1942 ///
1943 /// # Arguments
1944 ///
1945 /// * `request` - No description provided.
1946 /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
1947 pub fn authorized_certificates_create(
1948 &self,
1949 request: AuthorizedCertificate,
1950 apps_id: &str,
1951 ) -> AppAuthorizedCertificateCreateCall<'a, C> {
1952 AppAuthorizedCertificateCreateCall {
1953 hub: self.hub,
1954 _request: request,
1955 _apps_id: apps_id.to_string(),
1956 _delegate: Default::default(),
1957 _additional_params: Default::default(),
1958 _scopes: Default::default(),
1959 }
1960 }
1961
1962 /// Create a builder to help you perform the following task:
1963 ///
1964 /// Deletes the specified SSL certificate.
1965 ///
1966 /// # Arguments
1967 ///
1968 /// * `appsId` - Part of `name`. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345.
1969 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`.
1970 pub fn authorized_certificates_delete(
1971 &self,
1972 apps_id: &str,
1973 authorized_certificates_id: &str,
1974 ) -> AppAuthorizedCertificateDeleteCall<'a, C> {
1975 AppAuthorizedCertificateDeleteCall {
1976 hub: self.hub,
1977 _apps_id: apps_id.to_string(),
1978 _authorized_certificates_id: authorized_certificates_id.to_string(),
1979 _delegate: Default::default(),
1980 _additional_params: Default::default(),
1981 _scopes: Default::default(),
1982 }
1983 }
1984
1985 /// Create a builder to help you perform the following task:
1986 ///
1987 /// Gets the specified SSL certificate.
1988 ///
1989 /// # Arguments
1990 ///
1991 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345.
1992 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`.
1993 pub fn authorized_certificates_get(
1994 &self,
1995 apps_id: &str,
1996 authorized_certificates_id: &str,
1997 ) -> AppAuthorizedCertificateGetCall<'a, C> {
1998 AppAuthorizedCertificateGetCall {
1999 hub: self.hub,
2000 _apps_id: apps_id.to_string(),
2001 _authorized_certificates_id: authorized_certificates_id.to_string(),
2002 _view: Default::default(),
2003 _delegate: Default::default(),
2004 _additional_params: Default::default(),
2005 _scopes: Default::default(),
2006 }
2007 }
2008
2009 /// Create a builder to help you perform the following task:
2010 ///
2011 /// Lists all SSL certificates the user is authorized to administer.
2012 ///
2013 /// # Arguments
2014 ///
2015 /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
2016 pub fn authorized_certificates_list(
2017 &self,
2018 apps_id: &str,
2019 ) -> AppAuthorizedCertificateListCall<'a, C> {
2020 AppAuthorizedCertificateListCall {
2021 hub: self.hub,
2022 _apps_id: apps_id.to_string(),
2023 _view: Default::default(),
2024 _page_token: Default::default(),
2025 _page_size: Default::default(),
2026 _delegate: Default::default(),
2027 _additional_params: Default::default(),
2028 _scopes: Default::default(),
2029 }
2030 }
2031
2032 /// Create a builder to help you perform the following task:
2033 ///
2034 /// 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.
2035 ///
2036 /// # Arguments
2037 ///
2038 /// * `request` - No description provided.
2039 /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345.
2040 /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`.
2041 pub fn authorized_certificates_patch(
2042 &self,
2043 request: AuthorizedCertificate,
2044 apps_id: &str,
2045 authorized_certificates_id: &str,
2046 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
2047 AppAuthorizedCertificatePatchCall {
2048 hub: self.hub,
2049 _request: request,
2050 _apps_id: apps_id.to_string(),
2051 _authorized_certificates_id: authorized_certificates_id.to_string(),
2052 _update_mask: Default::default(),
2053 _delegate: Default::default(),
2054 _additional_params: Default::default(),
2055 _scopes: Default::default(),
2056 }
2057 }
2058
2059 /// Create a builder to help you perform the following task:
2060 ///
2061 /// Lists all domains the user is authorized to administer.
2062 ///
2063 /// # Arguments
2064 ///
2065 /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
2066 pub fn authorized_domains_list(&self, apps_id: &str) -> AppAuthorizedDomainListCall<'a, C> {
2067 AppAuthorizedDomainListCall {
2068 hub: self.hub,
2069 _apps_id: apps_id.to_string(),
2070 _page_token: Default::default(),
2071 _page_size: Default::default(),
2072 _delegate: Default::default(),
2073 _additional_params: Default::default(),
2074 _scopes: Default::default(),
2075 }
2076 }
2077
2078 /// Create a builder to help you perform the following task:
2079 ///
2080 /// 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.
2081 ///
2082 /// # Arguments
2083 ///
2084 /// * `request` - No description provided.
2085 /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
2086 pub fn domain_mappings_create(
2087 &self,
2088 request: DomainMapping,
2089 apps_id: &str,
2090 ) -> AppDomainMappingCreateCall<'a, C> {
2091 AppDomainMappingCreateCall {
2092 hub: self.hub,
2093 _request: request,
2094 _apps_id: apps_id.to_string(),
2095 _override_strategy: Default::default(),
2096 _delegate: Default::default(),
2097 _additional_params: Default::default(),
2098 _scopes: Default::default(),
2099 }
2100 }
2101
2102 /// Create a builder to help you perform the following task:
2103 ///
2104 /// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource.
2105 ///
2106 /// # Arguments
2107 ///
2108 /// * `appsId` - Part of `name`. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com.
2109 /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`.
2110 pub fn domain_mappings_delete(
2111 &self,
2112 apps_id: &str,
2113 domain_mappings_id: &str,
2114 ) -> AppDomainMappingDeleteCall<'a, C> {
2115 AppDomainMappingDeleteCall {
2116 hub: self.hub,
2117 _apps_id: apps_id.to_string(),
2118 _domain_mappings_id: domain_mappings_id.to_string(),
2119 _delegate: Default::default(),
2120 _additional_params: Default::default(),
2121 _scopes: Default::default(),
2122 }
2123 }
2124
2125 /// Create a builder to help you perform the following task:
2126 ///
2127 /// Gets the specified domain mapping.
2128 ///
2129 /// # Arguments
2130 ///
2131 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/domainMappings/example.com.
2132 /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`.
2133 pub fn domain_mappings_get(
2134 &self,
2135 apps_id: &str,
2136 domain_mappings_id: &str,
2137 ) -> AppDomainMappingGetCall<'a, C> {
2138 AppDomainMappingGetCall {
2139 hub: self.hub,
2140 _apps_id: apps_id.to_string(),
2141 _domain_mappings_id: domain_mappings_id.to_string(),
2142 _delegate: Default::default(),
2143 _additional_params: Default::default(),
2144 _scopes: Default::default(),
2145 }
2146 }
2147
2148 /// Create a builder to help you perform the following task:
2149 ///
2150 /// Lists the domain mappings on an application.
2151 ///
2152 /// # Arguments
2153 ///
2154 /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
2155 pub fn domain_mappings_list(&self, apps_id: &str) -> AppDomainMappingListCall<'a, C> {
2156 AppDomainMappingListCall {
2157 hub: self.hub,
2158 _apps_id: apps_id.to_string(),
2159 _page_token: Default::default(),
2160 _page_size: Default::default(),
2161 _delegate: Default::default(),
2162 _additional_params: Default::default(),
2163 _scopes: Default::default(),
2164 }
2165 }
2166
2167 /// Create a builder to help you perform the following task:
2168 ///
2169 /// 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.
2170 ///
2171 /// # Arguments
2172 ///
2173 /// * `request` - No description provided.
2174 /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/domainMappings/example.com.
2175 /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`.
2176 pub fn domain_mappings_patch(
2177 &self,
2178 request: DomainMapping,
2179 apps_id: &str,
2180 domain_mappings_id: &str,
2181 ) -> AppDomainMappingPatchCall<'a, C> {
2182 AppDomainMappingPatchCall {
2183 hub: self.hub,
2184 _request: request,
2185 _apps_id: apps_id.to_string(),
2186 _domain_mappings_id: domain_mappings_id.to_string(),
2187 _update_mask: Default::default(),
2188 _delegate: Default::default(),
2189 _additional_params: Default::default(),
2190 _scopes: Default::default(),
2191 }
2192 }
2193
2194 /// Create a builder to help you perform the following task:
2195 ///
2196 /// 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.
2197 ///
2198 /// # Arguments
2199 ///
2200 /// * `request` - No description provided.
2201 /// * `appsId` - Part of `name`. Name of the Firewall collection to set. Example: apps/myapp/firewall/ingressRules.
2202 pub fn firewall_ingress_rules_batch_update(
2203 &self,
2204 request: BatchUpdateIngressRulesRequest,
2205 apps_id: &str,
2206 ) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
2207 AppFirewallIngressRuleBatchUpdateCall {
2208 hub: self.hub,
2209 _request: request,
2210 _apps_id: apps_id.to_string(),
2211 _delegate: Default::default(),
2212 _additional_params: Default::default(),
2213 _scopes: Default::default(),
2214 }
2215 }
2216
2217 /// Create a builder to help you perform the following task:
2218 ///
2219 /// Creates a firewall rule for the application.
2220 ///
2221 /// # Arguments
2222 ///
2223 /// * `request` - No description provided.
2224 /// * `appsId` - Part of `parent`. Name of the parent Firewall collection in which to create a new rule. Example: apps/myapp/firewall/ingressRules.
2225 pub fn firewall_ingress_rules_create(
2226 &self,
2227 request: FirewallRule,
2228 apps_id: &str,
2229 ) -> AppFirewallIngressRuleCreateCall<'a, C> {
2230 AppFirewallIngressRuleCreateCall {
2231 hub: self.hub,
2232 _request: request,
2233 _apps_id: apps_id.to_string(),
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 /// Deletes the specified firewall rule.
2243 ///
2244 /// # Arguments
2245 ///
2246 /// * `appsId` - Part of `name`. Name of the Firewall resource to delete. Example: apps/myapp/firewall/ingressRules/100.
2247 /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`.
2248 pub fn firewall_ingress_rules_delete(
2249 &self,
2250 apps_id: &str,
2251 ingress_rules_id: &str,
2252 ) -> AppFirewallIngressRuleDeleteCall<'a, C> {
2253 AppFirewallIngressRuleDeleteCall {
2254 hub: self.hub,
2255 _apps_id: apps_id.to_string(),
2256 _ingress_rules_id: ingress_rules_id.to_string(),
2257 _delegate: Default::default(),
2258 _additional_params: Default::default(),
2259 _scopes: Default::default(),
2260 }
2261 }
2262
2263 /// Create a builder to help you perform the following task:
2264 ///
2265 /// Gets the specified firewall rule.
2266 ///
2267 /// # Arguments
2268 ///
2269 /// * `appsId` - Part of `name`. Name of the Firewall resource to retrieve. Example: apps/myapp/firewall/ingressRules/100.
2270 /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`.
2271 pub fn firewall_ingress_rules_get(
2272 &self,
2273 apps_id: &str,
2274 ingress_rules_id: &str,
2275 ) -> AppFirewallIngressRuleGetCall<'a, C> {
2276 AppFirewallIngressRuleGetCall {
2277 hub: self.hub,
2278 _apps_id: apps_id.to_string(),
2279 _ingress_rules_id: ingress_rules_id.to_string(),
2280 _delegate: Default::default(),
2281 _additional_params: Default::default(),
2282 _scopes: Default::default(),
2283 }
2284 }
2285
2286 /// Create a builder to help you perform the following task:
2287 ///
2288 /// Lists the firewall rules of an application.
2289 ///
2290 /// # Arguments
2291 ///
2292 /// * `appsId` - Part of `parent`. Name of the Firewall collection to retrieve. Example: apps/myapp/firewall/ingressRules.
2293 pub fn firewall_ingress_rules_list(
2294 &self,
2295 apps_id: &str,
2296 ) -> AppFirewallIngressRuleListCall<'a, C> {
2297 AppFirewallIngressRuleListCall {
2298 hub: self.hub,
2299 _apps_id: apps_id.to_string(),
2300 _page_token: Default::default(),
2301 _page_size: Default::default(),
2302 _matching_address: Default::default(),
2303 _delegate: Default::default(),
2304 _additional_params: Default::default(),
2305 _scopes: Default::default(),
2306 }
2307 }
2308
2309 /// Create a builder to help you perform the following task:
2310 ///
2311 /// Updates the specified firewall rule.
2312 ///
2313 /// # Arguments
2314 ///
2315 /// * `request` - No description provided.
2316 /// * `appsId` - Part of `name`. Name of the Firewall resource to update. Example: apps/myapp/firewall/ingressRules/100.
2317 /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`.
2318 pub fn firewall_ingress_rules_patch(
2319 &self,
2320 request: FirewallRule,
2321 apps_id: &str,
2322 ingress_rules_id: &str,
2323 ) -> AppFirewallIngressRulePatchCall<'a, C> {
2324 AppFirewallIngressRulePatchCall {
2325 hub: self.hub,
2326 _request: request,
2327 _apps_id: apps_id.to_string(),
2328 _ingress_rules_id: ingress_rules_id.to_string(),
2329 _update_mask: Default::default(),
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 information about a location.
2339 ///
2340 /// # Arguments
2341 ///
2342 /// * `appsId` - Part of `name`. Resource name for the location.
2343 /// * `locationsId` - Part of `name`. See documentation of `appsId`.
2344 pub fn locations_get(&self, apps_id: &str, locations_id: &str) -> AppLocationGetCall<'a, C> {
2345 AppLocationGetCall {
2346 hub: self.hub,
2347 _apps_id: apps_id.to_string(),
2348 _locations_id: locations_id.to_string(),
2349 _delegate: Default::default(),
2350 _additional_params: Default::default(),
2351 _scopes: Default::default(),
2352 }
2353 }
2354
2355 /// Create a builder to help you perform the following task:
2356 ///
2357 /// Lists information about the supported locations for this service.
2358 ///
2359 /// # Arguments
2360 ///
2361 /// * `appsId` - Part of `name`. The resource that owns the locations collection, if applicable.
2362 pub fn locations_list(&self, apps_id: &str) -> AppLocationListCall<'a, C> {
2363 AppLocationListCall {
2364 hub: self.hub,
2365 _apps_id: apps_id.to_string(),
2366 _page_token: Default::default(),
2367 _page_size: Default::default(),
2368 _filter: Default::default(),
2369 _delegate: Default::default(),
2370 _additional_params: Default::default(),
2371 _scopes: Default::default(),
2372 }
2373 }
2374
2375 /// Create a builder to help you perform the following task:
2376 ///
2377 /// 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.
2378 ///
2379 /// # Arguments
2380 ///
2381 /// * `appsId` - Part of `name`. The name of the operation resource.
2382 /// * `operationsId` - Part of `name`. See documentation of `appsId`.
2383 pub fn operations_get(&self, apps_id: &str, operations_id: &str) -> AppOperationGetCall<'a, C> {
2384 AppOperationGetCall {
2385 hub: self.hub,
2386 _apps_id: apps_id.to_string(),
2387 _operations_id: operations_id.to_string(),
2388 _delegate: Default::default(),
2389 _additional_params: Default::default(),
2390 _scopes: Default::default(),
2391 }
2392 }
2393
2394 /// Create a builder to help you perform the following task:
2395 ///
2396 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
2397 ///
2398 /// # Arguments
2399 ///
2400 /// * `appsId` - Part of `name`. The name of the operation's parent resource.
2401 pub fn operations_list(&self, apps_id: &str) -> AppOperationListCall<'a, C> {
2402 AppOperationListCall {
2403 hub: self.hub,
2404 _apps_id: apps_id.to_string(),
2405 _page_token: Default::default(),
2406 _page_size: Default::default(),
2407 _filter: Default::default(),
2408 _delegate: Default::default(),
2409 _additional_params: Default::default(),
2410 _scopes: Default::default(),
2411 }
2412 }
2413
2414 /// Create a builder to help you perform the following task:
2415 ///
2416 /// 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.
2417 ///
2418 /// # Arguments
2419 ///
2420 /// * `request` - No description provided.
2421 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
2422 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2423 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2424 /// * `instancesId` - Part of `name`. See documentation of `appsId`.
2425 pub fn services_versions_instances_debug(
2426 &self,
2427 request: DebugInstanceRequest,
2428 apps_id: &str,
2429 services_id: &str,
2430 versions_id: &str,
2431 instances_id: &str,
2432 ) -> AppServiceVersionInstanceDebugCall<'a, C> {
2433 AppServiceVersionInstanceDebugCall {
2434 hub: self.hub,
2435 _request: request,
2436 _apps_id: apps_id.to_string(),
2437 _services_id: services_id.to_string(),
2438 _versions_id: versions_id.to_string(),
2439 _instances_id: instances_id.to_string(),
2440 _delegate: Default::default(),
2441 _additional_params: Default::default(),
2442 _scopes: Default::default(),
2443 }
2444 }
2445
2446 /// Create a builder to help you perform the following task:
2447 ///
2448 /// 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.
2449 ///
2450 /// # Arguments
2451 ///
2452 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
2453 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2454 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2455 /// * `instancesId` - Part of `name`. See documentation of `appsId`.
2456 pub fn services_versions_instances_delete(
2457 &self,
2458 apps_id: &str,
2459 services_id: &str,
2460 versions_id: &str,
2461 instances_id: &str,
2462 ) -> AppServiceVersionInstanceDeleteCall<'a, C> {
2463 AppServiceVersionInstanceDeleteCall {
2464 hub: self.hub,
2465 _apps_id: apps_id.to_string(),
2466 _services_id: services_id.to_string(),
2467 _versions_id: versions_id.to_string(),
2468 _instances_id: instances_id.to_string(),
2469 _delegate: Default::default(),
2470 _additional_params: Default::default(),
2471 _scopes: Default::default(),
2472 }
2473 }
2474
2475 /// Create a builder to help you perform the following task:
2476 ///
2477 /// Gets instance information.
2478 ///
2479 /// # Arguments
2480 ///
2481 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
2482 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2483 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2484 /// * `instancesId` - Part of `name`. See documentation of `appsId`.
2485 pub fn services_versions_instances_get(
2486 &self,
2487 apps_id: &str,
2488 services_id: &str,
2489 versions_id: &str,
2490 instances_id: &str,
2491 ) -> AppServiceVersionInstanceGetCall<'a, C> {
2492 AppServiceVersionInstanceGetCall {
2493 hub: self.hub,
2494 _apps_id: apps_id.to_string(),
2495 _services_id: services_id.to_string(),
2496 _versions_id: versions_id.to_string(),
2497 _instances_id: instances_id.to_string(),
2498 _delegate: Default::default(),
2499 _additional_params: Default::default(),
2500 _scopes: Default::default(),
2501 }
2502 }
2503
2504 /// Create a builder to help you perform the following task:
2505 ///
2506 /// 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).
2507 ///
2508 /// # Arguments
2509 ///
2510 /// * `appsId` - Part of `parent`. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1.
2511 /// * `servicesId` - Part of `parent`. See documentation of `appsId`.
2512 /// * `versionsId` - Part of `parent`. See documentation of `appsId`.
2513 pub fn services_versions_instances_list(
2514 &self,
2515 apps_id: &str,
2516 services_id: &str,
2517 versions_id: &str,
2518 ) -> AppServiceVersionInstanceListCall<'a, C> {
2519 AppServiceVersionInstanceListCall {
2520 hub: self.hub,
2521 _apps_id: apps_id.to_string(),
2522 _services_id: services_id.to_string(),
2523 _versions_id: versions_id.to_string(),
2524 _page_token: Default::default(),
2525 _page_size: Default::default(),
2526 _delegate: Default::default(),
2527 _additional_params: Default::default(),
2528 _scopes: Default::default(),
2529 }
2530 }
2531
2532 /// Create a builder to help you perform the following task:
2533 ///
2534 /// Deploys code and resource files to a new version.
2535 ///
2536 /// # Arguments
2537 ///
2538 /// * `request` - No description provided.
2539 /// * `appsId` - Part of `parent`. Name of the parent resource to create this version under. Example: apps/myapp/services/default.
2540 /// * `servicesId` - Part of `parent`. See documentation of `appsId`.
2541 pub fn services_versions_create(
2542 &self,
2543 request: Version,
2544 apps_id: &str,
2545 services_id: &str,
2546 ) -> AppServiceVersionCreateCall<'a, C> {
2547 AppServiceVersionCreateCall {
2548 hub: self.hub,
2549 _request: request,
2550 _apps_id: apps_id.to_string(),
2551 _services_id: services_id.to_string(),
2552 _delegate: Default::default(),
2553 _additional_params: Default::default(),
2554 _scopes: Default::default(),
2555 }
2556 }
2557
2558 /// Create a builder to help you perform the following task:
2559 ///
2560 /// Deletes an existing Version resource.
2561 ///
2562 /// # Arguments
2563 ///
2564 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
2565 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2566 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2567 pub fn services_versions_delete(
2568 &self,
2569 apps_id: &str,
2570 services_id: &str,
2571 versions_id: &str,
2572 ) -> AppServiceVersionDeleteCall<'a, C> {
2573 AppServiceVersionDeleteCall {
2574 hub: self.hub,
2575 _apps_id: apps_id.to_string(),
2576 _services_id: services_id.to_string(),
2577 _versions_id: versions_id.to_string(),
2578 _delegate: Default::default(),
2579 _additional_params: Default::default(),
2580 _scopes: Default::default(),
2581 }
2582 }
2583
2584 /// Create a builder to help you perform the following task:
2585 ///
2586 /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.
2587 ///
2588 /// # Arguments
2589 ///
2590 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
2591 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2592 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2593 pub fn services_versions_get(
2594 &self,
2595 apps_id: &str,
2596 services_id: &str,
2597 versions_id: &str,
2598 ) -> AppServiceVersionGetCall<'a, C> {
2599 AppServiceVersionGetCall {
2600 hub: self.hub,
2601 _apps_id: apps_id.to_string(),
2602 _services_id: services_id.to_string(),
2603 _versions_id: versions_id.to_string(),
2604 _view: Default::default(),
2605 _delegate: Default::default(),
2606 _additional_params: Default::default(),
2607 _scopes: Default::default(),
2608 }
2609 }
2610
2611 /// Create a builder to help you perform the following task:
2612 ///
2613 /// Lists the versions of a service.
2614 ///
2615 /// # Arguments
2616 ///
2617 /// * `appsId` - Part of `parent`. Name of the parent Service resource. Example: apps/myapp/services/default.
2618 /// * `servicesId` - Part of `parent`. See documentation of `appsId`.
2619 pub fn services_versions_list(
2620 &self,
2621 apps_id: &str,
2622 services_id: &str,
2623 ) -> AppServiceVersionListCall<'a, C> {
2624 AppServiceVersionListCall {
2625 hub: self.hub,
2626 _apps_id: apps_id.to_string(),
2627 _services_id: services_id.to_string(),
2628 _view: Default::default(),
2629 _page_token: Default::default(),
2630 _page_size: Default::default(),
2631 _delegate: Default::default(),
2632 _additional_params: Default::default(),
2633 _scopes: Default::default(),
2634 }
2635 }
2636
2637 /// Create a builder to help you perform the following task:
2638 ///
2639 /// 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)
2640 ///
2641 /// # Arguments
2642 ///
2643 /// * `request` - No description provided.
2644 /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1.
2645 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2646 /// * `versionsId` - Part of `name`. See documentation of `appsId`.
2647 pub fn services_versions_patch(
2648 &self,
2649 request: Version,
2650 apps_id: &str,
2651 services_id: &str,
2652 versions_id: &str,
2653 ) -> AppServiceVersionPatchCall<'a, C> {
2654 AppServiceVersionPatchCall {
2655 hub: self.hub,
2656 _request: request,
2657 _apps_id: apps_id.to_string(),
2658 _services_id: services_id.to_string(),
2659 _versions_id: versions_id.to_string(),
2660 _update_mask: Default::default(),
2661 _delegate: Default::default(),
2662 _additional_params: Default::default(),
2663 _scopes: Default::default(),
2664 }
2665 }
2666
2667 /// Create a builder to help you perform the following task:
2668 ///
2669 /// Deletes the specified service and all enclosed versions.
2670 ///
2671 /// # Arguments
2672 ///
2673 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.
2674 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2675 pub fn services_delete(&self, apps_id: &str, services_id: &str) -> AppServiceDeleteCall<'a, C> {
2676 AppServiceDeleteCall {
2677 hub: self.hub,
2678 _apps_id: apps_id.to_string(),
2679 _services_id: services_id.to_string(),
2680 _delegate: Default::default(),
2681 _additional_params: Default::default(),
2682 _scopes: Default::default(),
2683 }
2684 }
2685
2686 /// Create a builder to help you perform the following task:
2687 ///
2688 /// Gets the current configuration of the specified service.
2689 ///
2690 /// # Arguments
2691 ///
2692 /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.
2693 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2694 pub fn services_get(&self, apps_id: &str, services_id: &str) -> AppServiceGetCall<'a, C> {
2695 AppServiceGetCall {
2696 hub: self.hub,
2697 _apps_id: apps_id.to_string(),
2698 _services_id: services_id.to_string(),
2699 _delegate: Default::default(),
2700 _additional_params: Default::default(),
2701 _scopes: Default::default(),
2702 }
2703 }
2704
2705 /// Create a builder to help you perform the following task:
2706 ///
2707 /// Lists all the services in the application.
2708 ///
2709 /// # Arguments
2710 ///
2711 /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
2712 pub fn services_list(&self, apps_id: &str) -> AppServiceListCall<'a, C> {
2713 AppServiceListCall {
2714 hub: self.hub,
2715 _apps_id: apps_id.to_string(),
2716 _page_token: Default::default(),
2717 _page_size: Default::default(),
2718 _delegate: Default::default(),
2719 _additional_params: Default::default(),
2720 _scopes: Default::default(),
2721 }
2722 }
2723
2724 /// Create a builder to help you perform the following task:
2725 ///
2726 /// Updates the configuration of the specified service.
2727 ///
2728 /// # Arguments
2729 ///
2730 /// * `request` - No description provided.
2731 /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default.
2732 /// * `servicesId` - Part of `name`. See documentation of `appsId`.
2733 pub fn services_patch(
2734 &self,
2735 request: Service,
2736 apps_id: &str,
2737 services_id: &str,
2738 ) -> AppServicePatchCall<'a, C> {
2739 AppServicePatchCall {
2740 hub: self.hub,
2741 _request: request,
2742 _apps_id: apps_id.to_string(),
2743 _services_id: services_id.to_string(),
2744 _update_mask: Default::default(),
2745 _migrate_traffic: Default::default(),
2746 _delegate: Default::default(),
2747 _additional_params: Default::default(),
2748 _scopes: Default::default(),
2749 }
2750 }
2751
2752 /// Create a builder to help you perform the following task:
2753 ///
2754 /// 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/).
2755 ///
2756 /// # Arguments
2757 ///
2758 /// * `request` - No description provided.
2759 pub fn create(&self, request: Application) -> AppCreateCall<'a, C> {
2760 AppCreateCall {
2761 hub: self.hub,
2762 _request: request,
2763 _delegate: Default::default(),
2764 _additional_params: Default::default(),
2765 _scopes: Default::default(),
2766 }
2767 }
2768
2769 /// Create a builder to help you perform the following task:
2770 ///
2771 /// Gets information about an application.
2772 ///
2773 /// # Arguments
2774 ///
2775 /// * `appsId` - Part of `name`. Name of the Application resource to get. Example: apps/myapp.
2776 pub fn get(&self, apps_id: &str) -> AppGetCall<'a, C> {
2777 AppGetCall {
2778 hub: self.hub,
2779 _apps_id: apps_id.to_string(),
2780 _include_extra_data: Default::default(),
2781 _delegate: Default::default(),
2782 _additional_params: Default::default(),
2783 _scopes: Default::default(),
2784 }
2785 }
2786
2787 /// Create a builder to help you perform the following task:
2788 ///
2789 /// Lists all the available runtimes for the application.
2790 ///
2791 /// # Arguments
2792 ///
2793 /// * `appsId` - Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
2794 pub fn list_runtimes(&self, apps_id: &str) -> AppListRuntimeCall<'a, C> {
2795 AppListRuntimeCall {
2796 hub: self.hub,
2797 _apps_id: apps_id.to_string(),
2798 _environment: Default::default(),
2799 _delegate: Default::default(),
2800 _additional_params: Default::default(),
2801 _scopes: Default::default(),
2802 }
2803 }
2804
2805 /// Create a builder to help you perform the following task:
2806 ///
2807 /// 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.
2808 ///
2809 /// # Arguments
2810 ///
2811 /// * `request` - No description provided.
2812 /// * `appsId` - Part of `name`. Name of the Application resource to update. Example: apps/myapp.
2813 pub fn patch(&self, request: Application, apps_id: &str) -> AppPatchCall<'a, C> {
2814 AppPatchCall {
2815 hub: self.hub,
2816 _request: request,
2817 _apps_id: apps_id.to_string(),
2818 _update_mask: Default::default(),
2819 _delegate: Default::default(),
2820 _additional_params: Default::default(),
2821 _scopes: Default::default(),
2822 }
2823 }
2824
2825 /// Create a builder to help you perform the following task:
2826 ///
2827 /// 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.
2828 ///
2829 /// # Arguments
2830 ///
2831 /// * `request` - No description provided.
2832 /// * `appsId` - Part of `name`. Name of the application to repair. Example: apps/myapp
2833 pub fn repair(&self, request: RepairApplicationRequest, apps_id: &str) -> AppRepairCall<'a, C> {
2834 AppRepairCall {
2835 hub: self.hub,
2836 _request: request,
2837 _apps_id: apps_id.to_string(),
2838 _delegate: Default::default(),
2839 _additional_params: Default::default(),
2840 _scopes: Default::default(),
2841 }
2842 }
2843}
2844
2845/// A builder providing access to all methods supported on *project* resources.
2846/// It is not used directly, but through the [`Appengine`] hub.
2847///
2848/// # Example
2849///
2850/// Instantiate a resource builder
2851///
2852/// ```test_harness,no_run
2853/// extern crate hyper;
2854/// extern crate hyper_rustls;
2855/// extern crate google_appengine1 as appengine1;
2856///
2857/// # async fn dox() {
2858/// use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2859///
2860/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2861/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2862/// secret,
2863/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2864/// ).build().await.unwrap();
2865///
2866/// let client = hyper_util::client::legacy::Client::builder(
2867/// hyper_util::rt::TokioExecutor::new()
2868/// )
2869/// .build(
2870/// hyper_rustls::HttpsConnectorBuilder::new()
2871/// .with_native_roots()
2872/// .unwrap()
2873/// .https_or_http()
2874/// .enable_http1()
2875/// .build()
2876/// );
2877/// let mut hub = Appengine::new(client, auth);
2878/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2879/// // like `locations_applications_authorized_domains_list(...)`
2880/// // to build up your call.
2881/// let rb = hub.projects();
2882/// # }
2883/// ```
2884pub struct ProjectMethods<'a, C>
2885where
2886 C: 'a,
2887{
2888 hub: &'a Appengine<C>,
2889}
2890
2891impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2892
2893impl<'a, C> ProjectMethods<'a, C> {
2894 /// Create a builder to help you perform the following task:
2895 ///
2896 /// Lists all domains the user is authorized to administer.
2897 ///
2898 /// # Arguments
2899 ///
2900 /// * `projectsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
2901 /// * `locationsId` - Part of `parent`. See documentation of `projectsId`.
2902 /// * `applicationsId` - Part of `parent`. See documentation of `projectsId`.
2903 pub fn locations_applications_authorized_domains_list(
2904 &self,
2905 projects_id: &str,
2906 locations_id: &str,
2907 applications_id: &str,
2908 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
2909 ProjectLocationApplicationAuthorizedDomainListCall {
2910 hub: self.hub,
2911 _projects_id: projects_id.to_string(),
2912 _locations_id: locations_id.to_string(),
2913 _applications_id: applications_id.to_string(),
2914 _page_token: Default::default(),
2915 _page_size: Default::default(),
2916 _delegate: Default::default(),
2917 _additional_params: Default::default(),
2918 _scopes: Default::default(),
2919 }
2920 }
2921}
2922
2923// ###################
2924// CallBuilders ###
2925// #################
2926
2927/// Uploads the specified SSL certificate.
2928///
2929/// A builder for the *authorizedCertificates.create* method supported by a *app* resource.
2930/// It is not used directly, but through a [`AppMethods`] instance.
2931///
2932/// # Example
2933///
2934/// Instantiate a resource method builder
2935///
2936/// ```test_harness,no_run
2937/// # extern crate hyper;
2938/// # extern crate hyper_rustls;
2939/// # extern crate google_appengine1 as appengine1;
2940/// use appengine1::api::AuthorizedCertificate;
2941/// # async fn dox() {
2942/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2943///
2944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2946/// # secret,
2947/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2948/// # ).build().await.unwrap();
2949///
2950/// # let client = hyper_util::client::legacy::Client::builder(
2951/// # hyper_util::rt::TokioExecutor::new()
2952/// # )
2953/// # .build(
2954/// # hyper_rustls::HttpsConnectorBuilder::new()
2955/// # .with_native_roots()
2956/// # .unwrap()
2957/// # .https_or_http()
2958/// # .enable_http1()
2959/// # .build()
2960/// # );
2961/// # let mut hub = Appengine::new(client, auth);
2962/// // As the method needs a request, you would usually fill it with the desired information
2963/// // into the respective structure. Some of the parts shown here might not be applicable !
2964/// // Values shown here are possibly random and not representative !
2965/// let mut req = AuthorizedCertificate::default();
2966///
2967/// // You can configure optional parameters by calling the respective setters at will, and
2968/// // execute the final call using `doit()`.
2969/// // Values shown here are possibly random and not representative !
2970/// let result = hub.apps().authorized_certificates_create(req, "appsId")
2971/// .doit().await;
2972/// # }
2973/// ```
2974pub struct AppAuthorizedCertificateCreateCall<'a, C>
2975where
2976 C: 'a,
2977{
2978 hub: &'a Appengine<C>,
2979 _request: AuthorizedCertificate,
2980 _apps_id: String,
2981 _delegate: Option<&'a mut dyn common::Delegate>,
2982 _additional_params: HashMap<String, String>,
2983 _scopes: BTreeSet<String>,
2984}
2985
2986impl<'a, C> common::CallBuilder for AppAuthorizedCertificateCreateCall<'a, C> {}
2987
2988impl<'a, C> AppAuthorizedCertificateCreateCall<'a, C>
2989where
2990 C: common::Connector,
2991{
2992 /// Perform the operation you have build so far.
2993 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
2994 use std::borrow::Cow;
2995 use std::io::{Read, Seek};
2996
2997 use common::{url::Params, ToParts};
2998 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2999
3000 let mut dd = common::DefaultDelegate;
3001 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3002 dlg.begin(common::MethodInfo {
3003 id: "appengine.apps.authorizedCertificates.create",
3004 http_method: hyper::Method::POST,
3005 });
3006
3007 for &field in ["alt", "appsId"].iter() {
3008 if self._additional_params.contains_key(field) {
3009 dlg.finished(false);
3010 return Err(common::Error::FieldClash(field));
3011 }
3012 }
3013
3014 let mut params = Params::with_capacity(4 + self._additional_params.len());
3015 params.push("appsId", self._apps_id);
3016
3017 params.extend(self._additional_params.iter());
3018
3019 params.push("alt", "json");
3020 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates";
3021 if self._scopes.is_empty() {
3022 self._scopes
3023 .insert(Scope::CloudPlatform.as_ref().to_string());
3024 }
3025
3026 #[allow(clippy::single_element_loop)]
3027 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
3028 url = params.uri_replacement(url, param_name, find_this, false);
3029 }
3030 {
3031 let to_remove = ["appsId"];
3032 params.remove_params(&to_remove);
3033 }
3034
3035 let url = params.parse_with_url(&url);
3036
3037 let mut json_mime_type = mime::APPLICATION_JSON;
3038 let mut request_value_reader = {
3039 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3040 common::remove_json_null_values(&mut value);
3041 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3042 serde_json::to_writer(&mut dst, &value).unwrap();
3043 dst
3044 };
3045 let request_size = request_value_reader
3046 .seek(std::io::SeekFrom::End(0))
3047 .unwrap();
3048 request_value_reader
3049 .seek(std::io::SeekFrom::Start(0))
3050 .unwrap();
3051
3052 loop {
3053 let token = match self
3054 .hub
3055 .auth
3056 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3057 .await
3058 {
3059 Ok(token) => token,
3060 Err(e) => match dlg.token(e) {
3061 Ok(token) => token,
3062 Err(e) => {
3063 dlg.finished(false);
3064 return Err(common::Error::MissingToken(e));
3065 }
3066 },
3067 };
3068 request_value_reader
3069 .seek(std::io::SeekFrom::Start(0))
3070 .unwrap();
3071 let mut req_result = {
3072 let client = &self.hub.client;
3073 dlg.pre_request();
3074 let mut req_builder = hyper::Request::builder()
3075 .method(hyper::Method::POST)
3076 .uri(url.as_str())
3077 .header(USER_AGENT, self.hub._user_agent.clone());
3078
3079 if let Some(token) = token.as_ref() {
3080 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3081 }
3082
3083 let request = req_builder
3084 .header(CONTENT_TYPE, json_mime_type.to_string())
3085 .header(CONTENT_LENGTH, request_size as u64)
3086 .body(common::to_body(
3087 request_value_reader.get_ref().clone().into(),
3088 ));
3089
3090 client.request(request.unwrap()).await
3091 };
3092
3093 match req_result {
3094 Err(err) => {
3095 if let common::Retry::After(d) = dlg.http_error(&err) {
3096 sleep(d).await;
3097 continue;
3098 }
3099 dlg.finished(false);
3100 return Err(common::Error::HttpError(err));
3101 }
3102 Ok(res) => {
3103 let (mut parts, body) = res.into_parts();
3104 let mut body = common::Body::new(body);
3105 if !parts.status.is_success() {
3106 let bytes = common::to_bytes(body).await.unwrap_or_default();
3107 let error = serde_json::from_str(&common::to_string(&bytes));
3108 let response = common::to_response(parts, bytes.into());
3109
3110 if let common::Retry::After(d) =
3111 dlg.http_failure(&response, error.as_ref().ok())
3112 {
3113 sleep(d).await;
3114 continue;
3115 }
3116
3117 dlg.finished(false);
3118
3119 return Err(match error {
3120 Ok(value) => common::Error::BadRequest(value),
3121 _ => common::Error::Failure(response),
3122 });
3123 }
3124 let response = {
3125 let bytes = common::to_bytes(body).await.unwrap_or_default();
3126 let encoded = common::to_string(&bytes);
3127 match serde_json::from_str(&encoded) {
3128 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3129 Err(error) => {
3130 dlg.response_json_decode_error(&encoded, &error);
3131 return Err(common::Error::JsonDecodeError(
3132 encoded.to_string(),
3133 error,
3134 ));
3135 }
3136 }
3137 };
3138
3139 dlg.finished(true);
3140 return Ok(response);
3141 }
3142 }
3143 }
3144 }
3145
3146 ///
3147 /// Sets the *request* property to the given value.
3148 ///
3149 /// Even though the property as already been set when instantiating this call,
3150 /// we provide this method for API completeness.
3151 pub fn request(
3152 mut self,
3153 new_value: AuthorizedCertificate,
3154 ) -> AppAuthorizedCertificateCreateCall<'a, C> {
3155 self._request = new_value;
3156 self
3157 }
3158 /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
3159 ///
3160 /// Sets the *apps id* path property to the given value.
3161 ///
3162 /// Even though the property as already been set when instantiating this call,
3163 /// we provide this method for API completeness.
3164 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateCreateCall<'a, C> {
3165 self._apps_id = new_value.to_string();
3166 self
3167 }
3168 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3169 /// while executing the actual API request.
3170 ///
3171 /// ````text
3172 /// It should be used to handle progress information, and to implement a certain level of resilience.
3173 /// ````
3174 ///
3175 /// Sets the *delegate* property to the given value.
3176 pub fn delegate(
3177 mut self,
3178 new_value: &'a mut dyn common::Delegate,
3179 ) -> AppAuthorizedCertificateCreateCall<'a, C> {
3180 self._delegate = Some(new_value);
3181 self
3182 }
3183
3184 /// Set any additional parameter of the query string used in the request.
3185 /// It should be used to set parameters which are not yet available through their own
3186 /// setters.
3187 ///
3188 /// Please note that this method must not be used to set any of the known parameters
3189 /// which have their own setter method. If done anyway, the request will fail.
3190 ///
3191 /// # Additional Parameters
3192 ///
3193 /// * *$.xgafv* (query-string) - V1 error format.
3194 /// * *access_token* (query-string) - OAuth access token.
3195 /// * *alt* (query-string) - Data format for response.
3196 /// * *callback* (query-string) - JSONP
3197 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3198 /// * *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.
3199 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3200 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3201 /// * *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.
3202 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3203 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3204 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateCreateCall<'a, C>
3205 where
3206 T: AsRef<str>,
3207 {
3208 self._additional_params
3209 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3210 self
3211 }
3212
3213 /// Identifies the authorization scope for the method you are building.
3214 ///
3215 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3216 /// [`Scope::CloudPlatform`].
3217 ///
3218 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3219 /// tokens for more than one scope.
3220 ///
3221 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3222 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3223 /// sufficient, a read-write scope will do as well.
3224 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateCreateCall<'a, C>
3225 where
3226 St: AsRef<str>,
3227 {
3228 self._scopes.insert(String::from(scope.as_ref()));
3229 self
3230 }
3231 /// Identifies the authorization scope(s) for the method you are building.
3232 ///
3233 /// See [`Self::add_scope()`] for details.
3234 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateCreateCall<'a, C>
3235 where
3236 I: IntoIterator<Item = St>,
3237 St: AsRef<str>,
3238 {
3239 self._scopes
3240 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3241 self
3242 }
3243
3244 /// Removes all scopes, and no default scope will be used either.
3245 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3246 /// for details).
3247 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateCreateCall<'a, C> {
3248 self._scopes.clear();
3249 self
3250 }
3251}
3252
3253/// Deletes the specified SSL certificate.
3254///
3255/// A builder for the *authorizedCertificates.delete* method supported by a *app* resource.
3256/// It is not used directly, but through a [`AppMethods`] instance.
3257///
3258/// # Example
3259///
3260/// Instantiate a resource method builder
3261///
3262/// ```test_harness,no_run
3263/// # extern crate hyper;
3264/// # extern crate hyper_rustls;
3265/// # extern crate google_appengine1 as appengine1;
3266/// # async fn dox() {
3267/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3268///
3269/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3270/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3271/// # secret,
3272/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3273/// # ).build().await.unwrap();
3274///
3275/// # let client = hyper_util::client::legacy::Client::builder(
3276/// # hyper_util::rt::TokioExecutor::new()
3277/// # )
3278/// # .build(
3279/// # hyper_rustls::HttpsConnectorBuilder::new()
3280/// # .with_native_roots()
3281/// # .unwrap()
3282/// # .https_or_http()
3283/// # .enable_http1()
3284/// # .build()
3285/// # );
3286/// # let mut hub = Appengine::new(client, auth);
3287/// // You can configure optional parameters by calling the respective setters at will, and
3288/// // execute the final call using `doit()`.
3289/// // Values shown here are possibly random and not representative !
3290/// let result = hub.apps().authorized_certificates_delete("appsId", "authorizedCertificatesId")
3291/// .doit().await;
3292/// # }
3293/// ```
3294pub struct AppAuthorizedCertificateDeleteCall<'a, C>
3295where
3296 C: 'a,
3297{
3298 hub: &'a Appengine<C>,
3299 _apps_id: String,
3300 _authorized_certificates_id: String,
3301 _delegate: Option<&'a mut dyn common::Delegate>,
3302 _additional_params: HashMap<String, String>,
3303 _scopes: BTreeSet<String>,
3304}
3305
3306impl<'a, C> common::CallBuilder for AppAuthorizedCertificateDeleteCall<'a, C> {}
3307
3308impl<'a, C> AppAuthorizedCertificateDeleteCall<'a, C>
3309where
3310 C: common::Connector,
3311{
3312 /// Perform the operation you have build so far.
3313 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3314 use std::borrow::Cow;
3315 use std::io::{Read, Seek};
3316
3317 use common::{url::Params, ToParts};
3318 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3319
3320 let mut dd = common::DefaultDelegate;
3321 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3322 dlg.begin(common::MethodInfo {
3323 id: "appengine.apps.authorizedCertificates.delete",
3324 http_method: hyper::Method::DELETE,
3325 });
3326
3327 for &field in ["alt", "appsId", "authorizedCertificatesId"].iter() {
3328 if self._additional_params.contains_key(field) {
3329 dlg.finished(false);
3330 return Err(common::Error::FieldClash(field));
3331 }
3332 }
3333
3334 let mut params = Params::with_capacity(4 + self._additional_params.len());
3335 params.push("appsId", self._apps_id);
3336 params.push("authorizedCertificatesId", self._authorized_certificates_id);
3337
3338 params.extend(self._additional_params.iter());
3339
3340 params.push("alt", "json");
3341 let mut url = self.hub._base_url.clone()
3342 + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}";
3343 if self._scopes.is_empty() {
3344 self._scopes
3345 .insert(Scope::CloudPlatform.as_ref().to_string());
3346 }
3347
3348 #[allow(clippy::single_element_loop)]
3349 for &(find_this, param_name) in [
3350 ("{appsId}", "appsId"),
3351 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
3352 ]
3353 .iter()
3354 {
3355 url = params.uri_replacement(url, param_name, find_this, false);
3356 }
3357 {
3358 let to_remove = ["authorizedCertificatesId", "appsId"];
3359 params.remove_params(&to_remove);
3360 }
3361
3362 let url = params.parse_with_url(&url);
3363
3364 loop {
3365 let token = match self
3366 .hub
3367 .auth
3368 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3369 .await
3370 {
3371 Ok(token) => token,
3372 Err(e) => match dlg.token(e) {
3373 Ok(token) => token,
3374 Err(e) => {
3375 dlg.finished(false);
3376 return Err(common::Error::MissingToken(e));
3377 }
3378 },
3379 };
3380 let mut req_result = {
3381 let client = &self.hub.client;
3382 dlg.pre_request();
3383 let mut req_builder = hyper::Request::builder()
3384 .method(hyper::Method::DELETE)
3385 .uri(url.as_str())
3386 .header(USER_AGENT, self.hub._user_agent.clone());
3387
3388 if let Some(token) = token.as_ref() {
3389 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3390 }
3391
3392 let request = req_builder
3393 .header(CONTENT_LENGTH, 0_u64)
3394 .body(common::to_body::<String>(None));
3395
3396 client.request(request.unwrap()).await
3397 };
3398
3399 match req_result {
3400 Err(err) => {
3401 if let common::Retry::After(d) = dlg.http_error(&err) {
3402 sleep(d).await;
3403 continue;
3404 }
3405 dlg.finished(false);
3406 return Err(common::Error::HttpError(err));
3407 }
3408 Ok(res) => {
3409 let (mut parts, body) = res.into_parts();
3410 let mut body = common::Body::new(body);
3411 if !parts.status.is_success() {
3412 let bytes = common::to_bytes(body).await.unwrap_or_default();
3413 let error = serde_json::from_str(&common::to_string(&bytes));
3414 let response = common::to_response(parts, bytes.into());
3415
3416 if let common::Retry::After(d) =
3417 dlg.http_failure(&response, error.as_ref().ok())
3418 {
3419 sleep(d).await;
3420 continue;
3421 }
3422
3423 dlg.finished(false);
3424
3425 return Err(match error {
3426 Ok(value) => common::Error::BadRequest(value),
3427 _ => common::Error::Failure(response),
3428 });
3429 }
3430 let response = {
3431 let bytes = common::to_bytes(body).await.unwrap_or_default();
3432 let encoded = common::to_string(&bytes);
3433 match serde_json::from_str(&encoded) {
3434 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3435 Err(error) => {
3436 dlg.response_json_decode_error(&encoded, &error);
3437 return Err(common::Error::JsonDecodeError(
3438 encoded.to_string(),
3439 error,
3440 ));
3441 }
3442 }
3443 };
3444
3445 dlg.finished(true);
3446 return Ok(response);
3447 }
3448 }
3449 }
3450 }
3451
3452 /// Part of `name`. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345.
3453 ///
3454 /// Sets the *apps id* path property to the given value.
3455 ///
3456 /// Even though the property as already been set when instantiating this call,
3457 /// we provide this method for API completeness.
3458 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateDeleteCall<'a, C> {
3459 self._apps_id = new_value.to_string();
3460 self
3461 }
3462 /// Part of `name`. See documentation of `appsId`.
3463 ///
3464 /// Sets the *authorized certificates id* path property to the given value.
3465 ///
3466 /// Even though the property as already been set when instantiating this call,
3467 /// we provide this method for API completeness.
3468 pub fn authorized_certificates_id(
3469 mut self,
3470 new_value: &str,
3471 ) -> AppAuthorizedCertificateDeleteCall<'a, C> {
3472 self._authorized_certificates_id = new_value.to_string();
3473 self
3474 }
3475 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3476 /// while executing the actual API request.
3477 ///
3478 /// ````text
3479 /// It should be used to handle progress information, and to implement a certain level of resilience.
3480 /// ````
3481 ///
3482 /// Sets the *delegate* property to the given value.
3483 pub fn delegate(
3484 mut self,
3485 new_value: &'a mut dyn common::Delegate,
3486 ) -> AppAuthorizedCertificateDeleteCall<'a, C> {
3487 self._delegate = Some(new_value);
3488 self
3489 }
3490
3491 /// Set any additional parameter of the query string used in the request.
3492 /// It should be used to set parameters which are not yet available through their own
3493 /// setters.
3494 ///
3495 /// Please note that this method must not be used to set any of the known parameters
3496 /// which have their own setter method. If done anyway, the request will fail.
3497 ///
3498 /// # Additional Parameters
3499 ///
3500 /// * *$.xgafv* (query-string) - V1 error format.
3501 /// * *access_token* (query-string) - OAuth access token.
3502 /// * *alt* (query-string) - Data format for response.
3503 /// * *callback* (query-string) - JSONP
3504 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3505 /// * *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.
3506 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3507 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3508 /// * *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.
3509 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3510 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3511 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateDeleteCall<'a, C>
3512 where
3513 T: AsRef<str>,
3514 {
3515 self._additional_params
3516 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3517 self
3518 }
3519
3520 /// Identifies the authorization scope for the method you are building.
3521 ///
3522 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3523 /// [`Scope::CloudPlatform`].
3524 ///
3525 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3526 /// tokens for more than one scope.
3527 ///
3528 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3529 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3530 /// sufficient, a read-write scope will do as well.
3531 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateDeleteCall<'a, C>
3532 where
3533 St: AsRef<str>,
3534 {
3535 self._scopes.insert(String::from(scope.as_ref()));
3536 self
3537 }
3538 /// Identifies the authorization scope(s) for the method you are building.
3539 ///
3540 /// See [`Self::add_scope()`] for details.
3541 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateDeleteCall<'a, C>
3542 where
3543 I: IntoIterator<Item = St>,
3544 St: AsRef<str>,
3545 {
3546 self._scopes
3547 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3548 self
3549 }
3550
3551 /// Removes all scopes, and no default scope will be used either.
3552 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3553 /// for details).
3554 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateDeleteCall<'a, C> {
3555 self._scopes.clear();
3556 self
3557 }
3558}
3559
3560/// Gets the specified SSL certificate.
3561///
3562/// A builder for the *authorizedCertificates.get* method supported by a *app* resource.
3563/// It is not used directly, but through a [`AppMethods`] instance.
3564///
3565/// # Example
3566///
3567/// Instantiate a resource method builder
3568///
3569/// ```test_harness,no_run
3570/// # extern crate hyper;
3571/// # extern crate hyper_rustls;
3572/// # extern crate google_appengine1 as appengine1;
3573/// # async fn dox() {
3574/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3575///
3576/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3577/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3578/// # secret,
3579/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3580/// # ).build().await.unwrap();
3581///
3582/// # let client = hyper_util::client::legacy::Client::builder(
3583/// # hyper_util::rt::TokioExecutor::new()
3584/// # )
3585/// # .build(
3586/// # hyper_rustls::HttpsConnectorBuilder::new()
3587/// # .with_native_roots()
3588/// # .unwrap()
3589/// # .https_or_http()
3590/// # .enable_http1()
3591/// # .build()
3592/// # );
3593/// # let mut hub = Appengine::new(client, auth);
3594/// // You can configure optional parameters by calling the respective setters at will, and
3595/// // execute the final call using `doit()`.
3596/// // Values shown here are possibly random and not representative !
3597/// let result = hub.apps().authorized_certificates_get("appsId", "authorizedCertificatesId")
3598/// .view("dolor")
3599/// .doit().await;
3600/// # }
3601/// ```
3602pub struct AppAuthorizedCertificateGetCall<'a, C>
3603where
3604 C: 'a,
3605{
3606 hub: &'a Appengine<C>,
3607 _apps_id: String,
3608 _authorized_certificates_id: String,
3609 _view: Option<String>,
3610 _delegate: Option<&'a mut dyn common::Delegate>,
3611 _additional_params: HashMap<String, String>,
3612 _scopes: BTreeSet<String>,
3613}
3614
3615impl<'a, C> common::CallBuilder for AppAuthorizedCertificateGetCall<'a, C> {}
3616
3617impl<'a, C> AppAuthorizedCertificateGetCall<'a, C>
3618where
3619 C: common::Connector,
3620{
3621 /// Perform the operation you have build so far.
3622 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
3623 use std::borrow::Cow;
3624 use std::io::{Read, Seek};
3625
3626 use common::{url::Params, ToParts};
3627 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3628
3629 let mut dd = common::DefaultDelegate;
3630 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3631 dlg.begin(common::MethodInfo {
3632 id: "appengine.apps.authorizedCertificates.get",
3633 http_method: hyper::Method::GET,
3634 });
3635
3636 for &field in ["alt", "appsId", "authorizedCertificatesId", "view"].iter() {
3637 if self._additional_params.contains_key(field) {
3638 dlg.finished(false);
3639 return Err(common::Error::FieldClash(field));
3640 }
3641 }
3642
3643 let mut params = Params::with_capacity(5 + self._additional_params.len());
3644 params.push("appsId", self._apps_id);
3645 params.push("authorizedCertificatesId", self._authorized_certificates_id);
3646 if let Some(value) = self._view.as_ref() {
3647 params.push("view", value);
3648 }
3649
3650 params.extend(self._additional_params.iter());
3651
3652 params.push("alt", "json");
3653 let mut url = self.hub._base_url.clone()
3654 + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}";
3655 if self._scopes.is_empty() {
3656 self._scopes.insert(Scope::Admin.as_ref().to_string());
3657 }
3658
3659 #[allow(clippy::single_element_loop)]
3660 for &(find_this, param_name) in [
3661 ("{appsId}", "appsId"),
3662 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
3663 ]
3664 .iter()
3665 {
3666 url = params.uri_replacement(url, param_name, find_this, false);
3667 }
3668 {
3669 let to_remove = ["authorizedCertificatesId", "appsId"];
3670 params.remove_params(&to_remove);
3671 }
3672
3673 let url = params.parse_with_url(&url);
3674
3675 loop {
3676 let token = match self
3677 .hub
3678 .auth
3679 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3680 .await
3681 {
3682 Ok(token) => token,
3683 Err(e) => match dlg.token(e) {
3684 Ok(token) => token,
3685 Err(e) => {
3686 dlg.finished(false);
3687 return Err(common::Error::MissingToken(e));
3688 }
3689 },
3690 };
3691 let mut req_result = {
3692 let client = &self.hub.client;
3693 dlg.pre_request();
3694 let mut req_builder = hyper::Request::builder()
3695 .method(hyper::Method::GET)
3696 .uri(url.as_str())
3697 .header(USER_AGENT, self.hub._user_agent.clone());
3698
3699 if let Some(token) = token.as_ref() {
3700 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3701 }
3702
3703 let request = req_builder
3704 .header(CONTENT_LENGTH, 0_u64)
3705 .body(common::to_body::<String>(None));
3706
3707 client.request(request.unwrap()).await
3708 };
3709
3710 match req_result {
3711 Err(err) => {
3712 if let common::Retry::After(d) = dlg.http_error(&err) {
3713 sleep(d).await;
3714 continue;
3715 }
3716 dlg.finished(false);
3717 return Err(common::Error::HttpError(err));
3718 }
3719 Ok(res) => {
3720 let (mut parts, body) = res.into_parts();
3721 let mut body = common::Body::new(body);
3722 if !parts.status.is_success() {
3723 let bytes = common::to_bytes(body).await.unwrap_or_default();
3724 let error = serde_json::from_str(&common::to_string(&bytes));
3725 let response = common::to_response(parts, bytes.into());
3726
3727 if let common::Retry::After(d) =
3728 dlg.http_failure(&response, error.as_ref().ok())
3729 {
3730 sleep(d).await;
3731 continue;
3732 }
3733
3734 dlg.finished(false);
3735
3736 return Err(match error {
3737 Ok(value) => common::Error::BadRequest(value),
3738 _ => common::Error::Failure(response),
3739 });
3740 }
3741 let response = {
3742 let bytes = common::to_bytes(body).await.unwrap_or_default();
3743 let encoded = common::to_string(&bytes);
3744 match serde_json::from_str(&encoded) {
3745 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3746 Err(error) => {
3747 dlg.response_json_decode_error(&encoded, &error);
3748 return Err(common::Error::JsonDecodeError(
3749 encoded.to_string(),
3750 error,
3751 ));
3752 }
3753 }
3754 };
3755
3756 dlg.finished(true);
3757 return Ok(response);
3758 }
3759 }
3760 }
3761 }
3762
3763 /// Part of `name`. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345.
3764 ///
3765 /// Sets the *apps id* path property to the given value.
3766 ///
3767 /// Even though the property as already been set when instantiating this call,
3768 /// we provide this method for API completeness.
3769 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateGetCall<'a, C> {
3770 self._apps_id = new_value.to_string();
3771 self
3772 }
3773 /// Part of `name`. See documentation of `appsId`.
3774 ///
3775 /// Sets the *authorized certificates id* path property to the given value.
3776 ///
3777 /// Even though the property as already been set when instantiating this call,
3778 /// we provide this method for API completeness.
3779 pub fn authorized_certificates_id(
3780 mut self,
3781 new_value: &str,
3782 ) -> AppAuthorizedCertificateGetCall<'a, C> {
3783 self._authorized_certificates_id = new_value.to_string();
3784 self
3785 }
3786 /// Controls the set of fields returned in the GET response.
3787 ///
3788 /// Sets the *view* query property to the given value.
3789 pub fn view(mut self, new_value: &str) -> AppAuthorizedCertificateGetCall<'a, C> {
3790 self._view = Some(new_value.to_string());
3791 self
3792 }
3793 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3794 /// while executing the actual API request.
3795 ///
3796 /// ````text
3797 /// It should be used to handle progress information, and to implement a certain level of resilience.
3798 /// ````
3799 ///
3800 /// Sets the *delegate* property to the given value.
3801 pub fn delegate(
3802 mut self,
3803 new_value: &'a mut dyn common::Delegate,
3804 ) -> AppAuthorizedCertificateGetCall<'a, C> {
3805 self._delegate = Some(new_value);
3806 self
3807 }
3808
3809 /// Set any additional parameter of the query string used in the request.
3810 /// It should be used to set parameters which are not yet available through their own
3811 /// setters.
3812 ///
3813 /// Please note that this method must not be used to set any of the known parameters
3814 /// which have their own setter method. If done anyway, the request will fail.
3815 ///
3816 /// # Additional Parameters
3817 ///
3818 /// * *$.xgafv* (query-string) - V1 error format.
3819 /// * *access_token* (query-string) - OAuth access token.
3820 /// * *alt* (query-string) - Data format for response.
3821 /// * *callback* (query-string) - JSONP
3822 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3823 /// * *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.
3824 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3825 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3826 /// * *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.
3827 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3828 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3829 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateGetCall<'a, C>
3830 where
3831 T: AsRef<str>,
3832 {
3833 self._additional_params
3834 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3835 self
3836 }
3837
3838 /// Identifies the authorization scope for the method you are building.
3839 ///
3840 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3841 /// [`Scope::Admin`].
3842 ///
3843 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3844 /// tokens for more than one scope.
3845 ///
3846 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3847 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3848 /// sufficient, a read-write scope will do as well.
3849 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateGetCall<'a, C>
3850 where
3851 St: AsRef<str>,
3852 {
3853 self._scopes.insert(String::from(scope.as_ref()));
3854 self
3855 }
3856 /// Identifies the authorization scope(s) for the method you are building.
3857 ///
3858 /// See [`Self::add_scope()`] for details.
3859 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateGetCall<'a, C>
3860 where
3861 I: IntoIterator<Item = St>,
3862 St: AsRef<str>,
3863 {
3864 self._scopes
3865 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3866 self
3867 }
3868
3869 /// Removes all scopes, and no default scope will be used either.
3870 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3871 /// for details).
3872 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateGetCall<'a, C> {
3873 self._scopes.clear();
3874 self
3875 }
3876}
3877
3878/// Lists all SSL certificates the user is authorized to administer.
3879///
3880/// A builder for the *authorizedCertificates.list* method supported by a *app* resource.
3881/// It is not used directly, but through a [`AppMethods`] instance.
3882///
3883/// # Example
3884///
3885/// Instantiate a resource method builder
3886///
3887/// ```test_harness,no_run
3888/// # extern crate hyper;
3889/// # extern crate hyper_rustls;
3890/// # extern crate google_appengine1 as appengine1;
3891/// # async fn dox() {
3892/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3893///
3894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3895/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3896/// # secret,
3897/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3898/// # ).build().await.unwrap();
3899///
3900/// # let client = hyper_util::client::legacy::Client::builder(
3901/// # hyper_util::rt::TokioExecutor::new()
3902/// # )
3903/// # .build(
3904/// # hyper_rustls::HttpsConnectorBuilder::new()
3905/// # .with_native_roots()
3906/// # .unwrap()
3907/// # .https_or_http()
3908/// # .enable_http1()
3909/// # .build()
3910/// # );
3911/// # let mut hub = Appengine::new(client, auth);
3912/// // You can configure optional parameters by calling the respective setters at will, and
3913/// // execute the final call using `doit()`.
3914/// // Values shown here are possibly random and not representative !
3915/// let result = hub.apps().authorized_certificates_list("appsId")
3916/// .view("ipsum")
3917/// .page_token("invidunt")
3918/// .page_size(-47)
3919/// .doit().await;
3920/// # }
3921/// ```
3922pub struct AppAuthorizedCertificateListCall<'a, C>
3923where
3924 C: 'a,
3925{
3926 hub: &'a Appengine<C>,
3927 _apps_id: String,
3928 _view: Option<String>,
3929 _page_token: Option<String>,
3930 _page_size: Option<i32>,
3931 _delegate: Option<&'a mut dyn common::Delegate>,
3932 _additional_params: HashMap<String, String>,
3933 _scopes: BTreeSet<String>,
3934}
3935
3936impl<'a, C> common::CallBuilder for AppAuthorizedCertificateListCall<'a, C> {}
3937
3938impl<'a, C> AppAuthorizedCertificateListCall<'a, C>
3939where
3940 C: common::Connector,
3941{
3942 /// Perform the operation you have build so far.
3943 pub async fn doit(
3944 mut self,
3945 ) -> common::Result<(common::Response, ListAuthorizedCertificatesResponse)> {
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.list",
3956 http_method: hyper::Method::GET,
3957 });
3958
3959 for &field in ["alt", "appsId", "view", "pageToken", "pageSize"].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(6 + self._additional_params.len());
3967 params.push("appsId", self._apps_id);
3968 if let Some(value) = self._view.as_ref() {
3969 params.push("view", value);
3970 }
3971 if let Some(value) = self._page_token.as_ref() {
3972 params.push("pageToken", value);
3973 }
3974 if let Some(value) = self._page_size.as_ref() {
3975 params.push("pageSize", value.to_string());
3976 }
3977
3978 params.extend(self._additional_params.iter());
3979
3980 params.push("alt", "json");
3981 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates";
3982 if self._scopes.is_empty() {
3983 self._scopes.insert(Scope::Admin.as_ref().to_string());
3984 }
3985
3986 #[allow(clippy::single_element_loop)]
3987 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
3988 url = params.uri_replacement(url, param_name, find_this, false);
3989 }
3990 {
3991 let to_remove = ["appsId"];
3992 params.remove_params(&to_remove);
3993 }
3994
3995 let url = params.parse_with_url(&url);
3996
3997 loop {
3998 let token = match self
3999 .hub
4000 .auth
4001 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4002 .await
4003 {
4004 Ok(token) => token,
4005 Err(e) => match dlg.token(e) {
4006 Ok(token) => token,
4007 Err(e) => {
4008 dlg.finished(false);
4009 return Err(common::Error::MissingToken(e));
4010 }
4011 },
4012 };
4013 let mut req_result = {
4014 let client = &self.hub.client;
4015 dlg.pre_request();
4016 let mut req_builder = hyper::Request::builder()
4017 .method(hyper::Method::GET)
4018 .uri(url.as_str())
4019 .header(USER_AGENT, self.hub._user_agent.clone());
4020
4021 if let Some(token) = token.as_ref() {
4022 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4023 }
4024
4025 let request = req_builder
4026 .header(CONTENT_LENGTH, 0_u64)
4027 .body(common::to_body::<String>(None));
4028
4029 client.request(request.unwrap()).await
4030 };
4031
4032 match req_result {
4033 Err(err) => {
4034 if let common::Retry::After(d) = dlg.http_error(&err) {
4035 sleep(d).await;
4036 continue;
4037 }
4038 dlg.finished(false);
4039 return Err(common::Error::HttpError(err));
4040 }
4041 Ok(res) => {
4042 let (mut parts, body) = res.into_parts();
4043 let mut body = common::Body::new(body);
4044 if !parts.status.is_success() {
4045 let bytes = common::to_bytes(body).await.unwrap_or_default();
4046 let error = serde_json::from_str(&common::to_string(&bytes));
4047 let response = common::to_response(parts, bytes.into());
4048
4049 if let common::Retry::After(d) =
4050 dlg.http_failure(&response, error.as_ref().ok())
4051 {
4052 sleep(d).await;
4053 continue;
4054 }
4055
4056 dlg.finished(false);
4057
4058 return Err(match error {
4059 Ok(value) => common::Error::BadRequest(value),
4060 _ => common::Error::Failure(response),
4061 });
4062 }
4063 let response = {
4064 let bytes = common::to_bytes(body).await.unwrap_or_default();
4065 let encoded = common::to_string(&bytes);
4066 match serde_json::from_str(&encoded) {
4067 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4068 Err(error) => {
4069 dlg.response_json_decode_error(&encoded, &error);
4070 return Err(common::Error::JsonDecodeError(
4071 encoded.to_string(),
4072 error,
4073 ));
4074 }
4075 }
4076 };
4077
4078 dlg.finished(true);
4079 return Ok(response);
4080 }
4081 }
4082 }
4083 }
4084
4085 /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
4086 ///
4087 /// Sets the *apps id* path property to the given value.
4088 ///
4089 /// Even though the property as already been set when instantiating this call,
4090 /// we provide this method for API completeness.
4091 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, C> {
4092 self._apps_id = new_value.to_string();
4093 self
4094 }
4095 /// Controls the set of fields returned in the LIST response.
4096 ///
4097 /// Sets the *view* query property to the given value.
4098 pub fn view(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, C> {
4099 self._view = Some(new_value.to_string());
4100 self
4101 }
4102 /// Continuation token for fetching the next page of results.
4103 ///
4104 /// Sets the *page token* query property to the given value.
4105 pub fn page_token(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, C> {
4106 self._page_token = Some(new_value.to_string());
4107 self
4108 }
4109 /// Maximum results to return per page.
4110 ///
4111 /// Sets the *page size* query property to the given value.
4112 pub fn page_size(mut self, new_value: i32) -> AppAuthorizedCertificateListCall<'a, C> {
4113 self._page_size = Some(new_value);
4114 self
4115 }
4116 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4117 /// while executing the actual API request.
4118 ///
4119 /// ````text
4120 /// It should be used to handle progress information, and to implement a certain level of resilience.
4121 /// ````
4122 ///
4123 /// Sets the *delegate* property to the given value.
4124 pub fn delegate(
4125 mut self,
4126 new_value: &'a mut dyn common::Delegate,
4127 ) -> AppAuthorizedCertificateListCall<'a, C> {
4128 self._delegate = Some(new_value);
4129 self
4130 }
4131
4132 /// Set any additional parameter of the query string used in the request.
4133 /// It should be used to set parameters which are not yet available through their own
4134 /// setters.
4135 ///
4136 /// Please note that this method must not be used to set any of the known parameters
4137 /// which have their own setter method. If done anyway, the request will fail.
4138 ///
4139 /// # Additional Parameters
4140 ///
4141 /// * *$.xgafv* (query-string) - V1 error format.
4142 /// * *access_token* (query-string) - OAuth access token.
4143 /// * *alt* (query-string) - Data format for response.
4144 /// * *callback* (query-string) - JSONP
4145 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4146 /// * *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.
4147 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4148 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4149 /// * *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.
4150 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4151 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4152 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificateListCall<'a, C>
4153 where
4154 T: AsRef<str>,
4155 {
4156 self._additional_params
4157 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4158 self
4159 }
4160
4161 /// Identifies the authorization scope for the method you are building.
4162 ///
4163 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4164 /// [`Scope::Admin`].
4165 ///
4166 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4167 /// tokens for more than one scope.
4168 ///
4169 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4170 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4171 /// sufficient, a read-write scope will do as well.
4172 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificateListCall<'a, C>
4173 where
4174 St: AsRef<str>,
4175 {
4176 self._scopes.insert(String::from(scope.as_ref()));
4177 self
4178 }
4179 /// Identifies the authorization scope(s) for the method you are building.
4180 ///
4181 /// See [`Self::add_scope()`] for details.
4182 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificateListCall<'a, C>
4183 where
4184 I: IntoIterator<Item = St>,
4185 St: AsRef<str>,
4186 {
4187 self._scopes
4188 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4189 self
4190 }
4191
4192 /// Removes all scopes, and no default scope will be used either.
4193 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4194 /// for details).
4195 pub fn clear_scopes(mut self) -> AppAuthorizedCertificateListCall<'a, C> {
4196 self._scopes.clear();
4197 self
4198 }
4199}
4200
4201/// 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.
4202///
4203/// A builder for the *authorizedCertificates.patch* method supported by a *app* resource.
4204/// It is not used directly, but through a [`AppMethods`] instance.
4205///
4206/// # Example
4207///
4208/// Instantiate a resource method builder
4209///
4210/// ```test_harness,no_run
4211/// # extern crate hyper;
4212/// # extern crate hyper_rustls;
4213/// # extern crate google_appengine1 as appengine1;
4214/// use appengine1::api::AuthorizedCertificate;
4215/// # async fn dox() {
4216/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4217///
4218/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4219/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4220/// # secret,
4221/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4222/// # ).build().await.unwrap();
4223///
4224/// # let client = hyper_util::client::legacy::Client::builder(
4225/// # hyper_util::rt::TokioExecutor::new()
4226/// # )
4227/// # .build(
4228/// # hyper_rustls::HttpsConnectorBuilder::new()
4229/// # .with_native_roots()
4230/// # .unwrap()
4231/// # .https_or_http()
4232/// # .enable_http1()
4233/// # .build()
4234/// # );
4235/// # let mut hub = Appengine::new(client, auth);
4236/// // As the method needs a request, you would usually fill it with the desired information
4237/// // into the respective structure. Some of the parts shown here might not be applicable !
4238/// // Values shown here are possibly random and not representative !
4239/// let mut req = AuthorizedCertificate::default();
4240///
4241/// // You can configure optional parameters by calling the respective setters at will, and
4242/// // execute the final call using `doit()`.
4243/// // Values shown here are possibly random and not representative !
4244/// let result = hub.apps().authorized_certificates_patch(req, "appsId", "authorizedCertificatesId")
4245/// .update_mask(FieldMask::new::<&str>(&[]))
4246/// .doit().await;
4247/// # }
4248/// ```
4249pub struct AppAuthorizedCertificatePatchCall<'a, C>
4250where
4251 C: 'a,
4252{
4253 hub: &'a Appengine<C>,
4254 _request: AuthorizedCertificate,
4255 _apps_id: String,
4256 _authorized_certificates_id: String,
4257 _update_mask: Option<common::FieldMask>,
4258 _delegate: Option<&'a mut dyn common::Delegate>,
4259 _additional_params: HashMap<String, String>,
4260 _scopes: BTreeSet<String>,
4261}
4262
4263impl<'a, C> common::CallBuilder for AppAuthorizedCertificatePatchCall<'a, C> {}
4264
4265impl<'a, C> AppAuthorizedCertificatePatchCall<'a, C>
4266where
4267 C: common::Connector,
4268{
4269 /// Perform the operation you have build so far.
4270 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizedCertificate)> {
4271 use std::borrow::Cow;
4272 use std::io::{Read, Seek};
4273
4274 use common::{url::Params, ToParts};
4275 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4276
4277 let mut dd = common::DefaultDelegate;
4278 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4279 dlg.begin(common::MethodInfo {
4280 id: "appengine.apps.authorizedCertificates.patch",
4281 http_method: hyper::Method::PATCH,
4282 });
4283
4284 for &field in ["alt", "appsId", "authorizedCertificatesId", "updateMask"].iter() {
4285 if self._additional_params.contains_key(field) {
4286 dlg.finished(false);
4287 return Err(common::Error::FieldClash(field));
4288 }
4289 }
4290
4291 let mut params = Params::with_capacity(6 + self._additional_params.len());
4292 params.push("appsId", self._apps_id);
4293 params.push("authorizedCertificatesId", self._authorized_certificates_id);
4294 if let Some(value) = self._update_mask.as_ref() {
4295 params.push("updateMask", value.to_string());
4296 }
4297
4298 params.extend(self._additional_params.iter());
4299
4300 params.push("alt", "json");
4301 let mut url = self.hub._base_url.clone()
4302 + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}";
4303 if self._scopes.is_empty() {
4304 self._scopes
4305 .insert(Scope::CloudPlatform.as_ref().to_string());
4306 }
4307
4308 #[allow(clippy::single_element_loop)]
4309 for &(find_this, param_name) in [
4310 ("{appsId}", "appsId"),
4311 ("{authorizedCertificatesId}", "authorizedCertificatesId"),
4312 ]
4313 .iter()
4314 {
4315 url = params.uri_replacement(url, param_name, find_this, false);
4316 }
4317 {
4318 let to_remove = ["authorizedCertificatesId", "appsId"];
4319 params.remove_params(&to_remove);
4320 }
4321
4322 let url = params.parse_with_url(&url);
4323
4324 let mut json_mime_type = mime::APPLICATION_JSON;
4325 let mut request_value_reader = {
4326 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4327 common::remove_json_null_values(&mut value);
4328 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4329 serde_json::to_writer(&mut dst, &value).unwrap();
4330 dst
4331 };
4332 let request_size = request_value_reader
4333 .seek(std::io::SeekFrom::End(0))
4334 .unwrap();
4335 request_value_reader
4336 .seek(std::io::SeekFrom::Start(0))
4337 .unwrap();
4338
4339 loop {
4340 let token = match self
4341 .hub
4342 .auth
4343 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4344 .await
4345 {
4346 Ok(token) => token,
4347 Err(e) => match dlg.token(e) {
4348 Ok(token) => token,
4349 Err(e) => {
4350 dlg.finished(false);
4351 return Err(common::Error::MissingToken(e));
4352 }
4353 },
4354 };
4355 request_value_reader
4356 .seek(std::io::SeekFrom::Start(0))
4357 .unwrap();
4358 let mut req_result = {
4359 let client = &self.hub.client;
4360 dlg.pre_request();
4361 let mut req_builder = hyper::Request::builder()
4362 .method(hyper::Method::PATCH)
4363 .uri(url.as_str())
4364 .header(USER_AGENT, self.hub._user_agent.clone());
4365
4366 if let Some(token) = token.as_ref() {
4367 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4368 }
4369
4370 let request = req_builder
4371 .header(CONTENT_TYPE, json_mime_type.to_string())
4372 .header(CONTENT_LENGTH, request_size as u64)
4373 .body(common::to_body(
4374 request_value_reader.get_ref().clone().into(),
4375 ));
4376
4377 client.request(request.unwrap()).await
4378 };
4379
4380 match req_result {
4381 Err(err) => {
4382 if let common::Retry::After(d) = dlg.http_error(&err) {
4383 sleep(d).await;
4384 continue;
4385 }
4386 dlg.finished(false);
4387 return Err(common::Error::HttpError(err));
4388 }
4389 Ok(res) => {
4390 let (mut parts, body) = res.into_parts();
4391 let mut body = common::Body::new(body);
4392 if !parts.status.is_success() {
4393 let bytes = common::to_bytes(body).await.unwrap_or_default();
4394 let error = serde_json::from_str(&common::to_string(&bytes));
4395 let response = common::to_response(parts, bytes.into());
4396
4397 if let common::Retry::After(d) =
4398 dlg.http_failure(&response, error.as_ref().ok())
4399 {
4400 sleep(d).await;
4401 continue;
4402 }
4403
4404 dlg.finished(false);
4405
4406 return Err(match error {
4407 Ok(value) => common::Error::BadRequest(value),
4408 _ => common::Error::Failure(response),
4409 });
4410 }
4411 let response = {
4412 let bytes = common::to_bytes(body).await.unwrap_or_default();
4413 let encoded = common::to_string(&bytes);
4414 match serde_json::from_str(&encoded) {
4415 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4416 Err(error) => {
4417 dlg.response_json_decode_error(&encoded, &error);
4418 return Err(common::Error::JsonDecodeError(
4419 encoded.to_string(),
4420 error,
4421 ));
4422 }
4423 }
4424 };
4425
4426 dlg.finished(true);
4427 return Ok(response);
4428 }
4429 }
4430 }
4431 }
4432
4433 ///
4434 /// Sets the *request* property to the given value.
4435 ///
4436 /// Even though the property as already been set when instantiating this call,
4437 /// we provide this method for API completeness.
4438 pub fn request(
4439 mut self,
4440 new_value: AuthorizedCertificate,
4441 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
4442 self._request = new_value;
4443 self
4444 }
4445 /// Part of `name`. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345.
4446 ///
4447 /// Sets the *apps id* path property to the given value.
4448 ///
4449 /// Even though the property as already been set when instantiating this call,
4450 /// we provide this method for API completeness.
4451 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificatePatchCall<'a, C> {
4452 self._apps_id = new_value.to_string();
4453 self
4454 }
4455 /// Part of `name`. See documentation of `appsId`.
4456 ///
4457 /// Sets the *authorized certificates id* path property to the given value.
4458 ///
4459 /// Even though the property as already been set when instantiating this call,
4460 /// we provide this method for API completeness.
4461 pub fn authorized_certificates_id(
4462 mut self,
4463 new_value: &str,
4464 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
4465 self._authorized_certificates_id = new_value.to_string();
4466 self
4467 }
4468 /// Standard field mask for the set of fields to be updated. Updates are only supported on the certificate_raw_data and display_name fields.
4469 ///
4470 /// Sets the *update mask* query property to the given value.
4471 pub fn update_mask(
4472 mut self,
4473 new_value: common::FieldMask,
4474 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
4475 self._update_mask = Some(new_value);
4476 self
4477 }
4478 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4479 /// while executing the actual API request.
4480 ///
4481 /// ````text
4482 /// It should be used to handle progress information, and to implement a certain level of resilience.
4483 /// ````
4484 ///
4485 /// Sets the *delegate* property to the given value.
4486 pub fn delegate(
4487 mut self,
4488 new_value: &'a mut dyn common::Delegate,
4489 ) -> AppAuthorizedCertificatePatchCall<'a, C> {
4490 self._delegate = Some(new_value);
4491 self
4492 }
4493
4494 /// Set any additional parameter of the query string used in the request.
4495 /// It should be used to set parameters which are not yet available through their own
4496 /// setters.
4497 ///
4498 /// Please note that this method must not be used to set any of the known parameters
4499 /// which have their own setter method. If done anyway, the request will fail.
4500 ///
4501 /// # Additional Parameters
4502 ///
4503 /// * *$.xgafv* (query-string) - V1 error format.
4504 /// * *access_token* (query-string) - OAuth access token.
4505 /// * *alt* (query-string) - Data format for response.
4506 /// * *callback* (query-string) - JSONP
4507 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4508 /// * *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.
4509 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4510 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4511 /// * *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.
4512 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4513 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4514 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedCertificatePatchCall<'a, C>
4515 where
4516 T: AsRef<str>,
4517 {
4518 self._additional_params
4519 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4520 self
4521 }
4522
4523 /// Identifies the authorization scope for the method you are building.
4524 ///
4525 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4526 /// [`Scope::CloudPlatform`].
4527 ///
4528 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4529 /// tokens for more than one scope.
4530 ///
4531 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4532 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4533 /// sufficient, a read-write scope will do as well.
4534 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedCertificatePatchCall<'a, C>
4535 where
4536 St: AsRef<str>,
4537 {
4538 self._scopes.insert(String::from(scope.as_ref()));
4539 self
4540 }
4541 /// Identifies the authorization scope(s) for the method you are building.
4542 ///
4543 /// See [`Self::add_scope()`] for details.
4544 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedCertificatePatchCall<'a, C>
4545 where
4546 I: IntoIterator<Item = St>,
4547 St: AsRef<str>,
4548 {
4549 self._scopes
4550 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4551 self
4552 }
4553
4554 /// Removes all scopes, and no default scope will be used either.
4555 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4556 /// for details).
4557 pub fn clear_scopes(mut self) -> AppAuthorizedCertificatePatchCall<'a, C> {
4558 self._scopes.clear();
4559 self
4560 }
4561}
4562
4563/// Lists all domains the user is authorized to administer.
4564///
4565/// A builder for the *authorizedDomains.list* method supported by a *app* resource.
4566/// It is not used directly, but through a [`AppMethods`] instance.
4567///
4568/// # Example
4569///
4570/// Instantiate a resource method builder
4571///
4572/// ```test_harness,no_run
4573/// # extern crate hyper;
4574/// # extern crate hyper_rustls;
4575/// # extern crate google_appengine1 as appengine1;
4576/// # async fn dox() {
4577/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4578///
4579/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4580/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4581/// # secret,
4582/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4583/// # ).build().await.unwrap();
4584///
4585/// # let client = hyper_util::client::legacy::Client::builder(
4586/// # hyper_util::rt::TokioExecutor::new()
4587/// # )
4588/// # .build(
4589/// # hyper_rustls::HttpsConnectorBuilder::new()
4590/// # .with_native_roots()
4591/// # .unwrap()
4592/// # .https_or_http()
4593/// # .enable_http1()
4594/// # .build()
4595/// # );
4596/// # let mut hub = Appengine::new(client, auth);
4597/// // You can configure optional parameters by calling the respective setters at will, and
4598/// // execute the final call using `doit()`.
4599/// // Values shown here are possibly random and not representative !
4600/// let result = hub.apps().authorized_domains_list("appsId")
4601/// .page_token("ut")
4602/// .page_size(-12)
4603/// .doit().await;
4604/// # }
4605/// ```
4606pub struct AppAuthorizedDomainListCall<'a, C>
4607where
4608 C: 'a,
4609{
4610 hub: &'a Appengine<C>,
4611 _apps_id: String,
4612 _page_token: Option<String>,
4613 _page_size: Option<i32>,
4614 _delegate: Option<&'a mut dyn common::Delegate>,
4615 _additional_params: HashMap<String, String>,
4616 _scopes: BTreeSet<String>,
4617}
4618
4619impl<'a, C> common::CallBuilder for AppAuthorizedDomainListCall<'a, C> {}
4620
4621impl<'a, C> AppAuthorizedDomainListCall<'a, C>
4622where
4623 C: common::Connector,
4624{
4625 /// Perform the operation you have build so far.
4626 pub async fn doit(
4627 mut self,
4628 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
4629 use std::borrow::Cow;
4630 use std::io::{Read, Seek};
4631
4632 use common::{url::Params, ToParts};
4633 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4634
4635 let mut dd = common::DefaultDelegate;
4636 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4637 dlg.begin(common::MethodInfo {
4638 id: "appengine.apps.authorizedDomains.list",
4639 http_method: hyper::Method::GET,
4640 });
4641
4642 for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
4643 if self._additional_params.contains_key(field) {
4644 dlg.finished(false);
4645 return Err(common::Error::FieldClash(field));
4646 }
4647 }
4648
4649 let mut params = Params::with_capacity(5 + self._additional_params.len());
4650 params.push("appsId", self._apps_id);
4651 if let Some(value) = self._page_token.as_ref() {
4652 params.push("pageToken", value);
4653 }
4654 if let Some(value) = self._page_size.as_ref() {
4655 params.push("pageSize", value.to_string());
4656 }
4657
4658 params.extend(self._additional_params.iter());
4659
4660 params.push("alt", "json");
4661 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedDomains";
4662 if self._scopes.is_empty() {
4663 self._scopes.insert(Scope::Admin.as_ref().to_string());
4664 }
4665
4666 #[allow(clippy::single_element_loop)]
4667 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
4668 url = params.uri_replacement(url, param_name, find_this, false);
4669 }
4670 {
4671 let to_remove = ["appsId"];
4672 params.remove_params(&to_remove);
4673 }
4674
4675 let url = params.parse_with_url(&url);
4676
4677 loop {
4678 let token = match self
4679 .hub
4680 .auth
4681 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4682 .await
4683 {
4684 Ok(token) => token,
4685 Err(e) => match dlg.token(e) {
4686 Ok(token) => token,
4687 Err(e) => {
4688 dlg.finished(false);
4689 return Err(common::Error::MissingToken(e));
4690 }
4691 },
4692 };
4693 let mut req_result = {
4694 let client = &self.hub.client;
4695 dlg.pre_request();
4696 let mut req_builder = hyper::Request::builder()
4697 .method(hyper::Method::GET)
4698 .uri(url.as_str())
4699 .header(USER_AGENT, self.hub._user_agent.clone());
4700
4701 if let Some(token) = token.as_ref() {
4702 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4703 }
4704
4705 let request = req_builder
4706 .header(CONTENT_LENGTH, 0_u64)
4707 .body(common::to_body::<String>(None));
4708
4709 client.request(request.unwrap()).await
4710 };
4711
4712 match req_result {
4713 Err(err) => {
4714 if let common::Retry::After(d) = dlg.http_error(&err) {
4715 sleep(d).await;
4716 continue;
4717 }
4718 dlg.finished(false);
4719 return Err(common::Error::HttpError(err));
4720 }
4721 Ok(res) => {
4722 let (mut parts, body) = res.into_parts();
4723 let mut body = common::Body::new(body);
4724 if !parts.status.is_success() {
4725 let bytes = common::to_bytes(body).await.unwrap_or_default();
4726 let error = serde_json::from_str(&common::to_string(&bytes));
4727 let response = common::to_response(parts, bytes.into());
4728
4729 if let common::Retry::After(d) =
4730 dlg.http_failure(&response, error.as_ref().ok())
4731 {
4732 sleep(d).await;
4733 continue;
4734 }
4735
4736 dlg.finished(false);
4737
4738 return Err(match error {
4739 Ok(value) => common::Error::BadRequest(value),
4740 _ => common::Error::Failure(response),
4741 });
4742 }
4743 let response = {
4744 let bytes = common::to_bytes(body).await.unwrap_or_default();
4745 let encoded = common::to_string(&bytes);
4746 match serde_json::from_str(&encoded) {
4747 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4748 Err(error) => {
4749 dlg.response_json_decode_error(&encoded, &error);
4750 return Err(common::Error::JsonDecodeError(
4751 encoded.to_string(),
4752 error,
4753 ));
4754 }
4755 }
4756 };
4757
4758 dlg.finished(true);
4759 return Ok(response);
4760 }
4761 }
4762 }
4763 }
4764
4765 /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
4766 ///
4767 /// Sets the *apps id* path property to the given value.
4768 ///
4769 /// Even though the property as already been set when instantiating this call,
4770 /// we provide this method for API completeness.
4771 pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedDomainListCall<'a, C> {
4772 self._apps_id = new_value.to_string();
4773 self
4774 }
4775 /// Continuation token for fetching the next page of results.
4776 ///
4777 /// Sets the *page token* query property to the given value.
4778 pub fn page_token(mut self, new_value: &str) -> AppAuthorizedDomainListCall<'a, C> {
4779 self._page_token = Some(new_value.to_string());
4780 self
4781 }
4782 /// Maximum results to return per page.
4783 ///
4784 /// Sets the *page size* query property to the given value.
4785 pub fn page_size(mut self, new_value: i32) -> AppAuthorizedDomainListCall<'a, C> {
4786 self._page_size = Some(new_value);
4787 self
4788 }
4789 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4790 /// while executing the actual API request.
4791 ///
4792 /// ````text
4793 /// It should be used to handle progress information, and to implement a certain level of resilience.
4794 /// ````
4795 ///
4796 /// Sets the *delegate* property to the given value.
4797 pub fn delegate(
4798 mut self,
4799 new_value: &'a mut dyn common::Delegate,
4800 ) -> AppAuthorizedDomainListCall<'a, C> {
4801 self._delegate = Some(new_value);
4802 self
4803 }
4804
4805 /// Set any additional parameter of the query string used in the request.
4806 /// It should be used to set parameters which are not yet available through their own
4807 /// setters.
4808 ///
4809 /// Please note that this method must not be used to set any of the known parameters
4810 /// which have their own setter method. If done anyway, the request will fail.
4811 ///
4812 /// # Additional Parameters
4813 ///
4814 /// * *$.xgafv* (query-string) - V1 error format.
4815 /// * *access_token* (query-string) - OAuth access token.
4816 /// * *alt* (query-string) - Data format for response.
4817 /// * *callback* (query-string) - JSONP
4818 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4819 /// * *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.
4820 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4821 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4822 /// * *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.
4823 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4824 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4825 pub fn param<T>(mut self, name: T, value: T) -> AppAuthorizedDomainListCall<'a, C>
4826 where
4827 T: AsRef<str>,
4828 {
4829 self._additional_params
4830 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4831 self
4832 }
4833
4834 /// Identifies the authorization scope for the method you are building.
4835 ///
4836 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4837 /// [`Scope::Admin`].
4838 ///
4839 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4840 /// tokens for more than one scope.
4841 ///
4842 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4843 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4844 /// sufficient, a read-write scope will do as well.
4845 pub fn add_scope<St>(mut self, scope: St) -> AppAuthorizedDomainListCall<'a, C>
4846 where
4847 St: AsRef<str>,
4848 {
4849 self._scopes.insert(String::from(scope.as_ref()));
4850 self
4851 }
4852 /// Identifies the authorization scope(s) for the method you are building.
4853 ///
4854 /// See [`Self::add_scope()`] for details.
4855 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppAuthorizedDomainListCall<'a, C>
4856 where
4857 I: IntoIterator<Item = St>,
4858 St: AsRef<str>,
4859 {
4860 self._scopes
4861 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4862 self
4863 }
4864
4865 /// Removes all scopes, and no default scope will be used either.
4866 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4867 /// for details).
4868 pub fn clear_scopes(mut self) -> AppAuthorizedDomainListCall<'a, C> {
4869 self._scopes.clear();
4870 self
4871 }
4872}
4873
4874/// 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.
4875///
4876/// A builder for the *domainMappings.create* method supported by a *app* resource.
4877/// It is not used directly, but through a [`AppMethods`] instance.
4878///
4879/// # Example
4880///
4881/// Instantiate a resource method builder
4882///
4883/// ```test_harness,no_run
4884/// # extern crate hyper;
4885/// # extern crate hyper_rustls;
4886/// # extern crate google_appengine1 as appengine1;
4887/// use appengine1::api::DomainMapping;
4888/// # async fn dox() {
4889/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4890///
4891/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4892/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4893/// # secret,
4894/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4895/// # ).build().await.unwrap();
4896///
4897/// # let client = hyper_util::client::legacy::Client::builder(
4898/// # hyper_util::rt::TokioExecutor::new()
4899/// # )
4900/// # .build(
4901/// # hyper_rustls::HttpsConnectorBuilder::new()
4902/// # .with_native_roots()
4903/// # .unwrap()
4904/// # .https_or_http()
4905/// # .enable_http1()
4906/// # .build()
4907/// # );
4908/// # let mut hub = Appengine::new(client, auth);
4909/// // As the method needs a request, you would usually fill it with the desired information
4910/// // into the respective structure. Some of the parts shown here might not be applicable !
4911/// // Values shown here are possibly random and not representative !
4912/// let mut req = DomainMapping::default();
4913///
4914/// // You can configure optional parameters by calling the respective setters at will, and
4915/// // execute the final call using `doit()`.
4916/// // Values shown here are possibly random and not representative !
4917/// let result = hub.apps().domain_mappings_create(req, "appsId")
4918/// .override_strategy("est")
4919/// .doit().await;
4920/// # }
4921/// ```
4922pub struct AppDomainMappingCreateCall<'a, C>
4923where
4924 C: 'a,
4925{
4926 hub: &'a Appengine<C>,
4927 _request: DomainMapping,
4928 _apps_id: String,
4929 _override_strategy: Option<String>,
4930 _delegate: Option<&'a mut dyn common::Delegate>,
4931 _additional_params: HashMap<String, String>,
4932 _scopes: BTreeSet<String>,
4933}
4934
4935impl<'a, C> common::CallBuilder for AppDomainMappingCreateCall<'a, C> {}
4936
4937impl<'a, C> AppDomainMappingCreateCall<'a, C>
4938where
4939 C: common::Connector,
4940{
4941 /// Perform the operation you have build so far.
4942 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4943 use std::borrow::Cow;
4944 use std::io::{Read, Seek};
4945
4946 use common::{url::Params, ToParts};
4947 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4948
4949 let mut dd = common::DefaultDelegate;
4950 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4951 dlg.begin(common::MethodInfo {
4952 id: "appengine.apps.domainMappings.create",
4953 http_method: hyper::Method::POST,
4954 });
4955
4956 for &field in ["alt", "appsId", "overrideStrategy"].iter() {
4957 if self._additional_params.contains_key(field) {
4958 dlg.finished(false);
4959 return Err(common::Error::FieldClash(field));
4960 }
4961 }
4962
4963 let mut params = Params::with_capacity(5 + self._additional_params.len());
4964 params.push("appsId", self._apps_id);
4965 if let Some(value) = self._override_strategy.as_ref() {
4966 params.push("overrideStrategy", value);
4967 }
4968
4969 params.extend(self._additional_params.iter());
4970
4971 params.push("alt", "json");
4972 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings";
4973 if self._scopes.is_empty() {
4974 self._scopes
4975 .insert(Scope::CloudPlatform.as_ref().to_string());
4976 }
4977
4978 #[allow(clippy::single_element_loop)]
4979 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
4980 url = params.uri_replacement(url, param_name, find_this, false);
4981 }
4982 {
4983 let to_remove = ["appsId"];
4984 params.remove_params(&to_remove);
4985 }
4986
4987 let url = params.parse_with_url(&url);
4988
4989 let mut json_mime_type = mime::APPLICATION_JSON;
4990 let mut request_value_reader = {
4991 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4992 common::remove_json_null_values(&mut value);
4993 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4994 serde_json::to_writer(&mut dst, &value).unwrap();
4995 dst
4996 };
4997 let request_size = request_value_reader
4998 .seek(std::io::SeekFrom::End(0))
4999 .unwrap();
5000 request_value_reader
5001 .seek(std::io::SeekFrom::Start(0))
5002 .unwrap();
5003
5004 loop {
5005 let token = match self
5006 .hub
5007 .auth
5008 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5009 .await
5010 {
5011 Ok(token) => token,
5012 Err(e) => match dlg.token(e) {
5013 Ok(token) => token,
5014 Err(e) => {
5015 dlg.finished(false);
5016 return Err(common::Error::MissingToken(e));
5017 }
5018 },
5019 };
5020 request_value_reader
5021 .seek(std::io::SeekFrom::Start(0))
5022 .unwrap();
5023 let mut req_result = {
5024 let client = &self.hub.client;
5025 dlg.pre_request();
5026 let mut req_builder = hyper::Request::builder()
5027 .method(hyper::Method::POST)
5028 .uri(url.as_str())
5029 .header(USER_AGENT, self.hub._user_agent.clone());
5030
5031 if let Some(token) = token.as_ref() {
5032 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5033 }
5034
5035 let request = req_builder
5036 .header(CONTENT_TYPE, json_mime_type.to_string())
5037 .header(CONTENT_LENGTH, request_size as u64)
5038 .body(common::to_body(
5039 request_value_reader.get_ref().clone().into(),
5040 ));
5041
5042 client.request(request.unwrap()).await
5043 };
5044
5045 match req_result {
5046 Err(err) => {
5047 if let common::Retry::After(d) = dlg.http_error(&err) {
5048 sleep(d).await;
5049 continue;
5050 }
5051 dlg.finished(false);
5052 return Err(common::Error::HttpError(err));
5053 }
5054 Ok(res) => {
5055 let (mut parts, body) = res.into_parts();
5056 let mut body = common::Body::new(body);
5057 if !parts.status.is_success() {
5058 let bytes = common::to_bytes(body).await.unwrap_or_default();
5059 let error = serde_json::from_str(&common::to_string(&bytes));
5060 let response = common::to_response(parts, bytes.into());
5061
5062 if let common::Retry::After(d) =
5063 dlg.http_failure(&response, error.as_ref().ok())
5064 {
5065 sleep(d).await;
5066 continue;
5067 }
5068
5069 dlg.finished(false);
5070
5071 return Err(match error {
5072 Ok(value) => common::Error::BadRequest(value),
5073 _ => common::Error::Failure(response),
5074 });
5075 }
5076 let response = {
5077 let bytes = common::to_bytes(body).await.unwrap_or_default();
5078 let encoded = common::to_string(&bytes);
5079 match serde_json::from_str(&encoded) {
5080 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5081 Err(error) => {
5082 dlg.response_json_decode_error(&encoded, &error);
5083 return Err(common::Error::JsonDecodeError(
5084 encoded.to_string(),
5085 error,
5086 ));
5087 }
5088 }
5089 };
5090
5091 dlg.finished(true);
5092 return Ok(response);
5093 }
5094 }
5095 }
5096 }
5097
5098 ///
5099 /// Sets the *request* property to the given value.
5100 ///
5101 /// Even though the property as already been set when instantiating this call,
5102 /// we provide this method for API completeness.
5103 pub fn request(mut self, new_value: DomainMapping) -> AppDomainMappingCreateCall<'a, C> {
5104 self._request = new_value;
5105 self
5106 }
5107 /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
5108 ///
5109 /// Sets the *apps id* path property to the given value.
5110 ///
5111 /// Even though the property as already been set when instantiating this call,
5112 /// we provide this method for API completeness.
5113 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingCreateCall<'a, C> {
5114 self._apps_id = new_value.to_string();
5115 self
5116 }
5117 /// Whether the domain creation should override any existing mappings for this domain. By default, overrides are rejected.
5118 ///
5119 /// Sets the *override strategy* query property to the given value.
5120 pub fn override_strategy(mut self, new_value: &str) -> AppDomainMappingCreateCall<'a, C> {
5121 self._override_strategy = Some(new_value.to_string());
5122 self
5123 }
5124 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5125 /// while executing the actual API request.
5126 ///
5127 /// ````text
5128 /// It should be used to handle progress information, and to implement a certain level of resilience.
5129 /// ````
5130 ///
5131 /// Sets the *delegate* property to the given value.
5132 pub fn delegate(
5133 mut self,
5134 new_value: &'a mut dyn common::Delegate,
5135 ) -> AppDomainMappingCreateCall<'a, C> {
5136 self._delegate = Some(new_value);
5137 self
5138 }
5139
5140 /// Set any additional parameter of the query string used in the request.
5141 /// It should be used to set parameters which are not yet available through their own
5142 /// setters.
5143 ///
5144 /// Please note that this method must not be used to set any of the known parameters
5145 /// which have their own setter method. If done anyway, the request will fail.
5146 ///
5147 /// # Additional Parameters
5148 ///
5149 /// * *$.xgafv* (query-string) - V1 error format.
5150 /// * *access_token* (query-string) - OAuth access token.
5151 /// * *alt* (query-string) - Data format for response.
5152 /// * *callback* (query-string) - JSONP
5153 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5154 /// * *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.
5155 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5156 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5157 /// * *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.
5158 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5159 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5160 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingCreateCall<'a, C>
5161 where
5162 T: AsRef<str>,
5163 {
5164 self._additional_params
5165 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5166 self
5167 }
5168
5169 /// Identifies the authorization scope for the method you are building.
5170 ///
5171 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5172 /// [`Scope::CloudPlatform`].
5173 ///
5174 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5175 /// tokens for more than one scope.
5176 ///
5177 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5178 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5179 /// sufficient, a read-write scope will do as well.
5180 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingCreateCall<'a, C>
5181 where
5182 St: AsRef<str>,
5183 {
5184 self._scopes.insert(String::from(scope.as_ref()));
5185 self
5186 }
5187 /// Identifies the authorization scope(s) for the method you are building.
5188 ///
5189 /// See [`Self::add_scope()`] for details.
5190 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingCreateCall<'a, C>
5191 where
5192 I: IntoIterator<Item = St>,
5193 St: AsRef<str>,
5194 {
5195 self._scopes
5196 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5197 self
5198 }
5199
5200 /// Removes all scopes, and no default scope will be used either.
5201 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5202 /// for details).
5203 pub fn clear_scopes(mut self) -> AppDomainMappingCreateCall<'a, C> {
5204 self._scopes.clear();
5205 self
5206 }
5207}
5208
5209/// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource.
5210///
5211/// A builder for the *domainMappings.delete* method supported by a *app* resource.
5212/// It is not used directly, but through a [`AppMethods`] instance.
5213///
5214/// # Example
5215///
5216/// Instantiate a resource method builder
5217///
5218/// ```test_harness,no_run
5219/// # extern crate hyper;
5220/// # extern crate hyper_rustls;
5221/// # extern crate google_appengine1 as appengine1;
5222/// # async fn dox() {
5223/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5224///
5225/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5227/// # secret,
5228/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5229/// # ).build().await.unwrap();
5230///
5231/// # let client = hyper_util::client::legacy::Client::builder(
5232/// # hyper_util::rt::TokioExecutor::new()
5233/// # )
5234/// # .build(
5235/// # hyper_rustls::HttpsConnectorBuilder::new()
5236/// # .with_native_roots()
5237/// # .unwrap()
5238/// # .https_or_http()
5239/// # .enable_http1()
5240/// # .build()
5241/// # );
5242/// # let mut hub = Appengine::new(client, auth);
5243/// // You can configure optional parameters by calling the respective setters at will, and
5244/// // execute the final call using `doit()`.
5245/// // Values shown here are possibly random and not representative !
5246/// let result = hub.apps().domain_mappings_delete("appsId", "domainMappingsId")
5247/// .doit().await;
5248/// # }
5249/// ```
5250pub struct AppDomainMappingDeleteCall<'a, C>
5251where
5252 C: 'a,
5253{
5254 hub: &'a Appengine<C>,
5255 _apps_id: String,
5256 _domain_mappings_id: String,
5257 _delegate: Option<&'a mut dyn common::Delegate>,
5258 _additional_params: HashMap<String, String>,
5259 _scopes: BTreeSet<String>,
5260}
5261
5262impl<'a, C> common::CallBuilder for AppDomainMappingDeleteCall<'a, C> {}
5263
5264impl<'a, C> AppDomainMappingDeleteCall<'a, C>
5265where
5266 C: common::Connector,
5267{
5268 /// Perform the operation you have build so far.
5269 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5270 use std::borrow::Cow;
5271 use std::io::{Read, Seek};
5272
5273 use common::{url::Params, ToParts};
5274 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5275
5276 let mut dd = common::DefaultDelegate;
5277 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5278 dlg.begin(common::MethodInfo {
5279 id: "appengine.apps.domainMappings.delete",
5280 http_method: hyper::Method::DELETE,
5281 });
5282
5283 for &field in ["alt", "appsId", "domainMappingsId"].iter() {
5284 if self._additional_params.contains_key(field) {
5285 dlg.finished(false);
5286 return Err(common::Error::FieldClash(field));
5287 }
5288 }
5289
5290 let mut params = Params::with_capacity(4 + self._additional_params.len());
5291 params.push("appsId", self._apps_id);
5292 params.push("domainMappingsId", self._domain_mappings_id);
5293
5294 params.extend(self._additional_params.iter());
5295
5296 params.push("alt", "json");
5297 let mut url =
5298 self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}";
5299 if self._scopes.is_empty() {
5300 self._scopes
5301 .insert(Scope::CloudPlatform.as_ref().to_string());
5302 }
5303
5304 #[allow(clippy::single_element_loop)]
5305 for &(find_this, param_name) in [
5306 ("{appsId}", "appsId"),
5307 ("{domainMappingsId}", "domainMappingsId"),
5308 ]
5309 .iter()
5310 {
5311 url = params.uri_replacement(url, param_name, find_this, false);
5312 }
5313 {
5314 let to_remove = ["domainMappingsId", "appsId"];
5315 params.remove_params(&to_remove);
5316 }
5317
5318 let url = params.parse_with_url(&url);
5319
5320 loop {
5321 let token = match self
5322 .hub
5323 .auth
5324 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5325 .await
5326 {
5327 Ok(token) => token,
5328 Err(e) => match dlg.token(e) {
5329 Ok(token) => token,
5330 Err(e) => {
5331 dlg.finished(false);
5332 return Err(common::Error::MissingToken(e));
5333 }
5334 },
5335 };
5336 let mut req_result = {
5337 let client = &self.hub.client;
5338 dlg.pre_request();
5339 let mut req_builder = hyper::Request::builder()
5340 .method(hyper::Method::DELETE)
5341 .uri(url.as_str())
5342 .header(USER_AGENT, self.hub._user_agent.clone());
5343
5344 if let Some(token) = token.as_ref() {
5345 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5346 }
5347
5348 let request = req_builder
5349 .header(CONTENT_LENGTH, 0_u64)
5350 .body(common::to_body::<String>(None));
5351
5352 client.request(request.unwrap()).await
5353 };
5354
5355 match req_result {
5356 Err(err) => {
5357 if let common::Retry::After(d) = dlg.http_error(&err) {
5358 sleep(d).await;
5359 continue;
5360 }
5361 dlg.finished(false);
5362 return Err(common::Error::HttpError(err));
5363 }
5364 Ok(res) => {
5365 let (mut parts, body) = res.into_parts();
5366 let mut body = common::Body::new(body);
5367 if !parts.status.is_success() {
5368 let bytes = common::to_bytes(body).await.unwrap_or_default();
5369 let error = serde_json::from_str(&common::to_string(&bytes));
5370 let response = common::to_response(parts, bytes.into());
5371
5372 if let common::Retry::After(d) =
5373 dlg.http_failure(&response, error.as_ref().ok())
5374 {
5375 sleep(d).await;
5376 continue;
5377 }
5378
5379 dlg.finished(false);
5380
5381 return Err(match error {
5382 Ok(value) => common::Error::BadRequest(value),
5383 _ => common::Error::Failure(response),
5384 });
5385 }
5386 let response = {
5387 let bytes = common::to_bytes(body).await.unwrap_or_default();
5388 let encoded = common::to_string(&bytes);
5389 match serde_json::from_str(&encoded) {
5390 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5391 Err(error) => {
5392 dlg.response_json_decode_error(&encoded, &error);
5393 return Err(common::Error::JsonDecodeError(
5394 encoded.to_string(),
5395 error,
5396 ));
5397 }
5398 }
5399 };
5400
5401 dlg.finished(true);
5402 return Ok(response);
5403 }
5404 }
5405 }
5406 }
5407
5408 /// Part of `name`. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com.
5409 ///
5410 /// Sets the *apps id* path property to the given value.
5411 ///
5412 /// Even though the property as already been set when instantiating this call,
5413 /// we provide this method for API completeness.
5414 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingDeleteCall<'a, C> {
5415 self._apps_id = new_value.to_string();
5416 self
5417 }
5418 /// Part of `name`. See documentation of `appsId`.
5419 ///
5420 /// Sets the *domain mappings id* path property to the given value.
5421 ///
5422 /// Even though the property as already been set when instantiating this call,
5423 /// we provide this method for API completeness.
5424 pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingDeleteCall<'a, C> {
5425 self._domain_mappings_id = new_value.to_string();
5426 self
5427 }
5428 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5429 /// while executing the actual API request.
5430 ///
5431 /// ````text
5432 /// It should be used to handle progress information, and to implement a certain level of resilience.
5433 /// ````
5434 ///
5435 /// Sets the *delegate* property to the given value.
5436 pub fn delegate(
5437 mut self,
5438 new_value: &'a mut dyn common::Delegate,
5439 ) -> AppDomainMappingDeleteCall<'a, C> {
5440 self._delegate = Some(new_value);
5441 self
5442 }
5443
5444 /// Set any additional parameter of the query string used in the request.
5445 /// It should be used to set parameters which are not yet available through their own
5446 /// setters.
5447 ///
5448 /// Please note that this method must not be used to set any of the known parameters
5449 /// which have their own setter method. If done anyway, the request will fail.
5450 ///
5451 /// # Additional Parameters
5452 ///
5453 /// * *$.xgafv* (query-string) - V1 error format.
5454 /// * *access_token* (query-string) - OAuth access token.
5455 /// * *alt* (query-string) - Data format for response.
5456 /// * *callback* (query-string) - JSONP
5457 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5458 /// * *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.
5459 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5460 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5461 /// * *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.
5462 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5463 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5464 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingDeleteCall<'a, C>
5465 where
5466 T: AsRef<str>,
5467 {
5468 self._additional_params
5469 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5470 self
5471 }
5472
5473 /// Identifies the authorization scope for the method you are building.
5474 ///
5475 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5476 /// [`Scope::CloudPlatform`].
5477 ///
5478 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5479 /// tokens for more than one scope.
5480 ///
5481 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5482 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5483 /// sufficient, a read-write scope will do as well.
5484 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingDeleteCall<'a, C>
5485 where
5486 St: AsRef<str>,
5487 {
5488 self._scopes.insert(String::from(scope.as_ref()));
5489 self
5490 }
5491 /// Identifies the authorization scope(s) for the method you are building.
5492 ///
5493 /// See [`Self::add_scope()`] for details.
5494 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingDeleteCall<'a, C>
5495 where
5496 I: IntoIterator<Item = St>,
5497 St: AsRef<str>,
5498 {
5499 self._scopes
5500 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5501 self
5502 }
5503
5504 /// Removes all scopes, and no default scope will be used either.
5505 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5506 /// for details).
5507 pub fn clear_scopes(mut self) -> AppDomainMappingDeleteCall<'a, C> {
5508 self._scopes.clear();
5509 self
5510 }
5511}
5512
5513/// Gets the specified domain mapping.
5514///
5515/// A builder for the *domainMappings.get* method supported by a *app* resource.
5516/// It is not used directly, but through a [`AppMethods`] instance.
5517///
5518/// # Example
5519///
5520/// Instantiate a resource method builder
5521///
5522/// ```test_harness,no_run
5523/// # extern crate hyper;
5524/// # extern crate hyper_rustls;
5525/// # extern crate google_appengine1 as appengine1;
5526/// # async fn dox() {
5527/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5528///
5529/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5530/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5531/// # secret,
5532/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5533/// # ).build().await.unwrap();
5534///
5535/// # let client = hyper_util::client::legacy::Client::builder(
5536/// # hyper_util::rt::TokioExecutor::new()
5537/// # )
5538/// # .build(
5539/// # hyper_rustls::HttpsConnectorBuilder::new()
5540/// # .with_native_roots()
5541/// # .unwrap()
5542/// # .https_or_http()
5543/// # .enable_http1()
5544/// # .build()
5545/// # );
5546/// # let mut hub = Appengine::new(client, auth);
5547/// // You can configure optional parameters by calling the respective setters at will, and
5548/// // execute the final call using `doit()`.
5549/// // Values shown here are possibly random and not representative !
5550/// let result = hub.apps().domain_mappings_get("appsId", "domainMappingsId")
5551/// .doit().await;
5552/// # }
5553/// ```
5554pub struct AppDomainMappingGetCall<'a, C>
5555where
5556 C: 'a,
5557{
5558 hub: &'a Appengine<C>,
5559 _apps_id: String,
5560 _domain_mappings_id: String,
5561 _delegate: Option<&'a mut dyn common::Delegate>,
5562 _additional_params: HashMap<String, String>,
5563 _scopes: BTreeSet<String>,
5564}
5565
5566impl<'a, C> common::CallBuilder for AppDomainMappingGetCall<'a, C> {}
5567
5568impl<'a, C> AppDomainMappingGetCall<'a, C>
5569where
5570 C: common::Connector,
5571{
5572 /// Perform the operation you have build so far.
5573 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
5574 use std::borrow::Cow;
5575 use std::io::{Read, Seek};
5576
5577 use common::{url::Params, ToParts};
5578 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5579
5580 let mut dd = common::DefaultDelegate;
5581 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5582 dlg.begin(common::MethodInfo {
5583 id: "appengine.apps.domainMappings.get",
5584 http_method: hyper::Method::GET,
5585 });
5586
5587 for &field in ["alt", "appsId", "domainMappingsId"].iter() {
5588 if self._additional_params.contains_key(field) {
5589 dlg.finished(false);
5590 return Err(common::Error::FieldClash(field));
5591 }
5592 }
5593
5594 let mut params = Params::with_capacity(4 + self._additional_params.len());
5595 params.push("appsId", self._apps_id);
5596 params.push("domainMappingsId", self._domain_mappings_id);
5597
5598 params.extend(self._additional_params.iter());
5599
5600 params.push("alt", "json");
5601 let mut url =
5602 self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}";
5603 if self._scopes.is_empty() {
5604 self._scopes.insert(Scope::Admin.as_ref().to_string());
5605 }
5606
5607 #[allow(clippy::single_element_loop)]
5608 for &(find_this, param_name) in [
5609 ("{appsId}", "appsId"),
5610 ("{domainMappingsId}", "domainMappingsId"),
5611 ]
5612 .iter()
5613 {
5614 url = params.uri_replacement(url, param_name, find_this, false);
5615 }
5616 {
5617 let to_remove = ["domainMappingsId", "appsId"];
5618 params.remove_params(&to_remove);
5619 }
5620
5621 let url = params.parse_with_url(&url);
5622
5623 loop {
5624 let token = match self
5625 .hub
5626 .auth
5627 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5628 .await
5629 {
5630 Ok(token) => token,
5631 Err(e) => match dlg.token(e) {
5632 Ok(token) => token,
5633 Err(e) => {
5634 dlg.finished(false);
5635 return Err(common::Error::MissingToken(e));
5636 }
5637 },
5638 };
5639 let mut req_result = {
5640 let client = &self.hub.client;
5641 dlg.pre_request();
5642 let mut req_builder = hyper::Request::builder()
5643 .method(hyper::Method::GET)
5644 .uri(url.as_str())
5645 .header(USER_AGENT, self.hub._user_agent.clone());
5646
5647 if let Some(token) = token.as_ref() {
5648 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5649 }
5650
5651 let request = req_builder
5652 .header(CONTENT_LENGTH, 0_u64)
5653 .body(common::to_body::<String>(None));
5654
5655 client.request(request.unwrap()).await
5656 };
5657
5658 match req_result {
5659 Err(err) => {
5660 if let common::Retry::After(d) = dlg.http_error(&err) {
5661 sleep(d).await;
5662 continue;
5663 }
5664 dlg.finished(false);
5665 return Err(common::Error::HttpError(err));
5666 }
5667 Ok(res) => {
5668 let (mut parts, body) = res.into_parts();
5669 let mut body = common::Body::new(body);
5670 if !parts.status.is_success() {
5671 let bytes = common::to_bytes(body).await.unwrap_or_default();
5672 let error = serde_json::from_str(&common::to_string(&bytes));
5673 let response = common::to_response(parts, bytes.into());
5674
5675 if let common::Retry::After(d) =
5676 dlg.http_failure(&response, error.as_ref().ok())
5677 {
5678 sleep(d).await;
5679 continue;
5680 }
5681
5682 dlg.finished(false);
5683
5684 return Err(match error {
5685 Ok(value) => common::Error::BadRequest(value),
5686 _ => common::Error::Failure(response),
5687 });
5688 }
5689 let response = {
5690 let bytes = common::to_bytes(body).await.unwrap_or_default();
5691 let encoded = common::to_string(&bytes);
5692 match serde_json::from_str(&encoded) {
5693 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5694 Err(error) => {
5695 dlg.response_json_decode_error(&encoded, &error);
5696 return Err(common::Error::JsonDecodeError(
5697 encoded.to_string(),
5698 error,
5699 ));
5700 }
5701 }
5702 };
5703
5704 dlg.finished(true);
5705 return Ok(response);
5706 }
5707 }
5708 }
5709 }
5710
5711 /// Part of `name`. Name of the resource requested. Example: apps/myapp/domainMappings/example.com.
5712 ///
5713 /// Sets the *apps id* path property to the given value.
5714 ///
5715 /// Even though the property as already been set when instantiating this call,
5716 /// we provide this method for API completeness.
5717 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingGetCall<'a, C> {
5718 self._apps_id = new_value.to_string();
5719 self
5720 }
5721 /// Part of `name`. See documentation of `appsId`.
5722 ///
5723 /// Sets the *domain mappings id* path property to the given value.
5724 ///
5725 /// Even though the property as already been set when instantiating this call,
5726 /// we provide this method for API completeness.
5727 pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingGetCall<'a, C> {
5728 self._domain_mappings_id = new_value.to_string();
5729 self
5730 }
5731 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5732 /// while executing the actual API request.
5733 ///
5734 /// ````text
5735 /// It should be used to handle progress information, and to implement a certain level of resilience.
5736 /// ````
5737 ///
5738 /// Sets the *delegate* property to the given value.
5739 pub fn delegate(
5740 mut self,
5741 new_value: &'a mut dyn common::Delegate,
5742 ) -> AppDomainMappingGetCall<'a, C> {
5743 self._delegate = Some(new_value);
5744 self
5745 }
5746
5747 /// Set any additional parameter of the query string used in the request.
5748 /// It should be used to set parameters which are not yet available through their own
5749 /// setters.
5750 ///
5751 /// Please note that this method must not be used to set any of the known parameters
5752 /// which have their own setter method. If done anyway, the request will fail.
5753 ///
5754 /// # Additional Parameters
5755 ///
5756 /// * *$.xgafv* (query-string) - V1 error format.
5757 /// * *access_token* (query-string) - OAuth access token.
5758 /// * *alt* (query-string) - Data format for response.
5759 /// * *callback* (query-string) - JSONP
5760 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5761 /// * *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.
5762 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5763 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5764 /// * *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.
5765 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5766 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5767 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingGetCall<'a, C>
5768 where
5769 T: AsRef<str>,
5770 {
5771 self._additional_params
5772 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5773 self
5774 }
5775
5776 /// Identifies the authorization scope for the method you are building.
5777 ///
5778 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5779 /// [`Scope::Admin`].
5780 ///
5781 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5782 /// tokens for more than one scope.
5783 ///
5784 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5785 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5786 /// sufficient, a read-write scope will do as well.
5787 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingGetCall<'a, C>
5788 where
5789 St: AsRef<str>,
5790 {
5791 self._scopes.insert(String::from(scope.as_ref()));
5792 self
5793 }
5794 /// Identifies the authorization scope(s) for the method you are building.
5795 ///
5796 /// See [`Self::add_scope()`] for details.
5797 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingGetCall<'a, C>
5798 where
5799 I: IntoIterator<Item = St>,
5800 St: AsRef<str>,
5801 {
5802 self._scopes
5803 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5804 self
5805 }
5806
5807 /// Removes all scopes, and no default scope will be used either.
5808 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5809 /// for details).
5810 pub fn clear_scopes(mut self) -> AppDomainMappingGetCall<'a, C> {
5811 self._scopes.clear();
5812 self
5813 }
5814}
5815
5816/// Lists the domain mappings on an application.
5817///
5818/// A builder for the *domainMappings.list* method supported by a *app* resource.
5819/// It is not used directly, but through a [`AppMethods`] instance.
5820///
5821/// # Example
5822///
5823/// Instantiate a resource method builder
5824///
5825/// ```test_harness,no_run
5826/// # extern crate hyper;
5827/// # extern crate hyper_rustls;
5828/// # extern crate google_appengine1 as appengine1;
5829/// # async fn dox() {
5830/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5831///
5832/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5833/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5834/// # secret,
5835/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5836/// # ).build().await.unwrap();
5837///
5838/// # let client = hyper_util::client::legacy::Client::builder(
5839/// # hyper_util::rt::TokioExecutor::new()
5840/// # )
5841/// # .build(
5842/// # hyper_rustls::HttpsConnectorBuilder::new()
5843/// # .with_native_roots()
5844/// # .unwrap()
5845/// # .https_or_http()
5846/// # .enable_http1()
5847/// # .build()
5848/// # );
5849/// # let mut hub = Appengine::new(client, auth);
5850/// // You can configure optional parameters by calling the respective setters at will, and
5851/// // execute the final call using `doit()`.
5852/// // Values shown here are possibly random and not representative !
5853/// let result = hub.apps().domain_mappings_list("appsId")
5854/// .page_token("dolor")
5855/// .page_size(-56)
5856/// .doit().await;
5857/// # }
5858/// ```
5859pub struct AppDomainMappingListCall<'a, C>
5860where
5861 C: 'a,
5862{
5863 hub: &'a Appengine<C>,
5864 _apps_id: String,
5865 _page_token: Option<String>,
5866 _page_size: Option<i32>,
5867 _delegate: Option<&'a mut dyn common::Delegate>,
5868 _additional_params: HashMap<String, String>,
5869 _scopes: BTreeSet<String>,
5870}
5871
5872impl<'a, C> common::CallBuilder for AppDomainMappingListCall<'a, C> {}
5873
5874impl<'a, C> AppDomainMappingListCall<'a, C>
5875where
5876 C: common::Connector,
5877{
5878 /// Perform the operation you have build so far.
5879 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainMappingsResponse)> {
5880 use std::borrow::Cow;
5881 use std::io::{Read, Seek};
5882
5883 use common::{url::Params, ToParts};
5884 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5885
5886 let mut dd = common::DefaultDelegate;
5887 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5888 dlg.begin(common::MethodInfo {
5889 id: "appengine.apps.domainMappings.list",
5890 http_method: hyper::Method::GET,
5891 });
5892
5893 for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
5894 if self._additional_params.contains_key(field) {
5895 dlg.finished(false);
5896 return Err(common::Error::FieldClash(field));
5897 }
5898 }
5899
5900 let mut params = Params::with_capacity(5 + self._additional_params.len());
5901 params.push("appsId", self._apps_id);
5902 if let Some(value) = self._page_token.as_ref() {
5903 params.push("pageToken", value);
5904 }
5905 if let Some(value) = self._page_size.as_ref() {
5906 params.push("pageSize", value.to_string());
5907 }
5908
5909 params.extend(self._additional_params.iter());
5910
5911 params.push("alt", "json");
5912 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings";
5913 if self._scopes.is_empty() {
5914 self._scopes.insert(Scope::Admin.as_ref().to_string());
5915 }
5916
5917 #[allow(clippy::single_element_loop)]
5918 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
5919 url = params.uri_replacement(url, param_name, find_this, false);
5920 }
5921 {
5922 let to_remove = ["appsId"];
5923 params.remove_params(&to_remove);
5924 }
5925
5926 let url = params.parse_with_url(&url);
5927
5928 loop {
5929 let token = match self
5930 .hub
5931 .auth
5932 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5933 .await
5934 {
5935 Ok(token) => token,
5936 Err(e) => match dlg.token(e) {
5937 Ok(token) => token,
5938 Err(e) => {
5939 dlg.finished(false);
5940 return Err(common::Error::MissingToken(e));
5941 }
5942 },
5943 };
5944 let mut req_result = {
5945 let client = &self.hub.client;
5946 dlg.pre_request();
5947 let mut req_builder = hyper::Request::builder()
5948 .method(hyper::Method::GET)
5949 .uri(url.as_str())
5950 .header(USER_AGENT, self.hub._user_agent.clone());
5951
5952 if let Some(token) = token.as_ref() {
5953 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5954 }
5955
5956 let request = req_builder
5957 .header(CONTENT_LENGTH, 0_u64)
5958 .body(common::to_body::<String>(None));
5959
5960 client.request(request.unwrap()).await
5961 };
5962
5963 match req_result {
5964 Err(err) => {
5965 if let common::Retry::After(d) = dlg.http_error(&err) {
5966 sleep(d).await;
5967 continue;
5968 }
5969 dlg.finished(false);
5970 return Err(common::Error::HttpError(err));
5971 }
5972 Ok(res) => {
5973 let (mut parts, body) = res.into_parts();
5974 let mut body = common::Body::new(body);
5975 if !parts.status.is_success() {
5976 let bytes = common::to_bytes(body).await.unwrap_or_default();
5977 let error = serde_json::from_str(&common::to_string(&bytes));
5978 let response = common::to_response(parts, bytes.into());
5979
5980 if let common::Retry::After(d) =
5981 dlg.http_failure(&response, error.as_ref().ok())
5982 {
5983 sleep(d).await;
5984 continue;
5985 }
5986
5987 dlg.finished(false);
5988
5989 return Err(match error {
5990 Ok(value) => common::Error::BadRequest(value),
5991 _ => common::Error::Failure(response),
5992 });
5993 }
5994 let response = {
5995 let bytes = common::to_bytes(body).await.unwrap_or_default();
5996 let encoded = common::to_string(&bytes);
5997 match serde_json::from_str(&encoded) {
5998 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5999 Err(error) => {
6000 dlg.response_json_decode_error(&encoded, &error);
6001 return Err(common::Error::JsonDecodeError(
6002 encoded.to_string(),
6003 error,
6004 ));
6005 }
6006 }
6007 };
6008
6009 dlg.finished(true);
6010 return Ok(response);
6011 }
6012 }
6013 }
6014 }
6015
6016 /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
6017 ///
6018 /// Sets the *apps id* path property to the given value.
6019 ///
6020 /// Even though the property as already been set when instantiating this call,
6021 /// we provide this method for API completeness.
6022 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingListCall<'a, C> {
6023 self._apps_id = new_value.to_string();
6024 self
6025 }
6026 /// Continuation token for fetching the next page of results.
6027 ///
6028 /// Sets the *page token* query property to the given value.
6029 pub fn page_token(mut self, new_value: &str) -> AppDomainMappingListCall<'a, C> {
6030 self._page_token = Some(new_value.to_string());
6031 self
6032 }
6033 /// Maximum results to return per page.
6034 ///
6035 /// Sets the *page size* query property to the given value.
6036 pub fn page_size(mut self, new_value: i32) -> AppDomainMappingListCall<'a, C> {
6037 self._page_size = Some(new_value);
6038 self
6039 }
6040 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6041 /// while executing the actual API request.
6042 ///
6043 /// ````text
6044 /// It should be used to handle progress information, and to implement a certain level of resilience.
6045 /// ````
6046 ///
6047 /// Sets the *delegate* property to the given value.
6048 pub fn delegate(
6049 mut self,
6050 new_value: &'a mut dyn common::Delegate,
6051 ) -> AppDomainMappingListCall<'a, C> {
6052 self._delegate = Some(new_value);
6053 self
6054 }
6055
6056 /// Set any additional parameter of the query string used in the request.
6057 /// It should be used to set parameters which are not yet available through their own
6058 /// setters.
6059 ///
6060 /// Please note that this method must not be used to set any of the known parameters
6061 /// which have their own setter method. If done anyway, the request will fail.
6062 ///
6063 /// # Additional Parameters
6064 ///
6065 /// * *$.xgafv* (query-string) - V1 error format.
6066 /// * *access_token* (query-string) - OAuth access token.
6067 /// * *alt* (query-string) - Data format for response.
6068 /// * *callback* (query-string) - JSONP
6069 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6070 /// * *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.
6071 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6072 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6073 /// * *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.
6074 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6075 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6076 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingListCall<'a, C>
6077 where
6078 T: AsRef<str>,
6079 {
6080 self._additional_params
6081 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6082 self
6083 }
6084
6085 /// Identifies the authorization scope for the method you are building.
6086 ///
6087 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6088 /// [`Scope::Admin`].
6089 ///
6090 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6091 /// tokens for more than one scope.
6092 ///
6093 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6094 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6095 /// sufficient, a read-write scope will do as well.
6096 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingListCall<'a, C>
6097 where
6098 St: AsRef<str>,
6099 {
6100 self._scopes.insert(String::from(scope.as_ref()));
6101 self
6102 }
6103 /// Identifies the authorization scope(s) for the method you are building.
6104 ///
6105 /// See [`Self::add_scope()`] for details.
6106 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingListCall<'a, C>
6107 where
6108 I: IntoIterator<Item = St>,
6109 St: AsRef<str>,
6110 {
6111 self._scopes
6112 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6113 self
6114 }
6115
6116 /// Removes all scopes, and no default scope will be used either.
6117 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6118 /// for details).
6119 pub fn clear_scopes(mut self) -> AppDomainMappingListCall<'a, C> {
6120 self._scopes.clear();
6121 self
6122 }
6123}
6124
6125/// 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.
6126///
6127/// A builder for the *domainMappings.patch* method supported by a *app* resource.
6128/// It is not used directly, but through a [`AppMethods`] instance.
6129///
6130/// # Example
6131///
6132/// Instantiate a resource method builder
6133///
6134/// ```test_harness,no_run
6135/// # extern crate hyper;
6136/// # extern crate hyper_rustls;
6137/// # extern crate google_appengine1 as appengine1;
6138/// use appengine1::api::DomainMapping;
6139/// # async fn dox() {
6140/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6141///
6142/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6143/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6144/// # secret,
6145/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6146/// # ).build().await.unwrap();
6147///
6148/// # let client = hyper_util::client::legacy::Client::builder(
6149/// # hyper_util::rt::TokioExecutor::new()
6150/// # )
6151/// # .build(
6152/// # hyper_rustls::HttpsConnectorBuilder::new()
6153/// # .with_native_roots()
6154/// # .unwrap()
6155/// # .https_or_http()
6156/// # .enable_http1()
6157/// # .build()
6158/// # );
6159/// # let mut hub = Appengine::new(client, auth);
6160/// // As the method needs a request, you would usually fill it with the desired information
6161/// // into the respective structure. Some of the parts shown here might not be applicable !
6162/// // Values shown here are possibly random and not representative !
6163/// let mut req = DomainMapping::default();
6164///
6165/// // You can configure optional parameters by calling the respective setters at will, and
6166/// // execute the final call using `doit()`.
6167/// // Values shown here are possibly random and not representative !
6168/// let result = hub.apps().domain_mappings_patch(req, "appsId", "domainMappingsId")
6169/// .update_mask(FieldMask::new::<&str>(&[]))
6170/// .doit().await;
6171/// # }
6172/// ```
6173pub struct AppDomainMappingPatchCall<'a, C>
6174where
6175 C: 'a,
6176{
6177 hub: &'a Appengine<C>,
6178 _request: DomainMapping,
6179 _apps_id: String,
6180 _domain_mappings_id: String,
6181 _update_mask: Option<common::FieldMask>,
6182 _delegate: Option<&'a mut dyn common::Delegate>,
6183 _additional_params: HashMap<String, String>,
6184 _scopes: BTreeSet<String>,
6185}
6186
6187impl<'a, C> common::CallBuilder for AppDomainMappingPatchCall<'a, C> {}
6188
6189impl<'a, C> AppDomainMappingPatchCall<'a, C>
6190where
6191 C: common::Connector,
6192{
6193 /// Perform the operation you have build so far.
6194 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6195 use std::borrow::Cow;
6196 use std::io::{Read, Seek};
6197
6198 use common::{url::Params, ToParts};
6199 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6200
6201 let mut dd = common::DefaultDelegate;
6202 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6203 dlg.begin(common::MethodInfo {
6204 id: "appengine.apps.domainMappings.patch",
6205 http_method: hyper::Method::PATCH,
6206 });
6207
6208 for &field in ["alt", "appsId", "domainMappingsId", "updateMask"].iter() {
6209 if self._additional_params.contains_key(field) {
6210 dlg.finished(false);
6211 return Err(common::Error::FieldClash(field));
6212 }
6213 }
6214
6215 let mut params = Params::with_capacity(6 + self._additional_params.len());
6216 params.push("appsId", self._apps_id);
6217 params.push("domainMappingsId", self._domain_mappings_id);
6218 if let Some(value) = self._update_mask.as_ref() {
6219 params.push("updateMask", value.to_string());
6220 }
6221
6222 params.extend(self._additional_params.iter());
6223
6224 params.push("alt", "json");
6225 let mut url =
6226 self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}";
6227 if self._scopes.is_empty() {
6228 self._scopes
6229 .insert(Scope::CloudPlatform.as_ref().to_string());
6230 }
6231
6232 #[allow(clippy::single_element_loop)]
6233 for &(find_this, param_name) in [
6234 ("{appsId}", "appsId"),
6235 ("{domainMappingsId}", "domainMappingsId"),
6236 ]
6237 .iter()
6238 {
6239 url = params.uri_replacement(url, param_name, find_this, false);
6240 }
6241 {
6242 let to_remove = ["domainMappingsId", "appsId"];
6243 params.remove_params(&to_remove);
6244 }
6245
6246 let url = params.parse_with_url(&url);
6247
6248 let mut json_mime_type = mime::APPLICATION_JSON;
6249 let mut request_value_reader = {
6250 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6251 common::remove_json_null_values(&mut value);
6252 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6253 serde_json::to_writer(&mut dst, &value).unwrap();
6254 dst
6255 };
6256 let request_size = request_value_reader
6257 .seek(std::io::SeekFrom::End(0))
6258 .unwrap();
6259 request_value_reader
6260 .seek(std::io::SeekFrom::Start(0))
6261 .unwrap();
6262
6263 loop {
6264 let token = match self
6265 .hub
6266 .auth
6267 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6268 .await
6269 {
6270 Ok(token) => token,
6271 Err(e) => match dlg.token(e) {
6272 Ok(token) => token,
6273 Err(e) => {
6274 dlg.finished(false);
6275 return Err(common::Error::MissingToken(e));
6276 }
6277 },
6278 };
6279 request_value_reader
6280 .seek(std::io::SeekFrom::Start(0))
6281 .unwrap();
6282 let mut req_result = {
6283 let client = &self.hub.client;
6284 dlg.pre_request();
6285 let mut req_builder = hyper::Request::builder()
6286 .method(hyper::Method::PATCH)
6287 .uri(url.as_str())
6288 .header(USER_AGENT, self.hub._user_agent.clone());
6289
6290 if let Some(token) = token.as_ref() {
6291 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6292 }
6293
6294 let request = req_builder
6295 .header(CONTENT_TYPE, json_mime_type.to_string())
6296 .header(CONTENT_LENGTH, request_size as u64)
6297 .body(common::to_body(
6298 request_value_reader.get_ref().clone().into(),
6299 ));
6300
6301 client.request(request.unwrap()).await
6302 };
6303
6304 match req_result {
6305 Err(err) => {
6306 if let common::Retry::After(d) = dlg.http_error(&err) {
6307 sleep(d).await;
6308 continue;
6309 }
6310 dlg.finished(false);
6311 return Err(common::Error::HttpError(err));
6312 }
6313 Ok(res) => {
6314 let (mut parts, body) = res.into_parts();
6315 let mut body = common::Body::new(body);
6316 if !parts.status.is_success() {
6317 let bytes = common::to_bytes(body).await.unwrap_or_default();
6318 let error = serde_json::from_str(&common::to_string(&bytes));
6319 let response = common::to_response(parts, bytes.into());
6320
6321 if let common::Retry::After(d) =
6322 dlg.http_failure(&response, error.as_ref().ok())
6323 {
6324 sleep(d).await;
6325 continue;
6326 }
6327
6328 dlg.finished(false);
6329
6330 return Err(match error {
6331 Ok(value) => common::Error::BadRequest(value),
6332 _ => common::Error::Failure(response),
6333 });
6334 }
6335 let response = {
6336 let bytes = common::to_bytes(body).await.unwrap_or_default();
6337 let encoded = common::to_string(&bytes);
6338 match serde_json::from_str(&encoded) {
6339 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6340 Err(error) => {
6341 dlg.response_json_decode_error(&encoded, &error);
6342 return Err(common::Error::JsonDecodeError(
6343 encoded.to_string(),
6344 error,
6345 ));
6346 }
6347 }
6348 };
6349
6350 dlg.finished(true);
6351 return Ok(response);
6352 }
6353 }
6354 }
6355 }
6356
6357 ///
6358 /// Sets the *request* property to the given value.
6359 ///
6360 /// Even though the property as already been set when instantiating this call,
6361 /// we provide this method for API completeness.
6362 pub fn request(mut self, new_value: DomainMapping) -> AppDomainMappingPatchCall<'a, C> {
6363 self._request = new_value;
6364 self
6365 }
6366 /// Part of `name`. Name of the resource to update. Example: apps/myapp/domainMappings/example.com.
6367 ///
6368 /// Sets the *apps id* path property to the given value.
6369 ///
6370 /// Even though the property as already been set when instantiating this call,
6371 /// we provide this method for API completeness.
6372 pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingPatchCall<'a, C> {
6373 self._apps_id = new_value.to_string();
6374 self
6375 }
6376 /// Part of `name`. See documentation of `appsId`.
6377 ///
6378 /// Sets the *domain mappings id* path property to the given value.
6379 ///
6380 /// Even though the property as already been set when instantiating this call,
6381 /// we provide this method for API completeness.
6382 pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingPatchCall<'a, C> {
6383 self._domain_mappings_id = new_value.to_string();
6384 self
6385 }
6386 /// Required. Standard field mask for the set of fields to be updated.
6387 ///
6388 /// Sets the *update mask* query property to the given value.
6389 pub fn update_mask(mut self, new_value: common::FieldMask) -> AppDomainMappingPatchCall<'a, C> {
6390 self._update_mask = Some(new_value);
6391 self
6392 }
6393 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6394 /// while executing the actual API request.
6395 ///
6396 /// ````text
6397 /// It should be used to handle progress information, and to implement a certain level of resilience.
6398 /// ````
6399 ///
6400 /// Sets the *delegate* property to the given value.
6401 pub fn delegate(
6402 mut self,
6403 new_value: &'a mut dyn common::Delegate,
6404 ) -> AppDomainMappingPatchCall<'a, C> {
6405 self._delegate = Some(new_value);
6406 self
6407 }
6408
6409 /// Set any additional parameter of the query string used in the request.
6410 /// It should be used to set parameters which are not yet available through their own
6411 /// setters.
6412 ///
6413 /// Please note that this method must not be used to set any of the known parameters
6414 /// which have their own setter method. If done anyway, the request will fail.
6415 ///
6416 /// # Additional Parameters
6417 ///
6418 /// * *$.xgafv* (query-string) - V1 error format.
6419 /// * *access_token* (query-string) - OAuth access token.
6420 /// * *alt* (query-string) - Data format for response.
6421 /// * *callback* (query-string) - JSONP
6422 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6423 /// * *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.
6424 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6425 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6426 /// * *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.
6427 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6428 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6429 pub fn param<T>(mut self, name: T, value: T) -> AppDomainMappingPatchCall<'a, C>
6430 where
6431 T: AsRef<str>,
6432 {
6433 self._additional_params
6434 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6435 self
6436 }
6437
6438 /// Identifies the authorization scope for the method you are building.
6439 ///
6440 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6441 /// [`Scope::CloudPlatform`].
6442 ///
6443 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6444 /// tokens for more than one scope.
6445 ///
6446 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6447 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6448 /// sufficient, a read-write scope will do as well.
6449 pub fn add_scope<St>(mut self, scope: St) -> AppDomainMappingPatchCall<'a, C>
6450 where
6451 St: AsRef<str>,
6452 {
6453 self._scopes.insert(String::from(scope.as_ref()));
6454 self
6455 }
6456 /// Identifies the authorization scope(s) for the method you are building.
6457 ///
6458 /// See [`Self::add_scope()`] for details.
6459 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppDomainMappingPatchCall<'a, C>
6460 where
6461 I: IntoIterator<Item = St>,
6462 St: AsRef<str>,
6463 {
6464 self._scopes
6465 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6466 self
6467 }
6468
6469 /// Removes all scopes, and no default scope will be used either.
6470 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6471 /// for details).
6472 pub fn clear_scopes(mut self) -> AppDomainMappingPatchCall<'a, C> {
6473 self._scopes.clear();
6474 self
6475 }
6476}
6477
6478/// 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.
6479///
6480/// A builder for the *firewall.ingressRules.batchUpdate* method supported by a *app* resource.
6481/// It is not used directly, but through a [`AppMethods`] instance.
6482///
6483/// # Example
6484///
6485/// Instantiate a resource method builder
6486///
6487/// ```test_harness,no_run
6488/// # extern crate hyper;
6489/// # extern crate hyper_rustls;
6490/// # extern crate google_appengine1 as appengine1;
6491/// use appengine1::api::BatchUpdateIngressRulesRequest;
6492/// # async fn dox() {
6493/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6494///
6495/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6496/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6497/// # secret,
6498/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6499/// # ).build().await.unwrap();
6500///
6501/// # let client = hyper_util::client::legacy::Client::builder(
6502/// # hyper_util::rt::TokioExecutor::new()
6503/// # )
6504/// # .build(
6505/// # hyper_rustls::HttpsConnectorBuilder::new()
6506/// # .with_native_roots()
6507/// # .unwrap()
6508/// # .https_or_http()
6509/// # .enable_http1()
6510/// # .build()
6511/// # );
6512/// # let mut hub = Appengine::new(client, auth);
6513/// // As the method needs a request, you would usually fill it with the desired information
6514/// // into the respective structure. Some of the parts shown here might not be applicable !
6515/// // Values shown here are possibly random and not representative !
6516/// let mut req = BatchUpdateIngressRulesRequest::default();
6517///
6518/// // You can configure optional parameters by calling the respective setters at will, and
6519/// // execute the final call using `doit()`.
6520/// // Values shown here are possibly random and not representative !
6521/// let result = hub.apps().firewall_ingress_rules_batch_update(req, "appsId")
6522/// .doit().await;
6523/// # }
6524/// ```
6525pub struct AppFirewallIngressRuleBatchUpdateCall<'a, C>
6526where
6527 C: 'a,
6528{
6529 hub: &'a Appengine<C>,
6530 _request: BatchUpdateIngressRulesRequest,
6531 _apps_id: String,
6532 _delegate: Option<&'a mut dyn common::Delegate>,
6533 _additional_params: HashMap<String, String>,
6534 _scopes: BTreeSet<String>,
6535}
6536
6537impl<'a, C> common::CallBuilder for AppFirewallIngressRuleBatchUpdateCall<'a, C> {}
6538
6539impl<'a, C> AppFirewallIngressRuleBatchUpdateCall<'a, C>
6540where
6541 C: common::Connector,
6542{
6543 /// Perform the operation you have build so far.
6544 pub async fn doit(
6545 mut self,
6546 ) -> common::Result<(common::Response, BatchUpdateIngressRulesResponse)> {
6547 use std::borrow::Cow;
6548 use std::io::{Read, Seek};
6549
6550 use common::{url::Params, ToParts};
6551 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6552
6553 let mut dd = common::DefaultDelegate;
6554 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6555 dlg.begin(common::MethodInfo {
6556 id: "appengine.apps.firewall.ingressRules.batchUpdate",
6557 http_method: hyper::Method::POST,
6558 });
6559
6560 for &field in ["alt", "appsId"].iter() {
6561 if self._additional_params.contains_key(field) {
6562 dlg.finished(false);
6563 return Err(common::Error::FieldClash(field));
6564 }
6565 }
6566
6567 let mut params = Params::with_capacity(4 + self._additional_params.len());
6568 params.push("appsId", self._apps_id);
6569
6570 params.extend(self._additional_params.iter());
6571
6572 params.push("alt", "json");
6573 let mut url =
6574 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules:batchUpdate";
6575 if self._scopes.is_empty() {
6576 self._scopes
6577 .insert(Scope::CloudPlatform.as_ref().to_string());
6578 }
6579
6580 #[allow(clippy::single_element_loop)]
6581 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
6582 url = params.uri_replacement(url, param_name, find_this, false);
6583 }
6584 {
6585 let to_remove = ["appsId"];
6586 params.remove_params(&to_remove);
6587 }
6588
6589 let url = params.parse_with_url(&url);
6590
6591 let mut json_mime_type = mime::APPLICATION_JSON;
6592 let mut request_value_reader = {
6593 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6594 common::remove_json_null_values(&mut value);
6595 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6596 serde_json::to_writer(&mut dst, &value).unwrap();
6597 dst
6598 };
6599 let request_size = request_value_reader
6600 .seek(std::io::SeekFrom::End(0))
6601 .unwrap();
6602 request_value_reader
6603 .seek(std::io::SeekFrom::Start(0))
6604 .unwrap();
6605
6606 loop {
6607 let token = match self
6608 .hub
6609 .auth
6610 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6611 .await
6612 {
6613 Ok(token) => token,
6614 Err(e) => match dlg.token(e) {
6615 Ok(token) => token,
6616 Err(e) => {
6617 dlg.finished(false);
6618 return Err(common::Error::MissingToken(e));
6619 }
6620 },
6621 };
6622 request_value_reader
6623 .seek(std::io::SeekFrom::Start(0))
6624 .unwrap();
6625 let mut req_result = {
6626 let client = &self.hub.client;
6627 dlg.pre_request();
6628 let mut req_builder = hyper::Request::builder()
6629 .method(hyper::Method::POST)
6630 .uri(url.as_str())
6631 .header(USER_AGENT, self.hub._user_agent.clone());
6632
6633 if let Some(token) = token.as_ref() {
6634 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6635 }
6636
6637 let request = req_builder
6638 .header(CONTENT_TYPE, json_mime_type.to_string())
6639 .header(CONTENT_LENGTH, request_size as u64)
6640 .body(common::to_body(
6641 request_value_reader.get_ref().clone().into(),
6642 ));
6643
6644 client.request(request.unwrap()).await
6645 };
6646
6647 match req_result {
6648 Err(err) => {
6649 if let common::Retry::After(d) = dlg.http_error(&err) {
6650 sleep(d).await;
6651 continue;
6652 }
6653 dlg.finished(false);
6654 return Err(common::Error::HttpError(err));
6655 }
6656 Ok(res) => {
6657 let (mut parts, body) = res.into_parts();
6658 let mut body = common::Body::new(body);
6659 if !parts.status.is_success() {
6660 let bytes = common::to_bytes(body).await.unwrap_or_default();
6661 let error = serde_json::from_str(&common::to_string(&bytes));
6662 let response = common::to_response(parts, bytes.into());
6663
6664 if let common::Retry::After(d) =
6665 dlg.http_failure(&response, error.as_ref().ok())
6666 {
6667 sleep(d).await;
6668 continue;
6669 }
6670
6671 dlg.finished(false);
6672
6673 return Err(match error {
6674 Ok(value) => common::Error::BadRequest(value),
6675 _ => common::Error::Failure(response),
6676 });
6677 }
6678 let response = {
6679 let bytes = common::to_bytes(body).await.unwrap_or_default();
6680 let encoded = common::to_string(&bytes);
6681 match serde_json::from_str(&encoded) {
6682 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6683 Err(error) => {
6684 dlg.response_json_decode_error(&encoded, &error);
6685 return Err(common::Error::JsonDecodeError(
6686 encoded.to_string(),
6687 error,
6688 ));
6689 }
6690 }
6691 };
6692
6693 dlg.finished(true);
6694 return Ok(response);
6695 }
6696 }
6697 }
6698 }
6699
6700 ///
6701 /// Sets the *request* property to the given value.
6702 ///
6703 /// Even though the property as already been set when instantiating this call,
6704 /// we provide this method for API completeness.
6705 pub fn request(
6706 mut self,
6707 new_value: BatchUpdateIngressRulesRequest,
6708 ) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
6709 self._request = new_value;
6710 self
6711 }
6712 /// Part of `name`. Name of the Firewall collection to set. Example: apps/myapp/firewall/ingressRules.
6713 ///
6714 /// Sets the *apps id* path property to the given value.
6715 ///
6716 /// Even though the property as already been set when instantiating this call,
6717 /// we provide this method for API completeness.
6718 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
6719 self._apps_id = new_value.to_string();
6720 self
6721 }
6722 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6723 /// while executing the actual API request.
6724 ///
6725 /// ````text
6726 /// It should be used to handle progress information, and to implement a certain level of resilience.
6727 /// ````
6728 ///
6729 /// Sets the *delegate* property to the given value.
6730 pub fn delegate(
6731 mut self,
6732 new_value: &'a mut dyn common::Delegate,
6733 ) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
6734 self._delegate = Some(new_value);
6735 self
6736 }
6737
6738 /// Set any additional parameter of the query string used in the request.
6739 /// It should be used to set parameters which are not yet available through their own
6740 /// setters.
6741 ///
6742 /// Please note that this method must not be used to set any of the known parameters
6743 /// which have their own setter method. If done anyway, the request will fail.
6744 ///
6745 /// # Additional Parameters
6746 ///
6747 /// * *$.xgafv* (query-string) - V1 error format.
6748 /// * *access_token* (query-string) - OAuth access token.
6749 /// * *alt* (query-string) - Data format for response.
6750 /// * *callback* (query-string) - JSONP
6751 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6752 /// * *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.
6753 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6754 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6755 /// * *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.
6756 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6757 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6758 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleBatchUpdateCall<'a, C>
6759 where
6760 T: AsRef<str>,
6761 {
6762 self._additional_params
6763 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6764 self
6765 }
6766
6767 /// Identifies the authorization scope for the method you are building.
6768 ///
6769 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6770 /// [`Scope::CloudPlatform`].
6771 ///
6772 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6773 /// tokens for more than one scope.
6774 ///
6775 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6776 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6777 /// sufficient, a read-write scope will do as well.
6778 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleBatchUpdateCall<'a, C>
6779 where
6780 St: AsRef<str>,
6781 {
6782 self._scopes.insert(String::from(scope.as_ref()));
6783 self
6784 }
6785 /// Identifies the authorization scope(s) for the method you are building.
6786 ///
6787 /// See [`Self::add_scope()`] for details.
6788 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleBatchUpdateCall<'a, C>
6789 where
6790 I: IntoIterator<Item = St>,
6791 St: AsRef<str>,
6792 {
6793 self._scopes
6794 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6795 self
6796 }
6797
6798 /// Removes all scopes, and no default scope will be used either.
6799 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6800 /// for details).
6801 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleBatchUpdateCall<'a, C> {
6802 self._scopes.clear();
6803 self
6804 }
6805}
6806
6807/// Creates a firewall rule for the application.
6808///
6809/// A builder for the *firewall.ingressRules.create* method supported by a *app* resource.
6810/// It is not used directly, but through a [`AppMethods`] instance.
6811///
6812/// # Example
6813///
6814/// Instantiate a resource method builder
6815///
6816/// ```test_harness,no_run
6817/// # extern crate hyper;
6818/// # extern crate hyper_rustls;
6819/// # extern crate google_appengine1 as appengine1;
6820/// use appengine1::api::FirewallRule;
6821/// # async fn dox() {
6822/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6823///
6824/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6825/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6826/// # secret,
6827/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6828/// # ).build().await.unwrap();
6829///
6830/// # let client = hyper_util::client::legacy::Client::builder(
6831/// # hyper_util::rt::TokioExecutor::new()
6832/// # )
6833/// # .build(
6834/// # hyper_rustls::HttpsConnectorBuilder::new()
6835/// # .with_native_roots()
6836/// # .unwrap()
6837/// # .https_or_http()
6838/// # .enable_http1()
6839/// # .build()
6840/// # );
6841/// # let mut hub = Appengine::new(client, auth);
6842/// // As the method needs a request, you would usually fill it with the desired information
6843/// // into the respective structure. Some of the parts shown here might not be applicable !
6844/// // Values shown here are possibly random and not representative !
6845/// let mut req = FirewallRule::default();
6846///
6847/// // You can configure optional parameters by calling the respective setters at will, and
6848/// // execute the final call using `doit()`.
6849/// // Values shown here are possibly random and not representative !
6850/// let result = hub.apps().firewall_ingress_rules_create(req, "appsId")
6851/// .doit().await;
6852/// # }
6853/// ```
6854pub struct AppFirewallIngressRuleCreateCall<'a, C>
6855where
6856 C: 'a,
6857{
6858 hub: &'a Appengine<C>,
6859 _request: FirewallRule,
6860 _apps_id: String,
6861 _delegate: Option<&'a mut dyn common::Delegate>,
6862 _additional_params: HashMap<String, String>,
6863 _scopes: BTreeSet<String>,
6864}
6865
6866impl<'a, C> common::CallBuilder for AppFirewallIngressRuleCreateCall<'a, C> {}
6867
6868impl<'a, C> AppFirewallIngressRuleCreateCall<'a, C>
6869where
6870 C: common::Connector,
6871{
6872 /// Perform the operation you have build so far.
6873 pub async fn doit(mut self) -> common::Result<(common::Response, FirewallRule)> {
6874 use std::borrow::Cow;
6875 use std::io::{Read, Seek};
6876
6877 use common::{url::Params, ToParts};
6878 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6879
6880 let mut dd = common::DefaultDelegate;
6881 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6882 dlg.begin(common::MethodInfo {
6883 id: "appengine.apps.firewall.ingressRules.create",
6884 http_method: hyper::Method::POST,
6885 });
6886
6887 for &field in ["alt", "appsId"].iter() {
6888 if self._additional_params.contains_key(field) {
6889 dlg.finished(false);
6890 return Err(common::Error::FieldClash(field));
6891 }
6892 }
6893
6894 let mut params = Params::with_capacity(4 + self._additional_params.len());
6895 params.push("appsId", self._apps_id);
6896
6897 params.extend(self._additional_params.iter());
6898
6899 params.push("alt", "json");
6900 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules";
6901 if self._scopes.is_empty() {
6902 self._scopes
6903 .insert(Scope::CloudPlatform.as_ref().to_string());
6904 }
6905
6906 #[allow(clippy::single_element_loop)]
6907 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
6908 url = params.uri_replacement(url, param_name, find_this, false);
6909 }
6910 {
6911 let to_remove = ["appsId"];
6912 params.remove_params(&to_remove);
6913 }
6914
6915 let url = params.parse_with_url(&url);
6916
6917 let mut json_mime_type = mime::APPLICATION_JSON;
6918 let mut request_value_reader = {
6919 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6920 common::remove_json_null_values(&mut value);
6921 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6922 serde_json::to_writer(&mut dst, &value).unwrap();
6923 dst
6924 };
6925 let request_size = request_value_reader
6926 .seek(std::io::SeekFrom::End(0))
6927 .unwrap();
6928 request_value_reader
6929 .seek(std::io::SeekFrom::Start(0))
6930 .unwrap();
6931
6932 loop {
6933 let token = match self
6934 .hub
6935 .auth
6936 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6937 .await
6938 {
6939 Ok(token) => token,
6940 Err(e) => match dlg.token(e) {
6941 Ok(token) => token,
6942 Err(e) => {
6943 dlg.finished(false);
6944 return Err(common::Error::MissingToken(e));
6945 }
6946 },
6947 };
6948 request_value_reader
6949 .seek(std::io::SeekFrom::Start(0))
6950 .unwrap();
6951 let mut req_result = {
6952 let client = &self.hub.client;
6953 dlg.pre_request();
6954 let mut req_builder = hyper::Request::builder()
6955 .method(hyper::Method::POST)
6956 .uri(url.as_str())
6957 .header(USER_AGENT, self.hub._user_agent.clone());
6958
6959 if let Some(token) = token.as_ref() {
6960 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6961 }
6962
6963 let request = req_builder
6964 .header(CONTENT_TYPE, json_mime_type.to_string())
6965 .header(CONTENT_LENGTH, request_size as u64)
6966 .body(common::to_body(
6967 request_value_reader.get_ref().clone().into(),
6968 ));
6969
6970 client.request(request.unwrap()).await
6971 };
6972
6973 match req_result {
6974 Err(err) => {
6975 if let common::Retry::After(d) = dlg.http_error(&err) {
6976 sleep(d).await;
6977 continue;
6978 }
6979 dlg.finished(false);
6980 return Err(common::Error::HttpError(err));
6981 }
6982 Ok(res) => {
6983 let (mut parts, body) = res.into_parts();
6984 let mut body = common::Body::new(body);
6985 if !parts.status.is_success() {
6986 let bytes = common::to_bytes(body).await.unwrap_or_default();
6987 let error = serde_json::from_str(&common::to_string(&bytes));
6988 let response = common::to_response(parts, bytes.into());
6989
6990 if let common::Retry::After(d) =
6991 dlg.http_failure(&response, error.as_ref().ok())
6992 {
6993 sleep(d).await;
6994 continue;
6995 }
6996
6997 dlg.finished(false);
6998
6999 return Err(match error {
7000 Ok(value) => common::Error::BadRequest(value),
7001 _ => common::Error::Failure(response),
7002 });
7003 }
7004 let response = {
7005 let bytes = common::to_bytes(body).await.unwrap_or_default();
7006 let encoded = common::to_string(&bytes);
7007 match serde_json::from_str(&encoded) {
7008 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7009 Err(error) => {
7010 dlg.response_json_decode_error(&encoded, &error);
7011 return Err(common::Error::JsonDecodeError(
7012 encoded.to_string(),
7013 error,
7014 ));
7015 }
7016 }
7017 };
7018
7019 dlg.finished(true);
7020 return Ok(response);
7021 }
7022 }
7023 }
7024 }
7025
7026 ///
7027 /// Sets the *request* property to the given value.
7028 ///
7029 /// Even though the property as already been set when instantiating this call,
7030 /// we provide this method for API completeness.
7031 pub fn request(mut self, new_value: FirewallRule) -> AppFirewallIngressRuleCreateCall<'a, C> {
7032 self._request = new_value;
7033 self
7034 }
7035 /// Part of `parent`. Name of the parent Firewall collection in which to create a new rule. Example: apps/myapp/firewall/ingressRules.
7036 ///
7037 /// Sets the *apps id* path property to the given value.
7038 ///
7039 /// Even though the property as already been set when instantiating this call,
7040 /// we provide this method for API completeness.
7041 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleCreateCall<'a, C> {
7042 self._apps_id = new_value.to_string();
7043 self
7044 }
7045 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7046 /// while executing the actual API request.
7047 ///
7048 /// ````text
7049 /// It should be used to handle progress information, and to implement a certain level of resilience.
7050 /// ````
7051 ///
7052 /// Sets the *delegate* property to the given value.
7053 pub fn delegate(
7054 mut self,
7055 new_value: &'a mut dyn common::Delegate,
7056 ) -> AppFirewallIngressRuleCreateCall<'a, C> {
7057 self._delegate = Some(new_value);
7058 self
7059 }
7060
7061 /// Set any additional parameter of the query string used in the request.
7062 /// It should be used to set parameters which are not yet available through their own
7063 /// setters.
7064 ///
7065 /// Please note that this method must not be used to set any of the known parameters
7066 /// which have their own setter method. If done anyway, the request will fail.
7067 ///
7068 /// # Additional Parameters
7069 ///
7070 /// * *$.xgafv* (query-string) - V1 error format.
7071 /// * *access_token* (query-string) - OAuth access token.
7072 /// * *alt* (query-string) - Data format for response.
7073 /// * *callback* (query-string) - JSONP
7074 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7075 /// * *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.
7076 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7077 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7078 /// * *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.
7079 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7080 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7081 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleCreateCall<'a, C>
7082 where
7083 T: AsRef<str>,
7084 {
7085 self._additional_params
7086 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7087 self
7088 }
7089
7090 /// Identifies the authorization scope for the method you are building.
7091 ///
7092 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7093 /// [`Scope::CloudPlatform`].
7094 ///
7095 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7096 /// tokens for more than one scope.
7097 ///
7098 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7099 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7100 /// sufficient, a read-write scope will do as well.
7101 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleCreateCall<'a, C>
7102 where
7103 St: AsRef<str>,
7104 {
7105 self._scopes.insert(String::from(scope.as_ref()));
7106 self
7107 }
7108 /// Identifies the authorization scope(s) for the method you are building.
7109 ///
7110 /// See [`Self::add_scope()`] for details.
7111 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleCreateCall<'a, C>
7112 where
7113 I: IntoIterator<Item = St>,
7114 St: AsRef<str>,
7115 {
7116 self._scopes
7117 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7118 self
7119 }
7120
7121 /// Removes all scopes, and no default scope will be used either.
7122 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7123 /// for details).
7124 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleCreateCall<'a, C> {
7125 self._scopes.clear();
7126 self
7127 }
7128}
7129
7130/// Deletes the specified firewall rule.
7131///
7132/// A builder for the *firewall.ingressRules.delete* method supported by a *app* resource.
7133/// It is not used directly, but through a [`AppMethods`] instance.
7134///
7135/// # Example
7136///
7137/// Instantiate a resource method builder
7138///
7139/// ```test_harness,no_run
7140/// # extern crate hyper;
7141/// # extern crate hyper_rustls;
7142/// # extern crate google_appengine1 as appengine1;
7143/// # async fn dox() {
7144/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7145///
7146/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7147/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7148/// # secret,
7149/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7150/// # ).build().await.unwrap();
7151///
7152/// # let client = hyper_util::client::legacy::Client::builder(
7153/// # hyper_util::rt::TokioExecutor::new()
7154/// # )
7155/// # .build(
7156/// # hyper_rustls::HttpsConnectorBuilder::new()
7157/// # .with_native_roots()
7158/// # .unwrap()
7159/// # .https_or_http()
7160/// # .enable_http1()
7161/// # .build()
7162/// # );
7163/// # let mut hub = Appengine::new(client, auth);
7164/// // You can configure optional parameters by calling the respective setters at will, and
7165/// // execute the final call using `doit()`.
7166/// // Values shown here are possibly random and not representative !
7167/// let result = hub.apps().firewall_ingress_rules_delete("appsId", "ingressRulesId")
7168/// .doit().await;
7169/// # }
7170/// ```
7171pub struct AppFirewallIngressRuleDeleteCall<'a, C>
7172where
7173 C: 'a,
7174{
7175 hub: &'a Appengine<C>,
7176 _apps_id: String,
7177 _ingress_rules_id: String,
7178 _delegate: Option<&'a mut dyn common::Delegate>,
7179 _additional_params: HashMap<String, String>,
7180 _scopes: BTreeSet<String>,
7181}
7182
7183impl<'a, C> common::CallBuilder for AppFirewallIngressRuleDeleteCall<'a, C> {}
7184
7185impl<'a, C> AppFirewallIngressRuleDeleteCall<'a, C>
7186where
7187 C: common::Connector,
7188{
7189 /// Perform the operation you have build so far.
7190 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7191 use std::borrow::Cow;
7192 use std::io::{Read, Seek};
7193
7194 use common::{url::Params, ToParts};
7195 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7196
7197 let mut dd = common::DefaultDelegate;
7198 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7199 dlg.begin(common::MethodInfo {
7200 id: "appengine.apps.firewall.ingressRules.delete",
7201 http_method: hyper::Method::DELETE,
7202 });
7203
7204 for &field in ["alt", "appsId", "ingressRulesId"].iter() {
7205 if self._additional_params.contains_key(field) {
7206 dlg.finished(false);
7207 return Err(common::Error::FieldClash(field));
7208 }
7209 }
7210
7211 let mut params = Params::with_capacity(4 + self._additional_params.len());
7212 params.push("appsId", self._apps_id);
7213 params.push("ingressRulesId", self._ingress_rules_id);
7214
7215 params.extend(self._additional_params.iter());
7216
7217 params.push("alt", "json");
7218 let mut url =
7219 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}";
7220 if self._scopes.is_empty() {
7221 self._scopes
7222 .insert(Scope::CloudPlatform.as_ref().to_string());
7223 }
7224
7225 #[allow(clippy::single_element_loop)]
7226 for &(find_this, param_name) in [
7227 ("{appsId}", "appsId"),
7228 ("{ingressRulesId}", "ingressRulesId"),
7229 ]
7230 .iter()
7231 {
7232 url = params.uri_replacement(url, param_name, find_this, false);
7233 }
7234 {
7235 let to_remove = ["ingressRulesId", "appsId"];
7236 params.remove_params(&to_remove);
7237 }
7238
7239 let url = params.parse_with_url(&url);
7240
7241 loop {
7242 let token = match self
7243 .hub
7244 .auth
7245 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7246 .await
7247 {
7248 Ok(token) => token,
7249 Err(e) => match dlg.token(e) {
7250 Ok(token) => token,
7251 Err(e) => {
7252 dlg.finished(false);
7253 return Err(common::Error::MissingToken(e));
7254 }
7255 },
7256 };
7257 let mut req_result = {
7258 let client = &self.hub.client;
7259 dlg.pre_request();
7260 let mut req_builder = hyper::Request::builder()
7261 .method(hyper::Method::DELETE)
7262 .uri(url.as_str())
7263 .header(USER_AGENT, self.hub._user_agent.clone());
7264
7265 if let Some(token) = token.as_ref() {
7266 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7267 }
7268
7269 let request = req_builder
7270 .header(CONTENT_LENGTH, 0_u64)
7271 .body(common::to_body::<String>(None));
7272
7273 client.request(request.unwrap()).await
7274 };
7275
7276 match req_result {
7277 Err(err) => {
7278 if let common::Retry::After(d) = dlg.http_error(&err) {
7279 sleep(d).await;
7280 continue;
7281 }
7282 dlg.finished(false);
7283 return Err(common::Error::HttpError(err));
7284 }
7285 Ok(res) => {
7286 let (mut parts, body) = res.into_parts();
7287 let mut body = common::Body::new(body);
7288 if !parts.status.is_success() {
7289 let bytes = common::to_bytes(body).await.unwrap_or_default();
7290 let error = serde_json::from_str(&common::to_string(&bytes));
7291 let response = common::to_response(parts, bytes.into());
7292
7293 if let common::Retry::After(d) =
7294 dlg.http_failure(&response, error.as_ref().ok())
7295 {
7296 sleep(d).await;
7297 continue;
7298 }
7299
7300 dlg.finished(false);
7301
7302 return Err(match error {
7303 Ok(value) => common::Error::BadRequest(value),
7304 _ => common::Error::Failure(response),
7305 });
7306 }
7307 let response = {
7308 let bytes = common::to_bytes(body).await.unwrap_or_default();
7309 let encoded = common::to_string(&bytes);
7310 match serde_json::from_str(&encoded) {
7311 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7312 Err(error) => {
7313 dlg.response_json_decode_error(&encoded, &error);
7314 return Err(common::Error::JsonDecodeError(
7315 encoded.to_string(),
7316 error,
7317 ));
7318 }
7319 }
7320 };
7321
7322 dlg.finished(true);
7323 return Ok(response);
7324 }
7325 }
7326 }
7327 }
7328
7329 /// Part of `name`. Name of the Firewall resource to delete. Example: apps/myapp/firewall/ingressRules/100.
7330 ///
7331 /// Sets the *apps id* path property to the given value.
7332 ///
7333 /// Even though the property as already been set when instantiating this call,
7334 /// we provide this method for API completeness.
7335 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleDeleteCall<'a, C> {
7336 self._apps_id = new_value.to_string();
7337 self
7338 }
7339 /// Part of `name`. See documentation of `appsId`.
7340 ///
7341 /// Sets the *ingress rules id* path property to the given value.
7342 ///
7343 /// Even though the property as already been set when instantiating this call,
7344 /// we provide this method for API completeness.
7345 pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRuleDeleteCall<'a, C> {
7346 self._ingress_rules_id = new_value.to_string();
7347 self
7348 }
7349 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7350 /// while executing the actual API request.
7351 ///
7352 /// ````text
7353 /// It should be used to handle progress information, and to implement a certain level of resilience.
7354 /// ````
7355 ///
7356 /// Sets the *delegate* property to the given value.
7357 pub fn delegate(
7358 mut self,
7359 new_value: &'a mut dyn common::Delegate,
7360 ) -> AppFirewallIngressRuleDeleteCall<'a, C> {
7361 self._delegate = Some(new_value);
7362 self
7363 }
7364
7365 /// Set any additional parameter of the query string used in the request.
7366 /// It should be used to set parameters which are not yet available through their own
7367 /// setters.
7368 ///
7369 /// Please note that this method must not be used to set any of the known parameters
7370 /// which have their own setter method. If done anyway, the request will fail.
7371 ///
7372 /// # Additional Parameters
7373 ///
7374 /// * *$.xgafv* (query-string) - V1 error format.
7375 /// * *access_token* (query-string) - OAuth access token.
7376 /// * *alt* (query-string) - Data format for response.
7377 /// * *callback* (query-string) - JSONP
7378 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7379 /// * *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.
7380 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7381 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7382 /// * *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.
7383 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7384 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7385 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleDeleteCall<'a, C>
7386 where
7387 T: AsRef<str>,
7388 {
7389 self._additional_params
7390 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7391 self
7392 }
7393
7394 /// Identifies the authorization scope for the method you are building.
7395 ///
7396 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7397 /// [`Scope::CloudPlatform`].
7398 ///
7399 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7400 /// tokens for more than one scope.
7401 ///
7402 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7403 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7404 /// sufficient, a read-write scope will do as well.
7405 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleDeleteCall<'a, C>
7406 where
7407 St: AsRef<str>,
7408 {
7409 self._scopes.insert(String::from(scope.as_ref()));
7410 self
7411 }
7412 /// Identifies the authorization scope(s) for the method you are building.
7413 ///
7414 /// See [`Self::add_scope()`] for details.
7415 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleDeleteCall<'a, C>
7416 where
7417 I: IntoIterator<Item = St>,
7418 St: AsRef<str>,
7419 {
7420 self._scopes
7421 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7422 self
7423 }
7424
7425 /// Removes all scopes, and no default scope will be used either.
7426 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7427 /// for details).
7428 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleDeleteCall<'a, C> {
7429 self._scopes.clear();
7430 self
7431 }
7432}
7433
7434/// Gets the specified firewall rule.
7435///
7436/// A builder for the *firewall.ingressRules.get* method supported by a *app* resource.
7437/// It is not used directly, but through a [`AppMethods`] instance.
7438///
7439/// # Example
7440///
7441/// Instantiate a resource method builder
7442///
7443/// ```test_harness,no_run
7444/// # extern crate hyper;
7445/// # extern crate hyper_rustls;
7446/// # extern crate google_appengine1 as appengine1;
7447/// # async fn dox() {
7448/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7449///
7450/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7451/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7452/// # secret,
7453/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7454/// # ).build().await.unwrap();
7455///
7456/// # let client = hyper_util::client::legacy::Client::builder(
7457/// # hyper_util::rt::TokioExecutor::new()
7458/// # )
7459/// # .build(
7460/// # hyper_rustls::HttpsConnectorBuilder::new()
7461/// # .with_native_roots()
7462/// # .unwrap()
7463/// # .https_or_http()
7464/// # .enable_http1()
7465/// # .build()
7466/// # );
7467/// # let mut hub = Appengine::new(client, auth);
7468/// // You can configure optional parameters by calling the respective setters at will, and
7469/// // execute the final call using `doit()`.
7470/// // Values shown here are possibly random and not representative !
7471/// let result = hub.apps().firewall_ingress_rules_get("appsId", "ingressRulesId")
7472/// .doit().await;
7473/// # }
7474/// ```
7475pub struct AppFirewallIngressRuleGetCall<'a, C>
7476where
7477 C: 'a,
7478{
7479 hub: &'a Appengine<C>,
7480 _apps_id: String,
7481 _ingress_rules_id: String,
7482 _delegate: Option<&'a mut dyn common::Delegate>,
7483 _additional_params: HashMap<String, String>,
7484 _scopes: BTreeSet<String>,
7485}
7486
7487impl<'a, C> common::CallBuilder for AppFirewallIngressRuleGetCall<'a, C> {}
7488
7489impl<'a, C> AppFirewallIngressRuleGetCall<'a, C>
7490where
7491 C: common::Connector,
7492{
7493 /// Perform the operation you have build so far.
7494 pub async fn doit(mut self) -> common::Result<(common::Response, FirewallRule)> {
7495 use std::borrow::Cow;
7496 use std::io::{Read, Seek};
7497
7498 use common::{url::Params, ToParts};
7499 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7500
7501 let mut dd = common::DefaultDelegate;
7502 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7503 dlg.begin(common::MethodInfo {
7504 id: "appengine.apps.firewall.ingressRules.get",
7505 http_method: hyper::Method::GET,
7506 });
7507
7508 for &field in ["alt", "appsId", "ingressRulesId"].iter() {
7509 if self._additional_params.contains_key(field) {
7510 dlg.finished(false);
7511 return Err(common::Error::FieldClash(field));
7512 }
7513 }
7514
7515 let mut params = Params::with_capacity(4 + self._additional_params.len());
7516 params.push("appsId", self._apps_id);
7517 params.push("ingressRulesId", self._ingress_rules_id);
7518
7519 params.extend(self._additional_params.iter());
7520
7521 params.push("alt", "json");
7522 let mut url =
7523 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}";
7524 if self._scopes.is_empty() {
7525 self._scopes.insert(Scope::Admin.as_ref().to_string());
7526 }
7527
7528 #[allow(clippy::single_element_loop)]
7529 for &(find_this, param_name) in [
7530 ("{appsId}", "appsId"),
7531 ("{ingressRulesId}", "ingressRulesId"),
7532 ]
7533 .iter()
7534 {
7535 url = params.uri_replacement(url, param_name, find_this, false);
7536 }
7537 {
7538 let to_remove = ["ingressRulesId", "appsId"];
7539 params.remove_params(&to_remove);
7540 }
7541
7542 let url = params.parse_with_url(&url);
7543
7544 loop {
7545 let token = match self
7546 .hub
7547 .auth
7548 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7549 .await
7550 {
7551 Ok(token) => token,
7552 Err(e) => match dlg.token(e) {
7553 Ok(token) => token,
7554 Err(e) => {
7555 dlg.finished(false);
7556 return Err(common::Error::MissingToken(e));
7557 }
7558 },
7559 };
7560 let mut req_result = {
7561 let client = &self.hub.client;
7562 dlg.pre_request();
7563 let mut req_builder = hyper::Request::builder()
7564 .method(hyper::Method::GET)
7565 .uri(url.as_str())
7566 .header(USER_AGENT, self.hub._user_agent.clone());
7567
7568 if let Some(token) = token.as_ref() {
7569 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7570 }
7571
7572 let request = req_builder
7573 .header(CONTENT_LENGTH, 0_u64)
7574 .body(common::to_body::<String>(None));
7575
7576 client.request(request.unwrap()).await
7577 };
7578
7579 match req_result {
7580 Err(err) => {
7581 if let common::Retry::After(d) = dlg.http_error(&err) {
7582 sleep(d).await;
7583 continue;
7584 }
7585 dlg.finished(false);
7586 return Err(common::Error::HttpError(err));
7587 }
7588 Ok(res) => {
7589 let (mut parts, body) = res.into_parts();
7590 let mut body = common::Body::new(body);
7591 if !parts.status.is_success() {
7592 let bytes = common::to_bytes(body).await.unwrap_or_default();
7593 let error = serde_json::from_str(&common::to_string(&bytes));
7594 let response = common::to_response(parts, bytes.into());
7595
7596 if let common::Retry::After(d) =
7597 dlg.http_failure(&response, error.as_ref().ok())
7598 {
7599 sleep(d).await;
7600 continue;
7601 }
7602
7603 dlg.finished(false);
7604
7605 return Err(match error {
7606 Ok(value) => common::Error::BadRequest(value),
7607 _ => common::Error::Failure(response),
7608 });
7609 }
7610 let response = {
7611 let bytes = common::to_bytes(body).await.unwrap_or_default();
7612 let encoded = common::to_string(&bytes);
7613 match serde_json::from_str(&encoded) {
7614 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7615 Err(error) => {
7616 dlg.response_json_decode_error(&encoded, &error);
7617 return Err(common::Error::JsonDecodeError(
7618 encoded.to_string(),
7619 error,
7620 ));
7621 }
7622 }
7623 };
7624
7625 dlg.finished(true);
7626 return Ok(response);
7627 }
7628 }
7629 }
7630 }
7631
7632 /// Part of `name`. Name of the Firewall resource to retrieve. Example: apps/myapp/firewall/ingressRules/100.
7633 ///
7634 /// Sets the *apps id* path property to the given value.
7635 ///
7636 /// Even though the property as already been set when instantiating this call,
7637 /// we provide this method for API completeness.
7638 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleGetCall<'a, C> {
7639 self._apps_id = new_value.to_string();
7640 self
7641 }
7642 /// Part of `name`. See documentation of `appsId`.
7643 ///
7644 /// Sets the *ingress rules id* path property to the given value.
7645 ///
7646 /// Even though the property as already been set when instantiating this call,
7647 /// we provide this method for API completeness.
7648 pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRuleGetCall<'a, C> {
7649 self._ingress_rules_id = new_value.to_string();
7650 self
7651 }
7652 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7653 /// while executing the actual API request.
7654 ///
7655 /// ````text
7656 /// It should be used to handle progress information, and to implement a certain level of resilience.
7657 /// ````
7658 ///
7659 /// Sets the *delegate* property to the given value.
7660 pub fn delegate(
7661 mut self,
7662 new_value: &'a mut dyn common::Delegate,
7663 ) -> AppFirewallIngressRuleGetCall<'a, C> {
7664 self._delegate = Some(new_value);
7665 self
7666 }
7667
7668 /// Set any additional parameter of the query string used in the request.
7669 /// It should be used to set parameters which are not yet available through their own
7670 /// setters.
7671 ///
7672 /// Please note that this method must not be used to set any of the known parameters
7673 /// which have their own setter method. If done anyway, the request will fail.
7674 ///
7675 /// # Additional Parameters
7676 ///
7677 /// * *$.xgafv* (query-string) - V1 error format.
7678 /// * *access_token* (query-string) - OAuth access token.
7679 /// * *alt* (query-string) - Data format for response.
7680 /// * *callback* (query-string) - JSONP
7681 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7682 /// * *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.
7683 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7684 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7685 /// * *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.
7686 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7687 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7688 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleGetCall<'a, C>
7689 where
7690 T: AsRef<str>,
7691 {
7692 self._additional_params
7693 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7694 self
7695 }
7696
7697 /// Identifies the authorization scope for the method you are building.
7698 ///
7699 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7700 /// [`Scope::Admin`].
7701 ///
7702 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7703 /// tokens for more than one scope.
7704 ///
7705 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7706 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7707 /// sufficient, a read-write scope will do as well.
7708 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleGetCall<'a, C>
7709 where
7710 St: AsRef<str>,
7711 {
7712 self._scopes.insert(String::from(scope.as_ref()));
7713 self
7714 }
7715 /// Identifies the authorization scope(s) for the method you are building.
7716 ///
7717 /// See [`Self::add_scope()`] for details.
7718 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleGetCall<'a, C>
7719 where
7720 I: IntoIterator<Item = St>,
7721 St: AsRef<str>,
7722 {
7723 self._scopes
7724 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7725 self
7726 }
7727
7728 /// Removes all scopes, and no default scope will be used either.
7729 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7730 /// for details).
7731 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleGetCall<'a, C> {
7732 self._scopes.clear();
7733 self
7734 }
7735}
7736
7737/// Lists the firewall rules of an application.
7738///
7739/// A builder for the *firewall.ingressRules.list* method supported by a *app* resource.
7740/// It is not used directly, but through a [`AppMethods`] instance.
7741///
7742/// # Example
7743///
7744/// Instantiate a resource method builder
7745///
7746/// ```test_harness,no_run
7747/// # extern crate hyper;
7748/// # extern crate hyper_rustls;
7749/// # extern crate google_appengine1 as appengine1;
7750/// # async fn dox() {
7751/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7752///
7753/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7754/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7755/// # secret,
7756/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7757/// # ).build().await.unwrap();
7758///
7759/// # let client = hyper_util::client::legacy::Client::builder(
7760/// # hyper_util::rt::TokioExecutor::new()
7761/// # )
7762/// # .build(
7763/// # hyper_rustls::HttpsConnectorBuilder::new()
7764/// # .with_native_roots()
7765/// # .unwrap()
7766/// # .https_or_http()
7767/// # .enable_http1()
7768/// # .build()
7769/// # );
7770/// # let mut hub = Appengine::new(client, auth);
7771/// // You can configure optional parameters by calling the respective setters at will, and
7772/// // execute the final call using `doit()`.
7773/// // Values shown here are possibly random and not representative !
7774/// let result = hub.apps().firewall_ingress_rules_list("appsId")
7775/// .page_token("sed")
7776/// .page_size(-24)
7777/// .matching_address("et")
7778/// .doit().await;
7779/// # }
7780/// ```
7781pub struct AppFirewallIngressRuleListCall<'a, C>
7782where
7783 C: 'a,
7784{
7785 hub: &'a Appengine<C>,
7786 _apps_id: String,
7787 _page_token: Option<String>,
7788 _page_size: Option<i32>,
7789 _matching_address: Option<String>,
7790 _delegate: Option<&'a mut dyn common::Delegate>,
7791 _additional_params: HashMap<String, String>,
7792 _scopes: BTreeSet<String>,
7793}
7794
7795impl<'a, C> common::CallBuilder for AppFirewallIngressRuleListCall<'a, C> {}
7796
7797impl<'a, C> AppFirewallIngressRuleListCall<'a, C>
7798where
7799 C: common::Connector,
7800{
7801 /// Perform the operation you have build so far.
7802 pub async fn doit(mut self) -> common::Result<(common::Response, ListIngressRulesResponse)> {
7803 use std::borrow::Cow;
7804 use std::io::{Read, Seek};
7805
7806 use common::{url::Params, ToParts};
7807 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7808
7809 let mut dd = common::DefaultDelegate;
7810 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7811 dlg.begin(common::MethodInfo {
7812 id: "appengine.apps.firewall.ingressRules.list",
7813 http_method: hyper::Method::GET,
7814 });
7815
7816 for &field in ["alt", "appsId", "pageToken", "pageSize", "matchingAddress"].iter() {
7817 if self._additional_params.contains_key(field) {
7818 dlg.finished(false);
7819 return Err(common::Error::FieldClash(field));
7820 }
7821 }
7822
7823 let mut params = Params::with_capacity(6 + self._additional_params.len());
7824 params.push("appsId", self._apps_id);
7825 if let Some(value) = self._page_token.as_ref() {
7826 params.push("pageToken", value);
7827 }
7828 if let Some(value) = self._page_size.as_ref() {
7829 params.push("pageSize", value.to_string());
7830 }
7831 if let Some(value) = self._matching_address.as_ref() {
7832 params.push("matchingAddress", value);
7833 }
7834
7835 params.extend(self._additional_params.iter());
7836
7837 params.push("alt", "json");
7838 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules";
7839 if self._scopes.is_empty() {
7840 self._scopes.insert(Scope::Admin.as_ref().to_string());
7841 }
7842
7843 #[allow(clippy::single_element_loop)]
7844 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
7845 url = params.uri_replacement(url, param_name, find_this, false);
7846 }
7847 {
7848 let to_remove = ["appsId"];
7849 params.remove_params(&to_remove);
7850 }
7851
7852 let url = params.parse_with_url(&url);
7853
7854 loop {
7855 let token = match self
7856 .hub
7857 .auth
7858 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7859 .await
7860 {
7861 Ok(token) => token,
7862 Err(e) => match dlg.token(e) {
7863 Ok(token) => token,
7864 Err(e) => {
7865 dlg.finished(false);
7866 return Err(common::Error::MissingToken(e));
7867 }
7868 },
7869 };
7870 let mut req_result = {
7871 let client = &self.hub.client;
7872 dlg.pre_request();
7873 let mut req_builder = hyper::Request::builder()
7874 .method(hyper::Method::GET)
7875 .uri(url.as_str())
7876 .header(USER_AGENT, self.hub._user_agent.clone());
7877
7878 if let Some(token) = token.as_ref() {
7879 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7880 }
7881
7882 let request = req_builder
7883 .header(CONTENT_LENGTH, 0_u64)
7884 .body(common::to_body::<String>(None));
7885
7886 client.request(request.unwrap()).await
7887 };
7888
7889 match req_result {
7890 Err(err) => {
7891 if let common::Retry::After(d) = dlg.http_error(&err) {
7892 sleep(d).await;
7893 continue;
7894 }
7895 dlg.finished(false);
7896 return Err(common::Error::HttpError(err));
7897 }
7898 Ok(res) => {
7899 let (mut parts, body) = res.into_parts();
7900 let mut body = common::Body::new(body);
7901 if !parts.status.is_success() {
7902 let bytes = common::to_bytes(body).await.unwrap_or_default();
7903 let error = serde_json::from_str(&common::to_string(&bytes));
7904 let response = common::to_response(parts, bytes.into());
7905
7906 if let common::Retry::After(d) =
7907 dlg.http_failure(&response, error.as_ref().ok())
7908 {
7909 sleep(d).await;
7910 continue;
7911 }
7912
7913 dlg.finished(false);
7914
7915 return Err(match error {
7916 Ok(value) => common::Error::BadRequest(value),
7917 _ => common::Error::Failure(response),
7918 });
7919 }
7920 let response = {
7921 let bytes = common::to_bytes(body).await.unwrap_or_default();
7922 let encoded = common::to_string(&bytes);
7923 match serde_json::from_str(&encoded) {
7924 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7925 Err(error) => {
7926 dlg.response_json_decode_error(&encoded, &error);
7927 return Err(common::Error::JsonDecodeError(
7928 encoded.to_string(),
7929 error,
7930 ));
7931 }
7932 }
7933 };
7934
7935 dlg.finished(true);
7936 return Ok(response);
7937 }
7938 }
7939 }
7940 }
7941
7942 /// Part of `parent`. Name of the Firewall collection to retrieve. Example: apps/myapp/firewall/ingressRules.
7943 ///
7944 /// Sets the *apps id* path property to the given value.
7945 ///
7946 /// Even though the property as already been set when instantiating this call,
7947 /// we provide this method for API completeness.
7948 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, C> {
7949 self._apps_id = new_value.to_string();
7950 self
7951 }
7952 /// Continuation token for fetching the next page of results.
7953 ///
7954 /// Sets the *page token* query property to the given value.
7955 pub fn page_token(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, C> {
7956 self._page_token = Some(new_value.to_string());
7957 self
7958 }
7959 /// Maximum results to return per page.
7960 ///
7961 /// Sets the *page size* query property to the given value.
7962 pub fn page_size(mut self, new_value: i32) -> AppFirewallIngressRuleListCall<'a, C> {
7963 self._page_size = Some(new_value);
7964 self
7965 }
7966 /// 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.
7967 ///
7968 /// Sets the *matching address* query property to the given value.
7969 pub fn matching_address(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, C> {
7970 self._matching_address = Some(new_value.to_string());
7971 self
7972 }
7973 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7974 /// while executing the actual API request.
7975 ///
7976 /// ````text
7977 /// It should be used to handle progress information, and to implement a certain level of resilience.
7978 /// ````
7979 ///
7980 /// Sets the *delegate* property to the given value.
7981 pub fn delegate(
7982 mut self,
7983 new_value: &'a mut dyn common::Delegate,
7984 ) -> AppFirewallIngressRuleListCall<'a, C> {
7985 self._delegate = Some(new_value);
7986 self
7987 }
7988
7989 /// Set any additional parameter of the query string used in the request.
7990 /// It should be used to set parameters which are not yet available through their own
7991 /// setters.
7992 ///
7993 /// Please note that this method must not be used to set any of the known parameters
7994 /// which have their own setter method. If done anyway, the request will fail.
7995 ///
7996 /// # Additional Parameters
7997 ///
7998 /// * *$.xgafv* (query-string) - V1 error format.
7999 /// * *access_token* (query-string) - OAuth access token.
8000 /// * *alt* (query-string) - Data format for response.
8001 /// * *callback* (query-string) - JSONP
8002 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8003 /// * *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.
8004 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8005 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8006 /// * *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.
8007 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8008 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8009 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRuleListCall<'a, C>
8010 where
8011 T: AsRef<str>,
8012 {
8013 self._additional_params
8014 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8015 self
8016 }
8017
8018 /// Identifies the authorization scope for the method you are building.
8019 ///
8020 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8021 /// [`Scope::Admin`].
8022 ///
8023 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8024 /// tokens for more than one scope.
8025 ///
8026 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8027 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8028 /// sufficient, a read-write scope will do as well.
8029 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRuleListCall<'a, C>
8030 where
8031 St: AsRef<str>,
8032 {
8033 self._scopes.insert(String::from(scope.as_ref()));
8034 self
8035 }
8036 /// Identifies the authorization scope(s) for the method you are building.
8037 ///
8038 /// See [`Self::add_scope()`] for details.
8039 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRuleListCall<'a, C>
8040 where
8041 I: IntoIterator<Item = St>,
8042 St: AsRef<str>,
8043 {
8044 self._scopes
8045 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8046 self
8047 }
8048
8049 /// Removes all scopes, and no default scope will be used either.
8050 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8051 /// for details).
8052 pub fn clear_scopes(mut self) -> AppFirewallIngressRuleListCall<'a, C> {
8053 self._scopes.clear();
8054 self
8055 }
8056}
8057
8058/// Updates the specified firewall rule.
8059///
8060/// A builder for the *firewall.ingressRules.patch* method supported by a *app* resource.
8061/// It is not used directly, but through a [`AppMethods`] instance.
8062///
8063/// # Example
8064///
8065/// Instantiate a resource method builder
8066///
8067/// ```test_harness,no_run
8068/// # extern crate hyper;
8069/// # extern crate hyper_rustls;
8070/// # extern crate google_appengine1 as appengine1;
8071/// use appengine1::api::FirewallRule;
8072/// # async fn dox() {
8073/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8074///
8075/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8076/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8077/// # secret,
8078/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8079/// # ).build().await.unwrap();
8080///
8081/// # let client = hyper_util::client::legacy::Client::builder(
8082/// # hyper_util::rt::TokioExecutor::new()
8083/// # )
8084/// # .build(
8085/// # hyper_rustls::HttpsConnectorBuilder::new()
8086/// # .with_native_roots()
8087/// # .unwrap()
8088/// # .https_or_http()
8089/// # .enable_http1()
8090/// # .build()
8091/// # );
8092/// # let mut hub = Appengine::new(client, auth);
8093/// // As the method needs a request, you would usually fill it with the desired information
8094/// // into the respective structure. Some of the parts shown here might not be applicable !
8095/// // Values shown here are possibly random and not representative !
8096/// let mut req = FirewallRule::default();
8097///
8098/// // You can configure optional parameters by calling the respective setters at will, and
8099/// // execute the final call using `doit()`.
8100/// // Values shown here are possibly random and not representative !
8101/// let result = hub.apps().firewall_ingress_rules_patch(req, "appsId", "ingressRulesId")
8102/// .update_mask(FieldMask::new::<&str>(&[]))
8103/// .doit().await;
8104/// # }
8105/// ```
8106pub struct AppFirewallIngressRulePatchCall<'a, C>
8107where
8108 C: 'a,
8109{
8110 hub: &'a Appengine<C>,
8111 _request: FirewallRule,
8112 _apps_id: String,
8113 _ingress_rules_id: String,
8114 _update_mask: Option<common::FieldMask>,
8115 _delegate: Option<&'a mut dyn common::Delegate>,
8116 _additional_params: HashMap<String, String>,
8117 _scopes: BTreeSet<String>,
8118}
8119
8120impl<'a, C> common::CallBuilder for AppFirewallIngressRulePatchCall<'a, C> {}
8121
8122impl<'a, C> AppFirewallIngressRulePatchCall<'a, C>
8123where
8124 C: common::Connector,
8125{
8126 /// Perform the operation you have build so far.
8127 pub async fn doit(mut self) -> common::Result<(common::Response, FirewallRule)> {
8128 use std::borrow::Cow;
8129 use std::io::{Read, Seek};
8130
8131 use common::{url::Params, ToParts};
8132 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8133
8134 let mut dd = common::DefaultDelegate;
8135 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8136 dlg.begin(common::MethodInfo {
8137 id: "appengine.apps.firewall.ingressRules.patch",
8138 http_method: hyper::Method::PATCH,
8139 });
8140
8141 for &field in ["alt", "appsId", "ingressRulesId", "updateMask"].iter() {
8142 if self._additional_params.contains_key(field) {
8143 dlg.finished(false);
8144 return Err(common::Error::FieldClash(field));
8145 }
8146 }
8147
8148 let mut params = Params::with_capacity(6 + self._additional_params.len());
8149 params.push("appsId", self._apps_id);
8150 params.push("ingressRulesId", self._ingress_rules_id);
8151 if let Some(value) = self._update_mask.as_ref() {
8152 params.push("updateMask", value.to_string());
8153 }
8154
8155 params.extend(self._additional_params.iter());
8156
8157 params.push("alt", "json");
8158 let mut url =
8159 self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}";
8160 if self._scopes.is_empty() {
8161 self._scopes
8162 .insert(Scope::CloudPlatform.as_ref().to_string());
8163 }
8164
8165 #[allow(clippy::single_element_loop)]
8166 for &(find_this, param_name) in [
8167 ("{appsId}", "appsId"),
8168 ("{ingressRulesId}", "ingressRulesId"),
8169 ]
8170 .iter()
8171 {
8172 url = params.uri_replacement(url, param_name, find_this, false);
8173 }
8174 {
8175 let to_remove = ["ingressRulesId", "appsId"];
8176 params.remove_params(&to_remove);
8177 }
8178
8179 let url = params.parse_with_url(&url);
8180
8181 let mut json_mime_type = mime::APPLICATION_JSON;
8182 let mut request_value_reader = {
8183 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8184 common::remove_json_null_values(&mut value);
8185 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8186 serde_json::to_writer(&mut dst, &value).unwrap();
8187 dst
8188 };
8189 let request_size = request_value_reader
8190 .seek(std::io::SeekFrom::End(0))
8191 .unwrap();
8192 request_value_reader
8193 .seek(std::io::SeekFrom::Start(0))
8194 .unwrap();
8195
8196 loop {
8197 let token = match self
8198 .hub
8199 .auth
8200 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8201 .await
8202 {
8203 Ok(token) => token,
8204 Err(e) => match dlg.token(e) {
8205 Ok(token) => token,
8206 Err(e) => {
8207 dlg.finished(false);
8208 return Err(common::Error::MissingToken(e));
8209 }
8210 },
8211 };
8212 request_value_reader
8213 .seek(std::io::SeekFrom::Start(0))
8214 .unwrap();
8215 let mut req_result = {
8216 let client = &self.hub.client;
8217 dlg.pre_request();
8218 let mut req_builder = hyper::Request::builder()
8219 .method(hyper::Method::PATCH)
8220 .uri(url.as_str())
8221 .header(USER_AGENT, self.hub._user_agent.clone());
8222
8223 if let Some(token) = token.as_ref() {
8224 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8225 }
8226
8227 let request = req_builder
8228 .header(CONTENT_TYPE, json_mime_type.to_string())
8229 .header(CONTENT_LENGTH, request_size as u64)
8230 .body(common::to_body(
8231 request_value_reader.get_ref().clone().into(),
8232 ));
8233
8234 client.request(request.unwrap()).await
8235 };
8236
8237 match req_result {
8238 Err(err) => {
8239 if let common::Retry::After(d) = dlg.http_error(&err) {
8240 sleep(d).await;
8241 continue;
8242 }
8243 dlg.finished(false);
8244 return Err(common::Error::HttpError(err));
8245 }
8246 Ok(res) => {
8247 let (mut parts, body) = res.into_parts();
8248 let mut body = common::Body::new(body);
8249 if !parts.status.is_success() {
8250 let bytes = common::to_bytes(body).await.unwrap_or_default();
8251 let error = serde_json::from_str(&common::to_string(&bytes));
8252 let response = common::to_response(parts, bytes.into());
8253
8254 if let common::Retry::After(d) =
8255 dlg.http_failure(&response, error.as_ref().ok())
8256 {
8257 sleep(d).await;
8258 continue;
8259 }
8260
8261 dlg.finished(false);
8262
8263 return Err(match error {
8264 Ok(value) => common::Error::BadRequest(value),
8265 _ => common::Error::Failure(response),
8266 });
8267 }
8268 let response = {
8269 let bytes = common::to_bytes(body).await.unwrap_or_default();
8270 let encoded = common::to_string(&bytes);
8271 match serde_json::from_str(&encoded) {
8272 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8273 Err(error) => {
8274 dlg.response_json_decode_error(&encoded, &error);
8275 return Err(common::Error::JsonDecodeError(
8276 encoded.to_string(),
8277 error,
8278 ));
8279 }
8280 }
8281 };
8282
8283 dlg.finished(true);
8284 return Ok(response);
8285 }
8286 }
8287 }
8288 }
8289
8290 ///
8291 /// Sets the *request* property to the given value.
8292 ///
8293 /// Even though the property as already been set when instantiating this call,
8294 /// we provide this method for API completeness.
8295 pub fn request(mut self, new_value: FirewallRule) -> AppFirewallIngressRulePatchCall<'a, C> {
8296 self._request = new_value;
8297 self
8298 }
8299 /// Part of `name`. Name of the Firewall resource to update. Example: apps/myapp/firewall/ingressRules/100.
8300 ///
8301 /// Sets the *apps id* path property to the given value.
8302 ///
8303 /// Even though the property as already been set when instantiating this call,
8304 /// we provide this method for API completeness.
8305 pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRulePatchCall<'a, C> {
8306 self._apps_id = new_value.to_string();
8307 self
8308 }
8309 /// Part of `name`. See documentation of `appsId`.
8310 ///
8311 /// Sets the *ingress rules id* path property to the given value.
8312 ///
8313 /// Even though the property as already been set when instantiating this call,
8314 /// we provide this method for API completeness.
8315 pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRulePatchCall<'a, C> {
8316 self._ingress_rules_id = new_value.to_string();
8317 self
8318 }
8319 /// Standard field mask for the set of fields to be updated.
8320 ///
8321 /// Sets the *update mask* query property to the given value.
8322 pub fn update_mask(
8323 mut self,
8324 new_value: common::FieldMask,
8325 ) -> AppFirewallIngressRulePatchCall<'a, C> {
8326 self._update_mask = Some(new_value);
8327 self
8328 }
8329 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8330 /// while executing the actual API request.
8331 ///
8332 /// ````text
8333 /// It should be used to handle progress information, and to implement a certain level of resilience.
8334 /// ````
8335 ///
8336 /// Sets the *delegate* property to the given value.
8337 pub fn delegate(
8338 mut self,
8339 new_value: &'a mut dyn common::Delegate,
8340 ) -> AppFirewallIngressRulePatchCall<'a, C> {
8341 self._delegate = Some(new_value);
8342 self
8343 }
8344
8345 /// Set any additional parameter of the query string used in the request.
8346 /// It should be used to set parameters which are not yet available through their own
8347 /// setters.
8348 ///
8349 /// Please note that this method must not be used to set any of the known parameters
8350 /// which have their own setter method. If done anyway, the request will fail.
8351 ///
8352 /// # Additional Parameters
8353 ///
8354 /// * *$.xgafv* (query-string) - V1 error format.
8355 /// * *access_token* (query-string) - OAuth access token.
8356 /// * *alt* (query-string) - Data format for response.
8357 /// * *callback* (query-string) - JSONP
8358 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8359 /// * *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.
8360 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8361 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8362 /// * *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.
8363 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8364 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8365 pub fn param<T>(mut self, name: T, value: T) -> AppFirewallIngressRulePatchCall<'a, C>
8366 where
8367 T: AsRef<str>,
8368 {
8369 self._additional_params
8370 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8371 self
8372 }
8373
8374 /// Identifies the authorization scope for the method you are building.
8375 ///
8376 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8377 /// [`Scope::CloudPlatform`].
8378 ///
8379 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8380 /// tokens for more than one scope.
8381 ///
8382 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8383 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8384 /// sufficient, a read-write scope will do as well.
8385 pub fn add_scope<St>(mut self, scope: St) -> AppFirewallIngressRulePatchCall<'a, C>
8386 where
8387 St: AsRef<str>,
8388 {
8389 self._scopes.insert(String::from(scope.as_ref()));
8390 self
8391 }
8392 /// Identifies the authorization scope(s) for the method you are building.
8393 ///
8394 /// See [`Self::add_scope()`] for details.
8395 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppFirewallIngressRulePatchCall<'a, C>
8396 where
8397 I: IntoIterator<Item = St>,
8398 St: AsRef<str>,
8399 {
8400 self._scopes
8401 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8402 self
8403 }
8404
8405 /// Removes all scopes, and no default scope will be used either.
8406 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8407 /// for details).
8408 pub fn clear_scopes(mut self) -> AppFirewallIngressRulePatchCall<'a, C> {
8409 self._scopes.clear();
8410 self
8411 }
8412}
8413
8414/// Gets information about a location.
8415///
8416/// A builder for the *locations.get* method supported by a *app* resource.
8417/// It is not used directly, but through a [`AppMethods`] instance.
8418///
8419/// # Example
8420///
8421/// Instantiate a resource method builder
8422///
8423/// ```test_harness,no_run
8424/// # extern crate hyper;
8425/// # extern crate hyper_rustls;
8426/// # extern crate google_appengine1 as appengine1;
8427/// # async fn dox() {
8428/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8429///
8430/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8431/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8432/// # secret,
8433/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8434/// # ).build().await.unwrap();
8435///
8436/// # let client = hyper_util::client::legacy::Client::builder(
8437/// # hyper_util::rt::TokioExecutor::new()
8438/// # )
8439/// # .build(
8440/// # hyper_rustls::HttpsConnectorBuilder::new()
8441/// # .with_native_roots()
8442/// # .unwrap()
8443/// # .https_or_http()
8444/// # .enable_http1()
8445/// # .build()
8446/// # );
8447/// # let mut hub = Appengine::new(client, auth);
8448/// // You can configure optional parameters by calling the respective setters at will, and
8449/// // execute the final call using `doit()`.
8450/// // Values shown here are possibly random and not representative !
8451/// let result = hub.apps().locations_get("appsId", "locationsId")
8452/// .doit().await;
8453/// # }
8454/// ```
8455pub struct AppLocationGetCall<'a, C>
8456where
8457 C: 'a,
8458{
8459 hub: &'a Appengine<C>,
8460 _apps_id: String,
8461 _locations_id: String,
8462 _delegate: Option<&'a mut dyn common::Delegate>,
8463 _additional_params: HashMap<String, String>,
8464 _scopes: BTreeSet<String>,
8465}
8466
8467impl<'a, C> common::CallBuilder for AppLocationGetCall<'a, C> {}
8468
8469impl<'a, C> AppLocationGetCall<'a, C>
8470where
8471 C: common::Connector,
8472{
8473 /// Perform the operation you have build so far.
8474 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
8475 use std::borrow::Cow;
8476 use std::io::{Read, Seek};
8477
8478 use common::{url::Params, ToParts};
8479 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8480
8481 let mut dd = common::DefaultDelegate;
8482 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8483 dlg.begin(common::MethodInfo {
8484 id: "appengine.apps.locations.get",
8485 http_method: hyper::Method::GET,
8486 });
8487
8488 for &field in ["alt", "appsId", "locationsId"].iter() {
8489 if self._additional_params.contains_key(field) {
8490 dlg.finished(false);
8491 return Err(common::Error::FieldClash(field));
8492 }
8493 }
8494
8495 let mut params = Params::with_capacity(4 + self._additional_params.len());
8496 params.push("appsId", self._apps_id);
8497 params.push("locationsId", self._locations_id);
8498
8499 params.extend(self._additional_params.iter());
8500
8501 params.push("alt", "json");
8502 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/locations/{locationsId}";
8503 if self._scopes.is_empty() {
8504 self._scopes.insert(Scope::Admin.as_ref().to_string());
8505 }
8506
8507 #[allow(clippy::single_element_loop)]
8508 for &(find_this, param_name) in
8509 [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter()
8510 {
8511 url = params.uri_replacement(url, param_name, find_this, false);
8512 }
8513 {
8514 let to_remove = ["locationsId", "appsId"];
8515 params.remove_params(&to_remove);
8516 }
8517
8518 let url = params.parse_with_url(&url);
8519
8520 loop {
8521 let token = match self
8522 .hub
8523 .auth
8524 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8525 .await
8526 {
8527 Ok(token) => token,
8528 Err(e) => match dlg.token(e) {
8529 Ok(token) => token,
8530 Err(e) => {
8531 dlg.finished(false);
8532 return Err(common::Error::MissingToken(e));
8533 }
8534 },
8535 };
8536 let mut req_result = {
8537 let client = &self.hub.client;
8538 dlg.pre_request();
8539 let mut req_builder = hyper::Request::builder()
8540 .method(hyper::Method::GET)
8541 .uri(url.as_str())
8542 .header(USER_AGENT, self.hub._user_agent.clone());
8543
8544 if let Some(token) = token.as_ref() {
8545 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8546 }
8547
8548 let request = req_builder
8549 .header(CONTENT_LENGTH, 0_u64)
8550 .body(common::to_body::<String>(None));
8551
8552 client.request(request.unwrap()).await
8553 };
8554
8555 match req_result {
8556 Err(err) => {
8557 if let common::Retry::After(d) = dlg.http_error(&err) {
8558 sleep(d).await;
8559 continue;
8560 }
8561 dlg.finished(false);
8562 return Err(common::Error::HttpError(err));
8563 }
8564 Ok(res) => {
8565 let (mut parts, body) = res.into_parts();
8566 let mut body = common::Body::new(body);
8567 if !parts.status.is_success() {
8568 let bytes = common::to_bytes(body).await.unwrap_or_default();
8569 let error = serde_json::from_str(&common::to_string(&bytes));
8570 let response = common::to_response(parts, bytes.into());
8571
8572 if let common::Retry::After(d) =
8573 dlg.http_failure(&response, error.as_ref().ok())
8574 {
8575 sleep(d).await;
8576 continue;
8577 }
8578
8579 dlg.finished(false);
8580
8581 return Err(match error {
8582 Ok(value) => common::Error::BadRequest(value),
8583 _ => common::Error::Failure(response),
8584 });
8585 }
8586 let response = {
8587 let bytes = common::to_bytes(body).await.unwrap_or_default();
8588 let encoded = common::to_string(&bytes);
8589 match serde_json::from_str(&encoded) {
8590 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8591 Err(error) => {
8592 dlg.response_json_decode_error(&encoded, &error);
8593 return Err(common::Error::JsonDecodeError(
8594 encoded.to_string(),
8595 error,
8596 ));
8597 }
8598 }
8599 };
8600
8601 dlg.finished(true);
8602 return Ok(response);
8603 }
8604 }
8605 }
8606 }
8607
8608 /// Part of `name`. Resource name for the location.
8609 ///
8610 /// Sets the *apps id* path property to the given value.
8611 ///
8612 /// Even though the property as already been set when instantiating this call,
8613 /// we provide this method for API completeness.
8614 pub fn apps_id(mut self, new_value: &str) -> AppLocationGetCall<'a, C> {
8615 self._apps_id = new_value.to_string();
8616 self
8617 }
8618 /// Part of `name`. See documentation of `appsId`.
8619 ///
8620 /// Sets the *locations id* path property to the given value.
8621 ///
8622 /// Even though the property as already been set when instantiating this call,
8623 /// we provide this method for API completeness.
8624 pub fn locations_id(mut self, new_value: &str) -> AppLocationGetCall<'a, C> {
8625 self._locations_id = new_value.to_string();
8626 self
8627 }
8628 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8629 /// while executing the actual API request.
8630 ///
8631 /// ````text
8632 /// It should be used to handle progress information, and to implement a certain level of resilience.
8633 /// ````
8634 ///
8635 /// Sets the *delegate* property to the given value.
8636 pub fn delegate(
8637 mut self,
8638 new_value: &'a mut dyn common::Delegate,
8639 ) -> AppLocationGetCall<'a, C> {
8640 self._delegate = Some(new_value);
8641 self
8642 }
8643
8644 /// Set any additional parameter of the query string used in the request.
8645 /// It should be used to set parameters which are not yet available through their own
8646 /// setters.
8647 ///
8648 /// Please note that this method must not be used to set any of the known parameters
8649 /// which have their own setter method. If done anyway, the request will fail.
8650 ///
8651 /// # Additional Parameters
8652 ///
8653 /// * *$.xgafv* (query-string) - V1 error format.
8654 /// * *access_token* (query-string) - OAuth access token.
8655 /// * *alt* (query-string) - Data format for response.
8656 /// * *callback* (query-string) - JSONP
8657 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8658 /// * *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.
8659 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8660 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8661 /// * *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.
8662 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8663 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8664 pub fn param<T>(mut self, name: T, value: T) -> AppLocationGetCall<'a, C>
8665 where
8666 T: AsRef<str>,
8667 {
8668 self._additional_params
8669 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8670 self
8671 }
8672
8673 /// Identifies the authorization scope for the method you are building.
8674 ///
8675 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8676 /// [`Scope::Admin`].
8677 ///
8678 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8679 /// tokens for more than one scope.
8680 ///
8681 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8682 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8683 /// sufficient, a read-write scope will do as well.
8684 pub fn add_scope<St>(mut self, scope: St) -> AppLocationGetCall<'a, C>
8685 where
8686 St: AsRef<str>,
8687 {
8688 self._scopes.insert(String::from(scope.as_ref()));
8689 self
8690 }
8691 /// Identifies the authorization scope(s) for the method you are building.
8692 ///
8693 /// See [`Self::add_scope()`] for details.
8694 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppLocationGetCall<'a, C>
8695 where
8696 I: IntoIterator<Item = St>,
8697 St: AsRef<str>,
8698 {
8699 self._scopes
8700 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8701 self
8702 }
8703
8704 /// Removes all scopes, and no default scope will be used either.
8705 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8706 /// for details).
8707 pub fn clear_scopes(mut self) -> AppLocationGetCall<'a, C> {
8708 self._scopes.clear();
8709 self
8710 }
8711}
8712
8713/// Lists information about the supported locations for this service.
8714///
8715/// A builder for the *locations.list* method supported by a *app* resource.
8716/// It is not used directly, but through a [`AppMethods`] instance.
8717///
8718/// # Example
8719///
8720/// Instantiate a resource method builder
8721///
8722/// ```test_harness,no_run
8723/// # extern crate hyper;
8724/// # extern crate hyper_rustls;
8725/// # extern crate google_appengine1 as appengine1;
8726/// # async fn dox() {
8727/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8728///
8729/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8730/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8731/// # secret,
8732/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8733/// # ).build().await.unwrap();
8734///
8735/// # let client = hyper_util::client::legacy::Client::builder(
8736/// # hyper_util::rt::TokioExecutor::new()
8737/// # )
8738/// # .build(
8739/// # hyper_rustls::HttpsConnectorBuilder::new()
8740/// # .with_native_roots()
8741/// # .unwrap()
8742/// # .https_or_http()
8743/// # .enable_http1()
8744/// # .build()
8745/// # );
8746/// # let mut hub = Appengine::new(client, auth);
8747/// // You can configure optional parameters by calling the respective setters at will, and
8748/// // execute the final call using `doit()`.
8749/// // Values shown here are possibly random and not representative !
8750/// let result = hub.apps().locations_list("appsId")
8751/// .page_token("et")
8752/// .page_size(-28)
8753/// .filter("amet.")
8754/// .doit().await;
8755/// # }
8756/// ```
8757pub struct AppLocationListCall<'a, C>
8758where
8759 C: 'a,
8760{
8761 hub: &'a Appengine<C>,
8762 _apps_id: String,
8763 _page_token: Option<String>,
8764 _page_size: Option<i32>,
8765 _filter: Option<String>,
8766 _delegate: Option<&'a mut dyn common::Delegate>,
8767 _additional_params: HashMap<String, String>,
8768 _scopes: BTreeSet<String>,
8769}
8770
8771impl<'a, C> common::CallBuilder for AppLocationListCall<'a, C> {}
8772
8773impl<'a, C> AppLocationListCall<'a, C>
8774where
8775 C: common::Connector,
8776{
8777 /// Perform the operation you have build so far.
8778 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
8779 use std::borrow::Cow;
8780 use std::io::{Read, Seek};
8781
8782 use common::{url::Params, ToParts};
8783 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8784
8785 let mut dd = common::DefaultDelegate;
8786 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8787 dlg.begin(common::MethodInfo {
8788 id: "appengine.apps.locations.list",
8789 http_method: hyper::Method::GET,
8790 });
8791
8792 for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() {
8793 if self._additional_params.contains_key(field) {
8794 dlg.finished(false);
8795 return Err(common::Error::FieldClash(field));
8796 }
8797 }
8798
8799 let mut params = Params::with_capacity(6 + self._additional_params.len());
8800 params.push("appsId", self._apps_id);
8801 if let Some(value) = self._page_token.as_ref() {
8802 params.push("pageToken", value);
8803 }
8804 if let Some(value) = self._page_size.as_ref() {
8805 params.push("pageSize", value.to_string());
8806 }
8807 if let Some(value) = self._filter.as_ref() {
8808 params.push("filter", value);
8809 }
8810
8811 params.extend(self._additional_params.iter());
8812
8813 params.push("alt", "json");
8814 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/locations";
8815 if self._scopes.is_empty() {
8816 self._scopes.insert(Scope::Admin.as_ref().to_string());
8817 }
8818
8819 #[allow(clippy::single_element_loop)]
8820 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
8821 url = params.uri_replacement(url, param_name, find_this, false);
8822 }
8823 {
8824 let to_remove = ["appsId"];
8825 params.remove_params(&to_remove);
8826 }
8827
8828 let url = params.parse_with_url(&url);
8829
8830 loop {
8831 let token = match self
8832 .hub
8833 .auth
8834 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8835 .await
8836 {
8837 Ok(token) => token,
8838 Err(e) => match dlg.token(e) {
8839 Ok(token) => token,
8840 Err(e) => {
8841 dlg.finished(false);
8842 return Err(common::Error::MissingToken(e));
8843 }
8844 },
8845 };
8846 let mut req_result = {
8847 let client = &self.hub.client;
8848 dlg.pre_request();
8849 let mut req_builder = hyper::Request::builder()
8850 .method(hyper::Method::GET)
8851 .uri(url.as_str())
8852 .header(USER_AGENT, self.hub._user_agent.clone());
8853
8854 if let Some(token) = token.as_ref() {
8855 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8856 }
8857
8858 let request = req_builder
8859 .header(CONTENT_LENGTH, 0_u64)
8860 .body(common::to_body::<String>(None));
8861
8862 client.request(request.unwrap()).await
8863 };
8864
8865 match req_result {
8866 Err(err) => {
8867 if let common::Retry::After(d) = dlg.http_error(&err) {
8868 sleep(d).await;
8869 continue;
8870 }
8871 dlg.finished(false);
8872 return Err(common::Error::HttpError(err));
8873 }
8874 Ok(res) => {
8875 let (mut parts, body) = res.into_parts();
8876 let mut body = common::Body::new(body);
8877 if !parts.status.is_success() {
8878 let bytes = common::to_bytes(body).await.unwrap_or_default();
8879 let error = serde_json::from_str(&common::to_string(&bytes));
8880 let response = common::to_response(parts, bytes.into());
8881
8882 if let common::Retry::After(d) =
8883 dlg.http_failure(&response, error.as_ref().ok())
8884 {
8885 sleep(d).await;
8886 continue;
8887 }
8888
8889 dlg.finished(false);
8890
8891 return Err(match error {
8892 Ok(value) => common::Error::BadRequest(value),
8893 _ => common::Error::Failure(response),
8894 });
8895 }
8896 let response = {
8897 let bytes = common::to_bytes(body).await.unwrap_or_default();
8898 let encoded = common::to_string(&bytes);
8899 match serde_json::from_str(&encoded) {
8900 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8901 Err(error) => {
8902 dlg.response_json_decode_error(&encoded, &error);
8903 return Err(common::Error::JsonDecodeError(
8904 encoded.to_string(),
8905 error,
8906 ));
8907 }
8908 }
8909 };
8910
8911 dlg.finished(true);
8912 return Ok(response);
8913 }
8914 }
8915 }
8916 }
8917
8918 /// Part of `name`. The resource that owns the locations collection, if applicable.
8919 ///
8920 /// Sets the *apps id* path property to the given value.
8921 ///
8922 /// Even though the property as already been set when instantiating this call,
8923 /// we provide this method for API completeness.
8924 pub fn apps_id(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
8925 self._apps_id = new_value.to_string();
8926 self
8927 }
8928 /// A page token received from the next_page_token field in the response. Send that page token to receive the subsequent page.
8929 ///
8930 /// Sets the *page token* query property to the given value.
8931 pub fn page_token(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
8932 self._page_token = Some(new_value.to_string());
8933 self
8934 }
8935 /// The maximum number of results to return. If not set, the service selects a default.
8936 ///
8937 /// Sets the *page size* query property to the given value.
8938 pub fn page_size(mut self, new_value: i32) -> AppLocationListCall<'a, C> {
8939 self._page_size = Some(new_value);
8940 self
8941 }
8942 /// 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).
8943 ///
8944 /// Sets the *filter* query property to the given value.
8945 pub fn filter(mut self, new_value: &str) -> AppLocationListCall<'a, C> {
8946 self._filter = Some(new_value.to_string());
8947 self
8948 }
8949 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8950 /// while executing the actual API request.
8951 ///
8952 /// ````text
8953 /// It should be used to handle progress information, and to implement a certain level of resilience.
8954 /// ````
8955 ///
8956 /// Sets the *delegate* property to the given value.
8957 pub fn delegate(
8958 mut self,
8959 new_value: &'a mut dyn common::Delegate,
8960 ) -> AppLocationListCall<'a, C> {
8961 self._delegate = Some(new_value);
8962 self
8963 }
8964
8965 /// Set any additional parameter of the query string used in the request.
8966 /// It should be used to set parameters which are not yet available through their own
8967 /// setters.
8968 ///
8969 /// Please note that this method must not be used to set any of the known parameters
8970 /// which have their own setter method. If done anyway, the request will fail.
8971 ///
8972 /// # Additional Parameters
8973 ///
8974 /// * *$.xgafv* (query-string) - V1 error format.
8975 /// * *access_token* (query-string) - OAuth access token.
8976 /// * *alt* (query-string) - Data format for response.
8977 /// * *callback* (query-string) - JSONP
8978 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8979 /// * *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.
8980 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8981 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8982 /// * *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.
8983 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8984 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8985 pub fn param<T>(mut self, name: T, value: T) -> AppLocationListCall<'a, C>
8986 where
8987 T: AsRef<str>,
8988 {
8989 self._additional_params
8990 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8991 self
8992 }
8993
8994 /// Identifies the authorization scope for the method you are building.
8995 ///
8996 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8997 /// [`Scope::Admin`].
8998 ///
8999 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9000 /// tokens for more than one scope.
9001 ///
9002 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9003 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9004 /// sufficient, a read-write scope will do as well.
9005 pub fn add_scope<St>(mut self, scope: St) -> AppLocationListCall<'a, C>
9006 where
9007 St: AsRef<str>,
9008 {
9009 self._scopes.insert(String::from(scope.as_ref()));
9010 self
9011 }
9012 /// Identifies the authorization scope(s) for the method you are building.
9013 ///
9014 /// See [`Self::add_scope()`] for details.
9015 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppLocationListCall<'a, C>
9016 where
9017 I: IntoIterator<Item = St>,
9018 St: AsRef<str>,
9019 {
9020 self._scopes
9021 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9022 self
9023 }
9024
9025 /// Removes all scopes, and no default scope will be used either.
9026 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9027 /// for details).
9028 pub fn clear_scopes(mut self) -> AppLocationListCall<'a, C> {
9029 self._scopes.clear();
9030 self
9031 }
9032}
9033
9034/// 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.
9035///
9036/// A builder for the *operations.get* method supported by a *app* resource.
9037/// It is not used directly, but through a [`AppMethods`] instance.
9038///
9039/// # Example
9040///
9041/// Instantiate a resource method builder
9042///
9043/// ```test_harness,no_run
9044/// # extern crate hyper;
9045/// # extern crate hyper_rustls;
9046/// # extern crate google_appengine1 as appengine1;
9047/// # async fn dox() {
9048/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9049///
9050/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9051/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9052/// # secret,
9053/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9054/// # ).build().await.unwrap();
9055///
9056/// # let client = hyper_util::client::legacy::Client::builder(
9057/// # hyper_util::rt::TokioExecutor::new()
9058/// # )
9059/// # .build(
9060/// # hyper_rustls::HttpsConnectorBuilder::new()
9061/// # .with_native_roots()
9062/// # .unwrap()
9063/// # .https_or_http()
9064/// # .enable_http1()
9065/// # .build()
9066/// # );
9067/// # let mut hub = Appengine::new(client, auth);
9068/// // You can configure optional parameters by calling the respective setters at will, and
9069/// // execute the final call using `doit()`.
9070/// // Values shown here are possibly random and not representative !
9071/// let result = hub.apps().operations_get("appsId", "operationsId")
9072/// .doit().await;
9073/// # }
9074/// ```
9075pub struct AppOperationGetCall<'a, C>
9076where
9077 C: 'a,
9078{
9079 hub: &'a Appengine<C>,
9080 _apps_id: String,
9081 _operations_id: String,
9082 _delegate: Option<&'a mut dyn common::Delegate>,
9083 _additional_params: HashMap<String, String>,
9084 _scopes: BTreeSet<String>,
9085}
9086
9087impl<'a, C> common::CallBuilder for AppOperationGetCall<'a, C> {}
9088
9089impl<'a, C> AppOperationGetCall<'a, C>
9090where
9091 C: common::Connector,
9092{
9093 /// Perform the operation you have build so far.
9094 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9095 use std::borrow::Cow;
9096 use std::io::{Read, Seek};
9097
9098 use common::{url::Params, ToParts};
9099 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9100
9101 let mut dd = common::DefaultDelegate;
9102 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9103 dlg.begin(common::MethodInfo {
9104 id: "appengine.apps.operations.get",
9105 http_method: hyper::Method::GET,
9106 });
9107
9108 for &field in ["alt", "appsId", "operationsId"].iter() {
9109 if self._additional_params.contains_key(field) {
9110 dlg.finished(false);
9111 return Err(common::Error::FieldClash(field));
9112 }
9113 }
9114
9115 let mut params = Params::with_capacity(4 + self._additional_params.len());
9116 params.push("appsId", self._apps_id);
9117 params.push("operationsId", self._operations_id);
9118
9119 params.extend(self._additional_params.iter());
9120
9121 params.push("alt", "json");
9122 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/operations/{operationsId}";
9123 if self._scopes.is_empty() {
9124 self._scopes.insert(Scope::Admin.as_ref().to_string());
9125 }
9126
9127 #[allow(clippy::single_element_loop)]
9128 for &(find_this, param_name) in
9129 [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter()
9130 {
9131 url = params.uri_replacement(url, param_name, find_this, false);
9132 }
9133 {
9134 let to_remove = ["operationsId", "appsId"];
9135 params.remove_params(&to_remove);
9136 }
9137
9138 let url = params.parse_with_url(&url);
9139
9140 loop {
9141 let token = match self
9142 .hub
9143 .auth
9144 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9145 .await
9146 {
9147 Ok(token) => token,
9148 Err(e) => match dlg.token(e) {
9149 Ok(token) => token,
9150 Err(e) => {
9151 dlg.finished(false);
9152 return Err(common::Error::MissingToken(e));
9153 }
9154 },
9155 };
9156 let mut req_result = {
9157 let client = &self.hub.client;
9158 dlg.pre_request();
9159 let mut req_builder = hyper::Request::builder()
9160 .method(hyper::Method::GET)
9161 .uri(url.as_str())
9162 .header(USER_AGENT, self.hub._user_agent.clone());
9163
9164 if let Some(token) = token.as_ref() {
9165 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9166 }
9167
9168 let request = req_builder
9169 .header(CONTENT_LENGTH, 0_u64)
9170 .body(common::to_body::<String>(None));
9171
9172 client.request(request.unwrap()).await
9173 };
9174
9175 match req_result {
9176 Err(err) => {
9177 if let common::Retry::After(d) = dlg.http_error(&err) {
9178 sleep(d).await;
9179 continue;
9180 }
9181 dlg.finished(false);
9182 return Err(common::Error::HttpError(err));
9183 }
9184 Ok(res) => {
9185 let (mut parts, body) = res.into_parts();
9186 let mut body = common::Body::new(body);
9187 if !parts.status.is_success() {
9188 let bytes = common::to_bytes(body).await.unwrap_or_default();
9189 let error = serde_json::from_str(&common::to_string(&bytes));
9190 let response = common::to_response(parts, bytes.into());
9191
9192 if let common::Retry::After(d) =
9193 dlg.http_failure(&response, error.as_ref().ok())
9194 {
9195 sleep(d).await;
9196 continue;
9197 }
9198
9199 dlg.finished(false);
9200
9201 return Err(match error {
9202 Ok(value) => common::Error::BadRequest(value),
9203 _ => common::Error::Failure(response),
9204 });
9205 }
9206 let response = {
9207 let bytes = common::to_bytes(body).await.unwrap_or_default();
9208 let encoded = common::to_string(&bytes);
9209 match serde_json::from_str(&encoded) {
9210 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9211 Err(error) => {
9212 dlg.response_json_decode_error(&encoded, &error);
9213 return Err(common::Error::JsonDecodeError(
9214 encoded.to_string(),
9215 error,
9216 ));
9217 }
9218 }
9219 };
9220
9221 dlg.finished(true);
9222 return Ok(response);
9223 }
9224 }
9225 }
9226 }
9227
9228 /// Part of `name`. The name of the operation resource.
9229 ///
9230 /// Sets the *apps id* path property to the given value.
9231 ///
9232 /// Even though the property as already been set when instantiating this call,
9233 /// we provide this method for API completeness.
9234 pub fn apps_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C> {
9235 self._apps_id = new_value.to_string();
9236 self
9237 }
9238 /// Part of `name`. See documentation of `appsId`.
9239 ///
9240 /// Sets the *operations id* path property to the given value.
9241 ///
9242 /// Even though the property as already been set when instantiating this call,
9243 /// we provide this method for API completeness.
9244 pub fn operations_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C> {
9245 self._operations_id = new_value.to_string();
9246 self
9247 }
9248 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9249 /// while executing the actual API request.
9250 ///
9251 /// ````text
9252 /// It should be used to handle progress information, and to implement a certain level of resilience.
9253 /// ````
9254 ///
9255 /// Sets the *delegate* property to the given value.
9256 pub fn delegate(
9257 mut self,
9258 new_value: &'a mut dyn common::Delegate,
9259 ) -> AppOperationGetCall<'a, C> {
9260 self._delegate = Some(new_value);
9261 self
9262 }
9263
9264 /// Set any additional parameter of the query string used in the request.
9265 /// It should be used to set parameters which are not yet available through their own
9266 /// setters.
9267 ///
9268 /// Please note that this method must not be used to set any of the known parameters
9269 /// which have their own setter method. If done anyway, the request will fail.
9270 ///
9271 /// # Additional Parameters
9272 ///
9273 /// * *$.xgafv* (query-string) - V1 error format.
9274 /// * *access_token* (query-string) - OAuth access token.
9275 /// * *alt* (query-string) - Data format for response.
9276 /// * *callback* (query-string) - JSONP
9277 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9278 /// * *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.
9279 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9280 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9281 /// * *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.
9282 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9283 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9284 pub fn param<T>(mut self, name: T, value: T) -> AppOperationGetCall<'a, C>
9285 where
9286 T: AsRef<str>,
9287 {
9288 self._additional_params
9289 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9290 self
9291 }
9292
9293 /// Identifies the authorization scope for the method you are building.
9294 ///
9295 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9296 /// [`Scope::Admin`].
9297 ///
9298 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9299 /// tokens for more than one scope.
9300 ///
9301 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9302 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9303 /// sufficient, a read-write scope will do as well.
9304 pub fn add_scope<St>(mut self, scope: St) -> AppOperationGetCall<'a, C>
9305 where
9306 St: AsRef<str>,
9307 {
9308 self._scopes.insert(String::from(scope.as_ref()));
9309 self
9310 }
9311 /// Identifies the authorization scope(s) for the method you are building.
9312 ///
9313 /// See [`Self::add_scope()`] for details.
9314 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppOperationGetCall<'a, C>
9315 where
9316 I: IntoIterator<Item = St>,
9317 St: AsRef<str>,
9318 {
9319 self._scopes
9320 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9321 self
9322 }
9323
9324 /// Removes all scopes, and no default scope will be used either.
9325 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9326 /// for details).
9327 pub fn clear_scopes(mut self) -> AppOperationGetCall<'a, C> {
9328 self._scopes.clear();
9329 self
9330 }
9331}
9332
9333/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
9334///
9335/// A builder for the *operations.list* method supported by a *app* resource.
9336/// It is not used directly, but through a [`AppMethods`] instance.
9337///
9338/// # Example
9339///
9340/// Instantiate a resource method builder
9341///
9342/// ```test_harness,no_run
9343/// # extern crate hyper;
9344/// # extern crate hyper_rustls;
9345/// # extern crate google_appengine1 as appengine1;
9346/// # async fn dox() {
9347/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9348///
9349/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9350/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9351/// # secret,
9352/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9353/// # ).build().await.unwrap();
9354///
9355/// # let client = hyper_util::client::legacy::Client::builder(
9356/// # hyper_util::rt::TokioExecutor::new()
9357/// # )
9358/// # .build(
9359/// # hyper_rustls::HttpsConnectorBuilder::new()
9360/// # .with_native_roots()
9361/// # .unwrap()
9362/// # .https_or_http()
9363/// # .enable_http1()
9364/// # .build()
9365/// # );
9366/// # let mut hub = Appengine::new(client, auth);
9367/// // You can configure optional parameters by calling the respective setters at will, and
9368/// // execute the final call using `doit()`.
9369/// // Values shown here are possibly random and not representative !
9370/// let result = hub.apps().operations_list("appsId")
9371/// .page_token("et")
9372/// .page_size(-22)
9373/// .filter("sadipscing")
9374/// .doit().await;
9375/// # }
9376/// ```
9377pub struct AppOperationListCall<'a, C>
9378where
9379 C: 'a,
9380{
9381 hub: &'a Appengine<C>,
9382 _apps_id: String,
9383 _page_token: Option<String>,
9384 _page_size: Option<i32>,
9385 _filter: Option<String>,
9386 _delegate: Option<&'a mut dyn common::Delegate>,
9387 _additional_params: HashMap<String, String>,
9388 _scopes: BTreeSet<String>,
9389}
9390
9391impl<'a, C> common::CallBuilder for AppOperationListCall<'a, C> {}
9392
9393impl<'a, C> AppOperationListCall<'a, C>
9394where
9395 C: common::Connector,
9396{
9397 /// Perform the operation you have build so far.
9398 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
9399 use std::borrow::Cow;
9400 use std::io::{Read, Seek};
9401
9402 use common::{url::Params, ToParts};
9403 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9404
9405 let mut dd = common::DefaultDelegate;
9406 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9407 dlg.begin(common::MethodInfo {
9408 id: "appengine.apps.operations.list",
9409 http_method: hyper::Method::GET,
9410 });
9411
9412 for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() {
9413 if self._additional_params.contains_key(field) {
9414 dlg.finished(false);
9415 return Err(common::Error::FieldClash(field));
9416 }
9417 }
9418
9419 let mut params = Params::with_capacity(6 + self._additional_params.len());
9420 params.push("appsId", self._apps_id);
9421 if let Some(value) = self._page_token.as_ref() {
9422 params.push("pageToken", value);
9423 }
9424 if let Some(value) = self._page_size.as_ref() {
9425 params.push("pageSize", value.to_string());
9426 }
9427 if let Some(value) = self._filter.as_ref() {
9428 params.push("filter", value);
9429 }
9430
9431 params.extend(self._additional_params.iter());
9432
9433 params.push("alt", "json");
9434 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/operations";
9435 if self._scopes.is_empty() {
9436 self._scopes.insert(Scope::Admin.as_ref().to_string());
9437 }
9438
9439 #[allow(clippy::single_element_loop)]
9440 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
9441 url = params.uri_replacement(url, param_name, find_this, false);
9442 }
9443 {
9444 let to_remove = ["appsId"];
9445 params.remove_params(&to_remove);
9446 }
9447
9448 let url = params.parse_with_url(&url);
9449
9450 loop {
9451 let token = match self
9452 .hub
9453 .auth
9454 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9455 .await
9456 {
9457 Ok(token) => token,
9458 Err(e) => match dlg.token(e) {
9459 Ok(token) => token,
9460 Err(e) => {
9461 dlg.finished(false);
9462 return Err(common::Error::MissingToken(e));
9463 }
9464 },
9465 };
9466 let mut req_result = {
9467 let client = &self.hub.client;
9468 dlg.pre_request();
9469 let mut req_builder = hyper::Request::builder()
9470 .method(hyper::Method::GET)
9471 .uri(url.as_str())
9472 .header(USER_AGENT, self.hub._user_agent.clone());
9473
9474 if let Some(token) = token.as_ref() {
9475 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9476 }
9477
9478 let request = req_builder
9479 .header(CONTENT_LENGTH, 0_u64)
9480 .body(common::to_body::<String>(None));
9481
9482 client.request(request.unwrap()).await
9483 };
9484
9485 match req_result {
9486 Err(err) => {
9487 if let common::Retry::After(d) = dlg.http_error(&err) {
9488 sleep(d).await;
9489 continue;
9490 }
9491 dlg.finished(false);
9492 return Err(common::Error::HttpError(err));
9493 }
9494 Ok(res) => {
9495 let (mut parts, body) = res.into_parts();
9496 let mut body = common::Body::new(body);
9497 if !parts.status.is_success() {
9498 let bytes = common::to_bytes(body).await.unwrap_or_default();
9499 let error = serde_json::from_str(&common::to_string(&bytes));
9500 let response = common::to_response(parts, bytes.into());
9501
9502 if let common::Retry::After(d) =
9503 dlg.http_failure(&response, error.as_ref().ok())
9504 {
9505 sleep(d).await;
9506 continue;
9507 }
9508
9509 dlg.finished(false);
9510
9511 return Err(match error {
9512 Ok(value) => common::Error::BadRequest(value),
9513 _ => common::Error::Failure(response),
9514 });
9515 }
9516 let response = {
9517 let bytes = common::to_bytes(body).await.unwrap_or_default();
9518 let encoded = common::to_string(&bytes);
9519 match serde_json::from_str(&encoded) {
9520 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9521 Err(error) => {
9522 dlg.response_json_decode_error(&encoded, &error);
9523 return Err(common::Error::JsonDecodeError(
9524 encoded.to_string(),
9525 error,
9526 ));
9527 }
9528 }
9529 };
9530
9531 dlg.finished(true);
9532 return Ok(response);
9533 }
9534 }
9535 }
9536 }
9537
9538 /// Part of `name`. The name of the operation's parent resource.
9539 ///
9540 /// Sets the *apps id* path property to the given value.
9541 ///
9542 /// Even though the property as already been set when instantiating this call,
9543 /// we provide this method for API completeness.
9544 pub fn apps_id(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
9545 self._apps_id = new_value.to_string();
9546 self
9547 }
9548 /// The standard list page token.
9549 ///
9550 /// Sets the *page token* query property to the given value.
9551 pub fn page_token(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
9552 self._page_token = Some(new_value.to_string());
9553 self
9554 }
9555 /// The standard list page size.
9556 ///
9557 /// Sets the *page size* query property to the given value.
9558 pub fn page_size(mut self, new_value: i32) -> AppOperationListCall<'a, C> {
9559 self._page_size = Some(new_value);
9560 self
9561 }
9562 /// The standard list filter.
9563 ///
9564 /// Sets the *filter* query property to the given value.
9565 pub fn filter(mut self, new_value: &str) -> AppOperationListCall<'a, C> {
9566 self._filter = Some(new_value.to_string());
9567 self
9568 }
9569 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9570 /// while executing the actual API request.
9571 ///
9572 /// ````text
9573 /// It should be used to handle progress information, and to implement a certain level of resilience.
9574 /// ````
9575 ///
9576 /// Sets the *delegate* property to the given value.
9577 pub fn delegate(
9578 mut self,
9579 new_value: &'a mut dyn common::Delegate,
9580 ) -> AppOperationListCall<'a, C> {
9581 self._delegate = Some(new_value);
9582 self
9583 }
9584
9585 /// Set any additional parameter of the query string used in the request.
9586 /// It should be used to set parameters which are not yet available through their own
9587 /// setters.
9588 ///
9589 /// Please note that this method must not be used to set any of the known parameters
9590 /// which have their own setter method. If done anyway, the request will fail.
9591 ///
9592 /// # Additional Parameters
9593 ///
9594 /// * *$.xgafv* (query-string) - V1 error format.
9595 /// * *access_token* (query-string) - OAuth access token.
9596 /// * *alt* (query-string) - Data format for response.
9597 /// * *callback* (query-string) - JSONP
9598 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9599 /// * *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.
9600 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9601 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9602 /// * *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.
9603 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9604 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9605 pub fn param<T>(mut self, name: T, value: T) -> AppOperationListCall<'a, C>
9606 where
9607 T: AsRef<str>,
9608 {
9609 self._additional_params
9610 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9611 self
9612 }
9613
9614 /// Identifies the authorization scope for the method you are building.
9615 ///
9616 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9617 /// [`Scope::Admin`].
9618 ///
9619 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9620 /// tokens for more than one scope.
9621 ///
9622 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9623 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9624 /// sufficient, a read-write scope will do as well.
9625 pub fn add_scope<St>(mut self, scope: St) -> AppOperationListCall<'a, C>
9626 where
9627 St: AsRef<str>,
9628 {
9629 self._scopes.insert(String::from(scope.as_ref()));
9630 self
9631 }
9632 /// Identifies the authorization scope(s) for the method you are building.
9633 ///
9634 /// See [`Self::add_scope()`] for details.
9635 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppOperationListCall<'a, C>
9636 where
9637 I: IntoIterator<Item = St>,
9638 St: AsRef<str>,
9639 {
9640 self._scopes
9641 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9642 self
9643 }
9644
9645 /// Removes all scopes, and no default scope will be used either.
9646 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9647 /// for details).
9648 pub fn clear_scopes(mut self) -> AppOperationListCall<'a, C> {
9649 self._scopes.clear();
9650 self
9651 }
9652}
9653
9654/// 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.
9655///
9656/// A builder for the *services.versions.instances.debug* method supported by a *app* resource.
9657/// It is not used directly, but through a [`AppMethods`] instance.
9658///
9659/// # Example
9660///
9661/// Instantiate a resource method builder
9662///
9663/// ```test_harness,no_run
9664/// # extern crate hyper;
9665/// # extern crate hyper_rustls;
9666/// # extern crate google_appengine1 as appengine1;
9667/// use appengine1::api::DebugInstanceRequest;
9668/// # async fn dox() {
9669/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9670///
9671/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9672/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9673/// # secret,
9674/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9675/// # ).build().await.unwrap();
9676///
9677/// # let client = hyper_util::client::legacy::Client::builder(
9678/// # hyper_util::rt::TokioExecutor::new()
9679/// # )
9680/// # .build(
9681/// # hyper_rustls::HttpsConnectorBuilder::new()
9682/// # .with_native_roots()
9683/// # .unwrap()
9684/// # .https_or_http()
9685/// # .enable_http1()
9686/// # .build()
9687/// # );
9688/// # let mut hub = Appengine::new(client, auth);
9689/// // As the method needs a request, you would usually fill it with the desired information
9690/// // into the respective structure. Some of the parts shown here might not be applicable !
9691/// // Values shown here are possibly random and not representative !
9692/// let mut req = DebugInstanceRequest::default();
9693///
9694/// // You can configure optional parameters by calling the respective setters at will, and
9695/// // execute the final call using `doit()`.
9696/// // Values shown here are possibly random and not representative !
9697/// let result = hub.apps().services_versions_instances_debug(req, "appsId", "servicesId", "versionsId", "instancesId")
9698/// .doit().await;
9699/// # }
9700/// ```
9701pub struct AppServiceVersionInstanceDebugCall<'a, C>
9702where
9703 C: 'a,
9704{
9705 hub: &'a Appengine<C>,
9706 _request: DebugInstanceRequest,
9707 _apps_id: String,
9708 _services_id: String,
9709 _versions_id: String,
9710 _instances_id: String,
9711 _delegate: Option<&'a mut dyn common::Delegate>,
9712 _additional_params: HashMap<String, String>,
9713 _scopes: BTreeSet<String>,
9714}
9715
9716impl<'a, C> common::CallBuilder for AppServiceVersionInstanceDebugCall<'a, C> {}
9717
9718impl<'a, C> AppServiceVersionInstanceDebugCall<'a, C>
9719where
9720 C: common::Connector,
9721{
9722 /// Perform the operation you have build so far.
9723 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9724 use std::borrow::Cow;
9725 use std::io::{Read, Seek};
9726
9727 use common::{url::Params, ToParts};
9728 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9729
9730 let mut dd = common::DefaultDelegate;
9731 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9732 dlg.begin(common::MethodInfo {
9733 id: "appengine.apps.services.versions.instances.debug",
9734 http_method: hyper::Method::POST,
9735 });
9736
9737 for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
9738 if self._additional_params.contains_key(field) {
9739 dlg.finished(false);
9740 return Err(common::Error::FieldClash(field));
9741 }
9742 }
9743
9744 let mut params = Params::with_capacity(7 + self._additional_params.len());
9745 params.push("appsId", self._apps_id);
9746 params.push("servicesId", self._services_id);
9747 params.push("versionsId", self._versions_id);
9748 params.push("instancesId", self._instances_id);
9749
9750 params.extend(self._additional_params.iter());
9751
9752 params.push("alt", "json");
9753 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}:debug";
9754 if self._scopes.is_empty() {
9755 self._scopes
9756 .insert(Scope::CloudPlatform.as_ref().to_string());
9757 }
9758
9759 #[allow(clippy::single_element_loop)]
9760 for &(find_this, param_name) in [
9761 ("{appsId}", "appsId"),
9762 ("{servicesId}", "servicesId"),
9763 ("{versionsId}", "versionsId"),
9764 ("{instancesId}", "instancesId"),
9765 ]
9766 .iter()
9767 {
9768 url = params.uri_replacement(url, param_name, find_this, false);
9769 }
9770 {
9771 let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"];
9772 params.remove_params(&to_remove);
9773 }
9774
9775 let url = params.parse_with_url(&url);
9776
9777 let mut json_mime_type = mime::APPLICATION_JSON;
9778 let mut request_value_reader = {
9779 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9780 common::remove_json_null_values(&mut value);
9781 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9782 serde_json::to_writer(&mut dst, &value).unwrap();
9783 dst
9784 };
9785 let request_size = request_value_reader
9786 .seek(std::io::SeekFrom::End(0))
9787 .unwrap();
9788 request_value_reader
9789 .seek(std::io::SeekFrom::Start(0))
9790 .unwrap();
9791
9792 loop {
9793 let token = match self
9794 .hub
9795 .auth
9796 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9797 .await
9798 {
9799 Ok(token) => token,
9800 Err(e) => match dlg.token(e) {
9801 Ok(token) => token,
9802 Err(e) => {
9803 dlg.finished(false);
9804 return Err(common::Error::MissingToken(e));
9805 }
9806 },
9807 };
9808 request_value_reader
9809 .seek(std::io::SeekFrom::Start(0))
9810 .unwrap();
9811 let mut req_result = {
9812 let client = &self.hub.client;
9813 dlg.pre_request();
9814 let mut req_builder = hyper::Request::builder()
9815 .method(hyper::Method::POST)
9816 .uri(url.as_str())
9817 .header(USER_AGENT, self.hub._user_agent.clone());
9818
9819 if let Some(token) = token.as_ref() {
9820 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9821 }
9822
9823 let request = req_builder
9824 .header(CONTENT_TYPE, json_mime_type.to_string())
9825 .header(CONTENT_LENGTH, request_size as u64)
9826 .body(common::to_body(
9827 request_value_reader.get_ref().clone().into(),
9828 ));
9829
9830 client.request(request.unwrap()).await
9831 };
9832
9833 match req_result {
9834 Err(err) => {
9835 if let common::Retry::After(d) = dlg.http_error(&err) {
9836 sleep(d).await;
9837 continue;
9838 }
9839 dlg.finished(false);
9840 return Err(common::Error::HttpError(err));
9841 }
9842 Ok(res) => {
9843 let (mut parts, body) = res.into_parts();
9844 let mut body = common::Body::new(body);
9845 if !parts.status.is_success() {
9846 let bytes = common::to_bytes(body).await.unwrap_or_default();
9847 let error = serde_json::from_str(&common::to_string(&bytes));
9848 let response = common::to_response(parts, bytes.into());
9849
9850 if let common::Retry::After(d) =
9851 dlg.http_failure(&response, error.as_ref().ok())
9852 {
9853 sleep(d).await;
9854 continue;
9855 }
9856
9857 dlg.finished(false);
9858
9859 return Err(match error {
9860 Ok(value) => common::Error::BadRequest(value),
9861 _ => common::Error::Failure(response),
9862 });
9863 }
9864 let response = {
9865 let bytes = common::to_bytes(body).await.unwrap_or_default();
9866 let encoded = common::to_string(&bytes);
9867 match serde_json::from_str(&encoded) {
9868 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9869 Err(error) => {
9870 dlg.response_json_decode_error(&encoded, &error);
9871 return Err(common::Error::JsonDecodeError(
9872 encoded.to_string(),
9873 error,
9874 ));
9875 }
9876 }
9877 };
9878
9879 dlg.finished(true);
9880 return Ok(response);
9881 }
9882 }
9883 }
9884 }
9885
9886 ///
9887 /// Sets the *request* property to the given value.
9888 ///
9889 /// Even though the property as already been set when instantiating this call,
9890 /// we provide this method for API completeness.
9891 pub fn request(
9892 mut self,
9893 new_value: DebugInstanceRequest,
9894 ) -> AppServiceVersionInstanceDebugCall<'a, C> {
9895 self._request = new_value;
9896 self
9897 }
9898 /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
9899 ///
9900 /// Sets the *apps id* path property to the given value.
9901 ///
9902 /// Even though the property as already been set when instantiating this call,
9903 /// we provide this method for API completeness.
9904 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
9905 self._apps_id = new_value.to_string();
9906 self
9907 }
9908 /// Part of `name`. See documentation of `appsId`.
9909 ///
9910 /// Sets the *services id* path property to the given value.
9911 ///
9912 /// Even though the property as already been set when instantiating this call,
9913 /// we provide this method for API completeness.
9914 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
9915 self._services_id = new_value.to_string();
9916 self
9917 }
9918 /// Part of `name`. See documentation of `appsId`.
9919 ///
9920 /// Sets the *versions id* path property to the given value.
9921 ///
9922 /// Even though the property as already been set when instantiating this call,
9923 /// we provide this method for API completeness.
9924 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
9925 self._versions_id = new_value.to_string();
9926 self
9927 }
9928 /// Part of `name`. See documentation of `appsId`.
9929 ///
9930 /// Sets the *instances id* path property to the given value.
9931 ///
9932 /// Even though the property as already been set when instantiating this call,
9933 /// we provide this method for API completeness.
9934 pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, C> {
9935 self._instances_id = new_value.to_string();
9936 self
9937 }
9938 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9939 /// while executing the actual API request.
9940 ///
9941 /// ````text
9942 /// It should be used to handle progress information, and to implement a certain level of resilience.
9943 /// ````
9944 ///
9945 /// Sets the *delegate* property to the given value.
9946 pub fn delegate(
9947 mut self,
9948 new_value: &'a mut dyn common::Delegate,
9949 ) -> AppServiceVersionInstanceDebugCall<'a, C> {
9950 self._delegate = Some(new_value);
9951 self
9952 }
9953
9954 /// Set any additional parameter of the query string used in the request.
9955 /// It should be used to set parameters which are not yet available through their own
9956 /// setters.
9957 ///
9958 /// Please note that this method must not be used to set any of the known parameters
9959 /// which have their own setter method. If done anyway, the request will fail.
9960 ///
9961 /// # Additional Parameters
9962 ///
9963 /// * *$.xgafv* (query-string) - V1 error format.
9964 /// * *access_token* (query-string) - OAuth access token.
9965 /// * *alt* (query-string) - Data format for response.
9966 /// * *callback* (query-string) - JSONP
9967 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9968 /// * *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.
9969 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9970 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9971 /// * *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.
9972 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9973 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9974 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceDebugCall<'a, C>
9975 where
9976 T: AsRef<str>,
9977 {
9978 self._additional_params
9979 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9980 self
9981 }
9982
9983 /// Identifies the authorization scope for the method you are building.
9984 ///
9985 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9986 /// [`Scope::CloudPlatform`].
9987 ///
9988 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9989 /// tokens for more than one scope.
9990 ///
9991 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9992 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9993 /// sufficient, a read-write scope will do as well.
9994 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceDebugCall<'a, C>
9995 where
9996 St: AsRef<str>,
9997 {
9998 self._scopes.insert(String::from(scope.as_ref()));
9999 self
10000 }
10001 /// Identifies the authorization scope(s) for the method you are building.
10002 ///
10003 /// See [`Self::add_scope()`] for details.
10004 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceDebugCall<'a, C>
10005 where
10006 I: IntoIterator<Item = St>,
10007 St: AsRef<str>,
10008 {
10009 self._scopes
10010 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10011 self
10012 }
10013
10014 /// Removes all scopes, and no default scope will be used either.
10015 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10016 /// for details).
10017 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceDebugCall<'a, C> {
10018 self._scopes.clear();
10019 self
10020 }
10021}
10022
10023/// 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.
10024///
10025/// A builder for the *services.versions.instances.delete* method supported by a *app* resource.
10026/// It is not used directly, but through a [`AppMethods`] instance.
10027///
10028/// # Example
10029///
10030/// Instantiate a resource method builder
10031///
10032/// ```test_harness,no_run
10033/// # extern crate hyper;
10034/// # extern crate hyper_rustls;
10035/// # extern crate google_appengine1 as appengine1;
10036/// # async fn dox() {
10037/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10038///
10039/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10040/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10041/// # secret,
10042/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10043/// # ).build().await.unwrap();
10044///
10045/// # let client = hyper_util::client::legacy::Client::builder(
10046/// # hyper_util::rt::TokioExecutor::new()
10047/// # )
10048/// # .build(
10049/// # hyper_rustls::HttpsConnectorBuilder::new()
10050/// # .with_native_roots()
10051/// # .unwrap()
10052/// # .https_or_http()
10053/// # .enable_http1()
10054/// # .build()
10055/// # );
10056/// # let mut hub = Appengine::new(client, auth);
10057/// // You can configure optional parameters by calling the respective setters at will, and
10058/// // execute the final call using `doit()`.
10059/// // Values shown here are possibly random and not representative !
10060/// let result = hub.apps().services_versions_instances_delete("appsId", "servicesId", "versionsId", "instancesId")
10061/// .doit().await;
10062/// # }
10063/// ```
10064pub struct AppServiceVersionInstanceDeleteCall<'a, C>
10065where
10066 C: 'a,
10067{
10068 hub: &'a Appengine<C>,
10069 _apps_id: String,
10070 _services_id: String,
10071 _versions_id: String,
10072 _instances_id: String,
10073 _delegate: Option<&'a mut dyn common::Delegate>,
10074 _additional_params: HashMap<String, String>,
10075 _scopes: BTreeSet<String>,
10076}
10077
10078impl<'a, C> common::CallBuilder for AppServiceVersionInstanceDeleteCall<'a, C> {}
10079
10080impl<'a, C> AppServiceVersionInstanceDeleteCall<'a, C>
10081where
10082 C: common::Connector,
10083{
10084 /// Perform the operation you have build so far.
10085 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10086 use std::borrow::Cow;
10087 use std::io::{Read, Seek};
10088
10089 use common::{url::Params, ToParts};
10090 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10091
10092 let mut dd = common::DefaultDelegate;
10093 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10094 dlg.begin(common::MethodInfo {
10095 id: "appengine.apps.services.versions.instances.delete",
10096 http_method: hyper::Method::DELETE,
10097 });
10098
10099 for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
10100 if self._additional_params.contains_key(field) {
10101 dlg.finished(false);
10102 return Err(common::Error::FieldClash(field));
10103 }
10104 }
10105
10106 let mut params = Params::with_capacity(6 + self._additional_params.len());
10107 params.push("appsId", self._apps_id);
10108 params.push("servicesId", self._services_id);
10109 params.push("versionsId", self._versions_id);
10110 params.push("instancesId", self._instances_id);
10111
10112 params.extend(self._additional_params.iter());
10113
10114 params.push("alt", "json");
10115 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}";
10116 if self._scopes.is_empty() {
10117 self._scopes
10118 .insert(Scope::CloudPlatform.as_ref().to_string());
10119 }
10120
10121 #[allow(clippy::single_element_loop)]
10122 for &(find_this, param_name) in [
10123 ("{appsId}", "appsId"),
10124 ("{servicesId}", "servicesId"),
10125 ("{versionsId}", "versionsId"),
10126 ("{instancesId}", "instancesId"),
10127 ]
10128 .iter()
10129 {
10130 url = params.uri_replacement(url, param_name, find_this, false);
10131 }
10132 {
10133 let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"];
10134 params.remove_params(&to_remove);
10135 }
10136
10137 let url = params.parse_with_url(&url);
10138
10139 loop {
10140 let token = match self
10141 .hub
10142 .auth
10143 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10144 .await
10145 {
10146 Ok(token) => token,
10147 Err(e) => match dlg.token(e) {
10148 Ok(token) => token,
10149 Err(e) => {
10150 dlg.finished(false);
10151 return Err(common::Error::MissingToken(e));
10152 }
10153 },
10154 };
10155 let mut req_result = {
10156 let client = &self.hub.client;
10157 dlg.pre_request();
10158 let mut req_builder = hyper::Request::builder()
10159 .method(hyper::Method::DELETE)
10160 .uri(url.as_str())
10161 .header(USER_AGENT, self.hub._user_agent.clone());
10162
10163 if let Some(token) = token.as_ref() {
10164 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10165 }
10166
10167 let request = req_builder
10168 .header(CONTENT_LENGTH, 0_u64)
10169 .body(common::to_body::<String>(None));
10170
10171 client.request(request.unwrap()).await
10172 };
10173
10174 match req_result {
10175 Err(err) => {
10176 if let common::Retry::After(d) = dlg.http_error(&err) {
10177 sleep(d).await;
10178 continue;
10179 }
10180 dlg.finished(false);
10181 return Err(common::Error::HttpError(err));
10182 }
10183 Ok(res) => {
10184 let (mut parts, body) = res.into_parts();
10185 let mut body = common::Body::new(body);
10186 if !parts.status.is_success() {
10187 let bytes = common::to_bytes(body).await.unwrap_or_default();
10188 let error = serde_json::from_str(&common::to_string(&bytes));
10189 let response = common::to_response(parts, bytes.into());
10190
10191 if let common::Retry::After(d) =
10192 dlg.http_failure(&response, error.as_ref().ok())
10193 {
10194 sleep(d).await;
10195 continue;
10196 }
10197
10198 dlg.finished(false);
10199
10200 return Err(match error {
10201 Ok(value) => common::Error::BadRequest(value),
10202 _ => common::Error::Failure(response),
10203 });
10204 }
10205 let response = {
10206 let bytes = common::to_bytes(body).await.unwrap_or_default();
10207 let encoded = common::to_string(&bytes);
10208 match serde_json::from_str(&encoded) {
10209 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10210 Err(error) => {
10211 dlg.response_json_decode_error(&encoded, &error);
10212 return Err(common::Error::JsonDecodeError(
10213 encoded.to_string(),
10214 error,
10215 ));
10216 }
10217 }
10218 };
10219
10220 dlg.finished(true);
10221 return Ok(response);
10222 }
10223 }
10224 }
10225 }
10226
10227 /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
10228 ///
10229 /// Sets the *apps id* path property to the given value.
10230 ///
10231 /// Even though the property as already been set when instantiating this call,
10232 /// we provide this method for API completeness.
10233 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
10234 self._apps_id = new_value.to_string();
10235 self
10236 }
10237 /// Part of `name`. See documentation of `appsId`.
10238 ///
10239 /// Sets the *services id* path property to the given value.
10240 ///
10241 /// Even though the property as already been set when instantiating this call,
10242 /// we provide this method for API completeness.
10243 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
10244 self._services_id = new_value.to_string();
10245 self
10246 }
10247 /// Part of `name`. See documentation of `appsId`.
10248 ///
10249 /// Sets the *versions id* path property to the given value.
10250 ///
10251 /// Even though the property as already been set when instantiating this call,
10252 /// we provide this method for API completeness.
10253 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
10254 self._versions_id = new_value.to_string();
10255 self
10256 }
10257 /// Part of `name`. See documentation of `appsId`.
10258 ///
10259 /// Sets the *instances id* path property to the given value.
10260 ///
10261 /// Even though the property as already been set when instantiating this call,
10262 /// we provide this method for API completeness.
10263 pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, C> {
10264 self._instances_id = new_value.to_string();
10265 self
10266 }
10267 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10268 /// while executing the actual API request.
10269 ///
10270 /// ````text
10271 /// It should be used to handle progress information, and to implement a certain level of resilience.
10272 /// ````
10273 ///
10274 /// Sets the *delegate* property to the given value.
10275 pub fn delegate(
10276 mut self,
10277 new_value: &'a mut dyn common::Delegate,
10278 ) -> AppServiceVersionInstanceDeleteCall<'a, C> {
10279 self._delegate = Some(new_value);
10280 self
10281 }
10282
10283 /// Set any additional parameter of the query string used in the request.
10284 /// It should be used to set parameters which are not yet available through their own
10285 /// setters.
10286 ///
10287 /// Please note that this method must not be used to set any of the known parameters
10288 /// which have their own setter method. If done anyway, the request will fail.
10289 ///
10290 /// # Additional Parameters
10291 ///
10292 /// * *$.xgafv* (query-string) - V1 error format.
10293 /// * *access_token* (query-string) - OAuth access token.
10294 /// * *alt* (query-string) - Data format for response.
10295 /// * *callback* (query-string) - JSONP
10296 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10297 /// * *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.
10298 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10299 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10300 /// * *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.
10301 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10302 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10303 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceDeleteCall<'a, C>
10304 where
10305 T: AsRef<str>,
10306 {
10307 self._additional_params
10308 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10309 self
10310 }
10311
10312 /// Identifies the authorization scope for the method you are building.
10313 ///
10314 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10315 /// [`Scope::CloudPlatform`].
10316 ///
10317 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10318 /// tokens for more than one scope.
10319 ///
10320 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10321 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10322 /// sufficient, a read-write scope will do as well.
10323 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceDeleteCall<'a, C>
10324 where
10325 St: AsRef<str>,
10326 {
10327 self._scopes.insert(String::from(scope.as_ref()));
10328 self
10329 }
10330 /// Identifies the authorization scope(s) for the method you are building.
10331 ///
10332 /// See [`Self::add_scope()`] for details.
10333 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceDeleteCall<'a, C>
10334 where
10335 I: IntoIterator<Item = St>,
10336 St: AsRef<str>,
10337 {
10338 self._scopes
10339 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10340 self
10341 }
10342
10343 /// Removes all scopes, and no default scope will be used either.
10344 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10345 /// for details).
10346 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceDeleteCall<'a, C> {
10347 self._scopes.clear();
10348 self
10349 }
10350}
10351
10352/// Gets instance information.
10353///
10354/// A builder for the *services.versions.instances.get* method supported by a *app* resource.
10355/// It is not used directly, but through a [`AppMethods`] instance.
10356///
10357/// # Example
10358///
10359/// Instantiate a resource method builder
10360///
10361/// ```test_harness,no_run
10362/// # extern crate hyper;
10363/// # extern crate hyper_rustls;
10364/// # extern crate google_appengine1 as appengine1;
10365/// # async fn dox() {
10366/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10367///
10368/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10369/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10370/// # secret,
10371/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10372/// # ).build().await.unwrap();
10373///
10374/// # let client = hyper_util::client::legacy::Client::builder(
10375/// # hyper_util::rt::TokioExecutor::new()
10376/// # )
10377/// # .build(
10378/// # hyper_rustls::HttpsConnectorBuilder::new()
10379/// # .with_native_roots()
10380/// # .unwrap()
10381/// # .https_or_http()
10382/// # .enable_http1()
10383/// # .build()
10384/// # );
10385/// # let mut hub = Appengine::new(client, auth);
10386/// // You can configure optional parameters by calling the respective setters at will, and
10387/// // execute the final call using `doit()`.
10388/// // Values shown here are possibly random and not representative !
10389/// let result = hub.apps().services_versions_instances_get("appsId", "servicesId", "versionsId", "instancesId")
10390/// .doit().await;
10391/// # }
10392/// ```
10393pub struct AppServiceVersionInstanceGetCall<'a, C>
10394where
10395 C: 'a,
10396{
10397 hub: &'a Appengine<C>,
10398 _apps_id: String,
10399 _services_id: String,
10400 _versions_id: String,
10401 _instances_id: String,
10402 _delegate: Option<&'a mut dyn common::Delegate>,
10403 _additional_params: HashMap<String, String>,
10404 _scopes: BTreeSet<String>,
10405}
10406
10407impl<'a, C> common::CallBuilder for AppServiceVersionInstanceGetCall<'a, C> {}
10408
10409impl<'a, C> AppServiceVersionInstanceGetCall<'a, C>
10410where
10411 C: common::Connector,
10412{
10413 /// Perform the operation you have build so far.
10414 pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
10415 use std::borrow::Cow;
10416 use std::io::{Read, Seek};
10417
10418 use common::{url::Params, ToParts};
10419 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10420
10421 let mut dd = common::DefaultDelegate;
10422 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10423 dlg.begin(common::MethodInfo {
10424 id: "appengine.apps.services.versions.instances.get",
10425 http_method: hyper::Method::GET,
10426 });
10427
10428 for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
10429 if self._additional_params.contains_key(field) {
10430 dlg.finished(false);
10431 return Err(common::Error::FieldClash(field));
10432 }
10433 }
10434
10435 let mut params = Params::with_capacity(6 + self._additional_params.len());
10436 params.push("appsId", self._apps_id);
10437 params.push("servicesId", self._services_id);
10438 params.push("versionsId", self._versions_id);
10439 params.push("instancesId", self._instances_id);
10440
10441 params.extend(self._additional_params.iter());
10442
10443 params.push("alt", "json");
10444 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}";
10445 if self._scopes.is_empty() {
10446 self._scopes.insert(Scope::Admin.as_ref().to_string());
10447 }
10448
10449 #[allow(clippy::single_element_loop)]
10450 for &(find_this, param_name) in [
10451 ("{appsId}", "appsId"),
10452 ("{servicesId}", "servicesId"),
10453 ("{versionsId}", "versionsId"),
10454 ("{instancesId}", "instancesId"),
10455 ]
10456 .iter()
10457 {
10458 url = params.uri_replacement(url, param_name, find_this, false);
10459 }
10460 {
10461 let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"];
10462 params.remove_params(&to_remove);
10463 }
10464
10465 let url = params.parse_with_url(&url);
10466
10467 loop {
10468 let token = match self
10469 .hub
10470 .auth
10471 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10472 .await
10473 {
10474 Ok(token) => token,
10475 Err(e) => match dlg.token(e) {
10476 Ok(token) => token,
10477 Err(e) => {
10478 dlg.finished(false);
10479 return Err(common::Error::MissingToken(e));
10480 }
10481 },
10482 };
10483 let mut req_result = {
10484 let client = &self.hub.client;
10485 dlg.pre_request();
10486 let mut req_builder = hyper::Request::builder()
10487 .method(hyper::Method::GET)
10488 .uri(url.as_str())
10489 .header(USER_AGENT, self.hub._user_agent.clone());
10490
10491 if let Some(token) = token.as_ref() {
10492 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10493 }
10494
10495 let request = req_builder
10496 .header(CONTENT_LENGTH, 0_u64)
10497 .body(common::to_body::<String>(None));
10498
10499 client.request(request.unwrap()).await
10500 };
10501
10502 match req_result {
10503 Err(err) => {
10504 if let common::Retry::After(d) = dlg.http_error(&err) {
10505 sleep(d).await;
10506 continue;
10507 }
10508 dlg.finished(false);
10509 return Err(common::Error::HttpError(err));
10510 }
10511 Ok(res) => {
10512 let (mut parts, body) = res.into_parts();
10513 let mut body = common::Body::new(body);
10514 if !parts.status.is_success() {
10515 let bytes = common::to_bytes(body).await.unwrap_or_default();
10516 let error = serde_json::from_str(&common::to_string(&bytes));
10517 let response = common::to_response(parts, bytes.into());
10518
10519 if let common::Retry::After(d) =
10520 dlg.http_failure(&response, error.as_ref().ok())
10521 {
10522 sleep(d).await;
10523 continue;
10524 }
10525
10526 dlg.finished(false);
10527
10528 return Err(match error {
10529 Ok(value) => common::Error::BadRequest(value),
10530 _ => common::Error::Failure(response),
10531 });
10532 }
10533 let response = {
10534 let bytes = common::to_bytes(body).await.unwrap_or_default();
10535 let encoded = common::to_string(&bytes);
10536 match serde_json::from_str(&encoded) {
10537 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10538 Err(error) => {
10539 dlg.response_json_decode_error(&encoded, &error);
10540 return Err(common::Error::JsonDecodeError(
10541 encoded.to_string(),
10542 error,
10543 ));
10544 }
10545 }
10546 };
10547
10548 dlg.finished(true);
10549 return Ok(response);
10550 }
10551 }
10552 }
10553 }
10554
10555 /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
10556 ///
10557 /// Sets the *apps id* path property to the given value.
10558 ///
10559 /// Even though the property as already been set when instantiating this call,
10560 /// we provide this method for API completeness.
10561 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
10562 self._apps_id = new_value.to_string();
10563 self
10564 }
10565 /// Part of `name`. See documentation of `appsId`.
10566 ///
10567 /// Sets the *services id* path property to the given value.
10568 ///
10569 /// Even though the property as already been set when instantiating this call,
10570 /// we provide this method for API completeness.
10571 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
10572 self._services_id = new_value.to_string();
10573 self
10574 }
10575 /// Part of `name`. See documentation of `appsId`.
10576 ///
10577 /// Sets the *versions id* path property to the given value.
10578 ///
10579 /// Even though the property as already been set when instantiating this call,
10580 /// we provide this method for API completeness.
10581 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
10582 self._versions_id = new_value.to_string();
10583 self
10584 }
10585 /// Part of `name`. See documentation of `appsId`.
10586 ///
10587 /// Sets the *instances id* path property to the given value.
10588 ///
10589 /// Even though the property as already been set when instantiating this call,
10590 /// we provide this method for API completeness.
10591 pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, C> {
10592 self._instances_id = new_value.to_string();
10593 self
10594 }
10595 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10596 /// while executing the actual API request.
10597 ///
10598 /// ````text
10599 /// It should be used to handle progress information, and to implement a certain level of resilience.
10600 /// ````
10601 ///
10602 /// Sets the *delegate* property to the given value.
10603 pub fn delegate(
10604 mut self,
10605 new_value: &'a mut dyn common::Delegate,
10606 ) -> AppServiceVersionInstanceGetCall<'a, C> {
10607 self._delegate = Some(new_value);
10608 self
10609 }
10610
10611 /// Set any additional parameter of the query string used in the request.
10612 /// It should be used to set parameters which are not yet available through their own
10613 /// setters.
10614 ///
10615 /// Please note that this method must not be used to set any of the known parameters
10616 /// which have their own setter method. If done anyway, the request will fail.
10617 ///
10618 /// # Additional Parameters
10619 ///
10620 /// * *$.xgafv* (query-string) - V1 error format.
10621 /// * *access_token* (query-string) - OAuth access token.
10622 /// * *alt* (query-string) - Data format for response.
10623 /// * *callback* (query-string) - JSONP
10624 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10625 /// * *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.
10626 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10627 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10628 /// * *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.
10629 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10630 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10631 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceGetCall<'a, C>
10632 where
10633 T: AsRef<str>,
10634 {
10635 self._additional_params
10636 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10637 self
10638 }
10639
10640 /// Identifies the authorization scope for the method you are building.
10641 ///
10642 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10643 /// [`Scope::Admin`].
10644 ///
10645 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10646 /// tokens for more than one scope.
10647 ///
10648 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10649 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10650 /// sufficient, a read-write scope will do as well.
10651 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceGetCall<'a, C>
10652 where
10653 St: AsRef<str>,
10654 {
10655 self._scopes.insert(String::from(scope.as_ref()));
10656 self
10657 }
10658 /// Identifies the authorization scope(s) for the method you are building.
10659 ///
10660 /// See [`Self::add_scope()`] for details.
10661 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceGetCall<'a, C>
10662 where
10663 I: IntoIterator<Item = St>,
10664 St: AsRef<str>,
10665 {
10666 self._scopes
10667 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10668 self
10669 }
10670
10671 /// Removes all scopes, and no default scope will be used either.
10672 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10673 /// for details).
10674 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceGetCall<'a, C> {
10675 self._scopes.clear();
10676 self
10677 }
10678}
10679
10680/// 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).
10681///
10682/// A builder for the *services.versions.instances.list* method supported by a *app* resource.
10683/// It is not used directly, but through a [`AppMethods`] instance.
10684///
10685/// # Example
10686///
10687/// Instantiate a resource method builder
10688///
10689/// ```test_harness,no_run
10690/// # extern crate hyper;
10691/// # extern crate hyper_rustls;
10692/// # extern crate google_appengine1 as appengine1;
10693/// # async fn dox() {
10694/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10695///
10696/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10697/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10698/// # secret,
10699/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10700/// # ).build().await.unwrap();
10701///
10702/// # let client = hyper_util::client::legacy::Client::builder(
10703/// # hyper_util::rt::TokioExecutor::new()
10704/// # )
10705/// # .build(
10706/// # hyper_rustls::HttpsConnectorBuilder::new()
10707/// # .with_native_roots()
10708/// # .unwrap()
10709/// # .https_or_http()
10710/// # .enable_http1()
10711/// # .build()
10712/// # );
10713/// # let mut hub = Appengine::new(client, auth);
10714/// // You can configure optional parameters by calling the respective setters at will, and
10715/// // execute the final call using `doit()`.
10716/// // Values shown here are possibly random and not representative !
10717/// let result = hub.apps().services_versions_instances_list("appsId", "servicesId", "versionsId")
10718/// .page_token("consetetur")
10719/// .page_size(-28)
10720/// .doit().await;
10721/// # }
10722/// ```
10723pub struct AppServiceVersionInstanceListCall<'a, C>
10724where
10725 C: 'a,
10726{
10727 hub: &'a Appengine<C>,
10728 _apps_id: String,
10729 _services_id: String,
10730 _versions_id: String,
10731 _page_token: Option<String>,
10732 _page_size: Option<i32>,
10733 _delegate: Option<&'a mut dyn common::Delegate>,
10734 _additional_params: HashMap<String, String>,
10735 _scopes: BTreeSet<String>,
10736}
10737
10738impl<'a, C> common::CallBuilder for AppServiceVersionInstanceListCall<'a, C> {}
10739
10740impl<'a, C> AppServiceVersionInstanceListCall<'a, C>
10741where
10742 C: common::Connector,
10743{
10744 /// Perform the operation you have build so far.
10745 pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
10746 use std::borrow::Cow;
10747 use std::io::{Read, Seek};
10748
10749 use common::{url::Params, ToParts};
10750 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10751
10752 let mut dd = common::DefaultDelegate;
10753 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10754 dlg.begin(common::MethodInfo {
10755 id: "appengine.apps.services.versions.instances.list",
10756 http_method: hyper::Method::GET,
10757 });
10758
10759 for &field in [
10760 "alt",
10761 "appsId",
10762 "servicesId",
10763 "versionsId",
10764 "pageToken",
10765 "pageSize",
10766 ]
10767 .iter()
10768 {
10769 if self._additional_params.contains_key(field) {
10770 dlg.finished(false);
10771 return Err(common::Error::FieldClash(field));
10772 }
10773 }
10774
10775 let mut params = Params::with_capacity(7 + self._additional_params.len());
10776 params.push("appsId", self._apps_id);
10777 params.push("servicesId", self._services_id);
10778 params.push("versionsId", self._versions_id);
10779 if let Some(value) = self._page_token.as_ref() {
10780 params.push("pageToken", value);
10781 }
10782 if let Some(value) = self._page_size.as_ref() {
10783 params.push("pageSize", value.to_string());
10784 }
10785
10786 params.extend(self._additional_params.iter());
10787
10788 params.push("alt", "json");
10789 let mut url = self.hub._base_url.clone()
10790 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances";
10791 if self._scopes.is_empty() {
10792 self._scopes.insert(Scope::Admin.as_ref().to_string());
10793 }
10794
10795 #[allow(clippy::single_element_loop)]
10796 for &(find_this, param_name) in [
10797 ("{appsId}", "appsId"),
10798 ("{servicesId}", "servicesId"),
10799 ("{versionsId}", "versionsId"),
10800 ]
10801 .iter()
10802 {
10803 url = params.uri_replacement(url, param_name, find_this, false);
10804 }
10805 {
10806 let to_remove = ["versionsId", "servicesId", "appsId"];
10807 params.remove_params(&to_remove);
10808 }
10809
10810 let url = params.parse_with_url(&url);
10811
10812 loop {
10813 let token = match self
10814 .hub
10815 .auth
10816 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10817 .await
10818 {
10819 Ok(token) => token,
10820 Err(e) => match dlg.token(e) {
10821 Ok(token) => token,
10822 Err(e) => {
10823 dlg.finished(false);
10824 return Err(common::Error::MissingToken(e));
10825 }
10826 },
10827 };
10828 let mut req_result = {
10829 let client = &self.hub.client;
10830 dlg.pre_request();
10831 let mut req_builder = hyper::Request::builder()
10832 .method(hyper::Method::GET)
10833 .uri(url.as_str())
10834 .header(USER_AGENT, self.hub._user_agent.clone());
10835
10836 if let Some(token) = token.as_ref() {
10837 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10838 }
10839
10840 let request = req_builder
10841 .header(CONTENT_LENGTH, 0_u64)
10842 .body(common::to_body::<String>(None));
10843
10844 client.request(request.unwrap()).await
10845 };
10846
10847 match req_result {
10848 Err(err) => {
10849 if let common::Retry::After(d) = dlg.http_error(&err) {
10850 sleep(d).await;
10851 continue;
10852 }
10853 dlg.finished(false);
10854 return Err(common::Error::HttpError(err));
10855 }
10856 Ok(res) => {
10857 let (mut parts, body) = res.into_parts();
10858 let mut body = common::Body::new(body);
10859 if !parts.status.is_success() {
10860 let bytes = common::to_bytes(body).await.unwrap_or_default();
10861 let error = serde_json::from_str(&common::to_string(&bytes));
10862 let response = common::to_response(parts, bytes.into());
10863
10864 if let common::Retry::After(d) =
10865 dlg.http_failure(&response, error.as_ref().ok())
10866 {
10867 sleep(d).await;
10868 continue;
10869 }
10870
10871 dlg.finished(false);
10872
10873 return Err(match error {
10874 Ok(value) => common::Error::BadRequest(value),
10875 _ => common::Error::Failure(response),
10876 });
10877 }
10878 let response = {
10879 let bytes = common::to_bytes(body).await.unwrap_or_default();
10880 let encoded = common::to_string(&bytes);
10881 match serde_json::from_str(&encoded) {
10882 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10883 Err(error) => {
10884 dlg.response_json_decode_error(&encoded, &error);
10885 return Err(common::Error::JsonDecodeError(
10886 encoded.to_string(),
10887 error,
10888 ));
10889 }
10890 }
10891 };
10892
10893 dlg.finished(true);
10894 return Ok(response);
10895 }
10896 }
10897 }
10898 }
10899
10900 /// Part of `parent`. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1.
10901 ///
10902 /// Sets the *apps id* path property to the given value.
10903 ///
10904 /// Even though the property as already been set when instantiating this call,
10905 /// we provide this method for API completeness.
10906 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
10907 self._apps_id = new_value.to_string();
10908 self
10909 }
10910 /// Part of `parent`. See documentation of `appsId`.
10911 ///
10912 /// Sets the *services id* path property to the given value.
10913 ///
10914 /// Even though the property as already been set when instantiating this call,
10915 /// we provide this method for API completeness.
10916 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
10917 self._services_id = new_value.to_string();
10918 self
10919 }
10920 /// Part of `parent`. See documentation of `appsId`.
10921 ///
10922 /// Sets the *versions id* path property to the given value.
10923 ///
10924 /// Even though the property as already been set when instantiating this call,
10925 /// we provide this method for API completeness.
10926 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
10927 self._versions_id = new_value.to_string();
10928 self
10929 }
10930 /// Continuation token for fetching the next page of results.
10931 ///
10932 /// Sets the *page token* query property to the given value.
10933 pub fn page_token(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, C> {
10934 self._page_token = Some(new_value.to_string());
10935 self
10936 }
10937 /// Maximum results to return per page.
10938 ///
10939 /// Sets the *page size* query property to the given value.
10940 pub fn page_size(mut self, new_value: i32) -> AppServiceVersionInstanceListCall<'a, C> {
10941 self._page_size = Some(new_value);
10942 self
10943 }
10944 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10945 /// while executing the actual API request.
10946 ///
10947 /// ````text
10948 /// It should be used to handle progress information, and to implement a certain level of resilience.
10949 /// ````
10950 ///
10951 /// Sets the *delegate* property to the given value.
10952 pub fn delegate(
10953 mut self,
10954 new_value: &'a mut dyn common::Delegate,
10955 ) -> AppServiceVersionInstanceListCall<'a, C> {
10956 self._delegate = Some(new_value);
10957 self
10958 }
10959
10960 /// Set any additional parameter of the query string used in the request.
10961 /// It should be used to set parameters which are not yet available through their own
10962 /// setters.
10963 ///
10964 /// Please note that this method must not be used to set any of the known parameters
10965 /// which have their own setter method. If done anyway, the request will fail.
10966 ///
10967 /// # Additional Parameters
10968 ///
10969 /// * *$.xgafv* (query-string) - V1 error format.
10970 /// * *access_token* (query-string) - OAuth access token.
10971 /// * *alt* (query-string) - Data format for response.
10972 /// * *callback* (query-string) - JSONP
10973 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10974 /// * *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.
10975 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10976 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10977 /// * *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.
10978 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10979 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10980 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceListCall<'a, C>
10981 where
10982 T: AsRef<str>,
10983 {
10984 self._additional_params
10985 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10986 self
10987 }
10988
10989 /// Identifies the authorization scope for the method you are building.
10990 ///
10991 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10992 /// [`Scope::Admin`].
10993 ///
10994 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10995 /// tokens for more than one scope.
10996 ///
10997 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10998 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10999 /// sufficient, a read-write scope will do as well.
11000 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionInstanceListCall<'a, C>
11001 where
11002 St: AsRef<str>,
11003 {
11004 self._scopes.insert(String::from(scope.as_ref()));
11005 self
11006 }
11007 /// Identifies the authorization scope(s) for the method you are building.
11008 ///
11009 /// See [`Self::add_scope()`] for details.
11010 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionInstanceListCall<'a, C>
11011 where
11012 I: IntoIterator<Item = St>,
11013 St: AsRef<str>,
11014 {
11015 self._scopes
11016 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11017 self
11018 }
11019
11020 /// Removes all scopes, and no default scope will be used either.
11021 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11022 /// for details).
11023 pub fn clear_scopes(mut self) -> AppServiceVersionInstanceListCall<'a, C> {
11024 self._scopes.clear();
11025 self
11026 }
11027}
11028
11029/// Deploys code and resource files to a new version.
11030///
11031/// A builder for the *services.versions.create* method supported by a *app* resource.
11032/// It is not used directly, but through a [`AppMethods`] instance.
11033///
11034/// # Example
11035///
11036/// Instantiate a resource method builder
11037///
11038/// ```test_harness,no_run
11039/// # extern crate hyper;
11040/// # extern crate hyper_rustls;
11041/// # extern crate google_appengine1 as appengine1;
11042/// use appengine1::api::Version;
11043/// # async fn dox() {
11044/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11045///
11046/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11047/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11048/// # secret,
11049/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11050/// # ).build().await.unwrap();
11051///
11052/// # let client = hyper_util::client::legacy::Client::builder(
11053/// # hyper_util::rt::TokioExecutor::new()
11054/// # )
11055/// # .build(
11056/// # hyper_rustls::HttpsConnectorBuilder::new()
11057/// # .with_native_roots()
11058/// # .unwrap()
11059/// # .https_or_http()
11060/// # .enable_http1()
11061/// # .build()
11062/// # );
11063/// # let mut hub = Appengine::new(client, auth);
11064/// // As the method needs a request, you would usually fill it with the desired information
11065/// // into the respective structure. Some of the parts shown here might not be applicable !
11066/// // Values shown here are possibly random and not representative !
11067/// let mut req = Version::default();
11068///
11069/// // You can configure optional parameters by calling the respective setters at will, and
11070/// // execute the final call using `doit()`.
11071/// // Values shown here are possibly random and not representative !
11072/// let result = hub.apps().services_versions_create(req, "appsId", "servicesId")
11073/// .doit().await;
11074/// # }
11075/// ```
11076pub struct AppServiceVersionCreateCall<'a, C>
11077where
11078 C: 'a,
11079{
11080 hub: &'a Appengine<C>,
11081 _request: Version,
11082 _apps_id: String,
11083 _services_id: String,
11084 _delegate: Option<&'a mut dyn common::Delegate>,
11085 _additional_params: HashMap<String, String>,
11086 _scopes: BTreeSet<String>,
11087}
11088
11089impl<'a, C> common::CallBuilder for AppServiceVersionCreateCall<'a, C> {}
11090
11091impl<'a, C> AppServiceVersionCreateCall<'a, C>
11092where
11093 C: common::Connector,
11094{
11095 /// Perform the operation you have build so far.
11096 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11097 use std::borrow::Cow;
11098 use std::io::{Read, Seek};
11099
11100 use common::{url::Params, ToParts};
11101 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11102
11103 let mut dd = common::DefaultDelegate;
11104 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11105 dlg.begin(common::MethodInfo {
11106 id: "appengine.apps.services.versions.create",
11107 http_method: hyper::Method::POST,
11108 });
11109
11110 for &field in ["alt", "appsId", "servicesId"].iter() {
11111 if self._additional_params.contains_key(field) {
11112 dlg.finished(false);
11113 return Err(common::Error::FieldClash(field));
11114 }
11115 }
11116
11117 let mut params = Params::with_capacity(5 + self._additional_params.len());
11118 params.push("appsId", self._apps_id);
11119 params.push("servicesId", self._services_id);
11120
11121 params.extend(self._additional_params.iter());
11122
11123 params.push("alt", "json");
11124 let mut url =
11125 self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions";
11126 if self._scopes.is_empty() {
11127 self._scopes
11128 .insert(Scope::CloudPlatform.as_ref().to_string());
11129 }
11130
11131 #[allow(clippy::single_element_loop)]
11132 for &(find_this, param_name) in
11133 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
11134 {
11135 url = params.uri_replacement(url, param_name, find_this, false);
11136 }
11137 {
11138 let to_remove = ["servicesId", "appsId"];
11139 params.remove_params(&to_remove);
11140 }
11141
11142 let url = params.parse_with_url(&url);
11143
11144 let mut json_mime_type = mime::APPLICATION_JSON;
11145 let mut request_value_reader = {
11146 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11147 common::remove_json_null_values(&mut value);
11148 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11149 serde_json::to_writer(&mut dst, &value).unwrap();
11150 dst
11151 };
11152 let request_size = request_value_reader
11153 .seek(std::io::SeekFrom::End(0))
11154 .unwrap();
11155 request_value_reader
11156 .seek(std::io::SeekFrom::Start(0))
11157 .unwrap();
11158
11159 loop {
11160 let token = match self
11161 .hub
11162 .auth
11163 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11164 .await
11165 {
11166 Ok(token) => token,
11167 Err(e) => match dlg.token(e) {
11168 Ok(token) => token,
11169 Err(e) => {
11170 dlg.finished(false);
11171 return Err(common::Error::MissingToken(e));
11172 }
11173 },
11174 };
11175 request_value_reader
11176 .seek(std::io::SeekFrom::Start(0))
11177 .unwrap();
11178 let mut req_result = {
11179 let client = &self.hub.client;
11180 dlg.pre_request();
11181 let mut req_builder = hyper::Request::builder()
11182 .method(hyper::Method::POST)
11183 .uri(url.as_str())
11184 .header(USER_AGENT, self.hub._user_agent.clone());
11185
11186 if let Some(token) = token.as_ref() {
11187 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11188 }
11189
11190 let request = req_builder
11191 .header(CONTENT_TYPE, json_mime_type.to_string())
11192 .header(CONTENT_LENGTH, request_size as u64)
11193 .body(common::to_body(
11194 request_value_reader.get_ref().clone().into(),
11195 ));
11196
11197 client.request(request.unwrap()).await
11198 };
11199
11200 match req_result {
11201 Err(err) => {
11202 if let common::Retry::After(d) = dlg.http_error(&err) {
11203 sleep(d).await;
11204 continue;
11205 }
11206 dlg.finished(false);
11207 return Err(common::Error::HttpError(err));
11208 }
11209 Ok(res) => {
11210 let (mut parts, body) = res.into_parts();
11211 let mut body = common::Body::new(body);
11212 if !parts.status.is_success() {
11213 let bytes = common::to_bytes(body).await.unwrap_or_default();
11214 let error = serde_json::from_str(&common::to_string(&bytes));
11215 let response = common::to_response(parts, bytes.into());
11216
11217 if let common::Retry::After(d) =
11218 dlg.http_failure(&response, error.as_ref().ok())
11219 {
11220 sleep(d).await;
11221 continue;
11222 }
11223
11224 dlg.finished(false);
11225
11226 return Err(match error {
11227 Ok(value) => common::Error::BadRequest(value),
11228 _ => common::Error::Failure(response),
11229 });
11230 }
11231 let response = {
11232 let bytes = common::to_bytes(body).await.unwrap_or_default();
11233 let encoded = common::to_string(&bytes);
11234 match serde_json::from_str(&encoded) {
11235 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11236 Err(error) => {
11237 dlg.response_json_decode_error(&encoded, &error);
11238 return Err(common::Error::JsonDecodeError(
11239 encoded.to_string(),
11240 error,
11241 ));
11242 }
11243 }
11244 };
11245
11246 dlg.finished(true);
11247 return Ok(response);
11248 }
11249 }
11250 }
11251 }
11252
11253 ///
11254 /// Sets the *request* property to the given value.
11255 ///
11256 /// Even though the property as already been set when instantiating this call,
11257 /// we provide this method for API completeness.
11258 pub fn request(mut self, new_value: Version) -> AppServiceVersionCreateCall<'a, C> {
11259 self._request = new_value;
11260 self
11261 }
11262 /// Part of `parent`. Name of the parent resource to create this version under. Example: apps/myapp/services/default.
11263 ///
11264 /// Sets the *apps id* path property to the given value.
11265 ///
11266 /// Even though the property as already been set when instantiating this call,
11267 /// we provide this method for API completeness.
11268 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, C> {
11269 self._apps_id = new_value.to_string();
11270 self
11271 }
11272 /// Part of `parent`. See documentation of `appsId`.
11273 ///
11274 /// Sets the *services id* path property to the given value.
11275 ///
11276 /// Even though the property as already been set when instantiating this call,
11277 /// we provide this method for API completeness.
11278 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, C> {
11279 self._services_id = new_value.to_string();
11280 self
11281 }
11282 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11283 /// while executing the actual API request.
11284 ///
11285 /// ````text
11286 /// It should be used to handle progress information, and to implement a certain level of resilience.
11287 /// ````
11288 ///
11289 /// Sets the *delegate* property to the given value.
11290 pub fn delegate(
11291 mut self,
11292 new_value: &'a mut dyn common::Delegate,
11293 ) -> AppServiceVersionCreateCall<'a, C> {
11294 self._delegate = Some(new_value);
11295 self
11296 }
11297
11298 /// Set any additional parameter of the query string used in the request.
11299 /// It should be used to set parameters which are not yet available through their own
11300 /// setters.
11301 ///
11302 /// Please note that this method must not be used to set any of the known parameters
11303 /// which have their own setter method. If done anyway, the request will fail.
11304 ///
11305 /// # Additional Parameters
11306 ///
11307 /// * *$.xgafv* (query-string) - V1 error format.
11308 /// * *access_token* (query-string) - OAuth access token.
11309 /// * *alt* (query-string) - Data format for response.
11310 /// * *callback* (query-string) - JSONP
11311 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11312 /// * *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.
11313 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11314 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11315 /// * *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.
11316 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11317 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11318 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionCreateCall<'a, C>
11319 where
11320 T: AsRef<str>,
11321 {
11322 self._additional_params
11323 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11324 self
11325 }
11326
11327 /// Identifies the authorization scope for the method you are building.
11328 ///
11329 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11330 /// [`Scope::CloudPlatform`].
11331 ///
11332 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11333 /// tokens for more than one scope.
11334 ///
11335 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11336 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11337 /// sufficient, a read-write scope will do as well.
11338 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionCreateCall<'a, C>
11339 where
11340 St: AsRef<str>,
11341 {
11342 self._scopes.insert(String::from(scope.as_ref()));
11343 self
11344 }
11345 /// Identifies the authorization scope(s) for the method you are building.
11346 ///
11347 /// See [`Self::add_scope()`] for details.
11348 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionCreateCall<'a, C>
11349 where
11350 I: IntoIterator<Item = St>,
11351 St: AsRef<str>,
11352 {
11353 self._scopes
11354 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11355 self
11356 }
11357
11358 /// Removes all scopes, and no default scope will be used either.
11359 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11360 /// for details).
11361 pub fn clear_scopes(mut self) -> AppServiceVersionCreateCall<'a, C> {
11362 self._scopes.clear();
11363 self
11364 }
11365}
11366
11367/// Deletes an existing Version resource.
11368///
11369/// A builder for the *services.versions.delete* method supported by a *app* resource.
11370/// It is not used directly, but through a [`AppMethods`] instance.
11371///
11372/// # Example
11373///
11374/// Instantiate a resource method builder
11375///
11376/// ```test_harness,no_run
11377/// # extern crate hyper;
11378/// # extern crate hyper_rustls;
11379/// # extern crate google_appengine1 as appengine1;
11380/// # async fn dox() {
11381/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11382///
11383/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11384/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11385/// # secret,
11386/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11387/// # ).build().await.unwrap();
11388///
11389/// # let client = hyper_util::client::legacy::Client::builder(
11390/// # hyper_util::rt::TokioExecutor::new()
11391/// # )
11392/// # .build(
11393/// # hyper_rustls::HttpsConnectorBuilder::new()
11394/// # .with_native_roots()
11395/// # .unwrap()
11396/// # .https_or_http()
11397/// # .enable_http1()
11398/// # .build()
11399/// # );
11400/// # let mut hub = Appengine::new(client, auth);
11401/// // You can configure optional parameters by calling the respective setters at will, and
11402/// // execute the final call using `doit()`.
11403/// // Values shown here are possibly random and not representative !
11404/// let result = hub.apps().services_versions_delete("appsId", "servicesId", "versionsId")
11405/// .doit().await;
11406/// # }
11407/// ```
11408pub struct AppServiceVersionDeleteCall<'a, C>
11409where
11410 C: 'a,
11411{
11412 hub: &'a Appengine<C>,
11413 _apps_id: String,
11414 _services_id: String,
11415 _versions_id: String,
11416 _delegate: Option<&'a mut dyn common::Delegate>,
11417 _additional_params: HashMap<String, String>,
11418 _scopes: BTreeSet<String>,
11419}
11420
11421impl<'a, C> common::CallBuilder for AppServiceVersionDeleteCall<'a, C> {}
11422
11423impl<'a, C> AppServiceVersionDeleteCall<'a, C>
11424where
11425 C: common::Connector,
11426{
11427 /// Perform the operation you have build so far.
11428 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11429 use std::borrow::Cow;
11430 use std::io::{Read, Seek};
11431
11432 use common::{url::Params, ToParts};
11433 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11434
11435 let mut dd = common::DefaultDelegate;
11436 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11437 dlg.begin(common::MethodInfo {
11438 id: "appengine.apps.services.versions.delete",
11439 http_method: hyper::Method::DELETE,
11440 });
11441
11442 for &field in ["alt", "appsId", "servicesId", "versionsId"].iter() {
11443 if self._additional_params.contains_key(field) {
11444 dlg.finished(false);
11445 return Err(common::Error::FieldClash(field));
11446 }
11447 }
11448
11449 let mut params = Params::with_capacity(5 + self._additional_params.len());
11450 params.push("appsId", self._apps_id);
11451 params.push("servicesId", self._services_id);
11452 params.push("versionsId", self._versions_id);
11453
11454 params.extend(self._additional_params.iter());
11455
11456 params.push("alt", "json");
11457 let mut url = self.hub._base_url.clone()
11458 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}";
11459 if self._scopes.is_empty() {
11460 self._scopes
11461 .insert(Scope::CloudPlatform.as_ref().to_string());
11462 }
11463
11464 #[allow(clippy::single_element_loop)]
11465 for &(find_this, param_name) in [
11466 ("{appsId}", "appsId"),
11467 ("{servicesId}", "servicesId"),
11468 ("{versionsId}", "versionsId"),
11469 ]
11470 .iter()
11471 {
11472 url = params.uri_replacement(url, param_name, find_this, false);
11473 }
11474 {
11475 let to_remove = ["versionsId", "servicesId", "appsId"];
11476 params.remove_params(&to_remove);
11477 }
11478
11479 let url = params.parse_with_url(&url);
11480
11481 loop {
11482 let token = match self
11483 .hub
11484 .auth
11485 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11486 .await
11487 {
11488 Ok(token) => token,
11489 Err(e) => match dlg.token(e) {
11490 Ok(token) => token,
11491 Err(e) => {
11492 dlg.finished(false);
11493 return Err(common::Error::MissingToken(e));
11494 }
11495 },
11496 };
11497 let mut req_result = {
11498 let client = &self.hub.client;
11499 dlg.pre_request();
11500 let mut req_builder = hyper::Request::builder()
11501 .method(hyper::Method::DELETE)
11502 .uri(url.as_str())
11503 .header(USER_AGENT, self.hub._user_agent.clone());
11504
11505 if let Some(token) = token.as_ref() {
11506 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11507 }
11508
11509 let request = req_builder
11510 .header(CONTENT_LENGTH, 0_u64)
11511 .body(common::to_body::<String>(None));
11512
11513 client.request(request.unwrap()).await
11514 };
11515
11516 match req_result {
11517 Err(err) => {
11518 if let common::Retry::After(d) = dlg.http_error(&err) {
11519 sleep(d).await;
11520 continue;
11521 }
11522 dlg.finished(false);
11523 return Err(common::Error::HttpError(err));
11524 }
11525 Ok(res) => {
11526 let (mut parts, body) = res.into_parts();
11527 let mut body = common::Body::new(body);
11528 if !parts.status.is_success() {
11529 let bytes = common::to_bytes(body).await.unwrap_or_default();
11530 let error = serde_json::from_str(&common::to_string(&bytes));
11531 let response = common::to_response(parts, bytes.into());
11532
11533 if let common::Retry::After(d) =
11534 dlg.http_failure(&response, error.as_ref().ok())
11535 {
11536 sleep(d).await;
11537 continue;
11538 }
11539
11540 dlg.finished(false);
11541
11542 return Err(match error {
11543 Ok(value) => common::Error::BadRequest(value),
11544 _ => common::Error::Failure(response),
11545 });
11546 }
11547 let response = {
11548 let bytes = common::to_bytes(body).await.unwrap_or_default();
11549 let encoded = common::to_string(&bytes);
11550 match serde_json::from_str(&encoded) {
11551 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11552 Err(error) => {
11553 dlg.response_json_decode_error(&encoded, &error);
11554 return Err(common::Error::JsonDecodeError(
11555 encoded.to_string(),
11556 error,
11557 ));
11558 }
11559 }
11560 };
11561
11562 dlg.finished(true);
11563 return Ok(response);
11564 }
11565 }
11566 }
11567 }
11568
11569 /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
11570 ///
11571 /// Sets the *apps id* path property to the given value.
11572 ///
11573 /// Even though the property as already been set when instantiating this call,
11574 /// we provide this method for API completeness.
11575 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C> {
11576 self._apps_id = new_value.to_string();
11577 self
11578 }
11579 /// Part of `name`. See documentation of `appsId`.
11580 ///
11581 /// Sets the *services id* path property to the given value.
11582 ///
11583 /// Even though the property as already been set when instantiating this call,
11584 /// we provide this method for API completeness.
11585 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C> {
11586 self._services_id = new_value.to_string();
11587 self
11588 }
11589 /// Part of `name`. See documentation of `appsId`.
11590 ///
11591 /// Sets the *versions id* path property to the given value.
11592 ///
11593 /// Even though the property as already been set when instantiating this call,
11594 /// we provide this method for API completeness.
11595 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C> {
11596 self._versions_id = new_value.to_string();
11597 self
11598 }
11599 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11600 /// while executing the actual API request.
11601 ///
11602 /// ````text
11603 /// It should be used to handle progress information, and to implement a certain level of resilience.
11604 /// ````
11605 ///
11606 /// Sets the *delegate* property to the given value.
11607 pub fn delegate(
11608 mut self,
11609 new_value: &'a mut dyn common::Delegate,
11610 ) -> AppServiceVersionDeleteCall<'a, C> {
11611 self._delegate = Some(new_value);
11612 self
11613 }
11614
11615 /// Set any additional parameter of the query string used in the request.
11616 /// It should be used to set parameters which are not yet available through their own
11617 /// setters.
11618 ///
11619 /// Please note that this method must not be used to set any of the known parameters
11620 /// which have their own setter method. If done anyway, the request will fail.
11621 ///
11622 /// # Additional Parameters
11623 ///
11624 /// * *$.xgafv* (query-string) - V1 error format.
11625 /// * *access_token* (query-string) - OAuth access token.
11626 /// * *alt* (query-string) - Data format for response.
11627 /// * *callback* (query-string) - JSONP
11628 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11629 /// * *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.
11630 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11631 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11632 /// * *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.
11633 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11634 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11635 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionDeleteCall<'a, C>
11636 where
11637 T: AsRef<str>,
11638 {
11639 self._additional_params
11640 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11641 self
11642 }
11643
11644 /// Identifies the authorization scope for the method you are building.
11645 ///
11646 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11647 /// [`Scope::CloudPlatform`].
11648 ///
11649 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11650 /// tokens for more than one scope.
11651 ///
11652 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11653 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11654 /// sufficient, a read-write scope will do as well.
11655 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionDeleteCall<'a, C>
11656 where
11657 St: AsRef<str>,
11658 {
11659 self._scopes.insert(String::from(scope.as_ref()));
11660 self
11661 }
11662 /// Identifies the authorization scope(s) for the method you are building.
11663 ///
11664 /// See [`Self::add_scope()`] for details.
11665 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionDeleteCall<'a, C>
11666 where
11667 I: IntoIterator<Item = St>,
11668 St: AsRef<str>,
11669 {
11670 self._scopes
11671 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11672 self
11673 }
11674
11675 /// Removes all scopes, and no default scope will be used either.
11676 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11677 /// for details).
11678 pub fn clear_scopes(mut self) -> AppServiceVersionDeleteCall<'a, C> {
11679 self._scopes.clear();
11680 self
11681 }
11682}
11683
11684/// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.
11685///
11686/// A builder for the *services.versions.get* method supported by a *app* resource.
11687/// It is not used directly, but through a [`AppMethods`] instance.
11688///
11689/// # Example
11690///
11691/// Instantiate a resource method builder
11692///
11693/// ```test_harness,no_run
11694/// # extern crate hyper;
11695/// # extern crate hyper_rustls;
11696/// # extern crate google_appengine1 as appengine1;
11697/// # async fn dox() {
11698/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11699///
11700/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11701/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11702/// # secret,
11703/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11704/// # ).build().await.unwrap();
11705///
11706/// # let client = hyper_util::client::legacy::Client::builder(
11707/// # hyper_util::rt::TokioExecutor::new()
11708/// # )
11709/// # .build(
11710/// # hyper_rustls::HttpsConnectorBuilder::new()
11711/// # .with_native_roots()
11712/// # .unwrap()
11713/// # .https_or_http()
11714/// # .enable_http1()
11715/// # .build()
11716/// # );
11717/// # let mut hub = Appengine::new(client, auth);
11718/// // You can configure optional parameters by calling the respective setters at will, and
11719/// // execute the final call using `doit()`.
11720/// // Values shown here are possibly random and not representative !
11721/// let result = hub.apps().services_versions_get("appsId", "servicesId", "versionsId")
11722/// .view("et")
11723/// .doit().await;
11724/// # }
11725/// ```
11726pub struct AppServiceVersionGetCall<'a, C>
11727where
11728 C: 'a,
11729{
11730 hub: &'a Appengine<C>,
11731 _apps_id: String,
11732 _services_id: String,
11733 _versions_id: String,
11734 _view: Option<String>,
11735 _delegate: Option<&'a mut dyn common::Delegate>,
11736 _additional_params: HashMap<String, String>,
11737 _scopes: BTreeSet<String>,
11738}
11739
11740impl<'a, C> common::CallBuilder for AppServiceVersionGetCall<'a, C> {}
11741
11742impl<'a, C> AppServiceVersionGetCall<'a, C>
11743where
11744 C: common::Connector,
11745{
11746 /// Perform the operation you have build so far.
11747 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
11748 use std::borrow::Cow;
11749 use std::io::{Read, Seek};
11750
11751 use common::{url::Params, ToParts};
11752 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11753
11754 let mut dd = common::DefaultDelegate;
11755 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11756 dlg.begin(common::MethodInfo {
11757 id: "appengine.apps.services.versions.get",
11758 http_method: hyper::Method::GET,
11759 });
11760
11761 for &field in ["alt", "appsId", "servicesId", "versionsId", "view"].iter() {
11762 if self._additional_params.contains_key(field) {
11763 dlg.finished(false);
11764 return Err(common::Error::FieldClash(field));
11765 }
11766 }
11767
11768 let mut params = Params::with_capacity(6 + self._additional_params.len());
11769 params.push("appsId", self._apps_id);
11770 params.push("servicesId", self._services_id);
11771 params.push("versionsId", self._versions_id);
11772 if let Some(value) = self._view.as_ref() {
11773 params.push("view", value);
11774 }
11775
11776 params.extend(self._additional_params.iter());
11777
11778 params.push("alt", "json");
11779 let mut url = self.hub._base_url.clone()
11780 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}";
11781 if self._scopes.is_empty() {
11782 self._scopes.insert(Scope::Admin.as_ref().to_string());
11783 }
11784
11785 #[allow(clippy::single_element_loop)]
11786 for &(find_this, param_name) in [
11787 ("{appsId}", "appsId"),
11788 ("{servicesId}", "servicesId"),
11789 ("{versionsId}", "versionsId"),
11790 ]
11791 .iter()
11792 {
11793 url = params.uri_replacement(url, param_name, find_this, false);
11794 }
11795 {
11796 let to_remove = ["versionsId", "servicesId", "appsId"];
11797 params.remove_params(&to_remove);
11798 }
11799
11800 let url = params.parse_with_url(&url);
11801
11802 loop {
11803 let token = match self
11804 .hub
11805 .auth
11806 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11807 .await
11808 {
11809 Ok(token) => token,
11810 Err(e) => match dlg.token(e) {
11811 Ok(token) => token,
11812 Err(e) => {
11813 dlg.finished(false);
11814 return Err(common::Error::MissingToken(e));
11815 }
11816 },
11817 };
11818 let mut req_result = {
11819 let client = &self.hub.client;
11820 dlg.pre_request();
11821 let mut req_builder = hyper::Request::builder()
11822 .method(hyper::Method::GET)
11823 .uri(url.as_str())
11824 .header(USER_AGENT, self.hub._user_agent.clone());
11825
11826 if let Some(token) = token.as_ref() {
11827 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11828 }
11829
11830 let request = req_builder
11831 .header(CONTENT_LENGTH, 0_u64)
11832 .body(common::to_body::<String>(None));
11833
11834 client.request(request.unwrap()).await
11835 };
11836
11837 match req_result {
11838 Err(err) => {
11839 if let common::Retry::After(d) = dlg.http_error(&err) {
11840 sleep(d).await;
11841 continue;
11842 }
11843 dlg.finished(false);
11844 return Err(common::Error::HttpError(err));
11845 }
11846 Ok(res) => {
11847 let (mut parts, body) = res.into_parts();
11848 let mut body = common::Body::new(body);
11849 if !parts.status.is_success() {
11850 let bytes = common::to_bytes(body).await.unwrap_or_default();
11851 let error = serde_json::from_str(&common::to_string(&bytes));
11852 let response = common::to_response(parts, bytes.into());
11853
11854 if let common::Retry::After(d) =
11855 dlg.http_failure(&response, error.as_ref().ok())
11856 {
11857 sleep(d).await;
11858 continue;
11859 }
11860
11861 dlg.finished(false);
11862
11863 return Err(match error {
11864 Ok(value) => common::Error::BadRequest(value),
11865 _ => common::Error::Failure(response),
11866 });
11867 }
11868 let response = {
11869 let bytes = common::to_bytes(body).await.unwrap_or_default();
11870 let encoded = common::to_string(&bytes);
11871 match serde_json::from_str(&encoded) {
11872 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11873 Err(error) => {
11874 dlg.response_json_decode_error(&encoded, &error);
11875 return Err(common::Error::JsonDecodeError(
11876 encoded.to_string(),
11877 error,
11878 ));
11879 }
11880 }
11881 };
11882
11883 dlg.finished(true);
11884 return Ok(response);
11885 }
11886 }
11887 }
11888 }
11889
11890 /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.
11891 ///
11892 /// Sets the *apps id* path property to the given value.
11893 ///
11894 /// Even though the property as already been set when instantiating this call,
11895 /// we provide this method for API completeness.
11896 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
11897 self._apps_id = new_value.to_string();
11898 self
11899 }
11900 /// Part of `name`. See documentation of `appsId`.
11901 ///
11902 /// Sets the *services id* path property to the given value.
11903 ///
11904 /// Even though the property as already been set when instantiating this call,
11905 /// we provide this method for API completeness.
11906 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
11907 self._services_id = new_value.to_string();
11908 self
11909 }
11910 /// Part of `name`. See documentation of `appsId`.
11911 ///
11912 /// Sets the *versions id* path property to the given value.
11913 ///
11914 /// Even though the property as already been set when instantiating this call,
11915 /// we provide this method for API completeness.
11916 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
11917 self._versions_id = new_value.to_string();
11918 self
11919 }
11920 /// Controls the set of fields returned in the Get response.
11921 ///
11922 /// Sets the *view* query property to the given value.
11923 pub fn view(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C> {
11924 self._view = Some(new_value.to_string());
11925 self
11926 }
11927 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11928 /// while executing the actual API request.
11929 ///
11930 /// ````text
11931 /// It should be used to handle progress information, and to implement a certain level of resilience.
11932 /// ````
11933 ///
11934 /// Sets the *delegate* property to the given value.
11935 pub fn delegate(
11936 mut self,
11937 new_value: &'a mut dyn common::Delegate,
11938 ) -> AppServiceVersionGetCall<'a, C> {
11939 self._delegate = Some(new_value);
11940 self
11941 }
11942
11943 /// Set any additional parameter of the query string used in the request.
11944 /// It should be used to set parameters which are not yet available through their own
11945 /// setters.
11946 ///
11947 /// Please note that this method must not be used to set any of the known parameters
11948 /// which have their own setter method. If done anyway, the request will fail.
11949 ///
11950 /// # Additional Parameters
11951 ///
11952 /// * *$.xgafv* (query-string) - V1 error format.
11953 /// * *access_token* (query-string) - OAuth access token.
11954 /// * *alt* (query-string) - Data format for response.
11955 /// * *callback* (query-string) - JSONP
11956 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11957 /// * *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.
11958 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11959 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11960 /// * *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.
11961 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11962 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11963 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionGetCall<'a, C>
11964 where
11965 T: AsRef<str>,
11966 {
11967 self._additional_params
11968 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11969 self
11970 }
11971
11972 /// Identifies the authorization scope for the method you are building.
11973 ///
11974 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11975 /// [`Scope::Admin`].
11976 ///
11977 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11978 /// tokens for more than one scope.
11979 ///
11980 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11981 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11982 /// sufficient, a read-write scope will do as well.
11983 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionGetCall<'a, C>
11984 where
11985 St: AsRef<str>,
11986 {
11987 self._scopes.insert(String::from(scope.as_ref()));
11988 self
11989 }
11990 /// Identifies the authorization scope(s) for the method you are building.
11991 ///
11992 /// See [`Self::add_scope()`] for details.
11993 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionGetCall<'a, C>
11994 where
11995 I: IntoIterator<Item = St>,
11996 St: AsRef<str>,
11997 {
11998 self._scopes
11999 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12000 self
12001 }
12002
12003 /// Removes all scopes, and no default scope will be used either.
12004 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12005 /// for details).
12006 pub fn clear_scopes(mut self) -> AppServiceVersionGetCall<'a, C> {
12007 self._scopes.clear();
12008 self
12009 }
12010}
12011
12012/// Lists the versions of a service.
12013///
12014/// A builder for the *services.versions.list* method supported by a *app* resource.
12015/// It is not used directly, but through a [`AppMethods`] instance.
12016///
12017/// # Example
12018///
12019/// Instantiate a resource method builder
12020///
12021/// ```test_harness,no_run
12022/// # extern crate hyper;
12023/// # extern crate hyper_rustls;
12024/// # extern crate google_appengine1 as appengine1;
12025/// # async fn dox() {
12026/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12027///
12028/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12029/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12030/// # secret,
12031/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12032/// # ).build().await.unwrap();
12033///
12034/// # let client = hyper_util::client::legacy::Client::builder(
12035/// # hyper_util::rt::TokioExecutor::new()
12036/// # )
12037/// # .build(
12038/// # hyper_rustls::HttpsConnectorBuilder::new()
12039/// # .with_native_roots()
12040/// # .unwrap()
12041/// # .https_or_http()
12042/// # .enable_http1()
12043/// # .build()
12044/// # );
12045/// # let mut hub = Appengine::new(client, auth);
12046/// // You can configure optional parameters by calling the respective setters at will, and
12047/// // execute the final call using `doit()`.
12048/// // Values shown here are possibly random and not representative !
12049/// let result = hub.apps().services_versions_list("appsId", "servicesId")
12050/// .view("dolore")
12051/// .page_token("dolore")
12052/// .page_size(-34)
12053/// .doit().await;
12054/// # }
12055/// ```
12056pub struct AppServiceVersionListCall<'a, C>
12057where
12058 C: 'a,
12059{
12060 hub: &'a Appengine<C>,
12061 _apps_id: String,
12062 _services_id: String,
12063 _view: Option<String>,
12064 _page_token: Option<String>,
12065 _page_size: Option<i32>,
12066 _delegate: Option<&'a mut dyn common::Delegate>,
12067 _additional_params: HashMap<String, String>,
12068 _scopes: BTreeSet<String>,
12069}
12070
12071impl<'a, C> common::CallBuilder for AppServiceVersionListCall<'a, C> {}
12072
12073impl<'a, C> AppServiceVersionListCall<'a, C>
12074where
12075 C: common::Connector,
12076{
12077 /// Perform the operation you have build so far.
12078 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
12079 use std::borrow::Cow;
12080 use std::io::{Read, Seek};
12081
12082 use common::{url::Params, ToParts};
12083 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12084
12085 let mut dd = common::DefaultDelegate;
12086 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12087 dlg.begin(common::MethodInfo {
12088 id: "appengine.apps.services.versions.list",
12089 http_method: hyper::Method::GET,
12090 });
12091
12092 for &field in [
12093 "alt",
12094 "appsId",
12095 "servicesId",
12096 "view",
12097 "pageToken",
12098 "pageSize",
12099 ]
12100 .iter()
12101 {
12102 if self._additional_params.contains_key(field) {
12103 dlg.finished(false);
12104 return Err(common::Error::FieldClash(field));
12105 }
12106 }
12107
12108 let mut params = Params::with_capacity(7 + self._additional_params.len());
12109 params.push("appsId", self._apps_id);
12110 params.push("servicesId", self._services_id);
12111 if let Some(value) = self._view.as_ref() {
12112 params.push("view", value);
12113 }
12114 if let Some(value) = self._page_token.as_ref() {
12115 params.push("pageToken", value);
12116 }
12117 if let Some(value) = self._page_size.as_ref() {
12118 params.push("pageSize", value.to_string());
12119 }
12120
12121 params.extend(self._additional_params.iter());
12122
12123 params.push("alt", "json");
12124 let mut url =
12125 self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions";
12126 if self._scopes.is_empty() {
12127 self._scopes.insert(Scope::Admin.as_ref().to_string());
12128 }
12129
12130 #[allow(clippy::single_element_loop)]
12131 for &(find_this, param_name) in
12132 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
12133 {
12134 url = params.uri_replacement(url, param_name, find_this, false);
12135 }
12136 {
12137 let to_remove = ["servicesId", "appsId"];
12138 params.remove_params(&to_remove);
12139 }
12140
12141 let url = params.parse_with_url(&url);
12142
12143 loop {
12144 let token = match self
12145 .hub
12146 .auth
12147 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12148 .await
12149 {
12150 Ok(token) => token,
12151 Err(e) => match dlg.token(e) {
12152 Ok(token) => token,
12153 Err(e) => {
12154 dlg.finished(false);
12155 return Err(common::Error::MissingToken(e));
12156 }
12157 },
12158 };
12159 let mut req_result = {
12160 let client = &self.hub.client;
12161 dlg.pre_request();
12162 let mut req_builder = hyper::Request::builder()
12163 .method(hyper::Method::GET)
12164 .uri(url.as_str())
12165 .header(USER_AGENT, self.hub._user_agent.clone());
12166
12167 if let Some(token) = token.as_ref() {
12168 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12169 }
12170
12171 let request = req_builder
12172 .header(CONTENT_LENGTH, 0_u64)
12173 .body(common::to_body::<String>(None));
12174
12175 client.request(request.unwrap()).await
12176 };
12177
12178 match req_result {
12179 Err(err) => {
12180 if let common::Retry::After(d) = dlg.http_error(&err) {
12181 sleep(d).await;
12182 continue;
12183 }
12184 dlg.finished(false);
12185 return Err(common::Error::HttpError(err));
12186 }
12187 Ok(res) => {
12188 let (mut parts, body) = res.into_parts();
12189 let mut body = common::Body::new(body);
12190 if !parts.status.is_success() {
12191 let bytes = common::to_bytes(body).await.unwrap_or_default();
12192 let error = serde_json::from_str(&common::to_string(&bytes));
12193 let response = common::to_response(parts, bytes.into());
12194
12195 if let common::Retry::After(d) =
12196 dlg.http_failure(&response, error.as_ref().ok())
12197 {
12198 sleep(d).await;
12199 continue;
12200 }
12201
12202 dlg.finished(false);
12203
12204 return Err(match error {
12205 Ok(value) => common::Error::BadRequest(value),
12206 _ => common::Error::Failure(response),
12207 });
12208 }
12209 let response = {
12210 let bytes = common::to_bytes(body).await.unwrap_or_default();
12211 let encoded = common::to_string(&bytes);
12212 match serde_json::from_str(&encoded) {
12213 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12214 Err(error) => {
12215 dlg.response_json_decode_error(&encoded, &error);
12216 return Err(common::Error::JsonDecodeError(
12217 encoded.to_string(),
12218 error,
12219 ));
12220 }
12221 }
12222 };
12223
12224 dlg.finished(true);
12225 return Ok(response);
12226 }
12227 }
12228 }
12229 }
12230
12231 /// Part of `parent`. Name of the parent Service resource. Example: apps/myapp/services/default.
12232 ///
12233 /// Sets the *apps id* path property to the given value.
12234 ///
12235 /// Even though the property as already been set when instantiating this call,
12236 /// we provide this method for API completeness.
12237 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
12238 self._apps_id = new_value.to_string();
12239 self
12240 }
12241 /// Part of `parent`. See documentation of `appsId`.
12242 ///
12243 /// Sets the *services id* path property to the given value.
12244 ///
12245 /// Even though the property as already been set when instantiating this call,
12246 /// we provide this method for API completeness.
12247 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
12248 self._services_id = new_value.to_string();
12249 self
12250 }
12251 /// Controls the set of fields returned in the List response.
12252 ///
12253 /// Sets the *view* query property to the given value.
12254 pub fn view(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
12255 self._view = Some(new_value.to_string());
12256 self
12257 }
12258 /// Continuation token for fetching the next page of results.
12259 ///
12260 /// Sets the *page token* query property to the given value.
12261 pub fn page_token(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C> {
12262 self._page_token = Some(new_value.to_string());
12263 self
12264 }
12265 /// Maximum results to return per page.
12266 ///
12267 /// Sets the *page size* query property to the given value.
12268 pub fn page_size(mut self, new_value: i32) -> AppServiceVersionListCall<'a, C> {
12269 self._page_size = Some(new_value);
12270 self
12271 }
12272 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12273 /// while executing the actual API request.
12274 ///
12275 /// ````text
12276 /// It should be used to handle progress information, and to implement a certain level of resilience.
12277 /// ````
12278 ///
12279 /// Sets the *delegate* property to the given value.
12280 pub fn delegate(
12281 mut self,
12282 new_value: &'a mut dyn common::Delegate,
12283 ) -> AppServiceVersionListCall<'a, C> {
12284 self._delegate = Some(new_value);
12285 self
12286 }
12287
12288 /// Set any additional parameter of the query string used in the request.
12289 /// It should be used to set parameters which are not yet available through their own
12290 /// setters.
12291 ///
12292 /// Please note that this method must not be used to set any of the known parameters
12293 /// which have their own setter method. If done anyway, the request will fail.
12294 ///
12295 /// # Additional Parameters
12296 ///
12297 /// * *$.xgafv* (query-string) - V1 error format.
12298 /// * *access_token* (query-string) - OAuth access token.
12299 /// * *alt* (query-string) - Data format for response.
12300 /// * *callback* (query-string) - JSONP
12301 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12302 /// * *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.
12303 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12304 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12305 /// * *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.
12306 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12307 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12308 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionListCall<'a, C>
12309 where
12310 T: AsRef<str>,
12311 {
12312 self._additional_params
12313 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12314 self
12315 }
12316
12317 /// Identifies the authorization scope for the method you are building.
12318 ///
12319 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12320 /// [`Scope::Admin`].
12321 ///
12322 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12323 /// tokens for more than one scope.
12324 ///
12325 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12326 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12327 /// sufficient, a read-write scope will do as well.
12328 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionListCall<'a, C>
12329 where
12330 St: AsRef<str>,
12331 {
12332 self._scopes.insert(String::from(scope.as_ref()));
12333 self
12334 }
12335 /// Identifies the authorization scope(s) for the method you are building.
12336 ///
12337 /// See [`Self::add_scope()`] for details.
12338 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionListCall<'a, C>
12339 where
12340 I: IntoIterator<Item = St>,
12341 St: AsRef<str>,
12342 {
12343 self._scopes
12344 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12345 self
12346 }
12347
12348 /// Removes all scopes, and no default scope will be used either.
12349 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12350 /// for details).
12351 pub fn clear_scopes(mut self) -> AppServiceVersionListCall<'a, C> {
12352 self._scopes.clear();
12353 self
12354 }
12355}
12356
12357/// 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)
12358///
12359/// A builder for the *services.versions.patch* method supported by a *app* resource.
12360/// It is not used directly, but through a [`AppMethods`] instance.
12361///
12362/// # Example
12363///
12364/// Instantiate a resource method builder
12365///
12366/// ```test_harness,no_run
12367/// # extern crate hyper;
12368/// # extern crate hyper_rustls;
12369/// # extern crate google_appengine1 as appengine1;
12370/// use appengine1::api::Version;
12371/// # async fn dox() {
12372/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12373///
12374/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12375/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12376/// # secret,
12377/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12378/// # ).build().await.unwrap();
12379///
12380/// # let client = hyper_util::client::legacy::Client::builder(
12381/// # hyper_util::rt::TokioExecutor::new()
12382/// # )
12383/// # .build(
12384/// # hyper_rustls::HttpsConnectorBuilder::new()
12385/// # .with_native_roots()
12386/// # .unwrap()
12387/// # .https_or_http()
12388/// # .enable_http1()
12389/// # .build()
12390/// # );
12391/// # let mut hub = Appengine::new(client, auth);
12392/// // As the method needs a request, you would usually fill it with the desired information
12393/// // into the respective structure. Some of the parts shown here might not be applicable !
12394/// // Values shown here are possibly random and not representative !
12395/// let mut req = Version::default();
12396///
12397/// // You can configure optional parameters by calling the respective setters at will, and
12398/// // execute the final call using `doit()`.
12399/// // Values shown here are possibly random and not representative !
12400/// let result = hub.apps().services_versions_patch(req, "appsId", "servicesId", "versionsId")
12401/// .update_mask(FieldMask::new::<&str>(&[]))
12402/// .doit().await;
12403/// # }
12404/// ```
12405pub struct AppServiceVersionPatchCall<'a, C>
12406where
12407 C: 'a,
12408{
12409 hub: &'a Appengine<C>,
12410 _request: Version,
12411 _apps_id: String,
12412 _services_id: String,
12413 _versions_id: String,
12414 _update_mask: Option<common::FieldMask>,
12415 _delegate: Option<&'a mut dyn common::Delegate>,
12416 _additional_params: HashMap<String, String>,
12417 _scopes: BTreeSet<String>,
12418}
12419
12420impl<'a, C> common::CallBuilder for AppServiceVersionPatchCall<'a, C> {}
12421
12422impl<'a, C> AppServiceVersionPatchCall<'a, C>
12423where
12424 C: common::Connector,
12425{
12426 /// Perform the operation you have build so far.
12427 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12428 use std::borrow::Cow;
12429 use std::io::{Read, Seek};
12430
12431 use common::{url::Params, ToParts};
12432 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12433
12434 let mut dd = common::DefaultDelegate;
12435 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12436 dlg.begin(common::MethodInfo {
12437 id: "appengine.apps.services.versions.patch",
12438 http_method: hyper::Method::PATCH,
12439 });
12440
12441 for &field in ["alt", "appsId", "servicesId", "versionsId", "updateMask"].iter() {
12442 if self._additional_params.contains_key(field) {
12443 dlg.finished(false);
12444 return Err(common::Error::FieldClash(field));
12445 }
12446 }
12447
12448 let mut params = Params::with_capacity(7 + self._additional_params.len());
12449 params.push("appsId", self._apps_id);
12450 params.push("servicesId", self._services_id);
12451 params.push("versionsId", self._versions_id);
12452 if let Some(value) = self._update_mask.as_ref() {
12453 params.push("updateMask", value.to_string());
12454 }
12455
12456 params.extend(self._additional_params.iter());
12457
12458 params.push("alt", "json");
12459 let mut url = self.hub._base_url.clone()
12460 + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}";
12461 if self._scopes.is_empty() {
12462 self._scopes
12463 .insert(Scope::CloudPlatform.as_ref().to_string());
12464 }
12465
12466 #[allow(clippy::single_element_loop)]
12467 for &(find_this, param_name) in [
12468 ("{appsId}", "appsId"),
12469 ("{servicesId}", "servicesId"),
12470 ("{versionsId}", "versionsId"),
12471 ]
12472 .iter()
12473 {
12474 url = params.uri_replacement(url, param_name, find_this, false);
12475 }
12476 {
12477 let to_remove = ["versionsId", "servicesId", "appsId"];
12478 params.remove_params(&to_remove);
12479 }
12480
12481 let url = params.parse_with_url(&url);
12482
12483 let mut json_mime_type = mime::APPLICATION_JSON;
12484 let mut request_value_reader = {
12485 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12486 common::remove_json_null_values(&mut value);
12487 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12488 serde_json::to_writer(&mut dst, &value).unwrap();
12489 dst
12490 };
12491 let request_size = request_value_reader
12492 .seek(std::io::SeekFrom::End(0))
12493 .unwrap();
12494 request_value_reader
12495 .seek(std::io::SeekFrom::Start(0))
12496 .unwrap();
12497
12498 loop {
12499 let token = match self
12500 .hub
12501 .auth
12502 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12503 .await
12504 {
12505 Ok(token) => token,
12506 Err(e) => match dlg.token(e) {
12507 Ok(token) => token,
12508 Err(e) => {
12509 dlg.finished(false);
12510 return Err(common::Error::MissingToken(e));
12511 }
12512 },
12513 };
12514 request_value_reader
12515 .seek(std::io::SeekFrom::Start(0))
12516 .unwrap();
12517 let mut req_result = {
12518 let client = &self.hub.client;
12519 dlg.pre_request();
12520 let mut req_builder = hyper::Request::builder()
12521 .method(hyper::Method::PATCH)
12522 .uri(url.as_str())
12523 .header(USER_AGENT, self.hub._user_agent.clone());
12524
12525 if let Some(token) = token.as_ref() {
12526 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12527 }
12528
12529 let request = req_builder
12530 .header(CONTENT_TYPE, json_mime_type.to_string())
12531 .header(CONTENT_LENGTH, request_size as u64)
12532 .body(common::to_body(
12533 request_value_reader.get_ref().clone().into(),
12534 ));
12535
12536 client.request(request.unwrap()).await
12537 };
12538
12539 match req_result {
12540 Err(err) => {
12541 if let common::Retry::After(d) = dlg.http_error(&err) {
12542 sleep(d).await;
12543 continue;
12544 }
12545 dlg.finished(false);
12546 return Err(common::Error::HttpError(err));
12547 }
12548 Ok(res) => {
12549 let (mut parts, body) = res.into_parts();
12550 let mut body = common::Body::new(body);
12551 if !parts.status.is_success() {
12552 let bytes = common::to_bytes(body).await.unwrap_or_default();
12553 let error = serde_json::from_str(&common::to_string(&bytes));
12554 let response = common::to_response(parts, bytes.into());
12555
12556 if let common::Retry::After(d) =
12557 dlg.http_failure(&response, error.as_ref().ok())
12558 {
12559 sleep(d).await;
12560 continue;
12561 }
12562
12563 dlg.finished(false);
12564
12565 return Err(match error {
12566 Ok(value) => common::Error::BadRequest(value),
12567 _ => common::Error::Failure(response),
12568 });
12569 }
12570 let response = {
12571 let bytes = common::to_bytes(body).await.unwrap_or_default();
12572 let encoded = common::to_string(&bytes);
12573 match serde_json::from_str(&encoded) {
12574 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12575 Err(error) => {
12576 dlg.response_json_decode_error(&encoded, &error);
12577 return Err(common::Error::JsonDecodeError(
12578 encoded.to_string(),
12579 error,
12580 ));
12581 }
12582 }
12583 };
12584
12585 dlg.finished(true);
12586 return Ok(response);
12587 }
12588 }
12589 }
12590 }
12591
12592 ///
12593 /// Sets the *request* property to the given value.
12594 ///
12595 /// Even though the property as already been set when instantiating this call,
12596 /// we provide this method for API completeness.
12597 pub fn request(mut self, new_value: Version) -> AppServiceVersionPatchCall<'a, C> {
12598 self._request = new_value;
12599 self
12600 }
12601 /// Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1.
12602 ///
12603 /// Sets the *apps id* path property to the given value.
12604 ///
12605 /// Even though the property as already been set when instantiating this call,
12606 /// we provide this method for API completeness.
12607 pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, C> {
12608 self._apps_id = new_value.to_string();
12609 self
12610 }
12611 /// Part of `name`. See documentation of `appsId`.
12612 ///
12613 /// Sets the *services id* path property to the given value.
12614 ///
12615 /// Even though the property as already been set when instantiating this call,
12616 /// we provide this method for API completeness.
12617 pub fn services_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, C> {
12618 self._services_id = new_value.to_string();
12619 self
12620 }
12621 /// Part of `name`. See documentation of `appsId`.
12622 ///
12623 /// Sets the *versions id* path property to the given value.
12624 ///
12625 /// Even though the property as already been set when instantiating this call,
12626 /// we provide this method for API completeness.
12627 pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, C> {
12628 self._versions_id = new_value.to_string();
12629 self
12630 }
12631 /// Standard field mask for the set of fields to be updated.
12632 ///
12633 /// Sets the *update mask* query property to the given value.
12634 pub fn update_mask(
12635 mut self,
12636 new_value: common::FieldMask,
12637 ) -> AppServiceVersionPatchCall<'a, C> {
12638 self._update_mask = Some(new_value);
12639 self
12640 }
12641 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12642 /// while executing the actual API request.
12643 ///
12644 /// ````text
12645 /// It should be used to handle progress information, and to implement a certain level of resilience.
12646 /// ````
12647 ///
12648 /// Sets the *delegate* property to the given value.
12649 pub fn delegate(
12650 mut self,
12651 new_value: &'a mut dyn common::Delegate,
12652 ) -> AppServiceVersionPatchCall<'a, C> {
12653 self._delegate = Some(new_value);
12654 self
12655 }
12656
12657 /// Set any additional parameter of the query string used in the request.
12658 /// It should be used to set parameters which are not yet available through their own
12659 /// setters.
12660 ///
12661 /// Please note that this method must not be used to set any of the known parameters
12662 /// which have their own setter method. If done anyway, the request will fail.
12663 ///
12664 /// # Additional Parameters
12665 ///
12666 /// * *$.xgafv* (query-string) - V1 error format.
12667 /// * *access_token* (query-string) - OAuth access token.
12668 /// * *alt* (query-string) - Data format for response.
12669 /// * *callback* (query-string) - JSONP
12670 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12671 /// * *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.
12672 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12673 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12674 /// * *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.
12675 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12676 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12677 pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionPatchCall<'a, C>
12678 where
12679 T: AsRef<str>,
12680 {
12681 self._additional_params
12682 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12683 self
12684 }
12685
12686 /// Identifies the authorization scope for the method you are building.
12687 ///
12688 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12689 /// [`Scope::CloudPlatform`].
12690 ///
12691 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12692 /// tokens for more than one scope.
12693 ///
12694 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12695 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12696 /// sufficient, a read-write scope will do as well.
12697 pub fn add_scope<St>(mut self, scope: St) -> AppServiceVersionPatchCall<'a, C>
12698 where
12699 St: AsRef<str>,
12700 {
12701 self._scopes.insert(String::from(scope.as_ref()));
12702 self
12703 }
12704 /// Identifies the authorization scope(s) for the method you are building.
12705 ///
12706 /// See [`Self::add_scope()`] for details.
12707 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceVersionPatchCall<'a, C>
12708 where
12709 I: IntoIterator<Item = St>,
12710 St: AsRef<str>,
12711 {
12712 self._scopes
12713 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12714 self
12715 }
12716
12717 /// Removes all scopes, and no default scope will be used either.
12718 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12719 /// for details).
12720 pub fn clear_scopes(mut self) -> AppServiceVersionPatchCall<'a, C> {
12721 self._scopes.clear();
12722 self
12723 }
12724}
12725
12726/// Deletes the specified service and all enclosed versions.
12727///
12728/// A builder for the *services.delete* method supported by a *app* resource.
12729/// It is not used directly, but through a [`AppMethods`] instance.
12730///
12731/// # Example
12732///
12733/// Instantiate a resource method builder
12734///
12735/// ```test_harness,no_run
12736/// # extern crate hyper;
12737/// # extern crate hyper_rustls;
12738/// # extern crate google_appengine1 as appengine1;
12739/// # async fn dox() {
12740/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12741///
12742/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12743/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12744/// # secret,
12745/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12746/// # ).build().await.unwrap();
12747///
12748/// # let client = hyper_util::client::legacy::Client::builder(
12749/// # hyper_util::rt::TokioExecutor::new()
12750/// # )
12751/// # .build(
12752/// # hyper_rustls::HttpsConnectorBuilder::new()
12753/// # .with_native_roots()
12754/// # .unwrap()
12755/// # .https_or_http()
12756/// # .enable_http1()
12757/// # .build()
12758/// # );
12759/// # let mut hub = Appengine::new(client, auth);
12760/// // You can configure optional parameters by calling the respective setters at will, and
12761/// // execute the final call using `doit()`.
12762/// // Values shown here are possibly random and not representative !
12763/// let result = hub.apps().services_delete("appsId", "servicesId")
12764/// .doit().await;
12765/// # }
12766/// ```
12767pub struct AppServiceDeleteCall<'a, C>
12768where
12769 C: 'a,
12770{
12771 hub: &'a Appengine<C>,
12772 _apps_id: String,
12773 _services_id: String,
12774 _delegate: Option<&'a mut dyn common::Delegate>,
12775 _additional_params: HashMap<String, String>,
12776 _scopes: BTreeSet<String>,
12777}
12778
12779impl<'a, C> common::CallBuilder for AppServiceDeleteCall<'a, C> {}
12780
12781impl<'a, C> AppServiceDeleteCall<'a, C>
12782where
12783 C: common::Connector,
12784{
12785 /// Perform the operation you have build so far.
12786 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12787 use std::borrow::Cow;
12788 use std::io::{Read, Seek};
12789
12790 use common::{url::Params, ToParts};
12791 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12792
12793 let mut dd = common::DefaultDelegate;
12794 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12795 dlg.begin(common::MethodInfo {
12796 id: "appengine.apps.services.delete",
12797 http_method: hyper::Method::DELETE,
12798 });
12799
12800 for &field in ["alt", "appsId", "servicesId"].iter() {
12801 if self._additional_params.contains_key(field) {
12802 dlg.finished(false);
12803 return Err(common::Error::FieldClash(field));
12804 }
12805 }
12806
12807 let mut params = Params::with_capacity(4 + self._additional_params.len());
12808 params.push("appsId", self._apps_id);
12809 params.push("servicesId", self._services_id);
12810
12811 params.extend(self._additional_params.iter());
12812
12813 params.push("alt", "json");
12814 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}";
12815 if self._scopes.is_empty() {
12816 self._scopes
12817 .insert(Scope::CloudPlatform.as_ref().to_string());
12818 }
12819
12820 #[allow(clippy::single_element_loop)]
12821 for &(find_this, param_name) in
12822 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
12823 {
12824 url = params.uri_replacement(url, param_name, find_this, false);
12825 }
12826 {
12827 let to_remove = ["servicesId", "appsId"];
12828 params.remove_params(&to_remove);
12829 }
12830
12831 let url = params.parse_with_url(&url);
12832
12833 loop {
12834 let token = match self
12835 .hub
12836 .auth
12837 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12838 .await
12839 {
12840 Ok(token) => token,
12841 Err(e) => match dlg.token(e) {
12842 Ok(token) => token,
12843 Err(e) => {
12844 dlg.finished(false);
12845 return Err(common::Error::MissingToken(e));
12846 }
12847 },
12848 };
12849 let mut req_result = {
12850 let client = &self.hub.client;
12851 dlg.pre_request();
12852 let mut req_builder = hyper::Request::builder()
12853 .method(hyper::Method::DELETE)
12854 .uri(url.as_str())
12855 .header(USER_AGENT, self.hub._user_agent.clone());
12856
12857 if let Some(token) = token.as_ref() {
12858 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12859 }
12860
12861 let request = req_builder
12862 .header(CONTENT_LENGTH, 0_u64)
12863 .body(common::to_body::<String>(None));
12864
12865 client.request(request.unwrap()).await
12866 };
12867
12868 match req_result {
12869 Err(err) => {
12870 if let common::Retry::After(d) = dlg.http_error(&err) {
12871 sleep(d).await;
12872 continue;
12873 }
12874 dlg.finished(false);
12875 return Err(common::Error::HttpError(err));
12876 }
12877 Ok(res) => {
12878 let (mut parts, body) = res.into_parts();
12879 let mut body = common::Body::new(body);
12880 if !parts.status.is_success() {
12881 let bytes = common::to_bytes(body).await.unwrap_or_default();
12882 let error = serde_json::from_str(&common::to_string(&bytes));
12883 let response = common::to_response(parts, bytes.into());
12884
12885 if let common::Retry::After(d) =
12886 dlg.http_failure(&response, error.as_ref().ok())
12887 {
12888 sleep(d).await;
12889 continue;
12890 }
12891
12892 dlg.finished(false);
12893
12894 return Err(match error {
12895 Ok(value) => common::Error::BadRequest(value),
12896 _ => common::Error::Failure(response),
12897 });
12898 }
12899 let response = {
12900 let bytes = common::to_bytes(body).await.unwrap_or_default();
12901 let encoded = common::to_string(&bytes);
12902 match serde_json::from_str(&encoded) {
12903 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12904 Err(error) => {
12905 dlg.response_json_decode_error(&encoded, &error);
12906 return Err(common::Error::JsonDecodeError(
12907 encoded.to_string(),
12908 error,
12909 ));
12910 }
12911 }
12912 };
12913
12914 dlg.finished(true);
12915 return Ok(response);
12916 }
12917 }
12918 }
12919 }
12920
12921 /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.
12922 ///
12923 /// Sets the *apps id* path property to the given value.
12924 ///
12925 /// Even though the property as already been set when instantiating this call,
12926 /// we provide this method for API completeness.
12927 pub fn apps_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, C> {
12928 self._apps_id = new_value.to_string();
12929 self
12930 }
12931 /// Part of `name`. See documentation of `appsId`.
12932 ///
12933 /// Sets the *services id* path property to the given value.
12934 ///
12935 /// Even though the property as already been set when instantiating this call,
12936 /// we provide this method for API completeness.
12937 pub fn services_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, C> {
12938 self._services_id = new_value.to_string();
12939 self
12940 }
12941 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12942 /// while executing the actual API request.
12943 ///
12944 /// ````text
12945 /// It should be used to handle progress information, and to implement a certain level of resilience.
12946 /// ````
12947 ///
12948 /// Sets the *delegate* property to the given value.
12949 pub fn delegate(
12950 mut self,
12951 new_value: &'a mut dyn common::Delegate,
12952 ) -> AppServiceDeleteCall<'a, C> {
12953 self._delegate = Some(new_value);
12954 self
12955 }
12956
12957 /// Set any additional parameter of the query string used in the request.
12958 /// It should be used to set parameters which are not yet available through their own
12959 /// setters.
12960 ///
12961 /// Please note that this method must not be used to set any of the known parameters
12962 /// which have their own setter method. If done anyway, the request will fail.
12963 ///
12964 /// # Additional Parameters
12965 ///
12966 /// * *$.xgafv* (query-string) - V1 error format.
12967 /// * *access_token* (query-string) - OAuth access token.
12968 /// * *alt* (query-string) - Data format for response.
12969 /// * *callback* (query-string) - JSONP
12970 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12971 /// * *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.
12972 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12973 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12974 /// * *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.
12975 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12976 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12977 pub fn param<T>(mut self, name: T, value: T) -> AppServiceDeleteCall<'a, C>
12978 where
12979 T: AsRef<str>,
12980 {
12981 self._additional_params
12982 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12983 self
12984 }
12985
12986 /// Identifies the authorization scope for the method you are building.
12987 ///
12988 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12989 /// [`Scope::CloudPlatform`].
12990 ///
12991 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12992 /// tokens for more than one scope.
12993 ///
12994 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12995 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12996 /// sufficient, a read-write scope will do as well.
12997 pub fn add_scope<St>(mut self, scope: St) -> AppServiceDeleteCall<'a, C>
12998 where
12999 St: AsRef<str>,
13000 {
13001 self._scopes.insert(String::from(scope.as_ref()));
13002 self
13003 }
13004 /// Identifies the authorization scope(s) for the method you are building.
13005 ///
13006 /// See [`Self::add_scope()`] for details.
13007 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceDeleteCall<'a, C>
13008 where
13009 I: IntoIterator<Item = St>,
13010 St: AsRef<str>,
13011 {
13012 self._scopes
13013 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13014 self
13015 }
13016
13017 /// Removes all scopes, and no default scope will be used either.
13018 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13019 /// for details).
13020 pub fn clear_scopes(mut self) -> AppServiceDeleteCall<'a, C> {
13021 self._scopes.clear();
13022 self
13023 }
13024}
13025
13026/// Gets the current configuration of the specified service.
13027///
13028/// A builder for the *services.get* method supported by a *app* resource.
13029/// It is not used directly, but through a [`AppMethods`] instance.
13030///
13031/// # Example
13032///
13033/// Instantiate a resource method builder
13034///
13035/// ```test_harness,no_run
13036/// # extern crate hyper;
13037/// # extern crate hyper_rustls;
13038/// # extern crate google_appengine1 as appengine1;
13039/// # async fn dox() {
13040/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13041///
13042/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13043/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13044/// # secret,
13045/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13046/// # ).build().await.unwrap();
13047///
13048/// # let client = hyper_util::client::legacy::Client::builder(
13049/// # hyper_util::rt::TokioExecutor::new()
13050/// # )
13051/// # .build(
13052/// # hyper_rustls::HttpsConnectorBuilder::new()
13053/// # .with_native_roots()
13054/// # .unwrap()
13055/// # .https_or_http()
13056/// # .enable_http1()
13057/// # .build()
13058/// # );
13059/// # let mut hub = Appengine::new(client, auth);
13060/// // You can configure optional parameters by calling the respective setters at will, and
13061/// // execute the final call using `doit()`.
13062/// // Values shown here are possibly random and not representative !
13063/// let result = hub.apps().services_get("appsId", "servicesId")
13064/// .doit().await;
13065/// # }
13066/// ```
13067pub struct AppServiceGetCall<'a, C>
13068where
13069 C: 'a,
13070{
13071 hub: &'a Appengine<C>,
13072 _apps_id: String,
13073 _services_id: String,
13074 _delegate: Option<&'a mut dyn common::Delegate>,
13075 _additional_params: HashMap<String, String>,
13076 _scopes: BTreeSet<String>,
13077}
13078
13079impl<'a, C> common::CallBuilder for AppServiceGetCall<'a, C> {}
13080
13081impl<'a, C> AppServiceGetCall<'a, C>
13082where
13083 C: common::Connector,
13084{
13085 /// Perform the operation you have build so far.
13086 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
13087 use std::borrow::Cow;
13088 use std::io::{Read, Seek};
13089
13090 use common::{url::Params, ToParts};
13091 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13092
13093 let mut dd = common::DefaultDelegate;
13094 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13095 dlg.begin(common::MethodInfo {
13096 id: "appengine.apps.services.get",
13097 http_method: hyper::Method::GET,
13098 });
13099
13100 for &field in ["alt", "appsId", "servicesId"].iter() {
13101 if self._additional_params.contains_key(field) {
13102 dlg.finished(false);
13103 return Err(common::Error::FieldClash(field));
13104 }
13105 }
13106
13107 let mut params = Params::with_capacity(4 + self._additional_params.len());
13108 params.push("appsId", self._apps_id);
13109 params.push("servicesId", self._services_id);
13110
13111 params.extend(self._additional_params.iter());
13112
13113 params.push("alt", "json");
13114 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}";
13115 if self._scopes.is_empty() {
13116 self._scopes.insert(Scope::Admin.as_ref().to_string());
13117 }
13118
13119 #[allow(clippy::single_element_loop)]
13120 for &(find_this, param_name) in
13121 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
13122 {
13123 url = params.uri_replacement(url, param_name, find_this, false);
13124 }
13125 {
13126 let to_remove = ["servicesId", "appsId"];
13127 params.remove_params(&to_remove);
13128 }
13129
13130 let url = params.parse_with_url(&url);
13131
13132 loop {
13133 let token = match self
13134 .hub
13135 .auth
13136 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13137 .await
13138 {
13139 Ok(token) => token,
13140 Err(e) => match dlg.token(e) {
13141 Ok(token) => token,
13142 Err(e) => {
13143 dlg.finished(false);
13144 return Err(common::Error::MissingToken(e));
13145 }
13146 },
13147 };
13148 let mut req_result = {
13149 let client = &self.hub.client;
13150 dlg.pre_request();
13151 let mut req_builder = hyper::Request::builder()
13152 .method(hyper::Method::GET)
13153 .uri(url.as_str())
13154 .header(USER_AGENT, self.hub._user_agent.clone());
13155
13156 if let Some(token) = token.as_ref() {
13157 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13158 }
13159
13160 let request = req_builder
13161 .header(CONTENT_LENGTH, 0_u64)
13162 .body(common::to_body::<String>(None));
13163
13164 client.request(request.unwrap()).await
13165 };
13166
13167 match req_result {
13168 Err(err) => {
13169 if let common::Retry::After(d) = dlg.http_error(&err) {
13170 sleep(d).await;
13171 continue;
13172 }
13173 dlg.finished(false);
13174 return Err(common::Error::HttpError(err));
13175 }
13176 Ok(res) => {
13177 let (mut parts, body) = res.into_parts();
13178 let mut body = common::Body::new(body);
13179 if !parts.status.is_success() {
13180 let bytes = common::to_bytes(body).await.unwrap_or_default();
13181 let error = serde_json::from_str(&common::to_string(&bytes));
13182 let response = common::to_response(parts, bytes.into());
13183
13184 if let common::Retry::After(d) =
13185 dlg.http_failure(&response, error.as_ref().ok())
13186 {
13187 sleep(d).await;
13188 continue;
13189 }
13190
13191 dlg.finished(false);
13192
13193 return Err(match error {
13194 Ok(value) => common::Error::BadRequest(value),
13195 _ => common::Error::Failure(response),
13196 });
13197 }
13198 let response = {
13199 let bytes = common::to_bytes(body).await.unwrap_or_default();
13200 let encoded = common::to_string(&bytes);
13201 match serde_json::from_str(&encoded) {
13202 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13203 Err(error) => {
13204 dlg.response_json_decode_error(&encoded, &error);
13205 return Err(common::Error::JsonDecodeError(
13206 encoded.to_string(),
13207 error,
13208 ));
13209 }
13210 }
13211 };
13212
13213 dlg.finished(true);
13214 return Ok(response);
13215 }
13216 }
13217 }
13218 }
13219
13220 /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.
13221 ///
13222 /// Sets the *apps id* path property to the given value.
13223 ///
13224 /// Even though the property as already been set when instantiating this call,
13225 /// we provide this method for API completeness.
13226 pub fn apps_id(mut self, new_value: &str) -> AppServiceGetCall<'a, C> {
13227 self._apps_id = new_value.to_string();
13228 self
13229 }
13230 /// Part of `name`. See documentation of `appsId`.
13231 ///
13232 /// Sets the *services id* path property to the given value.
13233 ///
13234 /// Even though the property as already been set when instantiating this call,
13235 /// we provide this method for API completeness.
13236 pub fn services_id(mut self, new_value: &str) -> AppServiceGetCall<'a, C> {
13237 self._services_id = new_value.to_string();
13238 self
13239 }
13240 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13241 /// while executing the actual API request.
13242 ///
13243 /// ````text
13244 /// It should be used to handle progress information, and to implement a certain level of resilience.
13245 /// ````
13246 ///
13247 /// Sets the *delegate* property to the given value.
13248 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppServiceGetCall<'a, C> {
13249 self._delegate = Some(new_value);
13250 self
13251 }
13252
13253 /// Set any additional parameter of the query string used in the request.
13254 /// It should be used to set parameters which are not yet available through their own
13255 /// setters.
13256 ///
13257 /// Please note that this method must not be used to set any of the known parameters
13258 /// which have their own setter method. If done anyway, the request will fail.
13259 ///
13260 /// # Additional Parameters
13261 ///
13262 /// * *$.xgafv* (query-string) - V1 error format.
13263 /// * *access_token* (query-string) - OAuth access token.
13264 /// * *alt* (query-string) - Data format for response.
13265 /// * *callback* (query-string) - JSONP
13266 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13267 /// * *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.
13268 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13269 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13270 /// * *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.
13271 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13272 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13273 pub fn param<T>(mut self, name: T, value: T) -> AppServiceGetCall<'a, C>
13274 where
13275 T: AsRef<str>,
13276 {
13277 self._additional_params
13278 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13279 self
13280 }
13281
13282 /// Identifies the authorization scope for the method you are building.
13283 ///
13284 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13285 /// [`Scope::Admin`].
13286 ///
13287 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13288 /// tokens for more than one scope.
13289 ///
13290 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13291 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13292 /// sufficient, a read-write scope will do as well.
13293 pub fn add_scope<St>(mut self, scope: St) -> AppServiceGetCall<'a, C>
13294 where
13295 St: AsRef<str>,
13296 {
13297 self._scopes.insert(String::from(scope.as_ref()));
13298 self
13299 }
13300 /// Identifies the authorization scope(s) for the method you are building.
13301 ///
13302 /// See [`Self::add_scope()`] for details.
13303 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceGetCall<'a, C>
13304 where
13305 I: IntoIterator<Item = St>,
13306 St: AsRef<str>,
13307 {
13308 self._scopes
13309 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13310 self
13311 }
13312
13313 /// Removes all scopes, and no default scope will be used either.
13314 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13315 /// for details).
13316 pub fn clear_scopes(mut self) -> AppServiceGetCall<'a, C> {
13317 self._scopes.clear();
13318 self
13319 }
13320}
13321
13322/// Lists all the services in the application.
13323///
13324/// A builder for the *services.list* method supported by a *app* resource.
13325/// It is not used directly, but through a [`AppMethods`] instance.
13326///
13327/// # Example
13328///
13329/// Instantiate a resource method builder
13330///
13331/// ```test_harness,no_run
13332/// # extern crate hyper;
13333/// # extern crate hyper_rustls;
13334/// # extern crate google_appengine1 as appengine1;
13335/// # async fn dox() {
13336/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13337///
13338/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13339/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13340/// # secret,
13341/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13342/// # ).build().await.unwrap();
13343///
13344/// # let client = hyper_util::client::legacy::Client::builder(
13345/// # hyper_util::rt::TokioExecutor::new()
13346/// # )
13347/// # .build(
13348/// # hyper_rustls::HttpsConnectorBuilder::new()
13349/// # .with_native_roots()
13350/// # .unwrap()
13351/// # .https_or_http()
13352/// # .enable_http1()
13353/// # .build()
13354/// # );
13355/// # let mut hub = Appengine::new(client, auth);
13356/// // You can configure optional parameters by calling the respective setters at will, and
13357/// // execute the final call using `doit()`.
13358/// // Values shown here are possibly random and not representative !
13359/// let result = hub.apps().services_list("appsId")
13360/// .page_token("At")
13361/// .page_size(-43)
13362/// .doit().await;
13363/// # }
13364/// ```
13365pub struct AppServiceListCall<'a, C>
13366where
13367 C: 'a,
13368{
13369 hub: &'a Appengine<C>,
13370 _apps_id: String,
13371 _page_token: Option<String>,
13372 _page_size: Option<i32>,
13373 _delegate: Option<&'a mut dyn common::Delegate>,
13374 _additional_params: HashMap<String, String>,
13375 _scopes: BTreeSet<String>,
13376}
13377
13378impl<'a, C> common::CallBuilder for AppServiceListCall<'a, C> {}
13379
13380impl<'a, C> AppServiceListCall<'a, C>
13381where
13382 C: common::Connector,
13383{
13384 /// Perform the operation you have build so far.
13385 pub async fn doit(mut self) -> common::Result<(common::Response, ListServicesResponse)> {
13386 use std::borrow::Cow;
13387 use std::io::{Read, Seek};
13388
13389 use common::{url::Params, ToParts};
13390 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13391
13392 let mut dd = common::DefaultDelegate;
13393 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13394 dlg.begin(common::MethodInfo {
13395 id: "appengine.apps.services.list",
13396 http_method: hyper::Method::GET,
13397 });
13398
13399 for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
13400 if self._additional_params.contains_key(field) {
13401 dlg.finished(false);
13402 return Err(common::Error::FieldClash(field));
13403 }
13404 }
13405
13406 let mut params = Params::with_capacity(5 + self._additional_params.len());
13407 params.push("appsId", self._apps_id);
13408 if let Some(value) = self._page_token.as_ref() {
13409 params.push("pageToken", value);
13410 }
13411 if let Some(value) = self._page_size.as_ref() {
13412 params.push("pageSize", value.to_string());
13413 }
13414
13415 params.extend(self._additional_params.iter());
13416
13417 params.push("alt", "json");
13418 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services";
13419 if self._scopes.is_empty() {
13420 self._scopes.insert(Scope::Admin.as_ref().to_string());
13421 }
13422
13423 #[allow(clippy::single_element_loop)]
13424 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
13425 url = params.uri_replacement(url, param_name, find_this, false);
13426 }
13427 {
13428 let to_remove = ["appsId"];
13429 params.remove_params(&to_remove);
13430 }
13431
13432 let url = params.parse_with_url(&url);
13433
13434 loop {
13435 let token = match self
13436 .hub
13437 .auth
13438 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13439 .await
13440 {
13441 Ok(token) => token,
13442 Err(e) => match dlg.token(e) {
13443 Ok(token) => token,
13444 Err(e) => {
13445 dlg.finished(false);
13446 return Err(common::Error::MissingToken(e));
13447 }
13448 },
13449 };
13450 let mut req_result = {
13451 let client = &self.hub.client;
13452 dlg.pre_request();
13453 let mut req_builder = hyper::Request::builder()
13454 .method(hyper::Method::GET)
13455 .uri(url.as_str())
13456 .header(USER_AGENT, self.hub._user_agent.clone());
13457
13458 if let Some(token) = token.as_ref() {
13459 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13460 }
13461
13462 let request = req_builder
13463 .header(CONTENT_LENGTH, 0_u64)
13464 .body(common::to_body::<String>(None));
13465
13466 client.request(request.unwrap()).await
13467 };
13468
13469 match req_result {
13470 Err(err) => {
13471 if let common::Retry::After(d) = dlg.http_error(&err) {
13472 sleep(d).await;
13473 continue;
13474 }
13475 dlg.finished(false);
13476 return Err(common::Error::HttpError(err));
13477 }
13478 Ok(res) => {
13479 let (mut parts, body) = res.into_parts();
13480 let mut body = common::Body::new(body);
13481 if !parts.status.is_success() {
13482 let bytes = common::to_bytes(body).await.unwrap_or_default();
13483 let error = serde_json::from_str(&common::to_string(&bytes));
13484 let response = common::to_response(parts, bytes.into());
13485
13486 if let common::Retry::After(d) =
13487 dlg.http_failure(&response, error.as_ref().ok())
13488 {
13489 sleep(d).await;
13490 continue;
13491 }
13492
13493 dlg.finished(false);
13494
13495 return Err(match error {
13496 Ok(value) => common::Error::BadRequest(value),
13497 _ => common::Error::Failure(response),
13498 });
13499 }
13500 let response = {
13501 let bytes = common::to_bytes(body).await.unwrap_or_default();
13502 let encoded = common::to_string(&bytes);
13503 match serde_json::from_str(&encoded) {
13504 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13505 Err(error) => {
13506 dlg.response_json_decode_error(&encoded, &error);
13507 return Err(common::Error::JsonDecodeError(
13508 encoded.to_string(),
13509 error,
13510 ));
13511 }
13512 }
13513 };
13514
13515 dlg.finished(true);
13516 return Ok(response);
13517 }
13518 }
13519 }
13520 }
13521
13522 /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
13523 ///
13524 /// Sets the *apps id* path property to the given value.
13525 ///
13526 /// Even though the property as already been set when instantiating this call,
13527 /// we provide this method for API completeness.
13528 pub fn apps_id(mut self, new_value: &str) -> AppServiceListCall<'a, C> {
13529 self._apps_id = new_value.to_string();
13530 self
13531 }
13532 /// Continuation token for fetching the next page of results.
13533 ///
13534 /// Sets the *page token* query property to the given value.
13535 pub fn page_token(mut self, new_value: &str) -> AppServiceListCall<'a, C> {
13536 self._page_token = Some(new_value.to_string());
13537 self
13538 }
13539 /// Maximum results to return per page.
13540 ///
13541 /// Sets the *page size* query property to the given value.
13542 pub fn page_size(mut self, new_value: i32) -> AppServiceListCall<'a, C> {
13543 self._page_size = Some(new_value);
13544 self
13545 }
13546 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13547 /// while executing the actual API request.
13548 ///
13549 /// ````text
13550 /// It should be used to handle progress information, and to implement a certain level of resilience.
13551 /// ````
13552 ///
13553 /// Sets the *delegate* property to the given value.
13554 pub fn delegate(
13555 mut self,
13556 new_value: &'a mut dyn common::Delegate,
13557 ) -> AppServiceListCall<'a, C> {
13558 self._delegate = Some(new_value);
13559 self
13560 }
13561
13562 /// Set any additional parameter of the query string used in the request.
13563 /// It should be used to set parameters which are not yet available through their own
13564 /// setters.
13565 ///
13566 /// Please note that this method must not be used to set any of the known parameters
13567 /// which have their own setter method. If done anyway, the request will fail.
13568 ///
13569 /// # Additional Parameters
13570 ///
13571 /// * *$.xgafv* (query-string) - V1 error format.
13572 /// * *access_token* (query-string) - OAuth access token.
13573 /// * *alt* (query-string) - Data format for response.
13574 /// * *callback* (query-string) - JSONP
13575 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13576 /// * *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.
13577 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13578 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13579 /// * *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.
13580 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13581 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13582 pub fn param<T>(mut self, name: T, value: T) -> AppServiceListCall<'a, C>
13583 where
13584 T: AsRef<str>,
13585 {
13586 self._additional_params
13587 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13588 self
13589 }
13590
13591 /// Identifies the authorization scope for the method you are building.
13592 ///
13593 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13594 /// [`Scope::Admin`].
13595 ///
13596 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13597 /// tokens for more than one scope.
13598 ///
13599 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13600 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13601 /// sufficient, a read-write scope will do as well.
13602 pub fn add_scope<St>(mut self, scope: St) -> AppServiceListCall<'a, C>
13603 where
13604 St: AsRef<str>,
13605 {
13606 self._scopes.insert(String::from(scope.as_ref()));
13607 self
13608 }
13609 /// Identifies the authorization scope(s) for the method you are building.
13610 ///
13611 /// See [`Self::add_scope()`] for details.
13612 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServiceListCall<'a, C>
13613 where
13614 I: IntoIterator<Item = St>,
13615 St: AsRef<str>,
13616 {
13617 self._scopes
13618 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13619 self
13620 }
13621
13622 /// Removes all scopes, and no default scope will be used either.
13623 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13624 /// for details).
13625 pub fn clear_scopes(mut self) -> AppServiceListCall<'a, C> {
13626 self._scopes.clear();
13627 self
13628 }
13629}
13630
13631/// Updates the configuration of the specified service.
13632///
13633/// A builder for the *services.patch* method supported by a *app* resource.
13634/// It is not used directly, but through a [`AppMethods`] instance.
13635///
13636/// # Example
13637///
13638/// Instantiate a resource method builder
13639///
13640/// ```test_harness,no_run
13641/// # extern crate hyper;
13642/// # extern crate hyper_rustls;
13643/// # extern crate google_appengine1 as appengine1;
13644/// use appengine1::api::Service;
13645/// # async fn dox() {
13646/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13647///
13648/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13649/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13650/// # secret,
13651/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13652/// # ).build().await.unwrap();
13653///
13654/// # let client = hyper_util::client::legacy::Client::builder(
13655/// # hyper_util::rt::TokioExecutor::new()
13656/// # )
13657/// # .build(
13658/// # hyper_rustls::HttpsConnectorBuilder::new()
13659/// # .with_native_roots()
13660/// # .unwrap()
13661/// # .https_or_http()
13662/// # .enable_http1()
13663/// # .build()
13664/// # );
13665/// # let mut hub = Appengine::new(client, auth);
13666/// // As the method needs a request, you would usually fill it with the desired information
13667/// // into the respective structure. Some of the parts shown here might not be applicable !
13668/// // Values shown here are possibly random and not representative !
13669/// let mut req = Service::default();
13670///
13671/// // You can configure optional parameters by calling the respective setters at will, and
13672/// // execute the final call using `doit()`.
13673/// // Values shown here are possibly random and not representative !
13674/// let result = hub.apps().services_patch(req, "appsId", "servicesId")
13675/// .update_mask(FieldMask::new::<&str>(&[]))
13676/// .migrate_traffic(true)
13677/// .doit().await;
13678/// # }
13679/// ```
13680pub struct AppServicePatchCall<'a, C>
13681where
13682 C: 'a,
13683{
13684 hub: &'a Appengine<C>,
13685 _request: Service,
13686 _apps_id: String,
13687 _services_id: String,
13688 _update_mask: Option<common::FieldMask>,
13689 _migrate_traffic: Option<bool>,
13690 _delegate: Option<&'a mut dyn common::Delegate>,
13691 _additional_params: HashMap<String, String>,
13692 _scopes: BTreeSet<String>,
13693}
13694
13695impl<'a, C> common::CallBuilder for AppServicePatchCall<'a, C> {}
13696
13697impl<'a, C> AppServicePatchCall<'a, C>
13698where
13699 C: common::Connector,
13700{
13701 /// Perform the operation you have build so far.
13702 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13703 use std::borrow::Cow;
13704 use std::io::{Read, Seek};
13705
13706 use common::{url::Params, ToParts};
13707 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13708
13709 let mut dd = common::DefaultDelegate;
13710 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13711 dlg.begin(common::MethodInfo {
13712 id: "appengine.apps.services.patch",
13713 http_method: hyper::Method::PATCH,
13714 });
13715
13716 for &field in [
13717 "alt",
13718 "appsId",
13719 "servicesId",
13720 "updateMask",
13721 "migrateTraffic",
13722 ]
13723 .iter()
13724 {
13725 if self._additional_params.contains_key(field) {
13726 dlg.finished(false);
13727 return Err(common::Error::FieldClash(field));
13728 }
13729 }
13730
13731 let mut params = Params::with_capacity(7 + self._additional_params.len());
13732 params.push("appsId", self._apps_id);
13733 params.push("servicesId", self._services_id);
13734 if let Some(value) = self._update_mask.as_ref() {
13735 params.push("updateMask", value.to_string());
13736 }
13737 if let Some(value) = self._migrate_traffic.as_ref() {
13738 params.push("migrateTraffic", value.to_string());
13739 }
13740
13741 params.extend(self._additional_params.iter());
13742
13743 params.push("alt", "json");
13744 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}";
13745 if self._scopes.is_empty() {
13746 self._scopes
13747 .insert(Scope::CloudPlatform.as_ref().to_string());
13748 }
13749
13750 #[allow(clippy::single_element_loop)]
13751 for &(find_this, param_name) in
13752 [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter()
13753 {
13754 url = params.uri_replacement(url, param_name, find_this, false);
13755 }
13756 {
13757 let to_remove = ["servicesId", "appsId"];
13758 params.remove_params(&to_remove);
13759 }
13760
13761 let url = params.parse_with_url(&url);
13762
13763 let mut json_mime_type = mime::APPLICATION_JSON;
13764 let mut request_value_reader = {
13765 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13766 common::remove_json_null_values(&mut value);
13767 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13768 serde_json::to_writer(&mut dst, &value).unwrap();
13769 dst
13770 };
13771 let request_size = request_value_reader
13772 .seek(std::io::SeekFrom::End(0))
13773 .unwrap();
13774 request_value_reader
13775 .seek(std::io::SeekFrom::Start(0))
13776 .unwrap();
13777
13778 loop {
13779 let token = match self
13780 .hub
13781 .auth
13782 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13783 .await
13784 {
13785 Ok(token) => token,
13786 Err(e) => match dlg.token(e) {
13787 Ok(token) => token,
13788 Err(e) => {
13789 dlg.finished(false);
13790 return Err(common::Error::MissingToken(e));
13791 }
13792 },
13793 };
13794 request_value_reader
13795 .seek(std::io::SeekFrom::Start(0))
13796 .unwrap();
13797 let mut req_result = {
13798 let client = &self.hub.client;
13799 dlg.pre_request();
13800 let mut req_builder = hyper::Request::builder()
13801 .method(hyper::Method::PATCH)
13802 .uri(url.as_str())
13803 .header(USER_AGENT, self.hub._user_agent.clone());
13804
13805 if let Some(token) = token.as_ref() {
13806 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13807 }
13808
13809 let request = req_builder
13810 .header(CONTENT_TYPE, json_mime_type.to_string())
13811 .header(CONTENT_LENGTH, request_size as u64)
13812 .body(common::to_body(
13813 request_value_reader.get_ref().clone().into(),
13814 ));
13815
13816 client.request(request.unwrap()).await
13817 };
13818
13819 match req_result {
13820 Err(err) => {
13821 if let common::Retry::After(d) = dlg.http_error(&err) {
13822 sleep(d).await;
13823 continue;
13824 }
13825 dlg.finished(false);
13826 return Err(common::Error::HttpError(err));
13827 }
13828 Ok(res) => {
13829 let (mut parts, body) = res.into_parts();
13830 let mut body = common::Body::new(body);
13831 if !parts.status.is_success() {
13832 let bytes = common::to_bytes(body).await.unwrap_or_default();
13833 let error = serde_json::from_str(&common::to_string(&bytes));
13834 let response = common::to_response(parts, bytes.into());
13835
13836 if let common::Retry::After(d) =
13837 dlg.http_failure(&response, error.as_ref().ok())
13838 {
13839 sleep(d).await;
13840 continue;
13841 }
13842
13843 dlg.finished(false);
13844
13845 return Err(match error {
13846 Ok(value) => common::Error::BadRequest(value),
13847 _ => common::Error::Failure(response),
13848 });
13849 }
13850 let response = {
13851 let bytes = common::to_bytes(body).await.unwrap_or_default();
13852 let encoded = common::to_string(&bytes);
13853 match serde_json::from_str(&encoded) {
13854 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13855 Err(error) => {
13856 dlg.response_json_decode_error(&encoded, &error);
13857 return Err(common::Error::JsonDecodeError(
13858 encoded.to_string(),
13859 error,
13860 ));
13861 }
13862 }
13863 };
13864
13865 dlg.finished(true);
13866 return Ok(response);
13867 }
13868 }
13869 }
13870 }
13871
13872 ///
13873 /// Sets the *request* property to the given value.
13874 ///
13875 /// Even though the property as already been set when instantiating this call,
13876 /// we provide this method for API completeness.
13877 pub fn request(mut self, new_value: Service) -> AppServicePatchCall<'a, C> {
13878 self._request = new_value;
13879 self
13880 }
13881 /// Part of `name`. Name of the resource to update. Example: apps/myapp/services/default.
13882 ///
13883 /// Sets the *apps id* path property to the given value.
13884 ///
13885 /// Even though the property as already been set when instantiating this call,
13886 /// we provide this method for API completeness.
13887 pub fn apps_id(mut self, new_value: &str) -> AppServicePatchCall<'a, C> {
13888 self._apps_id = new_value.to_string();
13889 self
13890 }
13891 /// Part of `name`. See documentation of `appsId`.
13892 ///
13893 /// Sets the *services id* path property to the given value.
13894 ///
13895 /// Even though the property as already been set when instantiating this call,
13896 /// we provide this method for API completeness.
13897 pub fn services_id(mut self, new_value: &str) -> AppServicePatchCall<'a, C> {
13898 self._services_id = new_value.to_string();
13899 self
13900 }
13901 /// Required. Standard field mask for the set of fields to be updated.
13902 ///
13903 /// Sets the *update mask* query property to the given value.
13904 pub fn update_mask(mut self, new_value: common::FieldMask) -> AppServicePatchCall<'a, C> {
13905 self._update_mask = Some(new_value);
13906 self
13907 }
13908 /// 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).
13909 ///
13910 /// Sets the *migrate traffic* query property to the given value.
13911 pub fn migrate_traffic(mut self, new_value: bool) -> AppServicePatchCall<'a, C> {
13912 self._migrate_traffic = Some(new_value);
13913 self
13914 }
13915 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13916 /// while executing the actual API request.
13917 ///
13918 /// ````text
13919 /// It should be used to handle progress information, and to implement a certain level of resilience.
13920 /// ````
13921 ///
13922 /// Sets the *delegate* property to the given value.
13923 pub fn delegate(
13924 mut self,
13925 new_value: &'a mut dyn common::Delegate,
13926 ) -> AppServicePatchCall<'a, C> {
13927 self._delegate = Some(new_value);
13928 self
13929 }
13930
13931 /// Set any additional parameter of the query string used in the request.
13932 /// It should be used to set parameters which are not yet available through their own
13933 /// setters.
13934 ///
13935 /// Please note that this method must not be used to set any of the known parameters
13936 /// which have their own setter method. If done anyway, the request will fail.
13937 ///
13938 /// # Additional Parameters
13939 ///
13940 /// * *$.xgafv* (query-string) - V1 error format.
13941 /// * *access_token* (query-string) - OAuth access token.
13942 /// * *alt* (query-string) - Data format for response.
13943 /// * *callback* (query-string) - JSONP
13944 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13945 /// * *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.
13946 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13947 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13948 /// * *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.
13949 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13950 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13951 pub fn param<T>(mut self, name: T, value: T) -> AppServicePatchCall<'a, C>
13952 where
13953 T: AsRef<str>,
13954 {
13955 self._additional_params
13956 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13957 self
13958 }
13959
13960 /// Identifies the authorization scope for the method you are building.
13961 ///
13962 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13963 /// [`Scope::CloudPlatform`].
13964 ///
13965 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13966 /// tokens for more than one scope.
13967 ///
13968 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13969 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13970 /// sufficient, a read-write scope will do as well.
13971 pub fn add_scope<St>(mut self, scope: St) -> AppServicePatchCall<'a, C>
13972 where
13973 St: AsRef<str>,
13974 {
13975 self._scopes.insert(String::from(scope.as_ref()));
13976 self
13977 }
13978 /// Identifies the authorization scope(s) for the method you are building.
13979 ///
13980 /// See [`Self::add_scope()`] for details.
13981 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppServicePatchCall<'a, C>
13982 where
13983 I: IntoIterator<Item = St>,
13984 St: AsRef<str>,
13985 {
13986 self._scopes
13987 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13988 self
13989 }
13990
13991 /// Removes all scopes, and no default scope will be used either.
13992 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13993 /// for details).
13994 pub fn clear_scopes(mut self) -> AppServicePatchCall<'a, C> {
13995 self._scopes.clear();
13996 self
13997 }
13998}
13999
14000/// 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/).
14001///
14002/// A builder for the *create* method supported by a *app* resource.
14003/// It is not used directly, but through a [`AppMethods`] instance.
14004///
14005/// # Example
14006///
14007/// Instantiate a resource method builder
14008///
14009/// ```test_harness,no_run
14010/// # extern crate hyper;
14011/// # extern crate hyper_rustls;
14012/// # extern crate google_appengine1 as appengine1;
14013/// use appengine1::api::Application;
14014/// # async fn dox() {
14015/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14016///
14017/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14019/// # secret,
14020/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14021/// # ).build().await.unwrap();
14022///
14023/// # let client = hyper_util::client::legacy::Client::builder(
14024/// # hyper_util::rt::TokioExecutor::new()
14025/// # )
14026/// # .build(
14027/// # hyper_rustls::HttpsConnectorBuilder::new()
14028/// # .with_native_roots()
14029/// # .unwrap()
14030/// # .https_or_http()
14031/// # .enable_http1()
14032/// # .build()
14033/// # );
14034/// # let mut hub = Appengine::new(client, auth);
14035/// // As the method needs a request, you would usually fill it with the desired information
14036/// // into the respective structure. Some of the parts shown here might not be applicable !
14037/// // Values shown here are possibly random and not representative !
14038/// let mut req = Application::default();
14039///
14040/// // You can configure optional parameters by calling the respective setters at will, and
14041/// // execute the final call using `doit()`.
14042/// // Values shown here are possibly random and not representative !
14043/// let result = hub.apps().create(req)
14044/// .doit().await;
14045/// # }
14046/// ```
14047pub struct AppCreateCall<'a, C>
14048where
14049 C: 'a,
14050{
14051 hub: &'a Appengine<C>,
14052 _request: Application,
14053 _delegate: Option<&'a mut dyn common::Delegate>,
14054 _additional_params: HashMap<String, String>,
14055 _scopes: BTreeSet<String>,
14056}
14057
14058impl<'a, C> common::CallBuilder for AppCreateCall<'a, C> {}
14059
14060impl<'a, C> AppCreateCall<'a, C>
14061where
14062 C: common::Connector,
14063{
14064 /// Perform the operation you have build so far.
14065 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14066 use std::borrow::Cow;
14067 use std::io::{Read, Seek};
14068
14069 use common::{url::Params, ToParts};
14070 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14071
14072 let mut dd = common::DefaultDelegate;
14073 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14074 dlg.begin(common::MethodInfo {
14075 id: "appengine.apps.create",
14076 http_method: hyper::Method::POST,
14077 });
14078
14079 for &field in ["alt"].iter() {
14080 if self._additional_params.contains_key(field) {
14081 dlg.finished(false);
14082 return Err(common::Error::FieldClash(field));
14083 }
14084 }
14085
14086 let mut params = Params::with_capacity(3 + self._additional_params.len());
14087
14088 params.extend(self._additional_params.iter());
14089
14090 params.push("alt", "json");
14091 let mut url = self.hub._base_url.clone() + "v1/apps";
14092 if self._scopes.is_empty() {
14093 self._scopes
14094 .insert(Scope::CloudPlatform.as_ref().to_string());
14095 }
14096
14097 let url = params.parse_with_url(&url);
14098
14099 let mut json_mime_type = mime::APPLICATION_JSON;
14100 let mut request_value_reader = {
14101 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14102 common::remove_json_null_values(&mut value);
14103 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14104 serde_json::to_writer(&mut dst, &value).unwrap();
14105 dst
14106 };
14107 let request_size = request_value_reader
14108 .seek(std::io::SeekFrom::End(0))
14109 .unwrap();
14110 request_value_reader
14111 .seek(std::io::SeekFrom::Start(0))
14112 .unwrap();
14113
14114 loop {
14115 let token = match self
14116 .hub
14117 .auth
14118 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14119 .await
14120 {
14121 Ok(token) => token,
14122 Err(e) => match dlg.token(e) {
14123 Ok(token) => token,
14124 Err(e) => {
14125 dlg.finished(false);
14126 return Err(common::Error::MissingToken(e));
14127 }
14128 },
14129 };
14130 request_value_reader
14131 .seek(std::io::SeekFrom::Start(0))
14132 .unwrap();
14133 let mut req_result = {
14134 let client = &self.hub.client;
14135 dlg.pre_request();
14136 let mut req_builder = hyper::Request::builder()
14137 .method(hyper::Method::POST)
14138 .uri(url.as_str())
14139 .header(USER_AGENT, self.hub._user_agent.clone());
14140
14141 if let Some(token) = token.as_ref() {
14142 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14143 }
14144
14145 let request = req_builder
14146 .header(CONTENT_TYPE, json_mime_type.to_string())
14147 .header(CONTENT_LENGTH, request_size as u64)
14148 .body(common::to_body(
14149 request_value_reader.get_ref().clone().into(),
14150 ));
14151
14152 client.request(request.unwrap()).await
14153 };
14154
14155 match req_result {
14156 Err(err) => {
14157 if let common::Retry::After(d) = dlg.http_error(&err) {
14158 sleep(d).await;
14159 continue;
14160 }
14161 dlg.finished(false);
14162 return Err(common::Error::HttpError(err));
14163 }
14164 Ok(res) => {
14165 let (mut parts, body) = res.into_parts();
14166 let mut body = common::Body::new(body);
14167 if !parts.status.is_success() {
14168 let bytes = common::to_bytes(body).await.unwrap_or_default();
14169 let error = serde_json::from_str(&common::to_string(&bytes));
14170 let response = common::to_response(parts, bytes.into());
14171
14172 if let common::Retry::After(d) =
14173 dlg.http_failure(&response, error.as_ref().ok())
14174 {
14175 sleep(d).await;
14176 continue;
14177 }
14178
14179 dlg.finished(false);
14180
14181 return Err(match error {
14182 Ok(value) => common::Error::BadRequest(value),
14183 _ => common::Error::Failure(response),
14184 });
14185 }
14186 let response = {
14187 let bytes = common::to_bytes(body).await.unwrap_or_default();
14188 let encoded = common::to_string(&bytes);
14189 match serde_json::from_str(&encoded) {
14190 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14191 Err(error) => {
14192 dlg.response_json_decode_error(&encoded, &error);
14193 return Err(common::Error::JsonDecodeError(
14194 encoded.to_string(),
14195 error,
14196 ));
14197 }
14198 }
14199 };
14200
14201 dlg.finished(true);
14202 return Ok(response);
14203 }
14204 }
14205 }
14206 }
14207
14208 ///
14209 /// Sets the *request* property to the given value.
14210 ///
14211 /// Even though the property as already been set when instantiating this call,
14212 /// we provide this method for API completeness.
14213 pub fn request(mut self, new_value: Application) -> AppCreateCall<'a, C> {
14214 self._request = new_value;
14215 self
14216 }
14217 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14218 /// while executing the actual API request.
14219 ///
14220 /// ````text
14221 /// It should be used to handle progress information, and to implement a certain level of resilience.
14222 /// ````
14223 ///
14224 /// Sets the *delegate* property to the given value.
14225 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppCreateCall<'a, C> {
14226 self._delegate = Some(new_value);
14227 self
14228 }
14229
14230 /// Set any additional parameter of the query string used in the request.
14231 /// It should be used to set parameters which are not yet available through their own
14232 /// setters.
14233 ///
14234 /// Please note that this method must not be used to set any of the known parameters
14235 /// which have their own setter method. If done anyway, the request will fail.
14236 ///
14237 /// # Additional Parameters
14238 ///
14239 /// * *$.xgafv* (query-string) - V1 error format.
14240 /// * *access_token* (query-string) - OAuth access token.
14241 /// * *alt* (query-string) - Data format for response.
14242 /// * *callback* (query-string) - JSONP
14243 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14244 /// * *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.
14245 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14246 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14247 /// * *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.
14248 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14249 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14250 pub fn param<T>(mut self, name: T, value: T) -> AppCreateCall<'a, C>
14251 where
14252 T: AsRef<str>,
14253 {
14254 self._additional_params
14255 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14256 self
14257 }
14258
14259 /// Identifies the authorization scope for the method you are building.
14260 ///
14261 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14262 /// [`Scope::CloudPlatform`].
14263 ///
14264 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14265 /// tokens for more than one scope.
14266 ///
14267 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14268 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14269 /// sufficient, a read-write scope will do as well.
14270 pub fn add_scope<St>(mut self, scope: St) -> AppCreateCall<'a, C>
14271 where
14272 St: AsRef<str>,
14273 {
14274 self._scopes.insert(String::from(scope.as_ref()));
14275 self
14276 }
14277 /// Identifies the authorization scope(s) for the method you are building.
14278 ///
14279 /// See [`Self::add_scope()`] for details.
14280 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppCreateCall<'a, C>
14281 where
14282 I: IntoIterator<Item = St>,
14283 St: AsRef<str>,
14284 {
14285 self._scopes
14286 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14287 self
14288 }
14289
14290 /// Removes all scopes, and no default scope will be used either.
14291 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14292 /// for details).
14293 pub fn clear_scopes(mut self) -> AppCreateCall<'a, C> {
14294 self._scopes.clear();
14295 self
14296 }
14297}
14298
14299/// Gets information about an application.
14300///
14301/// A builder for the *get* method supported by a *app* resource.
14302/// It is not used directly, but through a [`AppMethods`] instance.
14303///
14304/// # Example
14305///
14306/// Instantiate a resource method builder
14307///
14308/// ```test_harness,no_run
14309/// # extern crate hyper;
14310/// # extern crate hyper_rustls;
14311/// # extern crate google_appengine1 as appengine1;
14312/// # async fn dox() {
14313/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14314///
14315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14317/// # secret,
14318/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14319/// # ).build().await.unwrap();
14320///
14321/// # let client = hyper_util::client::legacy::Client::builder(
14322/// # hyper_util::rt::TokioExecutor::new()
14323/// # )
14324/// # .build(
14325/// # hyper_rustls::HttpsConnectorBuilder::new()
14326/// # .with_native_roots()
14327/// # .unwrap()
14328/// # .https_or_http()
14329/// # .enable_http1()
14330/// # .build()
14331/// # );
14332/// # let mut hub = Appengine::new(client, auth);
14333/// // You can configure optional parameters by calling the respective setters at will, and
14334/// // execute the final call using `doit()`.
14335/// // Values shown here are possibly random and not representative !
14336/// let result = hub.apps().get("appsId")
14337/// .include_extra_data("ipsum")
14338/// .doit().await;
14339/// # }
14340/// ```
14341pub struct AppGetCall<'a, C>
14342where
14343 C: 'a,
14344{
14345 hub: &'a Appengine<C>,
14346 _apps_id: String,
14347 _include_extra_data: Option<String>,
14348 _delegate: Option<&'a mut dyn common::Delegate>,
14349 _additional_params: HashMap<String, String>,
14350 _scopes: BTreeSet<String>,
14351}
14352
14353impl<'a, C> common::CallBuilder for AppGetCall<'a, C> {}
14354
14355impl<'a, C> AppGetCall<'a, C>
14356where
14357 C: common::Connector,
14358{
14359 /// Perform the operation you have build so far.
14360 pub async fn doit(mut self) -> common::Result<(common::Response, Application)> {
14361 use std::borrow::Cow;
14362 use std::io::{Read, Seek};
14363
14364 use common::{url::Params, ToParts};
14365 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14366
14367 let mut dd = common::DefaultDelegate;
14368 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14369 dlg.begin(common::MethodInfo {
14370 id: "appengine.apps.get",
14371 http_method: hyper::Method::GET,
14372 });
14373
14374 for &field in ["alt", "appsId", "includeExtraData"].iter() {
14375 if self._additional_params.contains_key(field) {
14376 dlg.finished(false);
14377 return Err(common::Error::FieldClash(field));
14378 }
14379 }
14380
14381 let mut params = Params::with_capacity(4 + self._additional_params.len());
14382 params.push("appsId", self._apps_id);
14383 if let Some(value) = self._include_extra_data.as_ref() {
14384 params.push("includeExtraData", value);
14385 }
14386
14387 params.extend(self._additional_params.iter());
14388
14389 params.push("alt", "json");
14390 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}";
14391 if self._scopes.is_empty() {
14392 self._scopes.insert(Scope::Admin.as_ref().to_string());
14393 }
14394
14395 #[allow(clippy::single_element_loop)]
14396 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
14397 url = params.uri_replacement(url, param_name, find_this, false);
14398 }
14399 {
14400 let to_remove = ["appsId"];
14401 params.remove_params(&to_remove);
14402 }
14403
14404 let url = params.parse_with_url(&url);
14405
14406 loop {
14407 let token = match self
14408 .hub
14409 .auth
14410 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14411 .await
14412 {
14413 Ok(token) => token,
14414 Err(e) => match dlg.token(e) {
14415 Ok(token) => token,
14416 Err(e) => {
14417 dlg.finished(false);
14418 return Err(common::Error::MissingToken(e));
14419 }
14420 },
14421 };
14422 let mut req_result = {
14423 let client = &self.hub.client;
14424 dlg.pre_request();
14425 let mut req_builder = hyper::Request::builder()
14426 .method(hyper::Method::GET)
14427 .uri(url.as_str())
14428 .header(USER_AGENT, self.hub._user_agent.clone());
14429
14430 if let Some(token) = token.as_ref() {
14431 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14432 }
14433
14434 let request = req_builder
14435 .header(CONTENT_LENGTH, 0_u64)
14436 .body(common::to_body::<String>(None));
14437
14438 client.request(request.unwrap()).await
14439 };
14440
14441 match req_result {
14442 Err(err) => {
14443 if let common::Retry::After(d) = dlg.http_error(&err) {
14444 sleep(d).await;
14445 continue;
14446 }
14447 dlg.finished(false);
14448 return Err(common::Error::HttpError(err));
14449 }
14450 Ok(res) => {
14451 let (mut parts, body) = res.into_parts();
14452 let mut body = common::Body::new(body);
14453 if !parts.status.is_success() {
14454 let bytes = common::to_bytes(body).await.unwrap_or_default();
14455 let error = serde_json::from_str(&common::to_string(&bytes));
14456 let response = common::to_response(parts, bytes.into());
14457
14458 if let common::Retry::After(d) =
14459 dlg.http_failure(&response, error.as_ref().ok())
14460 {
14461 sleep(d).await;
14462 continue;
14463 }
14464
14465 dlg.finished(false);
14466
14467 return Err(match error {
14468 Ok(value) => common::Error::BadRequest(value),
14469 _ => common::Error::Failure(response),
14470 });
14471 }
14472 let response = {
14473 let bytes = common::to_bytes(body).await.unwrap_or_default();
14474 let encoded = common::to_string(&bytes);
14475 match serde_json::from_str(&encoded) {
14476 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14477 Err(error) => {
14478 dlg.response_json_decode_error(&encoded, &error);
14479 return Err(common::Error::JsonDecodeError(
14480 encoded.to_string(),
14481 error,
14482 ));
14483 }
14484 }
14485 };
14486
14487 dlg.finished(true);
14488 return Ok(response);
14489 }
14490 }
14491 }
14492 }
14493
14494 /// Part of `name`. Name of the Application resource to get. Example: apps/myapp.
14495 ///
14496 /// Sets the *apps id* path property to the given value.
14497 ///
14498 /// Even though the property as already been set when instantiating this call,
14499 /// we provide this method for API completeness.
14500 pub fn apps_id(mut self, new_value: &str) -> AppGetCall<'a, C> {
14501 self._apps_id = new_value.to_string();
14502 self
14503 }
14504 /// Options to include extra data
14505 ///
14506 /// Sets the *include extra data* query property to the given value.
14507 pub fn include_extra_data(mut self, new_value: &str) -> AppGetCall<'a, C> {
14508 self._include_extra_data = Some(new_value.to_string());
14509 self
14510 }
14511 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14512 /// while executing the actual API request.
14513 ///
14514 /// ````text
14515 /// It should be used to handle progress information, and to implement a certain level of resilience.
14516 /// ````
14517 ///
14518 /// Sets the *delegate* property to the given value.
14519 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppGetCall<'a, C> {
14520 self._delegate = Some(new_value);
14521 self
14522 }
14523
14524 /// Set any additional parameter of the query string used in the request.
14525 /// It should be used to set parameters which are not yet available through their own
14526 /// setters.
14527 ///
14528 /// Please note that this method must not be used to set any of the known parameters
14529 /// which have their own setter method. If done anyway, the request will fail.
14530 ///
14531 /// # Additional Parameters
14532 ///
14533 /// * *$.xgafv* (query-string) - V1 error format.
14534 /// * *access_token* (query-string) - OAuth access token.
14535 /// * *alt* (query-string) - Data format for response.
14536 /// * *callback* (query-string) - JSONP
14537 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14538 /// * *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.
14539 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14540 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14541 /// * *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.
14542 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14543 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14544 pub fn param<T>(mut self, name: T, value: T) -> AppGetCall<'a, C>
14545 where
14546 T: AsRef<str>,
14547 {
14548 self._additional_params
14549 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14550 self
14551 }
14552
14553 /// Identifies the authorization scope for the method you are building.
14554 ///
14555 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14556 /// [`Scope::Admin`].
14557 ///
14558 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14559 /// tokens for more than one scope.
14560 ///
14561 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14562 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14563 /// sufficient, a read-write scope will do as well.
14564 pub fn add_scope<St>(mut self, scope: St) -> AppGetCall<'a, C>
14565 where
14566 St: AsRef<str>,
14567 {
14568 self._scopes.insert(String::from(scope.as_ref()));
14569 self
14570 }
14571 /// Identifies the authorization scope(s) for the method you are building.
14572 ///
14573 /// See [`Self::add_scope()`] for details.
14574 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppGetCall<'a, C>
14575 where
14576 I: IntoIterator<Item = St>,
14577 St: AsRef<str>,
14578 {
14579 self._scopes
14580 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14581 self
14582 }
14583
14584 /// Removes all scopes, and no default scope will be used either.
14585 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14586 /// for details).
14587 pub fn clear_scopes(mut self) -> AppGetCall<'a, C> {
14588 self._scopes.clear();
14589 self
14590 }
14591}
14592
14593/// Lists all the available runtimes for the application.
14594///
14595/// A builder for the *listRuntimes* method supported by a *app* resource.
14596/// It is not used directly, but through a [`AppMethods`] instance.
14597///
14598/// # Example
14599///
14600/// Instantiate a resource method builder
14601///
14602/// ```test_harness,no_run
14603/// # extern crate hyper;
14604/// # extern crate hyper_rustls;
14605/// # extern crate google_appengine1 as appengine1;
14606/// # async fn dox() {
14607/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14608///
14609/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14610/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14611/// # secret,
14612/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14613/// # ).build().await.unwrap();
14614///
14615/// # let client = hyper_util::client::legacy::Client::builder(
14616/// # hyper_util::rt::TokioExecutor::new()
14617/// # )
14618/// # .build(
14619/// # hyper_rustls::HttpsConnectorBuilder::new()
14620/// # .with_native_roots()
14621/// # .unwrap()
14622/// # .https_or_http()
14623/// # .enable_http1()
14624/// # .build()
14625/// # );
14626/// # let mut hub = Appengine::new(client, auth);
14627/// // You can configure optional parameters by calling the respective setters at will, and
14628/// // execute the final call using `doit()`.
14629/// // Values shown here are possibly random and not representative !
14630/// let result = hub.apps().list_runtimes("appsId")
14631/// .environment("sanctus")
14632/// .doit().await;
14633/// # }
14634/// ```
14635pub struct AppListRuntimeCall<'a, C>
14636where
14637 C: 'a,
14638{
14639 hub: &'a Appengine<C>,
14640 _apps_id: String,
14641 _environment: Option<String>,
14642 _delegate: Option<&'a mut dyn common::Delegate>,
14643 _additional_params: HashMap<String, String>,
14644 _scopes: BTreeSet<String>,
14645}
14646
14647impl<'a, C> common::CallBuilder for AppListRuntimeCall<'a, C> {}
14648
14649impl<'a, C> AppListRuntimeCall<'a, C>
14650where
14651 C: common::Connector,
14652{
14653 /// Perform the operation you have build so far.
14654 pub async fn doit(mut self) -> common::Result<(common::Response, ListRuntimesResponse)> {
14655 use std::borrow::Cow;
14656 use std::io::{Read, Seek};
14657
14658 use common::{url::Params, ToParts};
14659 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14660
14661 let mut dd = common::DefaultDelegate;
14662 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14663 dlg.begin(common::MethodInfo {
14664 id: "appengine.apps.listRuntimes",
14665 http_method: hyper::Method::GET,
14666 });
14667
14668 for &field in ["alt", "appsId", "environment"].iter() {
14669 if self._additional_params.contains_key(field) {
14670 dlg.finished(false);
14671 return Err(common::Error::FieldClash(field));
14672 }
14673 }
14674
14675 let mut params = Params::with_capacity(4 + self._additional_params.len());
14676 params.push("appsId", self._apps_id);
14677 if let Some(value) = self._environment.as_ref() {
14678 params.push("environment", value);
14679 }
14680
14681 params.extend(self._additional_params.iter());
14682
14683 params.push("alt", "json");
14684 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}:listRuntimes";
14685 if self._scopes.is_empty() {
14686 self._scopes.insert(Scope::Admin.as_ref().to_string());
14687 }
14688
14689 #[allow(clippy::single_element_loop)]
14690 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
14691 url = params.uri_replacement(url, param_name, find_this, false);
14692 }
14693 {
14694 let to_remove = ["appsId"];
14695 params.remove_params(&to_remove);
14696 }
14697
14698 let url = params.parse_with_url(&url);
14699
14700 loop {
14701 let token = match self
14702 .hub
14703 .auth
14704 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14705 .await
14706 {
14707 Ok(token) => token,
14708 Err(e) => match dlg.token(e) {
14709 Ok(token) => token,
14710 Err(e) => {
14711 dlg.finished(false);
14712 return Err(common::Error::MissingToken(e));
14713 }
14714 },
14715 };
14716 let mut req_result = {
14717 let client = &self.hub.client;
14718 dlg.pre_request();
14719 let mut req_builder = hyper::Request::builder()
14720 .method(hyper::Method::GET)
14721 .uri(url.as_str())
14722 .header(USER_AGENT, self.hub._user_agent.clone());
14723
14724 if let Some(token) = token.as_ref() {
14725 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14726 }
14727
14728 let request = req_builder
14729 .header(CONTENT_LENGTH, 0_u64)
14730 .body(common::to_body::<String>(None));
14731
14732 client.request(request.unwrap()).await
14733 };
14734
14735 match req_result {
14736 Err(err) => {
14737 if let common::Retry::After(d) = dlg.http_error(&err) {
14738 sleep(d).await;
14739 continue;
14740 }
14741 dlg.finished(false);
14742 return Err(common::Error::HttpError(err));
14743 }
14744 Ok(res) => {
14745 let (mut parts, body) = res.into_parts();
14746 let mut body = common::Body::new(body);
14747 if !parts.status.is_success() {
14748 let bytes = common::to_bytes(body).await.unwrap_or_default();
14749 let error = serde_json::from_str(&common::to_string(&bytes));
14750 let response = common::to_response(parts, bytes.into());
14751
14752 if let common::Retry::After(d) =
14753 dlg.http_failure(&response, error.as_ref().ok())
14754 {
14755 sleep(d).await;
14756 continue;
14757 }
14758
14759 dlg.finished(false);
14760
14761 return Err(match error {
14762 Ok(value) => common::Error::BadRequest(value),
14763 _ => common::Error::Failure(response),
14764 });
14765 }
14766 let response = {
14767 let bytes = common::to_bytes(body).await.unwrap_or_default();
14768 let encoded = common::to_string(&bytes);
14769 match serde_json::from_str(&encoded) {
14770 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14771 Err(error) => {
14772 dlg.response_json_decode_error(&encoded, &error);
14773 return Err(common::Error::JsonDecodeError(
14774 encoded.to_string(),
14775 error,
14776 ));
14777 }
14778 }
14779 };
14780
14781 dlg.finished(true);
14782 return Ok(response);
14783 }
14784 }
14785 }
14786 }
14787
14788 /// Part of `parent`. Required. Name of the parent Application resource. Example: apps/myapp.
14789 ///
14790 /// Sets the *apps id* path property to the given value.
14791 ///
14792 /// Even though the property as already been set when instantiating this call,
14793 /// we provide this method for API completeness.
14794 pub fn apps_id(mut self, new_value: &str) -> AppListRuntimeCall<'a, C> {
14795 self._apps_id = new_value.to_string();
14796 self
14797 }
14798 /// Optional. The environment of the Application.
14799 ///
14800 /// Sets the *environment* query property to the given value.
14801 pub fn environment(mut self, new_value: &str) -> AppListRuntimeCall<'a, C> {
14802 self._environment = Some(new_value.to_string());
14803 self
14804 }
14805 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14806 /// while executing the actual API request.
14807 ///
14808 /// ````text
14809 /// It should be used to handle progress information, and to implement a certain level of resilience.
14810 /// ````
14811 ///
14812 /// Sets the *delegate* property to the given value.
14813 pub fn delegate(
14814 mut self,
14815 new_value: &'a mut dyn common::Delegate,
14816 ) -> AppListRuntimeCall<'a, C> {
14817 self._delegate = Some(new_value);
14818 self
14819 }
14820
14821 /// Set any additional parameter of the query string used in the request.
14822 /// It should be used to set parameters which are not yet available through their own
14823 /// setters.
14824 ///
14825 /// Please note that this method must not be used to set any of the known parameters
14826 /// which have their own setter method. If done anyway, the request will fail.
14827 ///
14828 /// # Additional Parameters
14829 ///
14830 /// * *$.xgafv* (query-string) - V1 error format.
14831 /// * *access_token* (query-string) - OAuth access token.
14832 /// * *alt* (query-string) - Data format for response.
14833 /// * *callback* (query-string) - JSONP
14834 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14835 /// * *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.
14836 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14837 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14838 /// * *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.
14839 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14840 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14841 pub fn param<T>(mut self, name: T, value: T) -> AppListRuntimeCall<'a, C>
14842 where
14843 T: AsRef<str>,
14844 {
14845 self._additional_params
14846 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14847 self
14848 }
14849
14850 /// Identifies the authorization scope for the method you are building.
14851 ///
14852 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14853 /// [`Scope::Admin`].
14854 ///
14855 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14856 /// tokens for more than one scope.
14857 ///
14858 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14859 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14860 /// sufficient, a read-write scope will do as well.
14861 pub fn add_scope<St>(mut self, scope: St) -> AppListRuntimeCall<'a, C>
14862 where
14863 St: AsRef<str>,
14864 {
14865 self._scopes.insert(String::from(scope.as_ref()));
14866 self
14867 }
14868 /// Identifies the authorization scope(s) for the method you are building.
14869 ///
14870 /// See [`Self::add_scope()`] for details.
14871 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppListRuntimeCall<'a, C>
14872 where
14873 I: IntoIterator<Item = St>,
14874 St: AsRef<str>,
14875 {
14876 self._scopes
14877 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14878 self
14879 }
14880
14881 /// Removes all scopes, and no default scope will be used either.
14882 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14883 /// for details).
14884 pub fn clear_scopes(mut self) -> AppListRuntimeCall<'a, C> {
14885 self._scopes.clear();
14886 self
14887 }
14888}
14889
14890/// 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.
14891///
14892/// A builder for the *patch* method supported by a *app* resource.
14893/// It is not used directly, but through a [`AppMethods`] instance.
14894///
14895/// # Example
14896///
14897/// Instantiate a resource method builder
14898///
14899/// ```test_harness,no_run
14900/// # extern crate hyper;
14901/// # extern crate hyper_rustls;
14902/// # extern crate google_appengine1 as appengine1;
14903/// use appengine1::api::Application;
14904/// # async fn dox() {
14905/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14906///
14907/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14908/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14909/// # secret,
14910/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14911/// # ).build().await.unwrap();
14912///
14913/// # let client = hyper_util::client::legacy::Client::builder(
14914/// # hyper_util::rt::TokioExecutor::new()
14915/// # )
14916/// # .build(
14917/// # hyper_rustls::HttpsConnectorBuilder::new()
14918/// # .with_native_roots()
14919/// # .unwrap()
14920/// # .https_or_http()
14921/// # .enable_http1()
14922/// # .build()
14923/// # );
14924/// # let mut hub = Appengine::new(client, auth);
14925/// // As the method needs a request, you would usually fill it with the desired information
14926/// // into the respective structure. Some of the parts shown here might not be applicable !
14927/// // Values shown here are possibly random and not representative !
14928/// let mut req = Application::default();
14929///
14930/// // You can configure optional parameters by calling the respective setters at will, and
14931/// // execute the final call using `doit()`.
14932/// // Values shown here are possibly random and not representative !
14933/// let result = hub.apps().patch(req, "appsId")
14934/// .update_mask(FieldMask::new::<&str>(&[]))
14935/// .doit().await;
14936/// # }
14937/// ```
14938pub struct AppPatchCall<'a, C>
14939where
14940 C: 'a,
14941{
14942 hub: &'a Appengine<C>,
14943 _request: Application,
14944 _apps_id: String,
14945 _update_mask: Option<common::FieldMask>,
14946 _delegate: Option<&'a mut dyn common::Delegate>,
14947 _additional_params: HashMap<String, String>,
14948 _scopes: BTreeSet<String>,
14949}
14950
14951impl<'a, C> common::CallBuilder for AppPatchCall<'a, C> {}
14952
14953impl<'a, C> AppPatchCall<'a, C>
14954where
14955 C: common::Connector,
14956{
14957 /// Perform the operation you have build so far.
14958 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14959 use std::borrow::Cow;
14960 use std::io::{Read, Seek};
14961
14962 use common::{url::Params, ToParts};
14963 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14964
14965 let mut dd = common::DefaultDelegate;
14966 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14967 dlg.begin(common::MethodInfo {
14968 id: "appengine.apps.patch",
14969 http_method: hyper::Method::PATCH,
14970 });
14971
14972 for &field in ["alt", "appsId", "updateMask"].iter() {
14973 if self._additional_params.contains_key(field) {
14974 dlg.finished(false);
14975 return Err(common::Error::FieldClash(field));
14976 }
14977 }
14978
14979 let mut params = Params::with_capacity(5 + self._additional_params.len());
14980 params.push("appsId", self._apps_id);
14981 if let Some(value) = self._update_mask.as_ref() {
14982 params.push("updateMask", value.to_string());
14983 }
14984
14985 params.extend(self._additional_params.iter());
14986
14987 params.push("alt", "json");
14988 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}";
14989 if self._scopes.is_empty() {
14990 self._scopes
14991 .insert(Scope::CloudPlatform.as_ref().to_string());
14992 }
14993
14994 #[allow(clippy::single_element_loop)]
14995 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
14996 url = params.uri_replacement(url, param_name, find_this, false);
14997 }
14998 {
14999 let to_remove = ["appsId"];
15000 params.remove_params(&to_remove);
15001 }
15002
15003 let url = params.parse_with_url(&url);
15004
15005 let mut json_mime_type = mime::APPLICATION_JSON;
15006 let mut request_value_reader = {
15007 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15008 common::remove_json_null_values(&mut value);
15009 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15010 serde_json::to_writer(&mut dst, &value).unwrap();
15011 dst
15012 };
15013 let request_size = request_value_reader
15014 .seek(std::io::SeekFrom::End(0))
15015 .unwrap();
15016 request_value_reader
15017 .seek(std::io::SeekFrom::Start(0))
15018 .unwrap();
15019
15020 loop {
15021 let token = match self
15022 .hub
15023 .auth
15024 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15025 .await
15026 {
15027 Ok(token) => token,
15028 Err(e) => match dlg.token(e) {
15029 Ok(token) => token,
15030 Err(e) => {
15031 dlg.finished(false);
15032 return Err(common::Error::MissingToken(e));
15033 }
15034 },
15035 };
15036 request_value_reader
15037 .seek(std::io::SeekFrom::Start(0))
15038 .unwrap();
15039 let mut req_result = {
15040 let client = &self.hub.client;
15041 dlg.pre_request();
15042 let mut req_builder = hyper::Request::builder()
15043 .method(hyper::Method::PATCH)
15044 .uri(url.as_str())
15045 .header(USER_AGENT, self.hub._user_agent.clone());
15046
15047 if let Some(token) = token.as_ref() {
15048 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15049 }
15050
15051 let request = req_builder
15052 .header(CONTENT_TYPE, json_mime_type.to_string())
15053 .header(CONTENT_LENGTH, request_size as u64)
15054 .body(common::to_body(
15055 request_value_reader.get_ref().clone().into(),
15056 ));
15057
15058 client.request(request.unwrap()).await
15059 };
15060
15061 match req_result {
15062 Err(err) => {
15063 if let common::Retry::After(d) = dlg.http_error(&err) {
15064 sleep(d).await;
15065 continue;
15066 }
15067 dlg.finished(false);
15068 return Err(common::Error::HttpError(err));
15069 }
15070 Ok(res) => {
15071 let (mut parts, body) = res.into_parts();
15072 let mut body = common::Body::new(body);
15073 if !parts.status.is_success() {
15074 let bytes = common::to_bytes(body).await.unwrap_or_default();
15075 let error = serde_json::from_str(&common::to_string(&bytes));
15076 let response = common::to_response(parts, bytes.into());
15077
15078 if let common::Retry::After(d) =
15079 dlg.http_failure(&response, error.as_ref().ok())
15080 {
15081 sleep(d).await;
15082 continue;
15083 }
15084
15085 dlg.finished(false);
15086
15087 return Err(match error {
15088 Ok(value) => common::Error::BadRequest(value),
15089 _ => common::Error::Failure(response),
15090 });
15091 }
15092 let response = {
15093 let bytes = common::to_bytes(body).await.unwrap_or_default();
15094 let encoded = common::to_string(&bytes);
15095 match serde_json::from_str(&encoded) {
15096 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15097 Err(error) => {
15098 dlg.response_json_decode_error(&encoded, &error);
15099 return Err(common::Error::JsonDecodeError(
15100 encoded.to_string(),
15101 error,
15102 ));
15103 }
15104 }
15105 };
15106
15107 dlg.finished(true);
15108 return Ok(response);
15109 }
15110 }
15111 }
15112 }
15113
15114 ///
15115 /// Sets the *request* property to the given value.
15116 ///
15117 /// Even though the property as already been set when instantiating this call,
15118 /// we provide this method for API completeness.
15119 pub fn request(mut self, new_value: Application) -> AppPatchCall<'a, C> {
15120 self._request = new_value;
15121 self
15122 }
15123 /// Part of `name`. Name of the Application resource to update. Example: apps/myapp.
15124 ///
15125 /// Sets the *apps id* path property to the given value.
15126 ///
15127 /// Even though the property as already been set when instantiating this call,
15128 /// we provide this method for API completeness.
15129 pub fn apps_id(mut self, new_value: &str) -> AppPatchCall<'a, C> {
15130 self._apps_id = new_value.to_string();
15131 self
15132 }
15133 /// Required. Standard field mask for the set of fields to be updated.
15134 ///
15135 /// Sets the *update mask* query property to the given value.
15136 pub fn update_mask(mut self, new_value: common::FieldMask) -> AppPatchCall<'a, C> {
15137 self._update_mask = Some(new_value);
15138 self
15139 }
15140 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15141 /// while executing the actual API request.
15142 ///
15143 /// ````text
15144 /// It should be used to handle progress information, and to implement a certain level of resilience.
15145 /// ````
15146 ///
15147 /// Sets the *delegate* property to the given value.
15148 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppPatchCall<'a, C> {
15149 self._delegate = Some(new_value);
15150 self
15151 }
15152
15153 /// Set any additional parameter of the query string used in the request.
15154 /// It should be used to set parameters which are not yet available through their own
15155 /// setters.
15156 ///
15157 /// Please note that this method must not be used to set any of the known parameters
15158 /// which have their own setter method. If done anyway, the request will fail.
15159 ///
15160 /// # Additional Parameters
15161 ///
15162 /// * *$.xgafv* (query-string) - V1 error format.
15163 /// * *access_token* (query-string) - OAuth access token.
15164 /// * *alt* (query-string) - Data format for response.
15165 /// * *callback* (query-string) - JSONP
15166 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15167 /// * *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.
15168 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15169 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15170 /// * *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.
15171 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15172 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15173 pub fn param<T>(mut self, name: T, value: T) -> AppPatchCall<'a, C>
15174 where
15175 T: AsRef<str>,
15176 {
15177 self._additional_params
15178 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15179 self
15180 }
15181
15182 /// Identifies the authorization scope for the method you are building.
15183 ///
15184 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15185 /// [`Scope::CloudPlatform`].
15186 ///
15187 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15188 /// tokens for more than one scope.
15189 ///
15190 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15191 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15192 /// sufficient, a read-write scope will do as well.
15193 pub fn add_scope<St>(mut self, scope: St) -> AppPatchCall<'a, C>
15194 where
15195 St: AsRef<str>,
15196 {
15197 self._scopes.insert(String::from(scope.as_ref()));
15198 self
15199 }
15200 /// Identifies the authorization scope(s) for the method you are building.
15201 ///
15202 /// See [`Self::add_scope()`] for details.
15203 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppPatchCall<'a, C>
15204 where
15205 I: IntoIterator<Item = St>,
15206 St: AsRef<str>,
15207 {
15208 self._scopes
15209 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15210 self
15211 }
15212
15213 /// Removes all scopes, and no default scope will be used either.
15214 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15215 /// for details).
15216 pub fn clear_scopes(mut self) -> AppPatchCall<'a, C> {
15217 self._scopes.clear();
15218 self
15219 }
15220}
15221
15222/// 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.
15223///
15224/// A builder for the *repair* method supported by a *app* resource.
15225/// It is not used directly, but through a [`AppMethods`] instance.
15226///
15227/// # Example
15228///
15229/// Instantiate a resource method builder
15230///
15231/// ```test_harness,no_run
15232/// # extern crate hyper;
15233/// # extern crate hyper_rustls;
15234/// # extern crate google_appengine1 as appengine1;
15235/// use appengine1::api::RepairApplicationRequest;
15236/// # async fn dox() {
15237/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15238///
15239/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15240/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15241/// # secret,
15242/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15243/// # ).build().await.unwrap();
15244///
15245/// # let client = hyper_util::client::legacy::Client::builder(
15246/// # hyper_util::rt::TokioExecutor::new()
15247/// # )
15248/// # .build(
15249/// # hyper_rustls::HttpsConnectorBuilder::new()
15250/// # .with_native_roots()
15251/// # .unwrap()
15252/// # .https_or_http()
15253/// # .enable_http1()
15254/// # .build()
15255/// # );
15256/// # let mut hub = Appengine::new(client, auth);
15257/// // As the method needs a request, you would usually fill it with the desired information
15258/// // into the respective structure. Some of the parts shown here might not be applicable !
15259/// // Values shown here are possibly random and not representative !
15260/// let mut req = RepairApplicationRequest::default();
15261///
15262/// // You can configure optional parameters by calling the respective setters at will, and
15263/// // execute the final call using `doit()`.
15264/// // Values shown here are possibly random and not representative !
15265/// let result = hub.apps().repair(req, "appsId")
15266/// .doit().await;
15267/// # }
15268/// ```
15269pub struct AppRepairCall<'a, C>
15270where
15271 C: 'a,
15272{
15273 hub: &'a Appengine<C>,
15274 _request: RepairApplicationRequest,
15275 _apps_id: String,
15276 _delegate: Option<&'a mut dyn common::Delegate>,
15277 _additional_params: HashMap<String, String>,
15278 _scopes: BTreeSet<String>,
15279}
15280
15281impl<'a, C> common::CallBuilder for AppRepairCall<'a, C> {}
15282
15283impl<'a, C> AppRepairCall<'a, C>
15284where
15285 C: common::Connector,
15286{
15287 /// Perform the operation you have build so far.
15288 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15289 use std::borrow::Cow;
15290 use std::io::{Read, Seek};
15291
15292 use common::{url::Params, ToParts};
15293 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15294
15295 let mut dd = common::DefaultDelegate;
15296 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15297 dlg.begin(common::MethodInfo {
15298 id: "appengine.apps.repair",
15299 http_method: hyper::Method::POST,
15300 });
15301
15302 for &field in ["alt", "appsId"].iter() {
15303 if self._additional_params.contains_key(field) {
15304 dlg.finished(false);
15305 return Err(common::Error::FieldClash(field));
15306 }
15307 }
15308
15309 let mut params = Params::with_capacity(4 + self._additional_params.len());
15310 params.push("appsId", self._apps_id);
15311
15312 params.extend(self._additional_params.iter());
15313
15314 params.push("alt", "json");
15315 let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}:repair";
15316 if self._scopes.is_empty() {
15317 self._scopes
15318 .insert(Scope::CloudPlatform.as_ref().to_string());
15319 }
15320
15321 #[allow(clippy::single_element_loop)]
15322 for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
15323 url = params.uri_replacement(url, param_name, find_this, false);
15324 }
15325 {
15326 let to_remove = ["appsId"];
15327 params.remove_params(&to_remove);
15328 }
15329
15330 let url = params.parse_with_url(&url);
15331
15332 let mut json_mime_type = mime::APPLICATION_JSON;
15333 let mut request_value_reader = {
15334 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15335 common::remove_json_null_values(&mut value);
15336 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15337 serde_json::to_writer(&mut dst, &value).unwrap();
15338 dst
15339 };
15340 let request_size = request_value_reader
15341 .seek(std::io::SeekFrom::End(0))
15342 .unwrap();
15343 request_value_reader
15344 .seek(std::io::SeekFrom::Start(0))
15345 .unwrap();
15346
15347 loop {
15348 let token = match self
15349 .hub
15350 .auth
15351 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15352 .await
15353 {
15354 Ok(token) => token,
15355 Err(e) => match dlg.token(e) {
15356 Ok(token) => token,
15357 Err(e) => {
15358 dlg.finished(false);
15359 return Err(common::Error::MissingToken(e));
15360 }
15361 },
15362 };
15363 request_value_reader
15364 .seek(std::io::SeekFrom::Start(0))
15365 .unwrap();
15366 let mut req_result = {
15367 let client = &self.hub.client;
15368 dlg.pre_request();
15369 let mut req_builder = hyper::Request::builder()
15370 .method(hyper::Method::POST)
15371 .uri(url.as_str())
15372 .header(USER_AGENT, self.hub._user_agent.clone());
15373
15374 if let Some(token) = token.as_ref() {
15375 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15376 }
15377
15378 let request = req_builder
15379 .header(CONTENT_TYPE, json_mime_type.to_string())
15380 .header(CONTENT_LENGTH, request_size as u64)
15381 .body(common::to_body(
15382 request_value_reader.get_ref().clone().into(),
15383 ));
15384
15385 client.request(request.unwrap()).await
15386 };
15387
15388 match req_result {
15389 Err(err) => {
15390 if let common::Retry::After(d) = dlg.http_error(&err) {
15391 sleep(d).await;
15392 continue;
15393 }
15394 dlg.finished(false);
15395 return Err(common::Error::HttpError(err));
15396 }
15397 Ok(res) => {
15398 let (mut parts, body) = res.into_parts();
15399 let mut body = common::Body::new(body);
15400 if !parts.status.is_success() {
15401 let bytes = common::to_bytes(body).await.unwrap_or_default();
15402 let error = serde_json::from_str(&common::to_string(&bytes));
15403 let response = common::to_response(parts, bytes.into());
15404
15405 if let common::Retry::After(d) =
15406 dlg.http_failure(&response, error.as_ref().ok())
15407 {
15408 sleep(d).await;
15409 continue;
15410 }
15411
15412 dlg.finished(false);
15413
15414 return Err(match error {
15415 Ok(value) => common::Error::BadRequest(value),
15416 _ => common::Error::Failure(response),
15417 });
15418 }
15419 let response = {
15420 let bytes = common::to_bytes(body).await.unwrap_or_default();
15421 let encoded = common::to_string(&bytes);
15422 match serde_json::from_str(&encoded) {
15423 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15424 Err(error) => {
15425 dlg.response_json_decode_error(&encoded, &error);
15426 return Err(common::Error::JsonDecodeError(
15427 encoded.to_string(),
15428 error,
15429 ));
15430 }
15431 }
15432 };
15433
15434 dlg.finished(true);
15435 return Ok(response);
15436 }
15437 }
15438 }
15439 }
15440
15441 ///
15442 /// Sets the *request* property to the given value.
15443 ///
15444 /// Even though the property as already been set when instantiating this call,
15445 /// we provide this method for API completeness.
15446 pub fn request(mut self, new_value: RepairApplicationRequest) -> AppRepairCall<'a, C> {
15447 self._request = new_value;
15448 self
15449 }
15450 /// Part of `name`. Name of the application to repair. Example: apps/myapp
15451 ///
15452 /// Sets the *apps id* path property to the given value.
15453 ///
15454 /// Even though the property as already been set when instantiating this call,
15455 /// we provide this method for API completeness.
15456 pub fn apps_id(mut self, new_value: &str) -> AppRepairCall<'a, C> {
15457 self._apps_id = new_value.to_string();
15458 self
15459 }
15460 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15461 /// while executing the actual API request.
15462 ///
15463 /// ````text
15464 /// It should be used to handle progress information, and to implement a certain level of resilience.
15465 /// ````
15466 ///
15467 /// Sets the *delegate* property to the given value.
15468 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AppRepairCall<'a, C> {
15469 self._delegate = Some(new_value);
15470 self
15471 }
15472
15473 /// Set any additional parameter of the query string used in the request.
15474 /// It should be used to set parameters which are not yet available through their own
15475 /// setters.
15476 ///
15477 /// Please note that this method must not be used to set any of the known parameters
15478 /// which have their own setter method. If done anyway, the request will fail.
15479 ///
15480 /// # Additional Parameters
15481 ///
15482 /// * *$.xgafv* (query-string) - V1 error format.
15483 /// * *access_token* (query-string) - OAuth access token.
15484 /// * *alt* (query-string) - Data format for response.
15485 /// * *callback* (query-string) - JSONP
15486 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15487 /// * *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.
15488 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15489 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15490 /// * *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.
15491 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15492 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15493 pub fn param<T>(mut self, name: T, value: T) -> AppRepairCall<'a, C>
15494 where
15495 T: AsRef<str>,
15496 {
15497 self._additional_params
15498 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15499 self
15500 }
15501
15502 /// Identifies the authorization scope for the method you are building.
15503 ///
15504 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15505 /// [`Scope::CloudPlatform`].
15506 ///
15507 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15508 /// tokens for more than one scope.
15509 ///
15510 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15511 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15512 /// sufficient, a read-write scope will do as well.
15513 pub fn add_scope<St>(mut self, scope: St) -> AppRepairCall<'a, C>
15514 where
15515 St: AsRef<str>,
15516 {
15517 self._scopes.insert(String::from(scope.as_ref()));
15518 self
15519 }
15520 /// Identifies the authorization scope(s) for the method you are building.
15521 ///
15522 /// See [`Self::add_scope()`] for details.
15523 pub fn add_scopes<I, St>(mut self, scopes: I) -> AppRepairCall<'a, C>
15524 where
15525 I: IntoIterator<Item = St>,
15526 St: AsRef<str>,
15527 {
15528 self._scopes
15529 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15530 self
15531 }
15532
15533 /// Removes all scopes, and no default scope will be used either.
15534 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15535 /// for details).
15536 pub fn clear_scopes(mut self) -> AppRepairCall<'a, C> {
15537 self._scopes.clear();
15538 self
15539 }
15540}
15541
15542/// Lists all domains the user is authorized to administer.
15543///
15544/// A builder for the *locations.applications.authorizedDomains.list* method supported by a *project* resource.
15545/// It is not used directly, but through a [`ProjectMethods`] instance.
15546///
15547/// # Example
15548///
15549/// Instantiate a resource method builder
15550///
15551/// ```test_harness,no_run
15552/// # extern crate hyper;
15553/// # extern crate hyper_rustls;
15554/// # extern crate google_appengine1 as appengine1;
15555/// # async fn dox() {
15556/// # use appengine1::{Appengine, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15557///
15558/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15559/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15560/// # secret,
15561/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15562/// # ).build().await.unwrap();
15563///
15564/// # let client = hyper_util::client::legacy::Client::builder(
15565/// # hyper_util::rt::TokioExecutor::new()
15566/// # )
15567/// # .build(
15568/// # hyper_rustls::HttpsConnectorBuilder::new()
15569/// # .with_native_roots()
15570/// # .unwrap()
15571/// # .https_or_http()
15572/// # .enable_http1()
15573/// # .build()
15574/// # );
15575/// # let mut hub = Appengine::new(client, auth);
15576/// // You can configure optional parameters by calling the respective setters at will, and
15577/// // execute the final call using `doit()`.
15578/// // Values shown here are possibly random and not representative !
15579/// let result = hub.projects().locations_applications_authorized_domains_list("projectsId", "locationsId", "applicationsId")
15580/// .page_token("dolores")
15581/// .page_size(-68)
15582/// .doit().await;
15583/// # }
15584/// ```
15585pub struct ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
15586where
15587 C: 'a,
15588{
15589 hub: &'a Appengine<C>,
15590 _projects_id: String,
15591 _locations_id: String,
15592 _applications_id: String,
15593 _page_token: Option<String>,
15594 _page_size: Option<i32>,
15595 _delegate: Option<&'a mut dyn common::Delegate>,
15596 _additional_params: HashMap<String, String>,
15597 _scopes: BTreeSet<String>,
15598}
15599
15600impl<'a, C> common::CallBuilder for ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {}
15601
15602impl<'a, C> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
15603where
15604 C: common::Connector,
15605{
15606 /// Perform the operation you have build so far.
15607 pub async fn doit(
15608 mut self,
15609 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
15610 use std::borrow::Cow;
15611 use std::io::{Read, Seek};
15612
15613 use common::{url::Params, ToParts};
15614 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15615
15616 let mut dd = common::DefaultDelegate;
15617 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15618 dlg.begin(common::MethodInfo {
15619 id: "appengine.projects.locations.applications.authorizedDomains.list",
15620 http_method: hyper::Method::GET,
15621 });
15622
15623 for &field in [
15624 "alt",
15625 "projectsId",
15626 "locationsId",
15627 "applicationsId",
15628 "pageToken",
15629 "pageSize",
15630 ]
15631 .iter()
15632 {
15633 if self._additional_params.contains_key(field) {
15634 dlg.finished(false);
15635 return Err(common::Error::FieldClash(field));
15636 }
15637 }
15638
15639 let mut params = Params::with_capacity(7 + self._additional_params.len());
15640 params.push("projectsId", self._projects_id);
15641 params.push("locationsId", self._locations_id);
15642 params.push("applicationsId", self._applications_id);
15643 if let Some(value) = self._page_token.as_ref() {
15644 params.push("pageToken", value);
15645 }
15646 if let Some(value) = self._page_size.as_ref() {
15647 params.push("pageSize", value.to_string());
15648 }
15649
15650 params.extend(self._additional_params.iter());
15651
15652 params.push("alt", "json");
15653 let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}/authorizedDomains";
15654 if self._scopes.is_empty() {
15655 self._scopes.insert(Scope::Admin.as_ref().to_string());
15656 }
15657
15658 #[allow(clippy::single_element_loop)]
15659 for &(find_this, param_name) in [
15660 ("{projectsId}", "projectsId"),
15661 ("{locationsId}", "locationsId"),
15662 ("{applicationsId}", "applicationsId"),
15663 ]
15664 .iter()
15665 {
15666 url = params.uri_replacement(url, param_name, find_this, false);
15667 }
15668 {
15669 let to_remove = ["applicationsId", "locationsId", "projectsId"];
15670 params.remove_params(&to_remove);
15671 }
15672
15673 let url = params.parse_with_url(&url);
15674
15675 loop {
15676 let token = match self
15677 .hub
15678 .auth
15679 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15680 .await
15681 {
15682 Ok(token) => token,
15683 Err(e) => match dlg.token(e) {
15684 Ok(token) => token,
15685 Err(e) => {
15686 dlg.finished(false);
15687 return Err(common::Error::MissingToken(e));
15688 }
15689 },
15690 };
15691 let mut req_result = {
15692 let client = &self.hub.client;
15693 dlg.pre_request();
15694 let mut req_builder = hyper::Request::builder()
15695 .method(hyper::Method::GET)
15696 .uri(url.as_str())
15697 .header(USER_AGENT, self.hub._user_agent.clone());
15698
15699 if let Some(token) = token.as_ref() {
15700 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15701 }
15702
15703 let request = req_builder
15704 .header(CONTENT_LENGTH, 0_u64)
15705 .body(common::to_body::<String>(None));
15706
15707 client.request(request.unwrap()).await
15708 };
15709
15710 match req_result {
15711 Err(err) => {
15712 if let common::Retry::After(d) = dlg.http_error(&err) {
15713 sleep(d).await;
15714 continue;
15715 }
15716 dlg.finished(false);
15717 return Err(common::Error::HttpError(err));
15718 }
15719 Ok(res) => {
15720 let (mut parts, body) = res.into_parts();
15721 let mut body = common::Body::new(body);
15722 if !parts.status.is_success() {
15723 let bytes = common::to_bytes(body).await.unwrap_or_default();
15724 let error = serde_json::from_str(&common::to_string(&bytes));
15725 let response = common::to_response(parts, bytes.into());
15726
15727 if let common::Retry::After(d) =
15728 dlg.http_failure(&response, error.as_ref().ok())
15729 {
15730 sleep(d).await;
15731 continue;
15732 }
15733
15734 dlg.finished(false);
15735
15736 return Err(match error {
15737 Ok(value) => common::Error::BadRequest(value),
15738 _ => common::Error::Failure(response),
15739 });
15740 }
15741 let response = {
15742 let bytes = common::to_bytes(body).await.unwrap_or_default();
15743 let encoded = common::to_string(&bytes);
15744 match serde_json::from_str(&encoded) {
15745 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15746 Err(error) => {
15747 dlg.response_json_decode_error(&encoded, &error);
15748 return Err(common::Error::JsonDecodeError(
15749 encoded.to_string(),
15750 error,
15751 ));
15752 }
15753 }
15754 };
15755
15756 dlg.finished(true);
15757 return Ok(response);
15758 }
15759 }
15760 }
15761 }
15762
15763 /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp.
15764 ///
15765 /// Sets the *projects id* path property to the given value.
15766 ///
15767 /// Even though the property as already been set when instantiating this call,
15768 /// we provide this method for API completeness.
15769 pub fn projects_id(
15770 mut self,
15771 new_value: &str,
15772 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
15773 self._projects_id = new_value.to_string();
15774 self
15775 }
15776 /// Part of `parent`. See documentation of `projectsId`.
15777 ///
15778 /// Sets the *locations id* path property to the given value.
15779 ///
15780 /// Even though the property as already been set when instantiating this call,
15781 /// we provide this method for API completeness.
15782 pub fn locations_id(
15783 mut self,
15784 new_value: &str,
15785 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
15786 self._locations_id = new_value.to_string();
15787 self
15788 }
15789 /// Part of `parent`. See documentation of `projectsId`.
15790 ///
15791 /// Sets the *applications id* path property to the given value.
15792 ///
15793 /// Even though the property as already been set when instantiating this call,
15794 /// we provide this method for API completeness.
15795 pub fn applications_id(
15796 mut self,
15797 new_value: &str,
15798 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
15799 self._applications_id = new_value.to_string();
15800 self
15801 }
15802 /// Continuation token for fetching the next page of results.
15803 ///
15804 /// Sets the *page token* query property to the given value.
15805 pub fn page_token(
15806 mut self,
15807 new_value: &str,
15808 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
15809 self._page_token = Some(new_value.to_string());
15810 self
15811 }
15812 /// Maximum results to return per page.
15813 ///
15814 /// Sets the *page size* query property to the given value.
15815 pub fn page_size(
15816 mut self,
15817 new_value: i32,
15818 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
15819 self._page_size = Some(new_value);
15820 self
15821 }
15822 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15823 /// while executing the actual API request.
15824 ///
15825 /// ````text
15826 /// It should be used to handle progress information, and to implement a certain level of resilience.
15827 /// ````
15828 ///
15829 /// Sets the *delegate* property to the given value.
15830 pub fn delegate(
15831 mut self,
15832 new_value: &'a mut dyn common::Delegate,
15833 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
15834 self._delegate = Some(new_value);
15835 self
15836 }
15837
15838 /// Set any additional parameter of the query string used in the request.
15839 /// It should be used to set parameters which are not yet available through their own
15840 /// setters.
15841 ///
15842 /// Please note that this method must not be used to set any of the known parameters
15843 /// which have their own setter method. If done anyway, the request will fail.
15844 ///
15845 /// # Additional Parameters
15846 ///
15847 /// * *$.xgafv* (query-string) - V1 error format.
15848 /// * *access_token* (query-string) - OAuth access token.
15849 /// * *alt* (query-string) - Data format for response.
15850 /// * *callback* (query-string) - JSONP
15851 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15852 /// * *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.
15853 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15854 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15855 /// * *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.
15856 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15857 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15858 pub fn param<T>(
15859 mut self,
15860 name: T,
15861 value: T,
15862 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
15863 where
15864 T: AsRef<str>,
15865 {
15866 self._additional_params
15867 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15868 self
15869 }
15870
15871 /// Identifies the authorization scope for the method you are building.
15872 ///
15873 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15874 /// [`Scope::Admin`].
15875 ///
15876 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15877 /// tokens for more than one scope.
15878 ///
15879 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15880 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15881 /// sufficient, a read-write scope will do as well.
15882 pub fn add_scope<St>(
15883 mut self,
15884 scope: St,
15885 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
15886 where
15887 St: AsRef<str>,
15888 {
15889 self._scopes.insert(String::from(scope.as_ref()));
15890 self
15891 }
15892 /// Identifies the authorization scope(s) for the method you are building.
15893 ///
15894 /// See [`Self::add_scope()`] for details.
15895 pub fn add_scopes<I, St>(
15896 mut self,
15897 scopes: I,
15898 ) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C>
15899 where
15900 I: IntoIterator<Item = St>,
15901 St: AsRef<str>,
15902 {
15903 self._scopes
15904 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15905 self
15906 }
15907
15908 /// Removes all scopes, and no default scope will be used either.
15909 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15910 /// for details).
15911 pub fn clear_scopes(mut self) -> ProjectLocationApplicationAuthorizedDomainListCall<'a, C> {
15912 self._scopes.clear();
15913 self
15914 }
15915}