mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-03 01:52:23 +01:00
7359 lines
331 KiB
Rust
7359 lines
331 KiB
Rust
// DO NOT EDIT !
|
|
// This file was generated automatically from 'src/mako/api/lib.rs.in.mako'
|
|
// DO NOT EDIT !
|
|
|
|
#[cfg(feature = "nightly")]
|
|
#[macro_use]
|
|
extern crate serde_derive;
|
|
|
|
extern crate hyper;
|
|
extern crate serde;
|
|
extern crate serde_json;
|
|
extern crate yup_oauth2 as oauth2;
|
|
extern crate mime;
|
|
extern crate url;
|
|
|
|
mod cmn;
|
|
|
|
use std::collections::HashMap;
|
|
use std::cell::RefCell;
|
|
use std::borrow::BorrowMut;
|
|
use std::default::Default;
|
|
use std::collections::BTreeMap;
|
|
use serde_json as json;
|
|
use std::io;
|
|
use std::fs;
|
|
use std::thread::sleep;
|
|
use std::time::Duration;
|
|
|
|
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part,
|
|
ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder,
|
|
Resource, ErrorResponse, remove_json_null_values};
|
|
|
|
|
|
// ##############
|
|
// 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,
|
|
|
|
/// View and manage your data across Google Cloud Platform services
|
|
CloudPlatform,
|
|
|
|
/// View your data across Google Cloud Platform services
|
|
CloudPlatformReadOnly,
|
|
}
|
|
|
|
impl AsRef<str> 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 yup_oauth2 as oauth2;
|
|
/// extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::DebugInstanceRequest;
|
|
/// use appengine1::{Result, Error};
|
|
/// # #[test] fn egal() {
|
|
/// use std::default::Default;
|
|
/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// use appengine1::Appengine;
|
|
///
|
|
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
|
/// // `client_secret`, among other things.
|
|
/// let secret: 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 = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// hyper::Client::new(),
|
|
/// <MemoryStorage as Default>::default(), None);
|
|
/// let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
///
|
|
/// 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::MissingAPIKey
|
|
/// |Error::MissingToken(_)
|
|
/// |Error::Cancelled
|
|
/// |Error::UploadSizeLimitExceeded(_, _)
|
|
/// |Error::Failure(_)
|
|
/// |Error::BadRequest(_)
|
|
/// |Error::FieldClash(_)
|
|
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
|
|
/// },
|
|
/// Ok(res) => println!("Success: {:?}", res),
|
|
/// }
|
|
/// # }
|
|
/// ```
|
|
pub struct Appengine<C, A> {
|
|
client: RefCell<C>,
|
|
auth: RefCell<A>,
|
|
_user_agent: String,
|
|
}
|
|
|
|
impl<'a, C, A> Hub for Appengine<C, A> {}
|
|
|
|
impl<'a, C, A> Appengine<C, A>
|
|
where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
pub fn new(client: C, authenticator: A) -> Appengine<C, A> {
|
|
Appengine {
|
|
client: RefCell::new(client),
|
|
auth: RefCell::new(authenticator),
|
|
_user_agent: "google-api-rust-client/1.0.0".to_string(),
|
|
}
|
|
}
|
|
|
|
pub fn apps(&'a self) -> AppMethods<'a, C, A> {
|
|
AppMethods { hub: &self }
|
|
}
|
|
|
|
/// Set the user-agent header field to use in all requests to the server.
|
|
/// It defaults to `google-api-rust-client/1.0.0`.
|
|
///
|
|
/// Returns the previously set user-agent.
|
|
pub fn user_agent(&mut self, agent_name: String) -> String {
|
|
let prev = self._user_agent.clone();
|
|
self._user_agent = agent_name;
|
|
prev
|
|
}
|
|
}
|
|
|
|
|
|
// ############
|
|
// SCHEMAS ###
|
|
// ##########
|
|
/// 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](struct.AppServiceVersionInstanceListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListInstancesResponse {
|
|
/// Continuation token for fetching the next page of results.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// The instances belonging to the requested version.
|
|
pub instances: Option<Vec<Instance>>,
|
|
}
|
|
|
|
impl ResponseResult for ListInstancesResponse {}
|
|
|
|
|
|
/// Extra network settings. Only applicable for VM runtimes.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Network {
|
|
/// Tag to apply to the VM instance during creation.
|
|
#[serde(rename="instanceTag")]
|
|
pub instance_tag: Option<String>,
|
|
/// List of ports, or port pairs, to forward from the virtual machine to the application container.
|
|
#[serde(rename="forwardedPorts")]
|
|
pub forwarded_ports: Option<Vec<String>>,
|
|
/// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default.
|
|
pub name: Option<String>,
|
|
/// 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 the VM instance is being created in is a Legacy network, then the IP address is allocated from the IPv4Range. If the network the VM instance is being created in is an auto Subnet Mode Network, then only network name should be specified (not the subnetwork_name) and the IP address is created from the IPCidrRange of the subnetwork that exists in that zone for that network. If the network the VM instance is being created in is a custom Subnet Mode Network, then the subnetwork_name must be specified and the IP address is created from the IPCidrRange of the subnetwork.If specified, the subnetwork must exist in the same region as the Flex app.
|
|
#[serde(rename="subnetworkName")]
|
|
pub subnetwork_name: Option<String>,
|
|
}
|
|
|
|
impl Part for Network {}
|
|
|
|
|
|
/// 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](struct.AppServiceGetCall.html) (response)
|
|
/// * [services patch apps](struct.AppServicePatchCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Service {
|
|
/// Mapping that defines fractional HTTP traffic diversion to different versions within the service.
|
|
pub split: Option<TrafficSplit>,
|
|
/// Relative name of the service within the application. Example: default.@OutputOnly
|
|
pub id: Option<String>,
|
|
/// Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
impl RequestValue for Service {}
|
|
impl ResponseResult for Service {}
|
|
|
|
|
|
/// 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](struct.AppRepairCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RepairApplicationRequest { _never_set: Option<bool> }
|
|
|
|
impl RequestValue for RepairApplicationRequest {}
|
|
|
|
|
|
/// 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](struct.AppCreateCall.html) (request)
|
|
/// * [patch apps](struct.AppPatchCall.html) (request)
|
|
/// * [get apps](struct.AppGetCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Application {
|
|
/// Hostname used to reach this application, as resolved by App Engine.@OutputOnly
|
|
#[serde(rename="defaultHostname")]
|
|
pub default_hostname: Option<String>,
|
|
/// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly
|
|
pub name: Option<String>,
|
|
/// 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<String>,
|
|
/// Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly
|
|
#[serde(rename="defaultBucket")]
|
|
pub default_bucket: Option<String>,
|
|
/// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent.@OutputOnly
|
|
#[serde(rename="dispatchRules")]
|
|
pub dispatch_rules: Option<Vec<UrlDispatchRule>>,
|
|
/// Cookie expiration policy for this application.
|
|
#[serde(rename="defaultCookieExpiration")]
|
|
pub default_cookie_expiration: Option<String>,
|
|
/// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US
|
|
#[serde(rename="locationId")]
|
|
pub location_id: Option<String>,
|
|
/// 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<String>,
|
|
/// 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<String>,
|
|
}
|
|
|
|
impl RequestValue for Application {}
|
|
impl ResponseResult for Application {}
|
|
|
|
|
|
/// 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 get apps](struct.AppServiceVersionGetCall.html) (response)
|
|
/// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (request)
|
|
/// * [services versions patch apps](struct.AppServiceVersionPatchCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Version {
|
|
/// 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<EndpointsApiService>,
|
|
/// 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<BasicScaling>,
|
|
/// Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly
|
|
pub name: Option<String>,
|
|
/// Metadata settings that are supplied to this version to enable beta runtime features.
|
|
#[serde(rename="betaSettings")]
|
|
pub beta_settings: Option<HashMap<String, String>>,
|
|
/// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time.
|
|
#[serde(rename="manualScaling")]
|
|
pub manual_scaling: Option<ManualScaling>,
|
|
/// Whether to deploy this version in a container on a virtual machine.
|
|
pub vm: Option<bool>,
|
|
/// Time that this version was created.@OutputOnly
|
|
#[serde(rename="createTime")]
|
|
pub create_time: Option<String>,
|
|
/// 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<Vec<String>>,
|
|
/// 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<String>,
|
|
/// Email address of the user who created this version.@OutputOnly
|
|
#[serde(rename="createdBy")]
|
|
pub created_by: Option<String>,
|
|
/// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set.
|
|
pub deployment: Option<Deployment>,
|
|
/// 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<Vec<ErrorHandler>>,
|
|
/// 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<String>,
|
|
/// 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<String>,
|
|
/// Extra network settings. Only applicable for VM runtimes.
|
|
pub network: Option<Network>,
|
|
/// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set.
|
|
#[serde(rename="apiConfig")]
|
|
pub api_config: Option<ApiConfigHandler>,
|
|
/// 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<String>,
|
|
/// Whether multiple requests can be dispatched to this version at once.
|
|
pub threadsafe: Option<bool>,
|
|
/// 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<Vec<UrlMap>>,
|
|
/// Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set.
|
|
#[serde(rename="healthCheck")]
|
|
pub health_check: Option<HealthCheck>,
|
|
/// 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")]
|
|
pub default_expiration: Option<String>,
|
|
/// Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com"@OutputOnly
|
|
#[serde(rename="versionUrl")]
|
|
pub version_url: Option<String>,
|
|
/// 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<Vec<Library>>,
|
|
/// App Engine execution environment for this version.Defaults to standard.
|
|
pub env: Option<String>,
|
|
/// Total size in bytes of all the files that are included in this version and curerntly hosted on the App Engine disk.@OutputOnly
|
|
#[serde(rename="diskUsageBytes")]
|
|
pub disk_usage_bytes: Option<String>,
|
|
/// Automatic scaling is based on request rate, response latencies, and other application metrics.
|
|
#[serde(rename="automaticScaling")]
|
|
pub automatic_scaling: Option<AutomaticScaling>,
|
|
/// Desired runtime. Example: python27.
|
|
pub runtime: Option<String>,
|
|
/// Environment variables available to the application.Only returned in GET requests if view=FULL is set.
|
|
#[serde(rename="envVariables")]
|
|
pub env_variables: Option<HashMap<String, String>>,
|
|
/// Machine resources for this version. Only applicable for VM runtimes.
|
|
pub resources: Option<Resources>,
|
|
}
|
|
|
|
impl RequestValue for Version {}
|
|
impl ResponseResult for Version {}
|
|
|
|
|
|
/// The response message for LocationService.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](struct.AppLocationListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListLocationsResponse {
|
|
/// The standard List next-page token.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// A list of locations that matches the specified filter in the request.
|
|
pub locations: Option<Vec<Location>>,
|
|
}
|
|
|
|
impl ResponseResult for ListLocationsResponse {}
|
|
|
|
|
|
/// 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](struct.AppLocationGetCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Location {
|
|
/// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
|
|
pub labels: Option<HashMap<String, String>>,
|
|
/// The canonical id for this location. For example: "us-east1".
|
|
#[serde(rename="locationId")]
|
|
pub location_id: Option<String>,
|
|
/// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1"
|
|
pub name: Option<String>,
|
|
/// Service-specific metadata. For example the available capacity at the given location.
|
|
pub metadata: Option<HashMap<String, String>>,
|
|
}
|
|
|
|
impl ResponseResult for Location {}
|
|
|
|
|
|
/// 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](struct.AppServiceVersionInstanceDebugCall.html) (request)
|
|
///
|
|
#[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<String>,
|
|
}
|
|
|
|
impl RequestValue for DebugInstanceRequest {}
|
|
|
|
|
|
/// Target scaling by CPU usage.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CpuUtilization {
|
|
/// Target CPU utilization ratio to maintain when scaling. Must be between 0 and 1.
|
|
#[serde(rename="targetUtilization")]
|
|
pub target_utilization: Option<f64>,
|
|
/// Period of time over which CPU utilization is calculated.
|
|
#[serde(rename="aggregationWindowLength")]
|
|
pub aggregation_window_length: Option<String>,
|
|
}
|
|
|
|
impl Part for CpuUtilization {}
|
|
|
|
|
|
/// Machine resources for a version.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Resources {
|
|
/// Memory (GB) needed.
|
|
#[serde(rename="memoryGb")]
|
|
pub memory_gb: Option<f64>,
|
|
/// Disk size (GB) needed.
|
|
#[serde(rename="diskGb")]
|
|
pub disk_gb: Option<f64>,
|
|
/// Number of CPU cores needed.
|
|
pub cpu: Option<f64>,
|
|
/// User specified volumes.
|
|
pub volumes: Option<Vec<Volume>>,
|
|
}
|
|
|
|
impl Part for Resources {}
|
|
|
|
|
|
/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: Simple to use and understand for most users Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose. Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Status {
|
|
/// 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<String>,
|
|
/// The status code, which should be an enum value of google.rpc.Code.
|
|
pub code: Option<i32>,
|
|
/// A list of messages that carry the error details. There will be a common set of message types for APIs to use.
|
|
pub details: Option<Vec<HashMap<String, String>>>,
|
|
}
|
|
|
|
impl Part for Status {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[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")]
|
|
pub idle_timeout: Option<String>,
|
|
/// Maximum number of instances to create for this version.
|
|
#[serde(rename="maxInstances")]
|
|
pub max_instances: Option<i32>,
|
|
}
|
|
|
|
impl Part for BasicScaling {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct StaticFilesHandler {
|
|
/// 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<String>,
|
|
/// Time a static file served by this handler should be cached by web proxies and browsers.
|
|
pub expiration: Option<String>,
|
|
/// 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<String>,
|
|
/// 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<String>,
|
|
/// 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<bool>,
|
|
/// HTTP headers to use for all responses from these URLs.
|
|
#[serde(rename="httpHeaders")]
|
|
pub http_headers: Option<HashMap<String, String>>,
|
|
/// 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<bool>,
|
|
}
|
|
|
|
impl Part for StaticFilesHandler {}
|
|
|
|
|
|
/// Target scaling by network usage. Only applicable for VM runtimes.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct NetworkUtilization {
|
|
/// Target packets received per second.
|
|
#[serde(rename="targetReceivedPacketsPerSecond")]
|
|
pub target_received_packets_per_second: Option<i32>,
|
|
/// Target packets sent per second.
|
|
#[serde(rename="targetSentPacketsPerSecond")]
|
|
pub target_sent_packets_per_second: Option<i32>,
|
|
/// Target bytes received per second.
|
|
#[serde(rename="targetReceivedBytesPerSecond")]
|
|
pub target_received_bytes_per_second: Option<i32>,
|
|
/// Target bytes sent per second.
|
|
#[serde(rename="targetSentBytesPerSecond")]
|
|
pub target_sent_bytes_per_second: Option<i32>,
|
|
}
|
|
|
|
impl Part for NetworkUtilization {}
|
|
|
|
|
|
/// 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](struct.AppServiceVersionListCall.html) (response)
|
|
///
|
|
#[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<String>,
|
|
/// The versions belonging to the requested service.
|
|
pub versions: Option<Vec<Version>>,
|
|
}
|
|
|
|
impl ResponseResult for ListVersionsResponse {}
|
|
|
|
|
|
/// Volumes mounted within the app container. Only applicable for VM runtimes.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Volume {
|
|
/// Underlying volume type, e.g. 'tmpfs'.
|
|
#[serde(rename="volumeType")]
|
|
pub volume_type: Option<String>,
|
|
/// Unique name for the volume.
|
|
pub name: Option<String>,
|
|
/// Volume size in gigabytes.
|
|
#[serde(rename="sizeGb")]
|
|
pub size_gb: Option<f64>,
|
|
}
|
|
|
|
impl Part for Volume {}
|
|
|
|
|
|
/// 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](struct.AppServiceListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListServicesResponse {
|
|
/// The services belonging to the requested application.
|
|
pub services: Option<Vec<Service>>,
|
|
/// Continuation token for fetching the next page of results.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
}
|
|
|
|
impl ResponseResult for ListServicesResponse {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[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<String>,
|
|
}
|
|
|
|
impl Part for ScriptHandler {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct UrlDispatchRule {
|
|
/// 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<String>,
|
|
/// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*".
|
|
pub domain: Option<String>,
|
|
/// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default.
|
|
pub service: Option<String>,
|
|
}
|
|
|
|
impl Part for UrlDispatchRule {}
|
|
|
|
|
|
/// Uses Google Cloud Endpoints to handle requests.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[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<String>,
|
|
}
|
|
|
|
impl Part for ApiEndpointHandler {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct HealthCheck {
|
|
/// Number of consecutive successful health checks required before receiving traffic.
|
|
#[serde(rename="healthyThreshold")]
|
|
pub healthy_threshold: Option<u32>,
|
|
/// Number of consecutive failed health checks required before an instance is restarted.
|
|
#[serde(rename="restartThreshold")]
|
|
pub restart_threshold: Option<u32>,
|
|
/// Time before the health check is considered failed.
|
|
pub timeout: Option<String>,
|
|
/// Interval between health checks.
|
|
#[serde(rename="checkInterval")]
|
|
pub check_interval: Option<String>,
|
|
/// Whether to explicitly disable health checks for this instance.
|
|
#[serde(rename="disableHealthCheck")]
|
|
pub disable_health_check: Option<bool>,
|
|
/// Host header to send when performing an HTTP health check. Example: "myapp.appspot.com"
|
|
pub host: Option<String>,
|
|
/// Number of consecutive failed health checks required before removing traffic.
|
|
#[serde(rename="unhealthyThreshold")]
|
|
pub unhealthy_threshold: Option<u32>,
|
|
}
|
|
|
|
impl Part for HealthCheck {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Deployment {
|
|
/// 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<HashMap<String, FileInfo>>,
|
|
/// A Docker image that App Engine uses to run the version. Only applicable for instances in App Engine flexible environment.
|
|
pub container: Option<ContainerInfo>,
|
|
/// The zip file for this deployment, if this is a zip deployment.
|
|
pub zip: Option<ZipInfo>,
|
|
}
|
|
|
|
impl Part for Deployment {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ErrorHandler {
|
|
/// Error condition this handler applies to.
|
|
#[serde(rename="errorCode")]
|
|
pub error_code: Option<String>,
|
|
/// MIME type of file. Defaults to text/html.
|
|
#[serde(rename="mimeType")]
|
|
pub mime_type: Option<String>,
|
|
/// Static file content to be served for this error.
|
|
#[serde(rename="staticFile")]
|
|
pub static_file: Option<String>,
|
|
}
|
|
|
|
impl Part for ErrorHandler {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct AutomaticScaling {
|
|
/// Target scaling by CPU usage.
|
|
#[serde(rename="cpuUtilization")]
|
|
pub cpu_utilization: Option<CpuUtilization>,
|
|
/// Target scaling by network usage.
|
|
#[serde(rename="networkUtilization")]
|
|
pub network_utilization: Option<NetworkUtilization>,
|
|
/// 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<i32>,
|
|
/// Maximum amount of time that a request should wait in the pending queue before starting a new instance to handle it.
|
|
#[serde(rename="maxPendingLatency")]
|
|
pub max_pending_latency: Option<String>,
|
|
/// Maximum number of idle instances that should be maintained for this version.
|
|
#[serde(rename="maxIdleInstances")]
|
|
pub max_idle_instances: Option<i32>,
|
|
/// Target scaling by disk usage.
|
|
#[serde(rename="diskUtilization")]
|
|
pub disk_utilization: Option<DiskUtilization>,
|
|
/// Target scaling by request utilization.
|
|
#[serde(rename="requestUtilization")]
|
|
pub request_utilization: Option<RequestUtilization>,
|
|
/// Amount of time that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes.
|
|
#[serde(rename="coolDownPeriod")]
|
|
pub cool_down_period: Option<String>,
|
|
/// Maximum number of instances that should be started to handle requests.
|
|
#[serde(rename="maxTotalInstances")]
|
|
pub max_total_instances: Option<i32>,
|
|
/// 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<i32>,
|
|
/// Minimum number of instances that should be maintained for this version.
|
|
#[serde(rename="minTotalInstances")]
|
|
pub min_total_instances: Option<i32>,
|
|
/// Minimum amount of time a request should wait in the pending queue before starting a new instance to handle it.
|
|
#[serde(rename="minPendingLatency")]
|
|
pub min_pending_latency: Option<String>,
|
|
}
|
|
|
|
impl Part for AutomaticScaling {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct UrlMap {
|
|
/// Security (HTTPS) enforcement for this URL.
|
|
#[serde(rename="securityLevel")]
|
|
pub security_level: Option<String>,
|
|
/// Action to take when users access resources that require authentication. Defaults to redirect.
|
|
#[serde(rename="authFailAction")]
|
|
pub auth_fail_action: Option<String>,
|
|
/// 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<String>,
|
|
/// Executes a script to handle the request that matches this URL pattern.
|
|
pub script: Option<ScriptHandler>,
|
|
/// Returns the contents of a file, such as an image, as the response.
|
|
#[serde(rename="staticFiles")]
|
|
pub static_files: Option<StaticFilesHandler>,
|
|
/// Uses API Endpoints to handle requests.
|
|
#[serde(rename="apiEndpoint")]
|
|
pub api_endpoint: Option<ApiEndpointHandler>,
|
|
/// Level of login required to access this resource.
|
|
pub login: Option<String>,
|
|
/// 30x code to use when performing redirects for the secure field. Defaults to 302.
|
|
#[serde(rename="redirectHttpResponseCode")]
|
|
pub redirect_http_response_code: Option<String>,
|
|
}
|
|
|
|
impl Part for UrlMap {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[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<String>,
|
|
/// 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<String>,
|
|
/// The SHA1 hash of the file, in hex.
|
|
#[serde(rename="sha1Sum")]
|
|
pub sha1_sum: Option<String>,
|
|
}
|
|
|
|
impl Part for FileInfo {}
|
|
|
|
|
|
/// The zip file information for a zip deployment.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[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<i32>,
|
|
/// 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<String>,
|
|
}
|
|
|
|
impl Part for ZipInfo {}
|
|
|
|
|
|
/// 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.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.
|
|
///
|
|
#[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"
|
|
#[serde(rename="configId")]
|
|
pub config_id: Option<String>,
|
|
/// 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<String>,
|
|
}
|
|
|
|
impl Part for EndpointsApiService {}
|
|
|
|
|
|
/// 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](struct.AppOperationListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListOperationsResponse {
|
|
/// A list of operations that matches the specified filter in the request.
|
|
pub operations: Option<Vec<Operation>>,
|
|
/// The standard List next-page token.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
}
|
|
|
|
impl ResponseResult for ListOperationsResponse {}
|
|
|
|
|
|
/// 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](struct.AppServiceVersionInstanceGetCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Instance {
|
|
/// App Engine release this instance is running on.@OutputOnly
|
|
#[serde(rename="appEngineRelease")]
|
|
pub app_engine_release: Option<String>,
|
|
/// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly
|
|
#[serde(rename="vmId")]
|
|
pub vm_id: Option<String>,
|
|
/// Total memory in use (bytes).@OutputOnly
|
|
#[serde(rename="memoryUsage")]
|
|
pub memory_usage: Option<String>,
|
|
/// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly
|
|
#[serde(rename="vmDebugEnabled")]
|
|
pub vm_debug_enabled: Option<bool>,
|
|
/// Time that this instance was started.@OutputOnly
|
|
#[serde(rename="startTime")]
|
|
pub start_time: Option<String>,
|
|
/// The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly
|
|
#[serde(rename="vmIp")]
|
|
pub vm_ip: Option<String>,
|
|
/// Average queries per second (QPS) over the last minute.@OutputOnly
|
|
pub qps: Option<f32>,
|
|
/// Availability of the instance.@OutputOnly
|
|
pub availability: Option<String>,
|
|
/// Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly
|
|
pub name: Option<String>,
|
|
/// Number of errors since this instance was started.@OutputOnly
|
|
pub errors: Option<i32>,
|
|
/// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly
|
|
#[serde(rename="vmStatus")]
|
|
pub vm_status: Option<String>,
|
|
/// Relative name of the instance within the version. Example: instance-1.@OutputOnly
|
|
pub id: Option<String>,
|
|
/// Average latency (ms) over the last minute.@OutputOnly
|
|
#[serde(rename="averageLatency")]
|
|
pub average_latency: Option<i32>,
|
|
/// Number of requests since this instance was started.@OutputOnly
|
|
pub requests: Option<i32>,
|
|
/// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly
|
|
#[serde(rename="vmName")]
|
|
pub vm_name: Option<String>,
|
|
/// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly
|
|
#[serde(rename="vmZoneName")]
|
|
pub vm_zone_name: Option<String>,
|
|
}
|
|
|
|
impl ResponseResult for Instance {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[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<i32>,
|
|
}
|
|
|
|
impl Part for ManualScaling {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct TrafficSplit {
|
|
/// 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<String>,
|
|
/// 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<HashMap<String, f64>>,
|
|
}
|
|
|
|
impl Part for TrafficSplit {}
|
|
|
|
|
|
/// Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ApiConfigHandler {
|
|
/// URL to serve the endpoint at.
|
|
pub url: Option<String>,
|
|
/// Security (HTTPS) enforcement for this URL.
|
|
#[serde(rename="securityLevel")]
|
|
pub security_level: Option<String>,
|
|
/// Action to take when users access resources that require authentication. Defaults to redirect.
|
|
#[serde(rename="authFailAction")]
|
|
pub auth_fail_action: Option<String>,
|
|
/// Level of login required to access this resource. Defaults to optional.
|
|
pub login: Option<String>,
|
|
/// Path to the script from the application root directory.
|
|
pub script: Option<String>,
|
|
}
|
|
|
|
impl Part for ApiConfigHandler {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Library {
|
|
/// Version of the library to select, or "latest".
|
|
pub version: Option<String>,
|
|
/// Name of the library. Example: "django".
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
impl Part for Library {}
|
|
|
|
|
|
/// Target scaling by disk usage. Only applicable for VM runtimes.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct DiskUtilization {
|
|
/// Target ops read per seconds.
|
|
#[serde(rename="targetReadOpsPerSecond")]
|
|
pub target_read_ops_per_second: Option<i32>,
|
|
/// Target bytes written per second.
|
|
#[serde(rename="targetWriteBytesPerSecond")]
|
|
pub target_write_bytes_per_second: Option<i32>,
|
|
/// Target bytes read per second.
|
|
#[serde(rename="targetReadBytesPerSecond")]
|
|
pub target_read_bytes_per_second: Option<i32>,
|
|
/// Target ops written per second.
|
|
#[serde(rename="targetWriteOpsPerSecond")]
|
|
pub target_write_ops_per_second: Option<i32>,
|
|
}
|
|
|
|
impl Part for DiskUtilization {}
|
|
|
|
|
|
/// Target scaling by request utilization. Only applicable for VM runtimes.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RequestUtilization {
|
|
/// Target number of concurrent requests.
|
|
#[serde(rename="targetConcurrentRequests")]
|
|
pub target_concurrent_requests: Option<i32>,
|
|
/// Target requests per second.
|
|
#[serde(rename="targetRequestCountPerSecond")]
|
|
pub target_request_count_per_second: Option<i32>,
|
|
}
|
|
|
|
impl Part for RequestUtilization {}
|
|
|
|
|
|
/// Docker image that is used to start a VM container for the version you deploy.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ContainerInfo {
|
|
/// URI to the hosted container image in a Docker repository. 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<String>,
|
|
}
|
|
|
|
impl Part for ContainerInfo {}
|
|
|
|
|
|
/// 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*).
|
|
///
|
|
/// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (response)
|
|
/// * [patch apps](struct.AppPatchCall.html) (response)
|
|
/// * [services versions instances debug apps](struct.AppServiceVersionInstanceDebugCall.html) (response)
|
|
/// * [create apps](struct.AppCreateCall.html) (response)
|
|
/// * [services versions instances delete apps](struct.AppServiceVersionInstanceDeleteCall.html) (response)
|
|
/// * [services versions patch apps](struct.AppServiceVersionPatchCall.html) (response)
|
|
/// * [operations get apps](struct.AppOperationGetCall.html) (response)
|
|
/// * [repair apps](struct.AppRepairCall.html) (response)
|
|
/// * [services versions delete apps](struct.AppServiceVersionDeleteCall.html) (response)
|
|
/// * [services patch apps](struct.AppServicePatchCall.html) (response)
|
|
/// * [services delete apps](struct.AppServiceDeleteCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Operation {
|
|
/// 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<HashMap<String, String>>,
|
|
/// 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<bool>,
|
|
/// 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<HashMap<String, String>>,
|
|
/// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name.
|
|
pub name: Option<String>,
|
|
/// The error result of the operation in case of failure or cancellation.
|
|
pub error: Option<Status>,
|
|
}
|
|
|
|
impl ResponseResult for Operation {}
|
|
|
|
|
|
|
|
// ###################
|
|
// 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 yup_oauth2 as oauth2;
|
|
/// extern crate google_appengine1 as appengine1;
|
|
///
|
|
/// # #[test] fn egal() {
|
|
/// use std::default::Default;
|
|
/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// use appengine1::Appengine;
|
|
///
|
|
/// let secret: ApplicationSecret = Default::default();
|
|
/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// hyper::Client::new(),
|
|
/// <MemoryStorage as Default>::default(), None);
|
|
/// let mut hub = Appengine::new(hyper::Client::new(), auth);
|
|
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
|
|
/// // like `create(...)`, `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, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
}
|
|
|
|
impl<'a, C, A> MethodsBuilder for AppMethods<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppMethods<'a, C, A> {
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists the instances of a version.
|
|
///
|
|
/// # 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
AppServiceVersionCreateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_apps_id: apps_id.to_string(),
|
|
_services_id: services_id.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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.
|
|
///
|
|
/// # 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, C, A> {
|
|
AppRepairCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_apps_id: apps_id.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
AppServiceGetCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_services_id: services_id.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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 (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.default_cookie_expiration)
|
|
///
|
|
/// # 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, C, A> {
|
|
AppPatchCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_apps_id: apps_id.to_string(),
|
|
_update_mask: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Stops a running instance.
|
|
///
|
|
/// # 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine 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): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.
|
|
///
|
|
/// # 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
AppOperationGetCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_operations_id: operations_id.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
AppServiceListCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_page_token: Default::default(),
|
|
_page_size: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
AppLocationListCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_page_token: Default::default(),
|
|
_page_size: Default::default(),
|
|
_filter: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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 below allows API services to override the binding to use different resource name schemes, such as users/*/operations.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `appsId` - Part of `name`. The name of the operation collection.
|
|
pub fn operations_list(&self, apps_id: &str) -> AppOperationListCall<'a, C, A> {
|
|
AppOperationListCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_page_token: Default::default(),
|
|
_page_size: Default::default(),
|
|
_filter: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Get 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, C, A> {
|
|
AppLocationGetCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_locations_id: locations_id.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
AppGetCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
AppServiceDeleteCall {
|
|
hub: self.hub,
|
|
_apps_id: apps_id.to_string(),
|
|
_services_id: services_id.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project).
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
pub fn create(&self, request: Application) -> AppCreateCall<'a, C, A> {
|
|
AppCreateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
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(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ###################
|
|
// CallBuilders ###
|
|
// #################
|
|
|
|
/// Lists the instances of a version.
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("erat")
|
|
/// .page_size(-35)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionInstanceListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_versions_id: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionInstanceListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListInstancesResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.instances.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
params.push(("versionsId", self._versions_id.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "servicesId", "versionsId", "pageToken", "pageSize"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["versionsId", "servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionInstanceListCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionInstanceListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::Version;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionCreateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_request: Version,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionCreateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.create",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
for &field in ["alt", "appsId", "servicesId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request);
|
|
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.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionCreateCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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.
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::RepairApplicationRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppRepairCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_request: RepairApplicationRequest,
|
|
_apps_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppRepairCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppRepairCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.repair",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
for &field in ["alt", "appsId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}:repair".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request);
|
|
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.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppRepairCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppRepairCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppRepairCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::DebugInstanceRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionInstanceDebugCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_request: DebugInstanceRequest,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_versions_id: String,
|
|
_instances_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionInstanceDebugCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.instances.debug",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
params.push(("versionsId", self._versions_id.to_string()));
|
|
params.push(("instancesId", self._instances_id.to_string()));
|
|
for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}:debug".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId"), ("{instancesId}", "instancesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["instancesId", "versionsId", "servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request);
|
|
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.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionInstanceDebugCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceDebugCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionInstanceDebugCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Service)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
for &field in ["alt", "appsId", "servicesId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceGetCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.default_cookie_expiration)
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::Application;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("et")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppPatchCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_request: Application,
|
|
_apps_id: String,
|
|
_update_mask: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppPatchCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.patch",
|
|
http_method: hyper::method::Method::Patch });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
if let Some(value) = self._update_mask {
|
|
params.push(("updateMask", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "updateMask"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request);
|
|
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.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
self._apps_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: &str) -> AppPatchCall<'a, C, A> {
|
|
self._update_mask = 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.
|
|
///
|
|
/// 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 Delegate) -> AppPatchCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppPatchCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppPatchCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Stops a running instance.
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionInstanceDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_versions_id: String,
|
|
_instances_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionInstanceDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.instances.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
params.push(("versionsId", self._versions_id.to_string()));
|
|
params.push(("instancesId", self._instances_id.to_string()));
|
|
for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId"), ("{instancesId}", "instancesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["instancesId", "versionsId", "servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionInstanceDeleteCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionInstanceDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine 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): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::Version;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("sea")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionPatchCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_request: Version,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_versions_id: String,
|
|
_update_mask: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionPatchCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.patch",
|
|
http_method: hyper::method::Method::Patch });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
params.push(("versionsId", self._versions_id.to_string()));
|
|
if let Some(value) = self._update_mask {
|
|
params.push(("updateMask", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "servicesId", "versionsId", "updateMask"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["versionsId", "servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request);
|
|
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.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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: &str) -> AppServiceVersionPatchCall<'a, C, A> {
|
|
self._update_mask = 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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionPatchCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionPatchCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionPatchCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("erat")
|
|
/// .page_token("sadipscing")
|
|
/// .page_size(-48)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_view: Option<String>,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListVersionsResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
if let Some(value) = self._view {
|
|
params.push(("view", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "servicesId", "view", "pageToken", "pageSize"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionListCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppOperationGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_operations_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppOperationGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.operations.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("operationsId", self._operations_id.to_string()));
|
|
for &field in ["alt", "appsId", "operationsId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/operations/{operationsId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["operationsId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppOperationGetCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppOperationGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppOperationGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("no")
|
|
/// .page_size(-36)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListServicesResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceListCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("dolore")
|
|
/// .page_size(-37)
|
|
/// .filter("aliquyam")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppLocationListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_filter: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppLocationListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListLocationsResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.locations.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
if let Some(value) = self._filter {
|
|
params.push(("filter", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/locations".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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) -> AppLocationListCall<'a, C, A> {
|
|
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) -> AppLocationListCall<'a, C, A> {
|
|
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) -> AppLocationListCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppLocationListCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppLocationListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppLocationListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionInstanceGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_versions_id: String,
|
|
_instances_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionInstanceGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Instance)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.instances.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
params.push(("versionsId", self._versions_id.to_string()));
|
|
params.push(("instancesId", self._instances_id.to_string()));
|
|
for &field in ["alt", "appsId", "servicesId", "versionsId", "instancesId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId"), ("{instancesId}", "instancesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["instancesId", "versionsId", "servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionInstanceGetCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionInstanceGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionInstanceGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 below allows API services to override the binding to use different resource name schemes, such as users/*/operations.
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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(-40)
|
|
/// .filter("sanctus")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppOperationListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_filter: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppOperationListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.operations.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
if let Some(value) = self._filter {
|
|
params.push(("filter", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/operations".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Part of `name`. The name of the operation collection.
|
|
///
|
|
/// 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppOperationListCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppOperationListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppOperationListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_versions_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
params.push(("versionsId", self._versions_id.to_string()));
|
|
for &field in ["alt", "appsId", "servicesId", "versionsId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["versionsId", "servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionDeleteCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Get 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppLocationGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_locations_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppLocationGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.locations.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("locationsId", self._locations_id.to_string()));
|
|
for &field in ["alt", "appsId", "locationsId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/locations/{locationsId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["locationsId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppLocationGetCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppLocationGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppLocationGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::Service;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("dolor")
|
|
/// .migrate_traffic(true)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServicePatchCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_request: Service,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_update_mask: Option<String>,
|
|
_migrate_traffic: Option<bool>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServicePatchCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.patch",
|
|
http_method: hyper::method::Method::Patch });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
if let Some(value) = self._update_mask {
|
|
params.push(("updateMask", value.to_string()));
|
|
}
|
|
if let Some(value) = self._migrate_traffic {
|
|
params.push(("migrateTraffic", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "servicesId", "updateMask", "migrateTraffic"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request);
|
|
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.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
self._services_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: &str) -> AppServicePatchCall<'a, C, A> {
|
|
self._update_mask = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Set to true to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version 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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServicePatchCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServicePatchCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServicePatchCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Application)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
for &field in ["alt", "appsId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppGetCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
for &field in ["alt", "appsId", "servicesId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceDeleteCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project).
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// use appengine1::Application;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppCreateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_request: Application,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppCreateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.create",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len()));
|
|
for &field in ["alt"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request);
|
|
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.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppCreateCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_appengine1 as appengine1;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use appengine1::Appengine;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::new(),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = Appengine::new(hyper::Client::new(), 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("gubergren")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct AppServiceVersionGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a Appengine<C, A>,
|
|
_apps_id: String,
|
|
_services_id: String,
|
|
_versions_id: String,
|
|
_view: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for AppServiceVersionGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Version)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "appengine.apps.services.versions.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len()));
|
|
params.push(("appsId", self._apps_id.to_string()));
|
|
params.push(("servicesId", self._services_id.to_string()));
|
|
params.push(("versionsId", self._versions_id.to_string()));
|
|
if let Some(value) = self._view {
|
|
params.push(("view", value.to_string()));
|
|
}
|
|
for &field in ["alt", "appsId", "servicesId", "versionsId", "view"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}".to_string();
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::Admin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["versionsId", "servicesId", "appsId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
if params.len() > 0 {
|
|
url.push('?');
|
|
url.push_str(&url::form_urlencoded::serialize(params));
|
|
}
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> AppServiceVersionGetCall<'a, C, A> {
|
|
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 paramters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *bearer_token* (query-string) - OAuth bearer token.
|
|
/// * *pp* (query-boolean) - Pretty-print response.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> AppServiceVersionGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
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 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<T>(mut self, scope: T) -> AppServiceVersionGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
|
self
|
|
}
|
|
}
|
|
|
|
|