use std::collections::HashMap; use std::cell::RefCell; use std::default::Default; use std::collections::BTreeSet; use std::error::Error as StdError; use serde_json as json; use std::io; use std::fs; use std::mem; use hyper::client::connect; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::time::sleep; use tower_service; use serde::{Serialize, Deserialize}; use crate::{client, client::GetToken, client::serde_with}; // ############## // UTILITIES ### // ############ /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { /// View and manage your applications deployed on Google App Engine Admin, /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. CloudPlatform, /// View your data across Google Cloud services and see the email address of your Google Account CloudPlatformReadOnly, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { Scope::Admin => "https://www.googleapis.com/auth/appengine.admin", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", } } } impl Default for Scope { fn default() -> Scope { Scope::CloudPlatform } } // ######## // HUB ### // ###### /// Central instance to access all Appengine related resource activities /// /// # Examples /// /// Instantiate a new hub /// /// ```test_harness,no_run /// extern crate hyper; /// extern crate hyper_rustls; /// extern crate google_appengine1 as appengine1; /// use appengine1::api::DebugInstanceRequest; /// use appengine1::{Result, Error}; /// # async fn dox() { /// use std::default::Default; /// use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// // Get an ApplicationSecret instance by some means. It contains the `client_id` and /// // `client_secret`, among other things. /// let secret: oauth2::ApplicationSecret = Default::default(); /// // Instantiate the authenticator. It will choose a suitable authentication flow for you, /// // unless you replace `None` with the desired Flow. /// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about /// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and /// // retrieve them from storage. /// let auth = oauth2::InstalledFlowAuthenticator::builder( /// secret, /// oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// ).build().await.unwrap(); /// let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = DebugInstanceRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_instances_debug(req, "appsId", "servicesId", "versionsId", "instancesId") /// .doit().await; /// /// match result { /// Err(e) => match e { /// // The Error enum provides details about what exactly happened. /// // You can also just use its `Debug`, `Display` or `Error` traits /// Error::HttpError(_) /// |Error::Io(_) /// |Error::MissingAPIKey /// |Error::MissingToken(_) /// |Error::Cancelled /// |Error::UploadSizeLimitExceeded(_, _) /// |Error::Failure(_) /// |Error::BadRequest(_) /// |Error::FieldClash(_) /// |Error::JsonDecodeError(_, _) => println!("{}", e), /// }, /// Ok(res) => println!("Success: {:?}", res), /// } /// # } /// ``` #[derive(Clone)] pub struct Appengine { pub client: hyper::Client, pub auth: Box, _user_agent: String, _base_url: String, _root_url: String, } impl<'a, S> client::Hub for Appengine {} impl<'a, S> Appengine { pub fn new(client: hyper::Client, auth: A) -> Appengine { Appengine { client, auth: Box::new(auth), _user_agent: "google-api-rust-client/5.0.3".to_string(), _base_url: "https://appengine.googleapis.com/".to_string(), _root_url: "https://appengine.googleapis.com/".to_string(), } } pub fn apps(&'a self) -> AppMethods<'a, S> { AppMethods { hub: &self } } pub fn projects(&'a self) -> ProjectMethods<'a, S> { ProjectMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. /// It defaults to `google-api-rust-client/5.0.3`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { mem::replace(&mut self._user_agent, agent_name) } /// Set the base url to use in all requests to the server. /// It defaults to `https://appengine.googleapis.com/`. /// /// Returns the previously set base url. pub fn base_url(&mut self, new_base_url: String) -> String { mem::replace(&mut self._base_url, new_base_url) } /// Set the root url to use in all requests to the server. /// It defaults to `https://appengine.googleapis.com/`. /// /// Returns the previously set root url. pub fn root_url(&mut self, new_root_url: String) -> String { mem::replace(&mut self._root_url, new_root_url) } } // ############ // SCHEMAS ### // ########## /// Google Cloud Endpoints (https://cloud.google.com/endpoints) configuration for API handlers. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ApiConfigHandler { /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, /// Level of login required to access this resource. Defaults to optional. pub login: Option, /// Path to the script from the application root directory. pub script: Option, /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, /// URL to serve the endpoint at. pub url: Option, } impl client::Part for ApiConfigHandler {} /// Uses Google Cloud Endpoints to handle requests. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ApiEndpointHandler { /// Path to the script from the application root directory. #[serde(rename="scriptPath")] pub script_path: Option, } impl client::Part for ApiEndpointHandler {} /// An Application resource contains the top-level configuration of an App Engine application. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [create apps](AppCreateCall) (request) /// * [get apps](AppGetCall) (response) /// * [patch apps](AppPatchCall) (request) /// * [locations applications get projects](ProjectLocationApplicationGetCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Application { /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. #[serde(rename="authDomain")] pub auth_domain: Option, /// 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 #[serde(rename="codeBucket")] pub code_bucket: Option, /// The type of the Cloud Firestore or Cloud Datastore database associated with this application. #[serde(rename="databaseType")] pub database_type: Option, /// Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly #[serde(rename="defaultBucket")] pub default_bucket: Option, /// Cookie expiration policy for this application. #[serde(rename="defaultCookieExpiration")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub default_cookie_expiration: Option, /// Hostname used to reach this application, as resolved by App Engine.@OutputOnly #[serde(rename="defaultHostname")] pub default_hostname: Option, /// 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. #[serde(rename="dispatchRules")] pub dispatch_rules: Option>, /// The feature specific settings to be used in the application. #[serde(rename="featureSettings")] pub feature_settings: Option, /// The Google Container Registry domain used for storing managed build docker images for this application. #[serde(rename="gcrDomain")] pub gcr_domain: Option, /// no description provided pub iap: Option, /// 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. pub id: Option, /// 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). #[serde(rename="locationId")] pub location_id: Option, /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly pub name: Option, /// 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. #[serde(rename="serviceAccount")] pub service_account: Option, /// Serving status of this application. #[serde(rename="servingStatus")] pub serving_status: Option, } impl client::RequestValue for Application {} impl client::ResponseResult for Application {} /// 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. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [authorized certificates create apps](AppAuthorizedCertificateCreateCall) (request|response) /// * [authorized certificates get apps](AppAuthorizedCertificateGetCall) (response) /// * [authorized certificates patch apps](AppAuthorizedCertificatePatchCall) (request|response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AuthorizedCertificate { /// The SSL certificate serving the AuthorizedCertificate resource. This must be obtained independently from a certificate authority. #[serde(rename="certificateRawData")] pub certificate_raw_data: Option, /// The user-specified display name of the certificate. This is not guaranteed to be unique. Example: My Certificate. #[serde(rename="displayName")] pub display_name: Option, /// 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 #[serde(rename="domainMappingsCount")] pub domain_mappings_count: Option, /// Topmost applicable domains of this certificate. This certificate applies to these domains and their subdomains. Example: example.com.@OutputOnly #[serde(rename="domainNames")] pub domain_names: Option>, /// 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 #[serde(rename="expireTime")] pub expire_time: Option>, /// Relative name of the certificate. This is a unique value autogenerated on AuthorizedCertificate resource creation. Example: 12345.@OutputOnly pub id: Option, /// 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 #[serde(rename="managedCertificate")] pub managed_certificate: Option, /// Full path to the AuthorizedCertificate resource in the API. Example: apps/myapp/authorizedCertificates/12345.@OutputOnly pub name: Option, /// 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 #[serde(rename="visibleDomainMappings")] pub visible_domain_mappings: Option>, } impl client::RequestValue for AuthorizedCertificate {} impl client::ResponseResult for AuthorizedCertificate {} /// A domain that a user has been authorized to administer. To authorize use of a domain, verify ownership via Webmaster Central (https://www.google.com/webmasters/verification/home). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AuthorizedDomain { /// Fully qualified domain name of the domain authorized for use. Example: example.com. pub id: Option, /// Full path to the AuthorizedDomain resource in the API. Example: apps/myapp/authorizedDomains/example.com.@OutputOnly pub name: Option, } impl client::Part for AuthorizedDomain {} /// Automatic scaling is based on request rate, response latencies, and other application metrics. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AutomaticScaling { /// 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. #[serde(rename="coolDownPeriod")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub cool_down_period: Option, /// Target scaling by CPU usage. #[serde(rename="cpuUtilization")] pub cpu_utilization: Option, /// Target scaling by disk usage. #[serde(rename="diskUtilization")] pub disk_utilization: Option, /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value. #[serde(rename="maxConcurrentRequests")] pub max_concurrent_requests: Option, /// Maximum number of idle instances that should be maintained for this version. #[serde(rename="maxIdleInstances")] pub max_idle_instances: Option, /// Maximum amount of time that a request should wait in the pending queue before starting a new instance to handle it. #[serde(rename="maxPendingLatency")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub max_pending_latency: Option, /// Maximum number of instances that should be started to handle requests for this version. #[serde(rename="maxTotalInstances")] pub max_total_instances: Option, /// Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a service. #[serde(rename="minIdleInstances")] pub min_idle_instances: Option, /// Minimum amount of time a request should wait in the pending queue before starting a new instance to handle it. #[serde(rename="minPendingLatency")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub min_pending_latency: Option, /// Minimum number of running instances that should be maintained for this version. #[serde(rename="minTotalInstances")] pub min_total_instances: Option, /// Target scaling by network usage. #[serde(rename="networkUtilization")] pub network_utilization: Option, /// Target scaling by request utilization. #[serde(rename="requestUtilization")] pub request_utilization: Option, /// Scheduler settings for standard environment. #[serde(rename="standardSchedulerSettings")] pub standard_scheduler_settings: Option, } impl client::Part for AutomaticScaling {} /// 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. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BasicScaling { /// Duration of time after the last request that an instance must wait before the instance is shut down. #[serde(rename="idleTimeout")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub idle_timeout: Option, /// Maximum number of instances to create for this version. #[serde(rename="maxInstances")] pub max_instances: Option, } impl client::Part for BasicScaling {} /// Request message for Firewall.BatchUpdateIngressRules. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [firewall ingress rules batch update apps](AppFirewallIngressRuleBatchUpdateCall) (request) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BatchUpdateIngressRulesRequest { /// A list of FirewallRules to replace the existing set. #[serde(rename="ingressRules")] pub ingress_rules: Option>, } impl client::RequestValue for BatchUpdateIngressRulesRequest {} /// Response message for Firewall.UpdateAllIngressRules. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [firewall ingress rules batch update apps](AppFirewallIngressRuleBatchUpdateCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BatchUpdateIngressRulesResponse { /// The full list of ingress FirewallRules for this application. #[serde(rename="ingressRules")] pub ingress_rules: Option>, } impl client::ResponseResult for BatchUpdateIngressRulesResponse {} /// An SSL certificate obtained from a certificate authority. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CertificateRawData { /// 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 #[serde(rename="privateKey")] pub private_key: Option, /// 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----- #[serde(rename="publicCertificate")] pub public_certificate: Option, } impl client::Part for CertificateRawData {} /// 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. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CloudBuildOptions { /// 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. #[serde(rename="appYamlPath")] pub app_yaml_path: Option, /// The Cloud Build timeout used as part of any dependent builds performed by version creation. Defaults to 10 minutes. #[serde(rename="cloudBuildTimeout")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub cloud_build_timeout: Option, } impl client::Part for CloudBuildOptions {} /// 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. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ContainerInfo { /// 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" pub image: Option, } impl client::Part for ContainerInfo {} /// Target scaling by CPU usage. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CpuUtilization { /// Period of time over which CPU utilization is calculated. #[serde(rename="aggregationWindowLength")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub aggregation_window_length: Option, /// Target CPU utilization ratio to maintain when scaling. Must be between 0 and 1. #[serde(rename="targetUtilization")] pub target_utilization: Option, } impl client::Part for CpuUtilization {} /// Request message for Instances.DebugInstance. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services versions instances debug apps](AppServiceVersionInstanceDebugCall) (request) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DebugInstanceRequest { /// 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). #[serde(rename="sshKey")] pub ssh_key: Option, } impl client::RequestValue for DebugInstanceRequest {} /// Code and application artifacts used to deploy a version to App Engine. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Deployment { /// 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. #[serde(rename="cloudBuildOptions")] pub cloud_build_options: Option, /// The Docker image for the container that runs the version. Only applicable for instances running in the App Engine flexible environment. pub container: Option, /// 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. pub files: Option>, /// The zip file for this deployment, if this is a zip deployment. pub zip: Option, } impl client::Part for Deployment {} /// Target scaling by disk usage. Only applicable in the App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskUtilization { /// Target bytes read per second. #[serde(rename="targetReadBytesPerSecond")] pub target_read_bytes_per_second: Option, /// Target ops read per seconds. #[serde(rename="targetReadOpsPerSecond")] pub target_read_ops_per_second: Option, /// Target bytes written per second. #[serde(rename="targetWriteBytesPerSecond")] pub target_write_bytes_per_second: Option, /// Target ops written per second. #[serde(rename="targetWriteOpsPerSecond")] pub target_write_ops_per_second: Option, } impl client::Part for DiskUtilization {} /// A domain serving an App Engine application. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [domain mappings create apps](AppDomainMappingCreateCall) (request) /// * [domain mappings get apps](AppDomainMappingGetCall) (response) /// * [domain mappings patch apps](AppDomainMappingPatchCall) (request) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DomainMapping { /// Relative name of the domain serving the application. Example: example.com. pub id: Option, /// Full path to the DomainMapping resource in the API. Example: apps/myapp/domainMapping/example.com.@OutputOnly pub name: Option, /// 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 #[serde(rename="resourceRecords")] pub resource_records: Option>, /// SSL configuration for this domain. If unconfigured, this domain will not serve with SSL. #[serde(rename="sslSettings")] pub ssl_settings: Option, } impl client::RequestValue for DomainMapping {} impl client::ResponseResult for DomainMapping {} /// 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); } /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [authorized certificates delete apps](AppAuthorizedCertificateDeleteCall) (response) /// * [firewall ingress rules delete apps](AppFirewallIngressRuleDeleteCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Empty { _never_set: Option } impl client::ResponseResult for Empty {} /// 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). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct EndpointsApiService { /// 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. #[serde(rename="configId")] pub config_id: Option, /// Enable or disable trace sampling. By default, this is set to false for enabled. #[serde(rename="disableTraceSampling")] pub disable_trace_sampling: Option, /// Endpoints service name which is the name of the "service" resource in the Service Management API. For example "myapi.endpoints.myproject.cloud.goog" pub name: Option, /// Endpoints rollout strategy. If FIXED, config_id must be specified. If MANAGED, config_id must be omitted. #[serde(rename="rolloutStrategy")] pub rollout_strategy: Option, } impl client::Part for EndpointsApiService {} /// The entrypoint for the application. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Entrypoint { /// The format should be a shell command that can be fed to bash -c. pub shell: Option, } impl client::Part for Entrypoint {} /// Custom static error page to be served when an error occurs. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ErrorHandler { /// Error condition this handler applies to. #[serde(rename="errorCode")] pub error_code: Option, /// MIME type of file. Defaults to text/html. #[serde(rename="mimeType")] pub mime_type: Option, /// Static file content to be served for this error. #[serde(rename="staticFile")] pub static_file: Option, } impl client::Part for ErrorHandler {} /// The feature specific settings to be used in the application. These define behaviors that are user configurable. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FeatureSettings { /// 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. #[serde(rename="splitHealthChecks")] pub split_health_checks: Option, /// If true, use Container-Optimized OS (https://cloud.google.com/container-optimized-os/) base image for VMs, rather than a base Debian image. #[serde(rename="useContainerOptimizedOs")] pub use_container_optimized_os: Option, } impl client::Part for FeatureSettings {} /// Single source file that is part of the version to be deployed. Each source file that is deployed must be specified separately. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FileInfo { /// The MIME type of the file.Defaults to the value from Google Cloud Storage. #[serde(rename="mimeType")] pub mime_type: Option, /// The SHA1 hash of the file, in hex. #[serde(rename="sha1Sum")] pub sha1_sum: Option, /// 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//'. #[serde(rename="sourceUrl")] pub source_url: Option, } impl client::Part for FileInfo {} /// A single firewall rule that is evaluated against incoming traffic and provides an action to take on matched requests. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [firewall ingress rules create apps](AppFirewallIngressRuleCreateCall) (request|response) /// * [firewall ingress rules get apps](AppFirewallIngressRuleGetCall) (response) /// * [firewall ingress rules patch apps](AppFirewallIngressRulePatchCall) (request|response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FirewallRule { /// The action to take on matched requests. pub action: Option, /// An optional string description of this rule. This field has a maximum length of 400 characters. pub description: Option, /// 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. pub priority: Option, /// 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. #[serde(rename="sourceRange")] pub source_range: Option, } impl client::RequestValue for FirewallRule {} impl client::ResponseResult for FirewallRule {} /// Health checking configuration for VM instances. Unhealthy instances are killed and replaced with new instances. Only applicable for instances in App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct HealthCheck { /// Interval between health checks. #[serde(rename="checkInterval")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub check_interval: Option, /// Whether to explicitly disable health checks for this instance. #[serde(rename="disableHealthCheck")] pub disable_health_check: Option, /// Number of consecutive successful health checks required before receiving traffic. #[serde(rename="healthyThreshold")] pub healthy_threshold: Option, /// Host header to send when performing an HTTP health check. Example: "myapp.appspot.com" pub host: Option, /// Number of consecutive failed health checks required before an instance is restarted. #[serde(rename="restartThreshold")] pub restart_threshold: Option, /// Time before the health check is considered failed. #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub timeout: Option, /// Number of consecutive failed health checks required before removing traffic. #[serde(rename="unhealthyThreshold")] pub unhealthy_threshold: Option, } impl client::Part for HealthCheck {} /// Identity-Aware Proxy /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IdentityAwareProxy { /// 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. pub enabled: Option, /// OAuth2 client ID to use for the authentication flow. #[serde(rename="oauth2ClientId")] pub oauth2_client_id: Option, /// 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 #[serde(rename="oauth2ClientSecret")] pub oauth2_client_secret: Option, /// Hex-encoded SHA-256 hash of the client secret.@OutputOnly #[serde(rename="oauth2ClientSecretSha256")] pub oauth2_client_secret_sha256: Option, } impl client::Part for IdentityAwareProxy {} /// An Instance resource is the computing unit that App Engine uses to automatically scale an application. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services versions instances get apps](AppServiceVersionInstanceGetCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Instance { /// Output only. App Engine release this instance is running on. #[serde(rename="appEngineRelease")] pub app_engine_release: Option, /// Output only. Availability of the instance. pub availability: Option, /// Output only. Average latency (ms) over the last minute. #[serde(rename="averageLatency")] pub average_latency: Option, /// Output only. Number of errors since this instance was started. pub errors: Option, /// Output only. Relative name of the instance within the version. Example: instance-1. pub id: Option, /// Output only. Total memory in use (bytes). #[serde(rename="memoryUsage")] #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")] pub memory_usage: Option, /// Output only. Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1. pub name: Option, /// Output only. Average queries per second (QPS) over the last minute. pub qps: Option, /// Output only. Number of requests since this instance was started. pub requests: Option, /// Output only. Time that this instance was started.@OutputOnly #[serde(rename="startTime")] pub start_time: Option>, /// Output only. Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment. #[serde(rename="vmDebugEnabled")] pub vm_debug_enabled: Option, /// Output only. Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment. #[serde(rename="vmId")] pub vm_id: Option, /// Output only. The IP address of this instance. Only applicable for instances in App Engine flexible environment. #[serde(rename="vmIp")] pub vm_ip: Option, /// Output only. The liveness health check of this instance. Only applicable for instances in App Engine flexible environment. #[serde(rename="vmLiveness")] pub vm_liveness: Option, /// Output only. Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. #[serde(rename="vmName")] pub vm_name: Option, /// Output only. Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. #[serde(rename="vmStatus")] pub vm_status: Option, /// Output only. Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment. #[serde(rename="vmZoneName")] pub vm_zone_name: Option, } impl client::ResponseResult for Instance {} /// Third-party Python runtime library that is required by the application. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Library { /// Name of the library. Example: "django". pub name: Option, /// Version of the library to select, or "latest". pub version: Option, } impl client::Part for Library {} /// Response message for AuthorizedCertificates.ListAuthorizedCertificates. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [authorized certificates list apps](AppAuthorizedCertificateListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListAuthorizedCertificatesResponse { /// The SSL certificates the user is authorized to administer. pub certificates: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, } impl client::ResponseResult for ListAuthorizedCertificatesResponse {} /// Response message for AuthorizedDomains.ListAuthorizedDomains. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [authorized domains list apps](AppAuthorizedDomainListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListAuthorizedDomainsResponse { /// The authorized domains belonging to the user. pub domains: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, } impl client::ResponseResult for ListAuthorizedDomainsResponse {} /// Response message for DomainMappings.ListDomainMappings. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [domain mappings list apps](AppDomainMappingListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListDomainMappingsResponse { /// The domain mappings for the application. #[serde(rename="domainMappings")] pub domain_mappings: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, } impl client::ResponseResult for ListDomainMappingsResponse {} /// Response message for Firewall.ListIngressRules. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [firewall ingress rules list apps](AppFirewallIngressRuleListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListIngressRulesResponse { /// The ingress FirewallRules for this application. #[serde(rename="ingressRules")] pub ingress_rules: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, } impl client::ResponseResult for ListIngressRulesResponse {} /// Response message for Instances.ListInstances. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services versions instances list apps](AppServiceVersionInstanceListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListInstancesResponse { /// The instances belonging to the requested version. pub instances: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, } impl client::ResponseResult for ListInstancesResponse {} /// The response message for Locations.ListLocations. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [locations list apps](AppLocationListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListLocationsResponse { /// A list of locations that matches the specified filter in the request. pub locations: Option>, /// The standard List next-page token. #[serde(rename="nextPageToken")] pub next_page_token: Option, } impl client::ResponseResult for ListLocationsResponse {} /// The response message for Operations.ListOperations. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [operations list apps](AppOperationListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListOperationsResponse { /// The standard List next-page token. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of operations that matches the specified filter in the request. pub operations: Option>, } impl client::ResponseResult for ListOperationsResponse {} /// Response message for Services.ListServices. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services list apps](AppServiceListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListServicesResponse { /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The services belonging to the requested application. pub services: Option>, } impl client::ResponseResult for ListServicesResponse {} /// Response message for Versions.ListVersions. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services versions list apps](AppServiceVersionListCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListVersionsResponse { /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The versions belonging to the requested service. pub versions: Option>, } impl client::ResponseResult for ListVersionsResponse {} /// Health checking configuration for VM instances. Unhealthy instances are killed and replaced with new instances. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LivenessCheck { /// Interval between health checks. #[serde(rename="checkInterval")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub check_interval: Option, /// Number of consecutive failed checks required before considering the VM unhealthy. #[serde(rename="failureThreshold")] pub failure_threshold: Option, /// Host header to send when performing a HTTP Liveness check. Example: "myapp.appspot.com" pub host: Option, /// The initial delay before starting to execute the checks. #[serde(rename="initialDelay")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub initial_delay: Option, /// The request path. pub path: Option, /// Number of consecutive successful checks required before considering the VM healthy. #[serde(rename="successThreshold")] pub success_threshold: Option, /// Time before the check is considered failed. #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub timeout: Option, } impl client::Part for LivenessCheck {} /// A resource that represents Google Cloud Platform location. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [locations get apps](AppLocationGetCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { /// The friendly name for this location, typically a nearby city name. For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"} pub labels: Option>, /// The canonical id for this location. For example: "us-east1". #[serde(rename="locationId")] pub location_id: Option, /// Service-specific metadata. For example the available capacity at the given location. pub metadata: Option>, /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1" pub name: Option, } impl client::ResponseResult for Location {} /// A certificate managed by App Engine. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManagedCertificate { /// 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 #[serde(rename="lastRenewalTime")] pub last_renewal_time: Option>, /// Status of certificate management. Refers to the most recent certificate acquisition or renewal attempt.@OutputOnly pub status: Option, } impl client::Part for ManagedCertificate {} /// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManualScaling { /// 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. pub instances: Option, } impl client::Part for ManualScaling {} /// Extra network settings. Only applicable in the App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Network { /// List of ports, or port pairs, to forward from the virtual machine to the application container. Only applicable in the App Engine flexible environment. #[serde(rename="forwardedPorts")] pub forwarded_ports: Option>, /// The IP mode for instances. Only applicable in the App Engine flexible environment. #[serde(rename="instanceIpMode")] pub instance_ip_mode: Option, /// Tag to apply to the instance during creation. Only applicable in the App Engine flexible environment. #[serde(rename="instanceTag")] pub instance_tag: Option, /// Google Compute Engine network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default. pub name: Option, /// Enable session affinity. Only applicable in the App Engine flexible environment. #[serde(rename="sessionAffinity")] pub session_affinity: Option, /// 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. #[serde(rename="subnetworkName")] pub subnetwork_name: Option, } impl client::Part for Network {} /// A NetworkSettings resource is a container for ingress settings for a version or service. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NetworkSettings { /// The ingress settings for version or service. #[serde(rename="ingressTrafficAllowed")] pub ingress_traffic_allowed: Option, } impl client::Part for NetworkSettings {} /// Target scaling by network usage. Only applicable in the App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NetworkUtilization { /// Target bytes received per second. #[serde(rename="targetReceivedBytesPerSecond")] pub target_received_bytes_per_second: Option, /// Target packets received per second. #[serde(rename="targetReceivedPacketsPerSecond")] pub target_received_packets_per_second: Option, /// Target bytes sent per second. #[serde(rename="targetSentBytesPerSecond")] pub target_sent_bytes_per_second: Option, /// Target packets sent per second. #[serde(rename="targetSentPacketsPerSecond")] pub target_sent_packets_per_second: Option, } impl client::Part for NetworkUtilization {} /// This resource represents a long-running operation that is the result of a network API call. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [domain mappings create apps](AppDomainMappingCreateCall) (response) /// * [domain mappings delete apps](AppDomainMappingDeleteCall) (response) /// * [domain mappings patch apps](AppDomainMappingPatchCall) (response) /// * [operations get apps](AppOperationGetCall) (response) /// * [services versions instances debug apps](AppServiceVersionInstanceDebugCall) (response) /// * [services versions instances delete apps](AppServiceVersionInstanceDeleteCall) (response) /// * [services versions create apps](AppServiceVersionCreateCall) (response) /// * [services versions delete apps](AppServiceVersionDeleteCall) (response) /// * [services versions patch apps](AppServiceVersionPatchCall) (response) /// * [services delete apps](AppServiceDeleteCall) (response) /// * [services patch apps](AppServicePatchCall) (response) /// * [create apps](AppCreateCall) (response) /// * [patch apps](AppPatchCall) (response) /// * [repair apps](AppRepairCall) (response) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { /// 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. pub done: Option, /// The error result of the operation in case of failure or cancellation. pub error: Option, /// 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. pub metadata: Option>, /// 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}. pub name: Option, /// The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse. pub response: Option>, } impl client::ResponseResult for Operation {} /// Readiness checking configuration for VM instances. Unhealthy instances are removed from traffic rotation. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ReadinessCheck { /// A maximum time limit on application initialization, measured from moment the application successfully replies to a healthcheck until it is ready to serve traffic. #[serde(rename="appStartTimeout")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub app_start_timeout: Option, /// Interval between health checks. #[serde(rename="checkInterval")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub check_interval: Option, /// Number of consecutive failed checks required before removing traffic. #[serde(rename="failureThreshold")] pub failure_threshold: Option, /// Host header to send when performing a HTTP Readiness check. Example: "myapp.appspot.com" pub host: Option, /// The request path. pub path: Option, /// Number of consecutive successful checks required before receiving traffic. #[serde(rename="successThreshold")] pub success_threshold: Option, /// Time before the check is considered failed. #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub timeout: Option, } impl client::Part for ReadinessCheck {} /// Request message for ‘Applications.RepairApplication’. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [repair apps](AppRepairCall) (request) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RepairApplicationRequest { _never_set: Option } impl client::RequestValue for RepairApplicationRequest {} /// Target scaling by request utilization. Only applicable in the App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RequestUtilization { /// Target number of concurrent requests. #[serde(rename="targetConcurrentRequests")] pub target_concurrent_requests: Option, /// Target requests per second. #[serde(rename="targetRequestCountPerSecond")] pub target_request_count_per_second: Option, } impl client::Part for RequestUtilization {} /// A DNS resource record. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceRecord { /// Relative name of the object affected by this record. Only applicable for CNAME records. Example: 'www'. pub name: Option, /// Data for this record. Values vary by record type, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). pub rrdata: Option, /// Resource record type. Example: AAAA. #[serde(rename="type")] pub type_: Option, } impl client::Part for ResourceRecord {} /// Machine resources for a version. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Resources { /// Number of CPU cores needed. pub cpu: Option, /// Disk size (GB) needed. #[serde(rename="diskGb")] pub disk_gb: Option, /// 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 #[serde(rename="kmsKeyReference")] pub kms_key_reference: Option, /// Memory (GB) needed. #[serde(rename="memoryGb")] pub memory_gb: Option, /// User specified volumes. pub volumes: Option>, } impl client::Part for Resources {} /// Executes a script to handle the request that matches the URL pattern. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ScriptHandler { /// Path to the script from the application root directory. #[serde(rename="scriptPath")] pub script_path: Option, } impl client::Part for ScriptHandler {} /// 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. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services get apps](AppServiceGetCall) (response) /// * [services patch apps](AppServicePatchCall) (request) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Service { /// Relative name of the service within the application. Example: default.@OutputOnly pub id: Option, /// 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. pub labels: Option>, /// Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly pub name: Option, /// Ingress settings for this service. Will apply to all versions. #[serde(rename="networkSettings")] pub network_settings: Option, /// Mapping that defines fractional HTTP traffic diversion to different versions within the service. pub split: Option, } impl client::RequestValue for Service {} impl client::ResponseResult for Service {} /// SSL configuration for a DomainMapping resource. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SslSettings { /// 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. #[serde(rename="certificateId")] pub certificate_id: Option, /// 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 #[serde(rename="pendingManagedCertificateId")] pub pending_managed_certificate_id: Option, /// 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. #[serde(rename="sslManagementType")] pub ssl_management_type: Option, } impl client::Part for SslSettings {} /// Scheduler settings for standard environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct StandardSchedulerSettings { /// Maximum number of instances to run for this version. Set to zero to disable max_instances configuration. #[serde(rename="maxInstances")] pub max_instances: Option, /// Minimum number of instances to run for this version. Set to zero to disable min_instances configuration. #[serde(rename="minInstances")] pub min_instances: Option, /// Target CPU utilization ratio to maintain when scaling. #[serde(rename="targetCpuUtilization")] pub target_cpu_utilization: Option, /// Target throughput utilization ratio to maintain when scaling #[serde(rename="targetThroughputUtilization")] pub target_throughput_utilization: Option, } impl client::Part for StandardSchedulerSettings {} /// 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. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct StaticFilesHandler { /// 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. #[serde(rename="applicationReadable")] pub application_readable: Option, /// Time a static file served by this handler should be cached by web proxies and browsers. #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub expiration: Option, /// HTTP headers to use for all responses from these URLs. #[serde(rename="httpHeaders")] pub http_headers: Option>, /// 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. #[serde(rename="mimeType")] pub mime_type: Option, /// 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. pub path: Option, /// Whether this handler should match the request if the file referenced by the handler does not exist. #[serde(rename="requireMatchingFile")] pub require_matching_file: Option, /// Regular expression that matches the file paths for all files that should be referenced by this handler. #[serde(rename="uploadPathRegex")] pub upload_path_regex: Option, } impl client::Part for StaticFilesHandler {} /// 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). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Status { /// The status code, which should be an enum value of google.rpc.Code. pub code: Option, /// A list of messages that carry the error details. There is a common set of message types for APIs to use. pub details: Option>>, /// 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. pub message: Option, } impl client::Part for Status {} /// Traffic routing configuration for versions within a single service. Traffic splits define how traffic directed to the service is assigned to versions. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TrafficSplit { /// 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. pub allocations: Option>, /// 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. #[serde(rename="shardBy")] pub shard_by: Option, } impl client::Part for TrafficSplit {} /// Rules to match an HTTP request and dispatch that request to a service. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlDispatchRule { /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*". pub domain: Option, /// 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. pub path: Option, /// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default. pub service: Option, } impl client::Part for UrlDispatchRule {} /// 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. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlMap { /// Uses API Endpoints to handle requests. #[serde(rename="apiEndpoint")] pub api_endpoint: Option, /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, /// Level of login required to access this resource. Not supported for Node.js in the App Engine standard environment. pub login: Option, /// 30x code to use when performing redirects for the secure field. Defaults to 302. #[serde(rename="redirectHttpResponseCode")] pub redirect_http_response_code: Option, /// 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". pub script: Option, /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, /// Returns the contents of a file, such as an image, as the response. #[serde(rename="staticFiles")] pub static_files: Option, /// 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. #[serde(rename="urlRegex")] pub url_regex: Option, } impl client::Part for UrlMap {} /// A Version resource is a specific set of source code and configuration files that are deployed into a service. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services versions create apps](AppServiceVersionCreateCall) (request) /// * [services versions get apps](AppServiceVersionGetCall) (response) /// * [services versions patch apps](AppServiceVersionPatchCall) (request) #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Version { /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/endpoints).Only returned in GET requests if view=FULL is set. #[serde(rename="apiConfig")] pub api_config: Option, /// Allows App Engine second generation runtimes to access the legacy bundled services. #[serde(rename="appEngineApis")] pub app_engine_apis: Option, /// 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. #[serde(rename="automaticScaling")] pub automatic_scaling: Option, /// 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. #[serde(rename="basicScaling")] pub basic_scaling: Option, /// Metadata settings that are supplied to this version to enable beta runtime features. #[serde(rename="betaSettings")] pub beta_settings: Option>, /// Environment variables available to the build environment.Only returned in GET requests if view=FULL is set. #[serde(rename="buildEnvVariables")] pub build_env_variables: Option>, /// Time that this version was created.@OutputOnly #[serde(rename="createTime")] pub create_time: Option>, /// Email address of the user who created this version.@OutputOnly #[serde(rename="createdBy")] pub created_by: Option, /// 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. #[serde(rename="defaultExpiration")] #[serde_as(as = "Option<::client::serde::duration::Wrapper>")] pub default_expiration: Option, /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set. pub deployment: Option, /// Total size in bytes of all the files that are included in this version and currently hosted on the App Engine disk.@OutputOnly #[serde(rename="diskUsageBytes")] #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")] pub disk_usage_bytes: Option, /// 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. #[serde(rename="endpointsApiService")] pub endpoints_api_service: Option, /// The entrypoint for the application. pub entrypoint: Option, /// App Engine execution environment for this version.Defaults to standard. pub env: Option, /// Environment variables available to the application.Only returned in GET requests if view=FULL is set. #[serde(rename="envVariables")] pub env_variables: Option>, /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set. #[serde(rename="errorHandlers")] pub error_handlers: Option>, /// 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. pub handlers: Option>, /// Configures health checking for instances. Unhealthy instances are stopped and replaced with new instances. Only applicable in the App Engine flexible environment.Only returned in GET requests if view=FULL is set. #[serde(rename="healthCheck")] pub health_check: Option, /// 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-". pub id: Option, /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. #[serde(rename="inboundServices")] pub inbound_services: Option>, /// 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. #[serde(rename="instanceClass")] pub instance_class: Option, /// Configuration for third-party Python runtime libraries that are required by the application.Only returned in GET requests if view=FULL is set. pub libraries: Option>, /// Configures liveness health checking for instances. Unhealthy instances are stopped and replaced with new instancesOnly returned in GET requests if view=FULL is set. #[serde(rename="livenessCheck")] pub liveness_check: Option, /// 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". #[serde(rename="manualScaling")] pub manual_scaling: Option, /// Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly pub name: Option, /// Extra network settings. Only applicable in the App Engine flexible environment. pub network: Option, /// 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. #[serde(rename="nobuildFilesRegex")] pub nobuild_files_regex: Option, /// Configures readiness health checking for instances. Unhealthy instances are not put into the backend traffic rotation.Only returned in GET requests if view=FULL is set. #[serde(rename="readinessCheck")] pub readiness_check: Option, /// Machine resources for this version. Only applicable in the App Engine flexible environment. pub resources: Option, /// Desired runtime. Example: python27. pub runtime: Option, /// 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 #[serde(rename="runtimeApiVersion")] pub runtime_api_version: Option, /// The channel of the runtime to use. Only available for some runtimes. Defaults to the default channel. #[serde(rename="runtimeChannel")] pub runtime_channel: Option, /// The path or name of the app's main executable. #[serde(rename="runtimeMainExecutablePath")] pub runtime_main_executable_path: Option, /// 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. #[serde(rename="serviceAccount")] pub service_account: Option, /// 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. #[serde(rename="servingStatus")] pub serving_status: Option, /// Whether multiple requests can be dispatched to this version at once. pub threadsafe: Option, /// Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com"@OutputOnly #[serde(rename="versionUrl")] pub version_url: Option, /// Whether to deploy this version in a container on a virtual machine. pub vm: Option, /// Enables VPC connectivity for standard apps. #[serde(rename="vpcAccessConnector")] pub vpc_access_connector: Option, /// The Google Compute Engine zones that are supported by this version in the App Engine flexible environment. Deprecated. pub zones: Option>, } impl client::RequestValue for Version {} impl client::ResponseResult for Version {} /// Volumes mounted within the app container. Only applicable in the App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Volume { /// Unique name for the volume. pub name: Option, /// Volume size in gigabytes. #[serde(rename="sizeGb")] pub size_gb: Option, /// Underlying volume type, e.g. 'tmpfs'. #[serde(rename="volumeType")] pub volume_type: Option, } impl client::Part for Volume {} /// VPC access connector specification. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct VpcAccessConnector { /// The egress setting for the connector, controlling what traffic is diverted through it. #[serde(rename="egressSetting")] pub egress_setting: Option, /// Full Serverless VPC Access Connector name e.g. /projects/my-project/locations/us-central1/connectors/c1. pub name: Option, } impl client::Part for VpcAccessConnector {} /// The zip file information for a zip deployment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ZipInfo { /// 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. #[serde(rename="filesCount")] pub files_count: Option, /// 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//'. #[serde(rename="sourceUrl")] pub source_url: Option, } impl client::Part for ZipInfo {} // ################### // MethodBuilders ### // ################# /// A builder providing access to all methods supported on *app* resources. /// It is not used directly, but through the [`Appengine`] hub. /// /// # Example /// /// Instantiate a resource builder /// /// ```test_harness,no_run /// extern crate hyper; /// extern crate hyper_rustls; /// extern crate google_appengine1 as appengine1; /// /// # async fn dox() { /// use std::default::Default; /// use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// let secret: oauth2::ApplicationSecret = Default::default(); /// let auth = oauth2::InstalledFlowAuthenticator::builder( /// secret, /// oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// ).build().await.unwrap(); /// let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* /// // 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(...)`, `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(...)` /// // to build up your call. /// let rb = hub.apps(); /// # } /// ``` pub struct AppMethods<'a, S> where S: 'a { hub: &'a Appengine, } impl<'a, S> client::MethodsBuilder for AppMethods<'a, S> {} impl<'a, S> AppMethods<'a, S> { /// Create a builder to help you perform the following task: /// /// Uploads the specified SSL certificate. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp. pub fn authorized_certificates_create(&self, request: AuthorizedCertificate, apps_id: &str) -> AppAuthorizedCertificateCreateCall<'a, S> { AppAuthorizedCertificateCreateCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Deletes the specified SSL certificate. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345. /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`. pub fn authorized_certificates_delete(&self, apps_id: &str, authorized_certificates_id: &str) -> AppAuthorizedCertificateDeleteCall<'a, S> { AppAuthorizedCertificateDeleteCall { hub: self.hub, _apps_id: apps_id.to_string(), _authorized_certificates_id: authorized_certificates_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets the specified SSL certificate. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345. /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`. pub fn authorized_certificates_get(&self, apps_id: &str, authorized_certificates_id: &str) -> AppAuthorizedCertificateGetCall<'a, S> { AppAuthorizedCertificateGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _authorized_certificates_id: authorized_certificates_id.to_string(), _view: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists all SSL certificates the user is authorized to administer. /// /// # Arguments /// /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp. pub fn authorized_certificates_list(&self, apps_id: &str) -> AppAuthorizedCertificateListCall<'a, S> { AppAuthorizedCertificateListCall { hub: self.hub, _apps_id: apps_id.to_string(), _view: Default::default(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345. /// * `authorizedCertificatesId` - Part of `name`. See documentation of `appsId`. pub fn authorized_certificates_patch(&self, request: AuthorizedCertificate, apps_id: &str, authorized_certificates_id: &str) -> AppAuthorizedCertificatePatchCall<'a, S> { AppAuthorizedCertificatePatchCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _authorized_certificates_id: authorized_certificates_id.to_string(), _update_mask: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists all domains the user is authorized to administer. /// /// # Arguments /// /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp. pub fn authorized_domains_list(&self, apps_id: &str) -> AppAuthorizedDomainListCall<'a, S> { AppAuthorizedDomainListCall { hub: self.hub, _apps_id: apps_id.to_string(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp. pub fn domain_mappings_create(&self, request: DomainMapping, apps_id: &str) -> AppDomainMappingCreateCall<'a, S> { AppDomainMappingCreateCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _override_strategy: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com. /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`. pub fn domain_mappings_delete(&self, apps_id: &str, domain_mappings_id: &str) -> AppDomainMappingDeleteCall<'a, S> { AppDomainMappingDeleteCall { hub: self.hub, _apps_id: apps_id.to_string(), _domain_mappings_id: domain_mappings_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets the specified domain mapping. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/domainMappings/example.com. /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`. pub fn domain_mappings_get(&self, apps_id: &str, domain_mappings_id: &str) -> AppDomainMappingGetCall<'a, S> { AppDomainMappingGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _domain_mappings_id: domain_mappings_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists the domain mappings on an application. /// /// # Arguments /// /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp. pub fn domain_mappings_list(&self, apps_id: &str) -> AppDomainMappingListCall<'a, S> { AppDomainMappingListCall { hub: self.hub, _apps_id: apps_id.to_string(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/domainMappings/example.com. /// * `domainMappingsId` - Part of `name`. See documentation of `appsId`. pub fn domain_mappings_patch(&self, request: DomainMapping, apps_id: &str, domain_mappings_id: &str) -> AppDomainMappingPatchCall<'a, S> { AppDomainMappingPatchCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _domain_mappings_id: domain_mappings_id.to_string(), _update_mask: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the Firewall collection to set. Example: apps/myapp/firewall/ingressRules. pub fn firewall_ingress_rules_batch_update(&self, request: BatchUpdateIngressRulesRequest, apps_id: &str) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> { AppFirewallIngressRuleBatchUpdateCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Creates a firewall rule for the application. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `parent`. Name of the parent Firewall collection in which to create a new rule. Example: apps/myapp/firewall/ingressRules. pub fn firewall_ingress_rules_create(&self, request: FirewallRule, apps_id: &str) -> AppFirewallIngressRuleCreateCall<'a, S> { AppFirewallIngressRuleCreateCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Deletes the specified firewall rule. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the Firewall resource to delete. Example: apps/myapp/firewall/ingressRules/100. /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`. pub fn firewall_ingress_rules_delete(&self, apps_id: &str, ingress_rules_id: &str) -> AppFirewallIngressRuleDeleteCall<'a, S> { AppFirewallIngressRuleDeleteCall { hub: self.hub, _apps_id: apps_id.to_string(), _ingress_rules_id: ingress_rules_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets the specified firewall rule. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the Firewall resource to retrieve. Example: apps/myapp/firewall/ingressRules/100. /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`. pub fn firewall_ingress_rules_get(&self, apps_id: &str, ingress_rules_id: &str) -> AppFirewallIngressRuleGetCall<'a, S> { AppFirewallIngressRuleGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _ingress_rules_id: ingress_rules_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists the firewall rules of an application. /// /// # Arguments /// /// * `appsId` - Part of `parent`. Name of the Firewall collection to retrieve. Example: apps/myapp/firewall/ingressRules. pub fn firewall_ingress_rules_list(&self, apps_id: &str) -> AppFirewallIngressRuleListCall<'a, S> { AppFirewallIngressRuleListCall { hub: self.hub, _apps_id: apps_id.to_string(), _page_token: Default::default(), _page_size: Default::default(), _matching_address: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Updates the specified firewall rule. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the Firewall resource to update. Example: apps/myapp/firewall/ingressRules/100. /// * `ingressRulesId` - Part of `name`. See documentation of `appsId`. pub fn firewall_ingress_rules_patch(&self, request: FirewallRule, apps_id: &str, ingress_rules_id: &str) -> AppFirewallIngressRulePatchCall<'a, S> { AppFirewallIngressRulePatchCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _ingress_rules_id: ingress_rules_id.to_string(), _update_mask: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets information about a location. /// /// # Arguments /// /// * `appsId` - Part of `name`. Resource name for the location. /// * `locationsId` - Part of `name`. See documentation of `appsId`. pub fn locations_get(&self, apps_id: &str, locations_id: &str) -> AppLocationGetCall<'a, S> { AppLocationGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _locations_id: locations_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists information about the supported locations for this service. /// /// # Arguments /// /// * `appsId` - Part of `name`. The resource that owns the locations collection, if applicable. pub fn locations_list(&self, apps_id: &str) -> AppLocationListCall<'a, S> { AppLocationListCall { hub: self.hub, _apps_id: apps_id.to_string(), _page_token: Default::default(), _page_size: Default::default(), _filter: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `appsId` - Part of `name`. The name of the operation resource. /// * `operationsId` - Part of `name`. See documentation of `appsId`. pub fn operations_get(&self, apps_id: &str, operations_id: &str) -> AppOperationGetCall<'a, S> { AppOperationGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _operations_id: operations_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id. /// /// # Arguments /// /// * `appsId` - Part of `name`. The name of the operation's parent resource. pub fn operations_list(&self, apps_id: &str) -> AppOperationListCall<'a, S> { AppOperationListCall { hub: self.hub, _apps_id: apps_id.to_string(), _page_token: Default::default(), _page_size: Default::default(), _filter: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_instances_debug(&self, request: DebugInstanceRequest, apps_id: &str, services_id: &str, versions_id: &str, instances_id: &str) -> AppServiceVersionInstanceDebugCall<'a, S> { AppServiceVersionInstanceDebugCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _versions_id: versions_id.to_string(), _instances_id: instances_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_instances_delete(&self, apps_id: &str, services_id: &str, versions_id: &str, instances_id: &str) -> AppServiceVersionInstanceDeleteCall<'a, S> { AppServiceVersionInstanceDeleteCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _versions_id: versions_id.to_string(), _instances_id: instances_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets instance information. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_instances_get(&self, apps_id: &str, services_id: &str, versions_id: &str, instances_id: &str) -> AppServiceVersionInstanceGetCall<'a, S> { AppServiceVersionInstanceGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _versions_id: versions_id.to_string(), _instances_id: instances_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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). /// /// # Arguments /// /// * `appsId` - Part of `parent`. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `parent`. See documentation of `appsId`. /// * `versionsId` - Part of `parent`. See documentation of `appsId`. pub fn services_versions_instances_list(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionInstanceListCall<'a, S> { AppServiceVersionInstanceListCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _versions_id: versions_id.to_string(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Deploys code and resource files to a new version. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `parent`. Name of the parent resource to create this version under. Example: apps/myapp/services/default. /// * `servicesId` - Part of `parent`. See documentation of `appsId`. pub fn services_versions_create(&self, request: Version, apps_id: &str, services_id: &str) -> AppServiceVersionCreateCall<'a, S> { AppServiceVersionCreateCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Deletes an existing Version resource. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_delete(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionDeleteCall<'a, S> { AppServiceVersionDeleteCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _versions_id: versions_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_get(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionGetCall<'a, S> { AppServiceVersionGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _versions_id: versions_id.to_string(), _view: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists the versions of a service. /// /// # Arguments /// /// * `appsId` - Part of `parent`. Name of the parent Service resource. Example: apps/myapp/services/default. /// * `servicesId` - Part of `parent`. See documentation of `appsId`. pub fn services_versions_list(&self, apps_id: &str, services_id: &str) -> AppServiceVersionListCall<'a, S> { AppServiceVersionListCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _view: Default::default(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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) /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_patch(&self, request: Version, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionPatchCall<'a, S> { AppServiceVersionPatchCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _versions_id: versions_id.to_string(), _update_mask: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Deletes the specified service and all enclosed versions. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_delete(&self, apps_id: &str, services_id: &str) -> AppServiceDeleteCall<'a, S> { AppServiceDeleteCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets the current configuration of the specified service. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_get(&self, apps_id: &str, services_id: &str) -> AppServiceGetCall<'a, S> { AppServiceGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists all the services in the application. /// /// # Arguments /// /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp. pub fn services_list(&self, apps_id: &str) -> AppServiceListCall<'a, S> { AppServiceListCall { hub: self.hub, _apps_id: apps_id.to_string(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Updates the configuration of the specified service. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_patch(&self, request: Service, apps_id: &str, services_id: &str) -> AppServicePatchCall<'a, S> { AppServicePatchCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _services_id: services_id.to_string(), _update_mask: Default::default(), _migrate_traffic: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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/). /// /// # Arguments /// /// * `request` - No description provided. pub fn create(&self, request: Application) -> AppCreateCall<'a, S> { AppCreateCall { hub: self.hub, _request: request, _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets information about an application. /// /// # Arguments /// /// * `appsId` - Part of `name`. Name of the Application resource to get. Example: apps/myapp. pub fn get(&self, apps_id: &str) -> AppGetCall<'a, S> { AppGetCall { hub: self.hub, _apps_id: apps_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the Application resource to update. Example: apps/myapp. pub fn patch(&self, request: Application, apps_id: &str) -> AppPatchCall<'a, S> { AppPatchCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _update_mask: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// 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. /// /// # Arguments /// /// * `request` - No description provided. /// * `appsId` - Part of `name`. Name of the application to repair. Example: apps/myapp pub fn repair(&self, request: RepairApplicationRequest, apps_id: &str) -> AppRepairCall<'a, S> { AppRepairCall { hub: self.hub, _request: request, _apps_id: apps_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } } /// A builder providing access to all methods supported on *project* resources. /// It is not used directly, but through the [`Appengine`] hub. /// /// # Example /// /// Instantiate a resource builder /// /// ```test_harness,no_run /// extern crate hyper; /// extern crate hyper_rustls; /// extern crate google_appengine1 as appengine1; /// /// # async fn dox() { /// use std::default::Default; /// use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// let secret: oauth2::ApplicationSecret = Default::default(); /// let auth = oauth2::InstalledFlowAuthenticator::builder( /// secret, /// oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// ).build().await.unwrap(); /// let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* /// // like `locations_applications_get(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } /// ``` pub struct ProjectMethods<'a, S> where S: 'a { hub: &'a Appengine, } impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {} impl<'a, S> ProjectMethods<'a, S> { /// Create a builder to help you perform the following task: /// /// Gets information about an application. /// /// # Arguments /// /// * `projectsId` - Part of `name`. Name of the Application resource to get. Example: apps/myapp. /// * `locationsId` - Part of `name`. See documentation of `projectsId`. /// * `applicationsId` - Part of `name`. See documentation of `projectsId`. pub fn locations_applications_get(&self, projects_id: &str, locations_id: &str, applications_id: &str) -> ProjectLocationApplicationGetCall<'a, S> { ProjectLocationApplicationGetCall { hub: self.hub, _projects_id: projects_id.to_string(), _locations_id: locations_id.to_string(), _applications_id: applications_id.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } } // ################### // CallBuilders ### // ################# /// Uploads the specified SSL certificate. /// /// A builder for the *authorizedCertificates.create* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::AuthorizedCertificate; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = AuthorizedCertificate::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().authorized_certificates_create(req, "appsId") /// .doit().await; /// # } /// ``` pub struct AppAuthorizedCertificateCreateCall<'a, S> where S: 'a { hub: &'a Appengine, _request: AuthorizedCertificate, _apps_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppAuthorizedCertificateCreateCall<'a, S> {} impl<'a, S> AppAuthorizedCertificateCreateCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, AuthorizedCertificate)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.authorizedCertificates.create", http_method: hyper::Method::POST }); for &field in ["alt", "appsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: AuthorizedCertificate) -> AppAuthorizedCertificateCreateCall<'a, S> { self._request = new_value; self } /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateCreateCall<'a, S> { self._apps_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppAuthorizedCertificateCreateCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppAuthorizedCertificateCreateCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppAuthorizedCertificateCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppAuthorizedCertificateCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppAuthorizedCertificateCreateCall<'a, S> { self._scopes.clear(); self } } /// Deletes the specified SSL certificate. /// /// A builder for the *authorizedCertificates.delete* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().authorized_certificates_delete("appsId", "authorizedCertificatesId") /// .doit().await; /// # } /// ``` pub struct AppAuthorizedCertificateDeleteCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _authorized_certificates_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppAuthorizedCertificateDeleteCall<'a, S> {} impl<'a, S> AppAuthorizedCertificateDeleteCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Empty)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.authorizedCertificates.delete", http_method: hyper::Method::DELETE }); for &field in ["alt", "appsId", "authorizedCertificatesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("authorizedCertificatesId", self._authorized_certificates_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{authorizedCertificatesId}", "authorizedCertificatesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["authorizedCertificatesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource to delete. Example: apps/myapp/authorizedCertificates/12345. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateDeleteCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *authorized certificates id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn authorized_certificates_id(mut self, new_value: &str) -> AppAuthorizedCertificateDeleteCall<'a, S> { self._authorized_certificates_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppAuthorizedCertificateDeleteCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppAuthorizedCertificateDeleteCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppAuthorizedCertificateDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppAuthorizedCertificateDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppAuthorizedCertificateDeleteCall<'a, S> { self._scopes.clear(); self } } /// Gets the specified SSL certificate. /// /// A builder for the *authorizedCertificates.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().authorized_certificates_get("appsId", "authorizedCertificatesId") /// .view("dolor") /// .doit().await; /// # } /// ``` pub struct AppAuthorizedCertificateGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _authorized_certificates_id: String, _view: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppAuthorizedCertificateGetCall<'a, S> {} impl<'a, S> AppAuthorizedCertificateGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, AuthorizedCertificate)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.authorizedCertificates.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "authorizedCertificatesId", "view"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("authorizedCertificatesId", self._authorized_certificates_id); if let Some(value) = self._view.as_ref() { params.push("view", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{authorizedCertificatesId}", "authorizedCertificatesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["authorizedCertificatesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/authorizedCertificates/12345. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *authorized certificates id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn authorized_certificates_id(mut self, new_value: &str) -> AppAuthorizedCertificateGetCall<'a, S> { self._authorized_certificates_id = new_value.to_string(); self } /// Controls the set of fields returned in the GET response. /// /// Sets the *view* query property to the given value. pub fn view(mut self, new_value: &str) -> AppAuthorizedCertificateGetCall<'a, S> { self._view = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppAuthorizedCertificateGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppAuthorizedCertificateGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppAuthorizedCertificateGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppAuthorizedCertificateGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppAuthorizedCertificateGetCall<'a, S> { self._scopes.clear(); self } } /// Lists all SSL certificates the user is authorized to administer. /// /// A builder for the *authorizedCertificates.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().authorized_certificates_list("appsId") /// .view("ipsum") /// .page_token("invidunt") /// .page_size(-47) /// .doit().await; /// # } /// ``` pub struct AppAuthorizedCertificateListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _view: Option, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppAuthorizedCertificateListCall<'a, S> {} impl<'a, S> AppAuthorizedCertificateListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListAuthorizedCertificatesResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.authorizedCertificates.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "view", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._view.as_ref() { params.push("view", value); } if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Controls the set of fields returned in the LIST response. /// /// Sets the *view* query property to the given value. pub fn view(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, S> { self._view = Some(new_value.to_string()); self } /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppAuthorizedCertificateListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// Maximum results to return per page. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppAuthorizedCertificateListCall<'a, S> { self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppAuthorizedCertificateListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppAuthorizedCertificateListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppAuthorizedCertificateListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppAuthorizedCertificateListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppAuthorizedCertificateListCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *authorizedCertificates.patch* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::AuthorizedCertificate; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = AuthorizedCertificate::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().authorized_certificates_patch(req, "appsId", "authorizedCertificatesId") /// .update_mask(&Default::default()) /// .doit().await; /// # } /// ``` pub struct AppAuthorizedCertificatePatchCall<'a, S> where S: 'a { hub: &'a Appengine, _request: AuthorizedCertificate, _apps_id: String, _authorized_certificates_id: String, _update_mask: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppAuthorizedCertificatePatchCall<'a, S> {} impl<'a, S> AppAuthorizedCertificatePatchCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, AuthorizedCertificate)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.authorizedCertificates.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "appsId", "authorizedCertificatesId", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("authorizedCertificatesId", self._authorized_certificates_id); if let Some(value) = self._update_mask.as_ref() { params.push("updateMask", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedCertificates/{authorizedCertificatesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{authorizedCertificatesId}", "authorizedCertificatesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["authorizedCertificatesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::PATCH) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: AuthorizedCertificate) -> AppAuthorizedCertificatePatchCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the resource to update. Example: apps/myapp/authorizedCertificates/12345. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedCertificatePatchCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *authorized certificates id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn authorized_certificates_id(mut self, new_value: &str) -> AppAuthorizedCertificatePatchCall<'a, S> { self._authorized_certificates_id = new_value.to_string(); self } /// Standard field mask for the set of fields to be updated. Updates are only supported on the certificate_raw_data and display_name fields. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: client::FieldMask) -> AppAuthorizedCertificatePatchCall<'a, S> { self._update_mask = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppAuthorizedCertificatePatchCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppAuthorizedCertificatePatchCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppAuthorizedCertificatePatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppAuthorizedCertificatePatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppAuthorizedCertificatePatchCall<'a, S> { self._scopes.clear(); self } } /// Lists all domains the user is authorized to administer. /// /// A builder for the *authorizedDomains.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().authorized_domains_list("appsId") /// .page_token("ut") /// .page_size(-12) /// .doit().await; /// # } /// ``` pub struct AppAuthorizedDomainListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppAuthorizedDomainListCall<'a, S> {} impl<'a, S> AppAuthorizedDomainListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListAuthorizedDomainsResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.authorizedDomains.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/authorizedDomains"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppAuthorizedDomainListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppAuthorizedDomainListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// Maximum results to return per page. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppAuthorizedDomainListCall<'a, S> { self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppAuthorizedDomainListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppAuthorizedDomainListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppAuthorizedDomainListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppAuthorizedDomainListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppAuthorizedDomainListCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *domainMappings.create* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::DomainMapping; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = DomainMapping::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().domain_mappings_create(req, "appsId") /// .override_strategy("est") /// .doit().await; /// # } /// ``` pub struct AppDomainMappingCreateCall<'a, S> where S: 'a { hub: &'a Appengine, _request: DomainMapping, _apps_id: String, _override_strategy: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppDomainMappingCreateCall<'a, S> {} impl<'a, S> AppDomainMappingCreateCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.domainMappings.create", http_method: hyper::Method::POST }); for &field in ["alt", "appsId", "overrideStrategy"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._override_strategy.as_ref() { params.push("overrideStrategy", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: DomainMapping) -> AppDomainMappingCreateCall<'a, S> { self._request = new_value; self } /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingCreateCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Whether the domain creation should override any existing mappings for this domain. By default, overrides are rejected. /// /// Sets the *override strategy* query property to the given value. pub fn override_strategy(mut self, new_value: &str) -> AppDomainMappingCreateCall<'a, S> { self._override_strategy = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppDomainMappingCreateCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppDomainMappingCreateCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppDomainMappingCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppDomainMappingCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppDomainMappingCreateCall<'a, S> { self._scopes.clear(); self } } /// Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a DomainMapping resource. /// /// A builder for the *domainMappings.delete* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().domain_mappings_delete("appsId", "domainMappingsId") /// .doit().await; /// # } /// ``` pub struct AppDomainMappingDeleteCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _domain_mappings_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppDomainMappingDeleteCall<'a, S> {} impl<'a, S> AppDomainMappingDeleteCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.domainMappings.delete", http_method: hyper::Method::DELETE }); for &field in ["alt", "appsId", "domainMappingsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("domainMappingsId", self._domain_mappings_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{domainMappingsId}", "domainMappingsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["domainMappingsId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource to delete. Example: apps/myapp/domainMappings/example.com. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingDeleteCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *domain mappings id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingDeleteCall<'a, S> { self._domain_mappings_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppDomainMappingDeleteCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppDomainMappingDeleteCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppDomainMappingDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppDomainMappingDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppDomainMappingDeleteCall<'a, S> { self._scopes.clear(); self } } /// Gets the specified domain mapping. /// /// A builder for the *domainMappings.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().domain_mappings_get("appsId", "domainMappingsId") /// .doit().await; /// # } /// ``` pub struct AppDomainMappingGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _domain_mappings_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppDomainMappingGetCall<'a, S> {} impl<'a, S> AppDomainMappingGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, DomainMapping)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.domainMappings.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "domainMappingsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("domainMappingsId", self._domain_mappings_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{domainMappingsId}", "domainMappingsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["domainMappingsId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/domainMappings/example.com. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *domain mappings id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingGetCall<'a, S> { self._domain_mappings_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppDomainMappingGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppDomainMappingGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppDomainMappingGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppDomainMappingGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppDomainMappingGetCall<'a, S> { self._scopes.clear(); self } } /// Lists the domain mappings on an application. /// /// A builder for the *domainMappings.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().domain_mappings_list("appsId") /// .page_token("dolor") /// .page_size(-56) /// .doit().await; /// # } /// ``` pub struct AppDomainMappingListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppDomainMappingListCall<'a, S> {} impl<'a, S> AppDomainMappingListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListDomainMappingsResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.domainMappings.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppDomainMappingListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// Maximum results to return per page. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppDomainMappingListCall<'a, S> { self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppDomainMappingListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppDomainMappingListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppDomainMappingListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppDomainMappingListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppDomainMappingListCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *domainMappings.patch* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::DomainMapping; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = DomainMapping::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().domain_mappings_patch(req, "appsId", "domainMappingsId") /// .update_mask(&Default::default()) /// .doit().await; /// # } /// ``` pub struct AppDomainMappingPatchCall<'a, S> where S: 'a { hub: &'a Appengine, _request: DomainMapping, _apps_id: String, _domain_mappings_id: String, _update_mask: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppDomainMappingPatchCall<'a, S> {} impl<'a, S> AppDomainMappingPatchCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.domainMappings.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "appsId", "domainMappingsId", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("domainMappingsId", self._domain_mappings_id); if let Some(value) = self._update_mask.as_ref() { params.push("updateMask", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/domainMappings/{domainMappingsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{domainMappingsId}", "domainMappingsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["domainMappingsId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::PATCH) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: DomainMapping) -> AppDomainMappingPatchCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the resource to update. Example: apps/myapp/domainMappings/example.com. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppDomainMappingPatchCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *domain mappings id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn domain_mappings_id(mut self, new_value: &str) -> AppDomainMappingPatchCall<'a, S> { self._domain_mappings_id = new_value.to_string(); self } /// Required. Standard field mask for the set of fields to be updated. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: client::FieldMask) -> AppDomainMappingPatchCall<'a, S> { self._update_mask = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppDomainMappingPatchCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppDomainMappingPatchCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppDomainMappingPatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppDomainMappingPatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppDomainMappingPatchCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *firewall.ingressRules.batchUpdate* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::BatchUpdateIngressRulesRequest; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = BatchUpdateIngressRulesRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().firewall_ingress_rules_batch_update(req, "appsId") /// .doit().await; /// # } /// ``` pub struct AppFirewallIngressRuleBatchUpdateCall<'a, S> where S: 'a { hub: &'a Appengine, _request: BatchUpdateIngressRulesRequest, _apps_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppFirewallIngressRuleBatchUpdateCall<'a, S> {} impl<'a, S> AppFirewallIngressRuleBatchUpdateCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, BatchUpdateIngressRulesResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.firewall.ingressRules.batchUpdate", http_method: hyper::Method::POST }); for &field in ["alt", "appsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules:batchUpdate"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: BatchUpdateIngressRulesRequest) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the Firewall collection to set. Example: apps/myapp/firewall/ingressRules. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> { self._apps_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppFirewallIngressRuleBatchUpdateCall<'a, S> { self._scopes.clear(); self } } /// Creates a firewall rule for the application. /// /// A builder for the *firewall.ingressRules.create* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::FirewallRule; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = FirewallRule::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().firewall_ingress_rules_create(req, "appsId") /// .doit().await; /// # } /// ``` pub struct AppFirewallIngressRuleCreateCall<'a, S> where S: 'a { hub: &'a Appengine, _request: FirewallRule, _apps_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppFirewallIngressRuleCreateCall<'a, S> {} impl<'a, S> AppFirewallIngressRuleCreateCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, FirewallRule)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.firewall.ingressRules.create", http_method: hyper::Method::POST }); for &field in ["alt", "appsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: FirewallRule) -> AppFirewallIngressRuleCreateCall<'a, S> { self._request = new_value; self } /// Part of `parent`. Name of the parent Firewall collection in which to create a new rule. Example: apps/myapp/firewall/ingressRules. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleCreateCall<'a, S> { self._apps_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppFirewallIngressRuleCreateCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppFirewallIngressRuleCreateCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppFirewallIngressRuleCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppFirewallIngressRuleCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppFirewallIngressRuleCreateCall<'a, S> { self._scopes.clear(); self } } /// Deletes the specified firewall rule. /// /// A builder for the *firewall.ingressRules.delete* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().firewall_ingress_rules_delete("appsId", "ingressRulesId") /// .doit().await; /// # } /// ``` pub struct AppFirewallIngressRuleDeleteCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _ingress_rules_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppFirewallIngressRuleDeleteCall<'a, S> {} impl<'a, S> AppFirewallIngressRuleDeleteCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Empty)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.firewall.ingressRules.delete", http_method: hyper::Method::DELETE }); for &field in ["alt", "appsId", "ingressRulesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("ingressRulesId", self._ingress_rules_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{ingressRulesId}", "ingressRulesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["ingressRulesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the Firewall resource to delete. Example: apps/myapp/firewall/ingressRules/100. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleDeleteCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *ingress rules id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRuleDeleteCall<'a, S> { self._ingress_rules_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppFirewallIngressRuleDeleteCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppFirewallIngressRuleDeleteCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppFirewallIngressRuleDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppFirewallIngressRuleDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppFirewallIngressRuleDeleteCall<'a, S> { self._scopes.clear(); self } } /// Gets the specified firewall rule. /// /// A builder for the *firewall.ingressRules.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().firewall_ingress_rules_get("appsId", "ingressRulesId") /// .doit().await; /// # } /// ``` pub struct AppFirewallIngressRuleGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _ingress_rules_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppFirewallIngressRuleGetCall<'a, S> {} impl<'a, S> AppFirewallIngressRuleGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, FirewallRule)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.firewall.ingressRules.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "ingressRulesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("ingressRulesId", self._ingress_rules_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{ingressRulesId}", "ingressRulesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["ingressRulesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the Firewall resource to retrieve. Example: apps/myapp/firewall/ingressRules/100. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *ingress rules id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRuleGetCall<'a, S> { self._ingress_rules_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppFirewallIngressRuleGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppFirewallIngressRuleGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppFirewallIngressRuleGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppFirewallIngressRuleGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppFirewallIngressRuleGetCall<'a, S> { self._scopes.clear(); self } } /// Lists the firewall rules of an application. /// /// A builder for the *firewall.ingressRules.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().firewall_ingress_rules_list("appsId") /// .page_token("sed") /// .page_size(-24) /// .matching_address("et") /// .doit().await; /// # } /// ``` pub struct AppFirewallIngressRuleListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _page_token: Option, _page_size: Option, _matching_address: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppFirewallIngressRuleListCall<'a, S> {} impl<'a, S> AppFirewallIngressRuleListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListIngressRulesResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.firewall.ingressRules.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "pageToken", "pageSize", "matchingAddress"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } if let Some(value) = self._matching_address.as_ref() { params.push("matchingAddress", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `parent`. Name of the Firewall collection to retrieve. Example: apps/myapp/firewall/ingressRules. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// Maximum results to return per page. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppFirewallIngressRuleListCall<'a, S> { self._page_size = Some(new_value); self } /// 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. /// /// Sets the *matching address* query property to the given value. pub fn matching_address(mut self, new_value: &str) -> AppFirewallIngressRuleListCall<'a, S> { self._matching_address = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppFirewallIngressRuleListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppFirewallIngressRuleListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppFirewallIngressRuleListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppFirewallIngressRuleListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppFirewallIngressRuleListCall<'a, S> { self._scopes.clear(); self } } /// Updates the specified firewall rule. /// /// A builder for the *firewall.ingressRules.patch* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::FirewallRule; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = FirewallRule::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().firewall_ingress_rules_patch(req, "appsId", "ingressRulesId") /// .update_mask(&Default::default()) /// .doit().await; /// # } /// ``` pub struct AppFirewallIngressRulePatchCall<'a, S> where S: 'a { hub: &'a Appengine, _request: FirewallRule, _apps_id: String, _ingress_rules_id: String, _update_mask: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppFirewallIngressRulePatchCall<'a, S> {} impl<'a, S> AppFirewallIngressRulePatchCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, FirewallRule)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.firewall.ingressRules.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "appsId", "ingressRulesId", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("ingressRulesId", self._ingress_rules_id); if let Some(value) = self._update_mask.as_ref() { params.push("updateMask", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/firewall/ingressRules/{ingressRulesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{ingressRulesId}", "ingressRulesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["ingressRulesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::PATCH) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: FirewallRule) -> AppFirewallIngressRulePatchCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the Firewall resource to update. Example: apps/myapp/firewall/ingressRules/100. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppFirewallIngressRulePatchCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *ingress rules id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ingress_rules_id(mut self, new_value: &str) -> AppFirewallIngressRulePatchCall<'a, S> { self._ingress_rules_id = new_value.to_string(); self } /// Standard field mask for the set of fields to be updated. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: client::FieldMask) -> AppFirewallIngressRulePatchCall<'a, S> { self._update_mask = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppFirewallIngressRulePatchCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppFirewallIngressRulePatchCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppFirewallIngressRulePatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppFirewallIngressRulePatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppFirewallIngressRulePatchCall<'a, S> { self._scopes.clear(); self } } /// Gets information about a location. /// /// A builder for the *locations.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().locations_get("appsId", "locationsId") /// .doit().await; /// # } /// ``` pub struct AppLocationGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _locations_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppLocationGetCall<'a, S> {} impl<'a, S> AppLocationGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Location)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.locations.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "locationsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("locationsId", self._locations_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/locations/{locationsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["locationsId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Resource name for the location. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppLocationGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *locations id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn locations_id(mut self, new_value: &str) -> AppLocationGetCall<'a, S> { self._locations_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppLocationGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppLocationGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppLocationGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppLocationGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppLocationGetCall<'a, S> { self._scopes.clear(); self } } /// Lists information about the supported locations for this service. /// /// A builder for the *locations.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().locations_list("appsId") /// .page_token("et") /// .page_size(-28) /// .filter("amet.") /// .doit().await; /// # } /// ``` pub struct AppLocationListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _page_token: Option, _page_size: Option, _filter: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppLocationListCall<'a, S> {} impl<'a, S> AppLocationListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListLocationsResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.locations.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } if let Some(value) = self._filter.as_ref() { params.push("filter", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/locations"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. The resource that owns the locations collection, if applicable. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppLocationListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// A page token received from the next_page_token field in the response. Send that page token to receive the subsequent page. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppLocationListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// The maximum number of results to return. If not set, the service selects a default. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppLocationListCall<'a, S> { self._page_size = Some(new_value); self } /// 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). /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> AppLocationListCall<'a, S> { self._filter = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppLocationListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppLocationListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppLocationListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppLocationListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppLocationListCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *operations.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().operations_get("appsId", "operationsId") /// .doit().await; /// # } /// ``` pub struct AppOperationGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _operations_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppOperationGetCall<'a, S> {} impl<'a, S> AppOperationGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.operations.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "operationsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("operationsId", self._operations_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/operations/{operationsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["operationsId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. The name of the operation resource. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppOperationGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *operations id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operations_id(mut self, new_value: &str) -> AppOperationGetCall<'a, S> { self._operations_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppOperationGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppOperationGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppOperationGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppOperationGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppOperationGetCall<'a, S> { self._scopes.clear(); self } } /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id. /// /// A builder for the *operations.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().operations_list("appsId") /// .page_token("et") /// .page_size(-22) /// .filter("sadipscing") /// .doit().await; /// # } /// ``` pub struct AppOperationListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _page_token: Option, _page_size: Option, _filter: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppOperationListCall<'a, S> {} impl<'a, S> AppOperationListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListOperationsResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.operations.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } if let Some(value) = self._filter.as_ref() { params.push("filter", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/operations"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. The name of the operation's parent resource. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppOperationListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// The standard list page token. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppOperationListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// The standard list page size. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppOperationListCall<'a, S> { self._page_size = Some(new_value); self } /// The standard list filter. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> AppOperationListCall<'a, S> { self._filter = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppOperationListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppOperationListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppOperationListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppOperationListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppOperationListCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *services.versions.instances.debug* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::DebugInstanceRequest; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = DebugInstanceRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_instances_debug(req, "appsId", "servicesId", "versionsId", "instancesId") /// .doit().await; /// # } /// ``` pub struct AppServiceVersionInstanceDebugCall<'a, S> where S: 'a { hub: &'a Appengine, _request: DebugInstanceRequest, _apps_id: String, _services_id: String, _versions_id: String, _instances_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionInstanceDebugCall<'a, S> {} impl<'a, S> AppServiceVersionInstanceDebugCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.instances.debug", http_method: hyper::Method::POST }); for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.push("versionsId", self._versions_id); params.push("instancesId", self._instances_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}:debug"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId"), ("{instancesId}", "instancesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: DebugInstanceRequest) -> AppServiceVersionInstanceDebugCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, S> { self._services_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *versions id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, S> { self._versions_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *instances id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceDebugCall<'a, S> { self._instances_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionInstanceDebugCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionInstanceDebugCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionInstanceDebugCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionInstanceDebugCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionInstanceDebugCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *services.versions.instances.delete* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_instances_delete("appsId", "servicesId", "versionsId", "instancesId") /// .doit().await; /// # } /// ``` pub struct AppServiceVersionInstanceDeleteCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _versions_id: String, _instances_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionInstanceDeleteCall<'a, S> {} impl<'a, S> AppServiceVersionInstanceDeleteCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.instances.delete", http_method: hyper::Method::DELETE }); for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.push("versionsId", self._versions_id); params.push("instancesId", self._instances_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId"), ("{instancesId}", "instancesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, S> { self._services_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *versions id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, S> { self._versions_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *instances id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceDeleteCall<'a, S> { self._instances_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionInstanceDeleteCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionInstanceDeleteCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionInstanceDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionInstanceDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionInstanceDeleteCall<'a, S> { self._scopes.clear(); self } } /// Gets instance information. /// /// A builder for the *services.versions.instances.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_instances_get("appsId", "servicesId", "versionsId", "instancesId") /// .doit().await; /// # } /// ``` pub struct AppServiceVersionInstanceGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _versions_id: String, _instances_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionInstanceGetCall<'a, S> {} impl<'a, S> AppServiceVersionInstanceGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Instance)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.instances.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.push("versionsId", self._versions_id); params.push("instancesId", self._instances_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId"), ("{instancesId}", "instancesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["instancesId", "versionsId", "servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, S> { self._services_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *versions id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, S> { self._versions_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *instances id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instances_id(mut self, new_value: &str) -> AppServiceVersionInstanceGetCall<'a, S> { self._instances_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionInstanceGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionInstanceGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionInstanceGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionInstanceGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionInstanceGetCall<'a, S> { self._scopes.clear(); self } } /// 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). /// /// A builder for the *services.versions.instances.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_instances_list("appsId", "servicesId", "versionsId") /// .page_token("consetetur") /// .page_size(-28) /// .doit().await; /// # } /// ``` pub struct AppServiceVersionInstanceListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _versions_id: String, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionInstanceListCall<'a, S> {} impl<'a, S> AppServiceVersionInstanceListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListInstancesResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.instances.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "servicesId", "versionsId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.push("versionsId", self._versions_id); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["versionsId", "servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `parent`. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `parent`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, S> { self._services_id = new_value.to_string(); self } /// Part of `parent`. See documentation of `appsId`. /// /// Sets the *versions id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, S> { self._versions_id = new_value.to_string(); self } /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppServiceVersionInstanceListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// Maximum results to return per page. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppServiceVersionInstanceListCall<'a, S> { self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionInstanceListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionInstanceListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionInstanceListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionInstanceListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionInstanceListCall<'a, S> { self._scopes.clear(); self } } /// Deploys code and resource files to a new version. /// /// A builder for the *services.versions.create* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::Version; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = Version::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_create(req, "appsId", "servicesId") /// .doit().await; /// # } /// ``` pub struct AppServiceVersionCreateCall<'a, S> where S: 'a { hub: &'a Appengine, _request: Version, _apps_id: String, _services_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionCreateCall<'a, S> {} impl<'a, S> AppServiceVersionCreateCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.create", http_method: hyper::Method::POST }); for &field in ["alt", "appsId", "servicesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: Version) -> AppServiceVersionCreateCall<'a, S> { self._request = new_value; self } /// Part of `parent`. Name of the parent resource to create this version under. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `parent`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, S> { self._services_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionCreateCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionCreateCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionCreateCall<'a, S> { self._scopes.clear(); self } } /// Deletes an existing Version resource. /// /// A builder for the *services.versions.delete* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_delete("appsId", "servicesId", "versionsId") /// .doit().await; /// # } /// ``` pub struct AppServiceVersionDeleteCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _versions_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionDeleteCall<'a, S> {} impl<'a, S> AppServiceVersionDeleteCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.delete", http_method: hyper::Method::DELETE }); for &field in ["alt", "appsId", "servicesId", "versionsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.push("versionsId", self._versions_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["versionsId", "servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, S> { self._services_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *versions id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, S> { self._versions_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionDeleteCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionDeleteCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionDeleteCall<'a, S> { self._scopes.clear(); self } } /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource. /// /// A builder for the *services.versions.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_get("appsId", "servicesId", "versionsId") /// .view("et") /// .doit().await; /// # } /// ``` pub struct AppServiceVersionGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _versions_id: String, _view: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionGetCall<'a, S> {} impl<'a, S> AppServiceVersionGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Version)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "servicesId", "versionsId", "view"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.push("versionsId", self._versions_id); if let Some(value) = self._view.as_ref() { params.push("view", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["versionsId", "servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, S> { self._services_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *versions id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, S> { self._versions_id = new_value.to_string(); self } /// Controls the set of fields returned in the Get response. /// /// Sets the *view* query property to the given value. pub fn view(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, S> { self._view = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionGetCall<'a, S> { self._scopes.clear(); self } } /// Lists the versions of a service. /// /// A builder for the *services.versions.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_list("appsId", "servicesId") /// .view("dolore") /// .page_token("dolore") /// .page_size(-34) /// .doit().await; /// # } /// ``` pub struct AppServiceVersionListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _view: Option, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionListCall<'a, S> {} impl<'a, S> AppServiceVersionListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListVersionsResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "servicesId", "view", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); if let Some(value) = self._view.as_ref() { params.push("view", value); } if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `parent`. Name of the parent Service resource. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `parent`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, S> { self._services_id = new_value.to_string(); self } /// Controls the set of fields returned in the List response. /// /// Sets the *view* query property to the given value. pub fn view(mut self, new_value: &str) -> AppServiceVersionListCall<'a, S> { self._view = Some(new_value.to_string()); self } /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppServiceVersionListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// Maximum results to return per page. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppServiceVersionListCall<'a, S> { self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionListCall<'a, S> { self._scopes.clear(); self } } /// 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) /// /// A builder for the *services.versions.patch* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::Version; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = Version::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_patch(req, "appsId", "servicesId", "versionsId") /// .update_mask(&Default::default()) /// .doit().await; /// # } /// ``` pub struct AppServiceVersionPatchCall<'a, S> where S: 'a { hub: &'a Appengine, _request: Version, _apps_id: String, _services_id: String, _versions_id: String, _update_mask: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceVersionPatchCall<'a, S> {} impl<'a, S> AppServiceVersionPatchCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.versions.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "appsId", "servicesId", "versionsId", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.push("versionsId", self._versions_id); if let Some(value) = self._update_mask.as_ref() { params.push("updateMask", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["versionsId", "servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::PATCH) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: Version) -> AppServiceVersionPatchCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, S> { self._services_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *versions id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionPatchCall<'a, S> { self._versions_id = new_value.to_string(); self } /// Standard field mask for the set of fields to be updated. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: client::FieldMask) -> AppServiceVersionPatchCall<'a, S> { self._update_mask = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceVersionPatchCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceVersionPatchCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceVersionPatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceVersionPatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceVersionPatchCall<'a, S> { self._scopes.clear(); self } } /// Deletes the specified service and all enclosed versions. /// /// A builder for the *services.delete* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_delete("appsId", "servicesId") /// .doit().await; /// # } /// ``` pub struct AppServiceDeleteCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceDeleteCall<'a, S> {} impl<'a, S> AppServiceDeleteCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.delete", http_method: hyper::Method::DELETE }); for &field in ["alt", "appsId", "servicesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, S> { self._services_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceDeleteCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceDeleteCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceDeleteCall<'a, S> { self._scopes.clear(); self } } /// Gets the current configuration of the specified service. /// /// A builder for the *services.get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_get("appsId", "servicesId") /// .doit().await; /// # } /// ``` pub struct AppServiceGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _services_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceGetCall<'a, S> {} impl<'a, S> AppServiceGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Service)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "servicesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServiceGetCall<'a, S> { self._services_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceGetCall<'a, S> { self._scopes.clear(); self } } /// Lists all the services in the application. /// /// A builder for the *services.list* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_list("appsId") /// .page_token("At") /// .page_size(-43) /// .doit().await; /// # } /// ``` pub struct AppServiceListCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServiceListCall<'a, S> {} impl<'a, S> AppServiceListCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, ListServicesResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.list", http_method: hyper::Method::GET }); for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._page_size.as_ref() { params.push("pageSize", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServiceListCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AppServiceListCall<'a, S> { self._page_token = Some(new_value.to_string()); self } /// Maximum results to return per page. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> AppServiceListCall<'a, S> { self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServiceListCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServiceListCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServiceListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServiceListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServiceListCall<'a, S> { self._scopes.clear(); self } } /// Updates the configuration of the specified service. /// /// A builder for the *services.patch* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::Service; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = Service::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_patch(req, "appsId", "servicesId") /// .update_mask(&Default::default()) /// .migrate_traffic(true) /// .doit().await; /// # } /// ``` pub struct AppServicePatchCall<'a, S> where S: 'a { hub: &'a Appengine, _request: Service, _apps_id: String, _services_id: String, _update_mask: Option, _migrate_traffic: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppServicePatchCall<'a, S> {} impl<'a, S> AppServicePatchCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.services.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "appsId", "servicesId", "updateMask", "migrateTraffic"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("appsId", self._apps_id); params.push("servicesId", self._services_id); if let Some(value) = self._update_mask.as_ref() { params.push("updateMask", value.to_string()); } if let Some(value) = self._migrate_traffic.as_ref() { params.push("migrateTraffic", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}/services/{servicesId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["servicesId", "appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::PATCH) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: Service) -> AppServicePatchCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the resource to update. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppServicePatchCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Part of `name`. See documentation of `appsId`. /// /// Sets the *services id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn services_id(mut self, new_value: &str) -> AppServicePatchCall<'a, S> { self._services_id = new_value.to_string(); self } /// Required. Standard field mask for the set of fields to be updated. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: client::FieldMask) -> AppServicePatchCall<'a, S> { self._update_mask = Some(new_value); self } /// 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). /// /// Sets the *migrate traffic* query property to the given value. pub fn migrate_traffic(mut self, new_value: bool) -> AppServicePatchCall<'a, S> { self._migrate_traffic = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppServicePatchCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppServicePatchCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppServicePatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppServicePatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppServicePatchCall<'a, S> { self._scopes.clear(); self } } /// 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/). /// /// A builder for the *create* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::Application; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = Application::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().create(req) /// .doit().await; /// # } /// ``` pub struct AppCreateCall<'a, S> where S: 'a { hub: &'a Appengine, _request: Application, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppCreateCall<'a, S> {} impl<'a, S> AppCreateCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.create", http_method: hyper::Method::POST }); for &field in ["alt"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(3 + self._additional_params.len()); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: Application) -> AppCreateCall<'a, S> { self._request = new_value; self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppCreateCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppCreateCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppCreateCall<'a, S> { self._scopes.clear(); self } } /// Gets information about an application. /// /// A builder for the *get* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().get("appsId") /// .doit().await; /// # } /// ``` pub struct AppGetCall<'a, S> where S: 'a { hub: &'a Appengine, _apps_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppGetCall<'a, S> {} impl<'a, S> AppGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Application)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.get", http_method: hyper::Method::GET }); for &field in ["alt", "appsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(3 + self._additional_params.len()); params.push("appsId", self._apps_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the Application resource to get. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppGetCall<'a, S> { self._apps_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppGetCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *patch* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::Application; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = Application::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().patch(req, "appsId") /// .update_mask(&Default::default()) /// .doit().await; /// # } /// ``` pub struct AppPatchCall<'a, S> where S: 'a { hub: &'a Appengine, _request: Application, _apps_id: String, _update_mask: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppPatchCall<'a, S> {} impl<'a, S> AppPatchCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "appsId", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("appsId", self._apps_id); if let Some(value) = self._update_mask.as_ref() { params.push("updateMask", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::PATCH) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: Application) -> AppPatchCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the Application resource to update. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppPatchCall<'a, S> { self._apps_id = new_value.to_string(); self } /// Required. Standard field mask for the set of fields to be updated. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: client::FieldMask) -> AppPatchCall<'a, S> { self._update_mask = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppPatchCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppPatchCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppPatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppPatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppPatchCall<'a, S> { self._scopes.clear(); self } } /// 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. /// /// A builder for the *repair* method supported by a *app* resource. /// It is not used directly, but through a [`AppMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// use appengine1::api::RepairApplicationRequest; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! /// let mut req = RepairApplicationRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().repair(req, "appsId") /// .doit().await; /// # } /// ``` pub struct AppRepairCall<'a, S> where S: 'a { hub: &'a Appengine, _request: RepairApplicationRequest, _apps_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for AppRepairCall<'a, S> {} impl<'a, S> AppRepairCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.apps.repair", http_method: hyper::Method::POST }); for &field in ["alt", "appsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("appsId", self._apps_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/apps/{appsId}:repair"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["appsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); client::remove_json_null_values(&mut value); let mut dst = io::Cursor::new(Vec::with_capacity(128)); json::to_writer(&mut dst, &value).unwrap(); dst }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::POST) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn request(mut self, new_value: RepairApplicationRequest) -> AppRepairCall<'a, S> { self._request = new_value; self } /// Part of `name`. Name of the application to repair. Example: apps/myapp /// /// Sets the *apps id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppRepairCall<'a, S> { self._apps_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AppRepairCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> AppRepairCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> AppRepairCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> AppRepairCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> AppRepairCall<'a, S> { self._scopes.clear(); self } } /// Gets information about an application. /// /// A builder for the *locations.applications.get* method supported by a *project* resource. /// It is not used directly, but through a [`ProjectMethods`] instance. /// /// # Example /// /// Instantiate a resource method builder /// /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; /// # extern crate google_appengine1 as appengine1; /// # async fn dox() { /// # use std::default::Default; /// # use appengine1::{Appengine, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); /// # let mut hub = Appengine::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth); /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_applications_get("projectsId", "locationsId", "applicationsId") /// .doit().await; /// # } /// ``` pub struct ProjectLocationApplicationGetCall<'a, S> where S: 'a { hub: &'a Appengine, _projects_id: String, _locations_id: String, _applications_id: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for ProjectLocationApplicationGetCall<'a, S> {} impl<'a, S> ProjectLocationApplicationGetCall<'a, S> where S: tower_service::Service + Clone + Send + Sync + 'static, S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, S::Future: Send + Unpin + 'static, S::Error: Into>, { /// Perform the operation you have build so far. pub async fn doit(mut self) -> client::Result<(hyper::Response, Application)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "appengine.projects.locations.applications.get", http_method: hyper::Method::GET }); for &field in ["alt", "projectsId", "locationsId", "applicationsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("projectsId", self._projects_id); params.push("locationsId", self._locations_id); params.push("applicationsId", self._applications_id); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "v1/projects/{projectsId}/locations/{locationsId}/applications/{applicationsId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::Admin.as_ref().to_string()); } for &(find_this, param_name) in [("{projectsId}", "projectsId"), ("{locationsId}", "locationsId"), ("{applicationsId}", "applicationsId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["applicationsId", "locationsId", "projectsId"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .body(hyper::body::Body::empty()); client.request(request.unwrap()).await }; match req_result { Err(err) => { if let client::Retry::After(d) = dlg.http_error(&err) { sleep(d).await; continue; } dlg.finished(false); return Err(client::Error::HttpError(err)) } Ok(mut res) => { if !res.status().is_success() { let res_body_string = client::get_body_as_string(res.body_mut()).await; let (parts, _) = res.into_parts(); let body = hyper::Body::from(res_body_string.clone()); let restored_response = hyper::Response::from_parts(parts, body); let server_response = json::from_str::(&res_body_string).ok(); if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { sleep(d).await; continue; } dlg.finished(false); return match server_response { Some(error_value) => Err(client::Error::BadRequest(error_value)), None => Err(client::Error::Failure(restored_response)), } } let result_value = { let res_body_string = client::get_body_as_string(res.body_mut()).await; match json::from_str(&res_body_string) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&res_body_string, &err); return Err(client::Error::JsonDecodeError(res_body_string, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// Part of `name`. Name of the Application resource to get. Example: apps/myapp. /// /// Sets the *projects id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectLocationApplicationGetCall<'a, S> { self._projects_id = new_value.to_string(); self } /// Part of `name`. See documentation of `projectsId`. /// /// Sets the *locations id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn locations_id(mut self, new_value: &str) -> ProjectLocationApplicationGetCall<'a, S> { self._locations_id = new_value.to_string(); self } /// Part of `name`. See documentation of `projectsId`. /// /// Sets the *applications id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn applications_id(mut self, new_value: &str) -> ProjectLocationApplicationGetCall<'a, S> { self._applications_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationApplicationGetCall<'a, S> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *$.xgafv* (query-string) - V1 error format. /// * *access_token* (query-string) - OAuth access token. /// * *alt* (query-string) - Data format for response. /// * *callback* (query-string) - JSONP /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *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. /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *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. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). pub fn param(mut self, name: T, value: T) -> ProjectLocationApplicationGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant /// [`Scope::Admin`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ProjectLocationApplicationGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ProjectLocationApplicationGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ProjectLocationApplicationGetCall<'a, S> { self._scopes.clear(); self } }