use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Application {
pub application_id: String,
pub author: String,
pub creation_time: Option<String>,
pub description: String,
pub home_page_url: Option<String>,
pub labels: Option<Vec<String>>,
pub license_url: Option<String>,
pub name: String,
pub readme_url: Option<String>,
pub spdx_license_id: Option<String>,
pub version: Option<Version>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ApplicationDependencyPage {
pub dependencies: Vec<ApplicationDependencySummary>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ApplicationDependencySummary {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "SemanticVersion")]
pub semantic_version: String,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ApplicationPage {
pub applications: Vec<ApplicationSummary>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ApplicationPolicy {
pub statements: Vec<ApplicationPolicyStatement>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ApplicationPolicyStatement {
#[serde(rename = "Actions")]
pub actions: Vec<String>,
#[serde(rename = "Principals")]
pub principals: Vec<String>,
#[serde(rename = "StatementId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ApplicationSummary {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "Author")]
pub author: String,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "Description")]
pub description: String,
#[serde(rename = "HomePageUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub home_page_url: Option<String>,
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SpdxLicenseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub spdx_license_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ApplicationVersionPage {
pub next_token: Option<String>,
pub versions: Vec<VersionSummary>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ChangeSetDetails {
pub application_id: String,
pub change_set_id: String,
pub semantic_version: String,
pub stack_id: String,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateApplicationInput {
pub author: String,
pub description: String,
pub home_page_url: Option<String>,
pub labels: Option<Vec<String>>,
pub license_body: Option<String>,
pub license_url: Option<String>,
pub name: String,
pub readme_body: Option<String>,
pub readme_url: Option<String>,
pub semantic_version: Option<String>,
pub source_code_url: Option<String>,
pub spdx_license_id: Option<String>,
pub template_body: Option<String>,
pub template_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateApplicationRequest {
#[serde(rename = "Author")]
pub author: String,
#[serde(rename = "Description")]
pub description: String,
#[serde(rename = "HomePageUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub home_page_url: Option<String>,
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
#[serde(rename = "LicenseBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub license_body: Option<String>,
#[serde(rename = "LicenseUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub license_url: Option<String>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "ReadmeBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub readme_body: Option<String>,
#[serde(rename = "ReadmeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub readme_url: Option<String>,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
#[serde(rename = "SourceCodeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_code_url: Option<String>,
#[serde(rename = "SpdxLicenseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub spdx_license_id: Option<String>,
#[serde(rename = "TemplateBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_body: Option<String>,
#[serde(rename = "TemplateUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateApplicationResponse {
#[serde(rename = "ApplicationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
#[serde(rename = "Author")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<String>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "HomePageUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub home_page_url: Option<String>,
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
#[serde(rename = "LicenseUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub license_url: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ReadmeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub readme_url: Option<String>,
#[serde(rename = "SpdxLicenseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub spdx_license_id: Option<String>,
#[serde(rename = "Version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<Version>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateApplicationVersionInput {
pub source_code_url: Option<String>,
pub template_body: Option<String>,
pub template_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateApplicationVersionRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "SemanticVersion")]
pub semantic_version: String,
#[serde(rename = "SourceCodeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_code_url: Option<String>,
#[serde(rename = "TemplateBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_body: Option<String>,
#[serde(rename = "TemplateUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateApplicationVersionResponse {
#[serde(rename = "ApplicationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "ParameterDefinitions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_definitions: Option<Vec<ParameterDefinition>>,
#[serde(rename = "RequiredCapabilities")]
#[serde(skip_serializing_if = "Option::is_none")]
pub required_capabilities: Option<Vec<String>>,
#[serde(rename = "ResourcesSupported")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resources_supported: Option<bool>,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
#[serde(rename = "SourceCodeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_code_url: Option<String>,
#[serde(rename = "TemplateUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateCloudFormationChangeSetInput {
pub capabilities: Option<Vec<String>>,
pub change_set_name: Option<String>,
pub client_token: Option<String>,
pub description: Option<String>,
pub notification_arns: Option<Vec<String>>,
pub parameter_overrides: Option<Vec<ParameterValue>>,
pub resource_types: Option<Vec<String>>,
pub rollback_configuration: Option<RollbackConfiguration>,
pub semantic_version: Option<String>,
pub stack_name: String,
pub tags: Option<Vec<Tag>>,
pub template_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateCloudFormationChangeSetRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "Capabilities")]
#[serde(skip_serializing_if = "Option::is_none")]
pub capabilities: Option<Vec<String>>,
#[serde(rename = "ChangeSetName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub change_set_name: Option<String>,
#[serde(rename = "ClientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "NotificationArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_arns: Option<Vec<String>>,
#[serde(rename = "ParameterOverrides")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_overrides: Option<Vec<ParameterValue>>,
#[serde(rename = "ResourceTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_types: Option<Vec<String>>,
#[serde(rename = "RollbackConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rollback_configuration: Option<RollbackConfiguration>,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
#[serde(rename = "StackName")]
pub stack_name: String,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "TemplateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateCloudFormationChangeSetResponse {
#[serde(rename = "ApplicationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
#[serde(rename = "ChangeSetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub change_set_id: Option<String>,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
#[serde(rename = "StackId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stack_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateCloudFormationTemplateRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateCloudFormationTemplateResponse {
#[serde(rename = "ApplicationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "ExpirationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expiration_time: Option<String>,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "TemplateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_id: Option<String>,
#[serde(rename = "TemplateUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteApplicationRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetApplicationPolicyRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetApplicationPolicyResponse {
#[serde(rename = "Statements")]
#[serde(skip_serializing_if = "Option::is_none")]
pub statements: Option<Vec<ApplicationPolicyStatement>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetApplicationRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetApplicationResponse {
#[serde(rename = "ApplicationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
#[serde(rename = "Author")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<String>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "HomePageUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub home_page_url: Option<String>,
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
#[serde(rename = "LicenseUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub license_url: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ReadmeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub readme_url: Option<String>,
#[serde(rename = "SpdxLicenseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub spdx_license_id: Option<String>,
#[serde(rename = "Version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<Version>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCloudFormationTemplateRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "TemplateId")]
pub template_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCloudFormationTemplateResponse {
#[serde(rename = "ApplicationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "ExpirationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expiration_time: Option<String>,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "TemplateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_id: Option<String>,
#[serde(rename = "TemplateUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListApplicationDependenciesRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "MaxItems")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_items: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SemanticVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListApplicationDependenciesResponse {
#[serde(rename = "Dependencies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dependencies: Option<Vec<ApplicationDependencySummary>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListApplicationVersionsRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "MaxItems")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_items: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListApplicationVersionsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Versions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub versions: Option<Vec<VersionSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListApplicationsRequest {
#[serde(rename = "MaxItems")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_items: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListApplicationsResponse {
#[serde(rename = "Applications")]
#[serde(skip_serializing_if = "Option::is_none")]
pub applications: Option<Vec<ApplicationSummary>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ParameterDefinition {
#[serde(rename = "AllowedPattern")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_pattern: Option<String>,
#[serde(rename = "AllowedValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_values: Option<Vec<String>>,
#[serde(rename = "ConstraintDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub constraint_description: Option<String>,
#[serde(rename = "DefaultValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_value: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "MaxLength")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_length: Option<i64>,
#[serde(rename = "MaxValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_value: Option<i64>,
#[serde(rename = "MinLength")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_length: Option<i64>,
#[serde(rename = "MinValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_value: Option<i64>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "NoEcho")]
#[serde(skip_serializing_if = "Option::is_none")]
pub no_echo: Option<bool>,
#[serde(rename = "ReferencedByResources")]
pub referenced_by_resources: Vec<String>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ParameterValue {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutApplicationPolicyRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "Statements")]
pub statements: Vec<ApplicationPolicyStatement>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutApplicationPolicyResponse {
#[serde(rename = "Statements")]
#[serde(skip_serializing_if = "Option::is_none")]
pub statements: Option<Vec<ApplicationPolicyStatement>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RollbackConfiguration {
#[serde(rename = "MonitoringTimeInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub monitoring_time_in_minutes: Option<i64>,
#[serde(rename = "RollbackTriggers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rollback_triggers: Option<Vec<RollbackTrigger>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RollbackTrigger {
#[serde(rename = "Arn")]
pub arn: String,
#[serde(rename = "Type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Tag {
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct TemplateDetails {
pub application_id: String,
pub creation_time: String,
pub expiration_time: String,
pub semantic_version: String,
pub status: String,
pub template_id: String,
pub template_url: String,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateApplicationInput {
pub author: Option<String>,
pub description: Option<String>,
pub home_page_url: Option<String>,
pub labels: Option<Vec<String>>,
pub readme_body: Option<String>,
pub readme_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateApplicationRequest {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "Author")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "HomePageUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub home_page_url: Option<String>,
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
#[serde(rename = "ReadmeBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub readme_body: Option<String>,
#[serde(rename = "ReadmeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub readme_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateApplicationResponse {
#[serde(rename = "ApplicationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
#[serde(rename = "Author")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<String>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "HomePageUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub home_page_url: Option<String>,
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
#[serde(rename = "LicenseUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub license_url: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ReadmeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub readme_url: Option<String>,
#[serde(rename = "SpdxLicenseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub spdx_license_id: Option<String>,
#[serde(rename = "Version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<Version>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Version {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "CreationTime")]
pub creation_time: String,
#[serde(rename = "ParameterDefinitions")]
pub parameter_definitions: Vec<ParameterDefinition>,
#[serde(rename = "RequiredCapabilities")]
pub required_capabilities: Vec<String>,
#[serde(rename = "ResourcesSupported")]
pub resources_supported: bool,
#[serde(rename = "SemanticVersion")]
pub semantic_version: String,
#[serde(rename = "SourceCodeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_code_url: Option<String>,
#[serde(rename = "TemplateUrl")]
pub template_url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VersionSummary {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "CreationTime")]
pub creation_time: String,
#[serde(rename = "SemanticVersion")]
pub semantic_version: String,
#[serde(rename = "SourceCodeUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_code_url: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum CreateApplicationError {
BadRequest(String),
Conflict(String),
Forbidden(String),
InternalServerError(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> CreateApplicationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return CreateApplicationError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateApplicationError::Conflict(String::from(error_message));
}
"ForbiddenException" => {
return CreateApplicationError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return CreateApplicationError::InternalServerError(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateApplicationError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateApplicationError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateApplicationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateApplicationError {
fn from(err: serde_json::error::Error) -> CreateApplicationError {
CreateApplicationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateApplicationError {
fn from(err: CredentialsError) -> CreateApplicationError {
CreateApplicationError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateApplicationError {
fn from(err: HttpDispatchError) -> CreateApplicationError {
CreateApplicationError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateApplicationError {
fn from(err: io::Error) -> CreateApplicationError {
CreateApplicationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateApplicationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateApplicationError {
fn description(&self) -> &str {
match *self {
CreateApplicationError::BadRequest(ref cause) => cause,
CreateApplicationError::Conflict(ref cause) => cause,
CreateApplicationError::Forbidden(ref cause) => cause,
CreateApplicationError::InternalServerError(ref cause) => cause,
CreateApplicationError::TooManyRequests(ref cause) => cause,
CreateApplicationError::Validation(ref cause) => cause,
CreateApplicationError::Credentials(ref err) => err.description(),
CreateApplicationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateApplicationError::ParseError(ref cause) => cause,
CreateApplicationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateApplicationVersionError {
BadRequest(String),
Conflict(String),
Forbidden(String),
InternalServerError(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateApplicationVersionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateApplicationVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return CreateApplicationVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateApplicationVersionError::Conflict(String::from(error_message));
}
"ForbiddenException" => {
return CreateApplicationVersionError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return CreateApplicationVersionError::InternalServerError(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return CreateApplicationVersionError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return CreateApplicationVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateApplicationVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateApplicationVersionError {
fn from(err: serde_json::error::Error) -> CreateApplicationVersionError {
CreateApplicationVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateApplicationVersionError {
fn from(err: CredentialsError) -> CreateApplicationVersionError {
CreateApplicationVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateApplicationVersionError {
fn from(err: HttpDispatchError) -> CreateApplicationVersionError {
CreateApplicationVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateApplicationVersionError {
fn from(err: io::Error) -> CreateApplicationVersionError {
CreateApplicationVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateApplicationVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateApplicationVersionError {
fn description(&self) -> &str {
match *self {
CreateApplicationVersionError::BadRequest(ref cause) => cause,
CreateApplicationVersionError::Conflict(ref cause) => cause,
CreateApplicationVersionError::Forbidden(ref cause) => cause,
CreateApplicationVersionError::InternalServerError(ref cause) => cause,
CreateApplicationVersionError::TooManyRequests(ref cause) => cause,
CreateApplicationVersionError::Validation(ref cause) => cause,
CreateApplicationVersionError::Credentials(ref err) => err.description(),
CreateApplicationVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateApplicationVersionError::ParseError(ref cause) => cause,
CreateApplicationVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateCloudFormationChangeSetError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateCloudFormationChangeSetError {
pub fn from_response(res: BufferedHttpResponse) -> CreateCloudFormationChangeSetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return CreateCloudFormationChangeSetError::BadRequest(String::from(
error_message,
));
}
"ForbiddenException" => {
return CreateCloudFormationChangeSetError::Forbidden(String::from(
error_message,
));
}
"InternalServerErrorException" => {
return CreateCloudFormationChangeSetError::InternalServerError(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return CreateCloudFormationChangeSetError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return CreateCloudFormationChangeSetError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateCloudFormationChangeSetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateCloudFormationChangeSetError {
fn from(err: serde_json::error::Error) -> CreateCloudFormationChangeSetError {
CreateCloudFormationChangeSetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateCloudFormationChangeSetError {
fn from(err: CredentialsError) -> CreateCloudFormationChangeSetError {
CreateCloudFormationChangeSetError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateCloudFormationChangeSetError {
fn from(err: HttpDispatchError) -> CreateCloudFormationChangeSetError {
CreateCloudFormationChangeSetError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateCloudFormationChangeSetError {
fn from(err: io::Error) -> CreateCloudFormationChangeSetError {
CreateCloudFormationChangeSetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateCloudFormationChangeSetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateCloudFormationChangeSetError {
fn description(&self) -> &str {
match *self {
CreateCloudFormationChangeSetError::BadRequest(ref cause) => cause,
CreateCloudFormationChangeSetError::Forbidden(ref cause) => cause,
CreateCloudFormationChangeSetError::InternalServerError(ref cause) => cause,
CreateCloudFormationChangeSetError::TooManyRequests(ref cause) => cause,
CreateCloudFormationChangeSetError::Validation(ref cause) => cause,
CreateCloudFormationChangeSetError::Credentials(ref err) => err.description(),
CreateCloudFormationChangeSetError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateCloudFormationChangeSetError::ParseError(ref cause) => cause,
CreateCloudFormationChangeSetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateCloudFormationTemplateError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateCloudFormationTemplateError {
pub fn from_response(res: BufferedHttpResponse) -> CreateCloudFormationTemplateError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return CreateCloudFormationTemplateError::BadRequest(String::from(
error_message,
));
}
"ForbiddenException" => {
return CreateCloudFormationTemplateError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return CreateCloudFormationTemplateError::InternalServerError(String::from(
error_message,
));
}
"NotFoundException" => {
return CreateCloudFormationTemplateError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateCloudFormationTemplateError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return CreateCloudFormationTemplateError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateCloudFormationTemplateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateCloudFormationTemplateError {
fn from(err: serde_json::error::Error) -> CreateCloudFormationTemplateError {
CreateCloudFormationTemplateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateCloudFormationTemplateError {
fn from(err: CredentialsError) -> CreateCloudFormationTemplateError {
CreateCloudFormationTemplateError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateCloudFormationTemplateError {
fn from(err: HttpDispatchError) -> CreateCloudFormationTemplateError {
CreateCloudFormationTemplateError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateCloudFormationTemplateError {
fn from(err: io::Error) -> CreateCloudFormationTemplateError {
CreateCloudFormationTemplateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateCloudFormationTemplateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateCloudFormationTemplateError {
fn description(&self) -> &str {
match *self {
CreateCloudFormationTemplateError::BadRequest(ref cause) => cause,
CreateCloudFormationTemplateError::Forbidden(ref cause) => cause,
CreateCloudFormationTemplateError::InternalServerError(ref cause) => cause,
CreateCloudFormationTemplateError::NotFound(ref cause) => cause,
CreateCloudFormationTemplateError::TooManyRequests(ref cause) => cause,
CreateCloudFormationTemplateError::Validation(ref cause) => cause,
CreateCloudFormationTemplateError::Credentials(ref err) => err.description(),
CreateCloudFormationTemplateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateCloudFormationTemplateError::ParseError(ref cause) => cause,
CreateCloudFormationTemplateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteApplicationError {
BadRequest(String),
Conflict(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteApplicationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteApplicationError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteApplicationError::Conflict(String::from(error_message));
}
"ForbiddenException" => {
return DeleteApplicationError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return DeleteApplicationError::InternalServerError(String::from(error_message));
}
"NotFoundException" => {
return DeleteApplicationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteApplicationError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteApplicationError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteApplicationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteApplicationError {
fn from(err: serde_json::error::Error) -> DeleteApplicationError {
DeleteApplicationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteApplicationError {
fn from(err: CredentialsError) -> DeleteApplicationError {
DeleteApplicationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteApplicationError {
fn from(err: HttpDispatchError) -> DeleteApplicationError {
DeleteApplicationError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteApplicationError {
fn from(err: io::Error) -> DeleteApplicationError {
DeleteApplicationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteApplicationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteApplicationError {
fn description(&self) -> &str {
match *self {
DeleteApplicationError::BadRequest(ref cause) => cause,
DeleteApplicationError::Conflict(ref cause) => cause,
DeleteApplicationError::Forbidden(ref cause) => cause,
DeleteApplicationError::InternalServerError(ref cause) => cause,
DeleteApplicationError::NotFound(ref cause) => cause,
DeleteApplicationError::TooManyRequests(ref cause) => cause,
DeleteApplicationError::Validation(ref cause) => cause,
DeleteApplicationError::Credentials(ref err) => err.description(),
DeleteApplicationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteApplicationError::ParseError(ref cause) => cause,
DeleteApplicationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetApplicationError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> GetApplicationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetApplicationError::BadRequest(String::from(error_message));
}
"ForbiddenException" => {
return GetApplicationError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return GetApplicationError::InternalServerError(String::from(error_message));
}
"NotFoundException" => {
return GetApplicationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetApplicationError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetApplicationError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetApplicationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApplicationError {
fn from(err: serde_json::error::Error) -> GetApplicationError {
GetApplicationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApplicationError {
fn from(err: CredentialsError) -> GetApplicationError {
GetApplicationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApplicationError {
fn from(err: HttpDispatchError) -> GetApplicationError {
GetApplicationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApplicationError {
fn from(err: io::Error) -> GetApplicationError {
GetApplicationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApplicationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApplicationError {
fn description(&self) -> &str {
match *self {
GetApplicationError::BadRequest(ref cause) => cause,
GetApplicationError::Forbidden(ref cause) => cause,
GetApplicationError::InternalServerError(ref cause) => cause,
GetApplicationError::NotFound(ref cause) => cause,
GetApplicationError::TooManyRequests(ref cause) => cause,
GetApplicationError::Validation(ref cause) => cause,
GetApplicationError::Credentials(ref err) => err.description(),
GetApplicationError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetApplicationError::ParseError(ref cause) => cause,
GetApplicationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetApplicationPolicyError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApplicationPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> GetApplicationPolicyError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetApplicationPolicyError::BadRequest(String::from(error_message));
}
"ForbiddenException" => {
return GetApplicationPolicyError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return GetApplicationPolicyError::InternalServerError(String::from(
error_message,
));
}
"NotFoundException" => {
return GetApplicationPolicyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetApplicationPolicyError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetApplicationPolicyError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetApplicationPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApplicationPolicyError {
fn from(err: serde_json::error::Error) -> GetApplicationPolicyError {
GetApplicationPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApplicationPolicyError {
fn from(err: CredentialsError) -> GetApplicationPolicyError {
GetApplicationPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApplicationPolicyError {
fn from(err: HttpDispatchError) -> GetApplicationPolicyError {
GetApplicationPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApplicationPolicyError {
fn from(err: io::Error) -> GetApplicationPolicyError {
GetApplicationPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApplicationPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApplicationPolicyError {
fn description(&self) -> &str {
match *self {
GetApplicationPolicyError::BadRequest(ref cause) => cause,
GetApplicationPolicyError::Forbidden(ref cause) => cause,
GetApplicationPolicyError::InternalServerError(ref cause) => cause,
GetApplicationPolicyError::NotFound(ref cause) => cause,
GetApplicationPolicyError::TooManyRequests(ref cause) => cause,
GetApplicationPolicyError::Validation(ref cause) => cause,
GetApplicationPolicyError::Credentials(ref err) => err.description(),
GetApplicationPolicyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetApplicationPolicyError::ParseError(ref cause) => cause,
GetApplicationPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCloudFormationTemplateError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCloudFormationTemplateError {
pub fn from_response(res: BufferedHttpResponse) -> GetCloudFormationTemplateError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetCloudFormationTemplateError::BadRequest(String::from(error_message));
}
"ForbiddenException" => {
return GetCloudFormationTemplateError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return GetCloudFormationTemplateError::InternalServerError(String::from(
error_message,
));
}
"NotFoundException" => {
return GetCloudFormationTemplateError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetCloudFormationTemplateError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return GetCloudFormationTemplateError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetCloudFormationTemplateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCloudFormationTemplateError {
fn from(err: serde_json::error::Error) -> GetCloudFormationTemplateError {
GetCloudFormationTemplateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCloudFormationTemplateError {
fn from(err: CredentialsError) -> GetCloudFormationTemplateError {
GetCloudFormationTemplateError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCloudFormationTemplateError {
fn from(err: HttpDispatchError) -> GetCloudFormationTemplateError {
GetCloudFormationTemplateError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCloudFormationTemplateError {
fn from(err: io::Error) -> GetCloudFormationTemplateError {
GetCloudFormationTemplateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCloudFormationTemplateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCloudFormationTemplateError {
fn description(&self) -> &str {
match *self {
GetCloudFormationTemplateError::BadRequest(ref cause) => cause,
GetCloudFormationTemplateError::Forbidden(ref cause) => cause,
GetCloudFormationTemplateError::InternalServerError(ref cause) => cause,
GetCloudFormationTemplateError::NotFound(ref cause) => cause,
GetCloudFormationTemplateError::TooManyRequests(ref cause) => cause,
GetCloudFormationTemplateError::Validation(ref cause) => cause,
GetCloudFormationTemplateError::Credentials(ref err) => err.description(),
GetCloudFormationTemplateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetCloudFormationTemplateError::ParseError(ref cause) => cause,
GetCloudFormationTemplateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListApplicationDependenciesError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListApplicationDependenciesError {
pub fn from_response(res: BufferedHttpResponse) -> ListApplicationDependenciesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return ListApplicationDependenciesError::BadRequest(String::from(error_message));
}
"ForbiddenException" => {
return ListApplicationDependenciesError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return ListApplicationDependenciesError::InternalServerError(String::from(
error_message,
));
}
"NotFoundException" => {
return ListApplicationDependenciesError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListApplicationDependenciesError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return ListApplicationDependenciesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListApplicationDependenciesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListApplicationDependenciesError {
fn from(err: serde_json::error::Error) -> ListApplicationDependenciesError {
ListApplicationDependenciesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListApplicationDependenciesError {
fn from(err: CredentialsError) -> ListApplicationDependenciesError {
ListApplicationDependenciesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListApplicationDependenciesError {
fn from(err: HttpDispatchError) -> ListApplicationDependenciesError {
ListApplicationDependenciesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListApplicationDependenciesError {
fn from(err: io::Error) -> ListApplicationDependenciesError {
ListApplicationDependenciesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListApplicationDependenciesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListApplicationDependenciesError {
fn description(&self) -> &str {
match *self {
ListApplicationDependenciesError::BadRequest(ref cause) => cause,
ListApplicationDependenciesError::Forbidden(ref cause) => cause,
ListApplicationDependenciesError::InternalServerError(ref cause) => cause,
ListApplicationDependenciesError::NotFound(ref cause) => cause,
ListApplicationDependenciesError::TooManyRequests(ref cause) => cause,
ListApplicationDependenciesError::Validation(ref cause) => cause,
ListApplicationDependenciesError::Credentials(ref err) => err.description(),
ListApplicationDependenciesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListApplicationDependenciesError::ParseError(ref cause) => cause,
ListApplicationDependenciesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListApplicationVersionsError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListApplicationVersionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListApplicationVersionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return ListApplicationVersionsError::BadRequest(String::from(error_message));
}
"ForbiddenException" => {
return ListApplicationVersionsError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return ListApplicationVersionsError::InternalServerError(String::from(
error_message,
));
}
"NotFoundException" => {
return ListApplicationVersionsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListApplicationVersionsError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return ListApplicationVersionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListApplicationVersionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListApplicationVersionsError {
fn from(err: serde_json::error::Error) -> ListApplicationVersionsError {
ListApplicationVersionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListApplicationVersionsError {
fn from(err: CredentialsError) -> ListApplicationVersionsError {
ListApplicationVersionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListApplicationVersionsError {
fn from(err: HttpDispatchError) -> ListApplicationVersionsError {
ListApplicationVersionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListApplicationVersionsError {
fn from(err: io::Error) -> ListApplicationVersionsError {
ListApplicationVersionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListApplicationVersionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListApplicationVersionsError {
fn description(&self) -> &str {
match *self {
ListApplicationVersionsError::BadRequest(ref cause) => cause,
ListApplicationVersionsError::Forbidden(ref cause) => cause,
ListApplicationVersionsError::InternalServerError(ref cause) => cause,
ListApplicationVersionsError::NotFound(ref cause) => cause,
ListApplicationVersionsError::TooManyRequests(ref cause) => cause,
ListApplicationVersionsError::Validation(ref cause) => cause,
ListApplicationVersionsError::Credentials(ref err) => err.description(),
ListApplicationVersionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListApplicationVersionsError::ParseError(ref cause) => cause,
ListApplicationVersionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListApplicationsError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListApplicationsError {
pub fn from_response(res: BufferedHttpResponse) -> ListApplicationsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return ListApplicationsError::BadRequest(String::from(error_message));
}
"ForbiddenException" => {
return ListApplicationsError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return ListApplicationsError::InternalServerError(String::from(error_message));
}
"NotFoundException" => {
return ListApplicationsError::NotFound(String::from(error_message));
}
"ValidationException" => {
return ListApplicationsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListApplicationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListApplicationsError {
fn from(err: serde_json::error::Error) -> ListApplicationsError {
ListApplicationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListApplicationsError {
fn from(err: CredentialsError) -> ListApplicationsError {
ListApplicationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListApplicationsError {
fn from(err: HttpDispatchError) -> ListApplicationsError {
ListApplicationsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListApplicationsError {
fn from(err: io::Error) -> ListApplicationsError {
ListApplicationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListApplicationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListApplicationsError {
fn description(&self) -> &str {
match *self {
ListApplicationsError::BadRequest(ref cause) => cause,
ListApplicationsError::Forbidden(ref cause) => cause,
ListApplicationsError::InternalServerError(ref cause) => cause,
ListApplicationsError::NotFound(ref cause) => cause,
ListApplicationsError::Validation(ref cause) => cause,
ListApplicationsError::Credentials(ref err) => err.description(),
ListApplicationsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListApplicationsError::ParseError(ref cause) => cause,
ListApplicationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutApplicationPolicyError {
BadRequest(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutApplicationPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> PutApplicationPolicyError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return PutApplicationPolicyError::BadRequest(String::from(error_message));
}
"ForbiddenException" => {
return PutApplicationPolicyError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return PutApplicationPolicyError::InternalServerError(String::from(
error_message,
));
}
"NotFoundException" => {
return PutApplicationPolicyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return PutApplicationPolicyError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return PutApplicationPolicyError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutApplicationPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutApplicationPolicyError {
fn from(err: serde_json::error::Error) -> PutApplicationPolicyError {
PutApplicationPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutApplicationPolicyError {
fn from(err: CredentialsError) -> PutApplicationPolicyError {
PutApplicationPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutApplicationPolicyError {
fn from(err: HttpDispatchError) -> PutApplicationPolicyError {
PutApplicationPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for PutApplicationPolicyError {
fn from(err: io::Error) -> PutApplicationPolicyError {
PutApplicationPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutApplicationPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutApplicationPolicyError {
fn description(&self) -> &str {
match *self {
PutApplicationPolicyError::BadRequest(ref cause) => cause,
PutApplicationPolicyError::Forbidden(ref cause) => cause,
PutApplicationPolicyError::InternalServerError(ref cause) => cause,
PutApplicationPolicyError::NotFound(ref cause) => cause,
PutApplicationPolicyError::TooManyRequests(ref cause) => cause,
PutApplicationPolicyError::Validation(ref cause) => cause,
PutApplicationPolicyError::Credentials(ref err) => err.description(),
PutApplicationPolicyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutApplicationPolicyError::ParseError(ref cause) => cause,
PutApplicationPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateApplicationError {
BadRequest(String),
Conflict(String),
Forbidden(String),
InternalServerError(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateApplicationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return UpdateApplicationError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateApplicationError::Conflict(String::from(error_message));
}
"ForbiddenException" => {
return UpdateApplicationError::Forbidden(String::from(error_message));
}
"InternalServerErrorException" => {
return UpdateApplicationError::InternalServerError(String::from(error_message));
}
"NotFoundException" => {
return UpdateApplicationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateApplicationError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateApplicationError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateApplicationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateApplicationError {
fn from(err: serde_json::error::Error) -> UpdateApplicationError {
UpdateApplicationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateApplicationError {
fn from(err: CredentialsError) -> UpdateApplicationError {
UpdateApplicationError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateApplicationError {
fn from(err: HttpDispatchError) -> UpdateApplicationError {
UpdateApplicationError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateApplicationError {
fn from(err: io::Error) -> UpdateApplicationError {
UpdateApplicationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateApplicationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateApplicationError {
fn description(&self) -> &str {
match *self {
UpdateApplicationError::BadRequest(ref cause) => cause,
UpdateApplicationError::Conflict(ref cause) => cause,
UpdateApplicationError::Forbidden(ref cause) => cause,
UpdateApplicationError::InternalServerError(ref cause) => cause,
UpdateApplicationError::NotFound(ref cause) => cause,
UpdateApplicationError::TooManyRequests(ref cause) => cause,
UpdateApplicationError::Validation(ref cause) => cause,
UpdateApplicationError::Credentials(ref err) => err.description(),
UpdateApplicationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateApplicationError::ParseError(ref cause) => cause,
UpdateApplicationError::Unknown(_) => "unknown error",
}
}
}
pub trait ServerlessRepo {
fn create_application(
&self,
input: CreateApplicationRequest,
) -> RusotoFuture<CreateApplicationResponse, CreateApplicationError>;
fn create_application_version(
&self,
input: CreateApplicationVersionRequest,
) -> RusotoFuture<CreateApplicationVersionResponse, CreateApplicationVersionError>;
fn create_cloud_formation_change_set(
&self,
input: CreateCloudFormationChangeSetRequest,
) -> RusotoFuture<CreateCloudFormationChangeSetResponse, CreateCloudFormationChangeSetError>;
fn create_cloud_formation_template(
&self,
input: CreateCloudFormationTemplateRequest,
) -> RusotoFuture<CreateCloudFormationTemplateResponse, CreateCloudFormationTemplateError>;
fn delete_application(
&self,
input: DeleteApplicationRequest,
) -> RusotoFuture<(), DeleteApplicationError>;
fn get_application(
&self,
input: GetApplicationRequest,
) -> RusotoFuture<GetApplicationResponse, GetApplicationError>;
fn get_application_policy(
&self,
input: GetApplicationPolicyRequest,
) -> RusotoFuture<GetApplicationPolicyResponse, GetApplicationPolicyError>;
fn get_cloud_formation_template(
&self,
input: GetCloudFormationTemplateRequest,
) -> RusotoFuture<GetCloudFormationTemplateResponse, GetCloudFormationTemplateError>;
fn list_application_dependencies(
&self,
input: ListApplicationDependenciesRequest,
) -> RusotoFuture<ListApplicationDependenciesResponse, ListApplicationDependenciesError>;
fn list_application_versions(
&self,
input: ListApplicationVersionsRequest,
) -> RusotoFuture<ListApplicationVersionsResponse, ListApplicationVersionsError>;
fn list_applications(
&self,
input: ListApplicationsRequest,
) -> RusotoFuture<ListApplicationsResponse, ListApplicationsError>;
fn put_application_policy(
&self,
input: PutApplicationPolicyRequest,
) -> RusotoFuture<PutApplicationPolicyResponse, PutApplicationPolicyError>;
fn update_application(
&self,
input: UpdateApplicationRequest,
) -> RusotoFuture<UpdateApplicationResponse, UpdateApplicationError>;
}
#[derive(Clone)]
pub struct ServerlessRepoClient {
client: Client,
region: region::Region,
}
impl ServerlessRepoClient {
pub fn new(region: region::Region) -> ServerlessRepoClient {
ServerlessRepoClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> ServerlessRepoClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
ServerlessRepoClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl ServerlessRepo for ServerlessRepoClient {
fn create_application(
&self,
input: CreateApplicationRequest,
) -> RusotoFuture<CreateApplicationResponse, CreateApplicationError> {
let request_uri = "/applications";
let mut request = SignedRequest::new("POST", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateApplicationResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateApplicationError::from_response(response))),
)
}
})
}
fn create_application_version(
&self,
input: CreateApplicationVersionRequest,
) -> RusotoFuture<CreateApplicationVersionResponse, CreateApplicationVersionError> {
let request_uri = format!(
"/applications/{application_id}/versions/{semantic_version}",
application_id = input.application_id,
semantic_version = input.semantic_version
);
let mut request = SignedRequest::new("PUT", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateApplicationVersionResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateApplicationVersionError::from_response(response))
}))
}
})
}
fn create_cloud_formation_change_set(
&self,
input: CreateCloudFormationChangeSetRequest,
) -> RusotoFuture<CreateCloudFormationChangeSetResponse, CreateCloudFormationChangeSetError>
{
let request_uri = format!(
"/applications/{application_id}/changesets",
application_id = input.application_id
);
let mut request = SignedRequest::new("POST", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateCloudFormationChangeSetResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateCloudFormationChangeSetError::from_response(response))
}))
}
})
}
fn create_cloud_formation_template(
&self,
input: CreateCloudFormationTemplateRequest,
) -> RusotoFuture<CreateCloudFormationTemplateResponse, CreateCloudFormationTemplateError> {
let request_uri = format!(
"/applications/{application_id}/templates",
application_id = input.application_id
);
let mut request = SignedRequest::new("POST", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateCloudFormationTemplateResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateCloudFormationTemplateError::from_response(response))
}))
}
})
}
fn delete_application(
&self,
input: DeleteApplicationRequest,
) -> RusotoFuture<(), DeleteApplicationError> {
let request_uri = format!(
"/applications/{application_id}",
application_id = input.application_id
);
let mut request =
SignedRequest::new("DELETE", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteApplicationError::from_response(response))),
)
}
})
}
fn get_application(
&self,
input: GetApplicationRequest,
) -> RusotoFuture<GetApplicationResponse, GetApplicationError> {
let request_uri = format!(
"/applications/{application_id}",
application_id = input.application_id
);
let mut request = SignedRequest::new("GET", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.semantic_version {
params.put("semanticVersion", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetApplicationResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetApplicationError::from_response(response))),
)
}
})
}
fn get_application_policy(
&self,
input: GetApplicationPolicyRequest,
) -> RusotoFuture<GetApplicationPolicyResponse, GetApplicationPolicyError> {
let request_uri = format!(
"/applications/{application_id}/policy",
application_id = input.application_id
);
let mut request = SignedRequest::new("GET", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetApplicationPolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetApplicationPolicyError::from_response(response))
}),
)
}
})
}
fn get_cloud_formation_template(
&self,
input: GetCloudFormationTemplateRequest,
) -> RusotoFuture<GetCloudFormationTemplateResponse, GetCloudFormationTemplateError> {
let request_uri = format!(
"/applications/{application_id}/templates/{template_id}",
application_id = input.application_id,
template_id = input.template_id
);
let mut request = SignedRequest::new("GET", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetCloudFormationTemplateResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetCloudFormationTemplateError::from_response(response))
}))
}
})
}
fn list_application_dependencies(
&self,
input: ListApplicationDependenciesRequest,
) -> RusotoFuture<ListApplicationDependenciesResponse, ListApplicationDependenciesError> {
let request_uri = format!(
"/applications/{application_id}/dependencies",
application_id = input.application_id
);
let mut request = SignedRequest::new("GET", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_items {
params.put("maxItems", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.semantic_version {
params.put("semanticVersion", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListApplicationDependenciesResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListApplicationDependenciesError::from_response(response))
}))
}
})
}
fn list_application_versions(
&self,
input: ListApplicationVersionsRequest,
) -> RusotoFuture<ListApplicationVersionsResponse, ListApplicationVersionsError> {
let request_uri = format!(
"/applications/{application_id}/versions",
application_id = input.application_id
);
let mut request = SignedRequest::new("GET", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_items {
params.put("maxItems", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListApplicationVersionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListApplicationVersionsError::from_response(response))
}))
}
})
}
fn list_applications(
&self,
input: ListApplicationsRequest,
) -> RusotoFuture<ListApplicationsResponse, ListApplicationsError> {
let request_uri = "/applications";
let mut request = SignedRequest::new("GET", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_items {
params.put("maxItems", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListApplicationsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListApplicationsError::from_response(response))),
)
}
})
}
fn put_application_policy(
&self,
input: PutApplicationPolicyRequest,
) -> RusotoFuture<PutApplicationPolicyResponse, PutApplicationPolicyError> {
let request_uri = format!(
"/applications/{application_id}/policy",
application_id = input.application_id
);
let mut request = SignedRequest::new("PUT", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<PutApplicationPolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(PutApplicationPolicyError::from_response(response))
}),
)
}
})
}
fn update_application(
&self,
input: UpdateApplicationRequest,
) -> RusotoFuture<UpdateApplicationResponse, UpdateApplicationError> {
let request_uri = format!(
"/applications/{application_id}",
application_id = input.application_id
);
let mut request = SignedRequest::new("PATCH", "serverlessrepo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<UpdateApplicationResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateApplicationError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}