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, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AccessLogSettings {
#[serde(rename = "destinationArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub destination_arn: Option<String>,
#[serde(rename = "format")]
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Account {
#[serde(rename = "apiKeyVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_version: Option<String>,
#[serde(rename = "cloudwatchRoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloudwatch_role_arn: Option<String>,
#[serde(rename = "features")]
#[serde(skip_serializing_if = "Option::is_none")]
pub features: Option<Vec<String>>,
#[serde(rename = "throttleSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub throttle_settings: Option<ThrottleSettings>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ApiKey {
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "customerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_id: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "stageKeys")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_keys: Option<Vec<String>>,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ApiKeyIds {
#[serde(rename = "ids")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ids: Option<Vec<String>>,
#[serde(rename = "warnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub warnings: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ApiKeys {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<ApiKey>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "warnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub warnings: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ApiStage {
#[serde(rename = "apiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
#[serde(rename = "throttle")]
#[serde(skip_serializing_if = "Option::is_none")]
pub throttle: Option<::std::collections::HashMap<String, ThrottleSettings>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Authorizer {
#[serde(rename = "authType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_type: Option<String>,
#[serde(rename = "authorizerCredentials")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials: Option<String>,
#[serde(rename = "authorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "authorizerUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_uri: Option<String>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "identitySource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_source: Option<String>,
#[serde(rename = "identityValidationExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_validation_expression: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "providerARNs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_ar_ns: Option<Vec<String>>,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Authorizers {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Authorizer>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BasePathMapping {
#[serde(rename = "basePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub base_path: Option<String>,
#[serde(rename = "restApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rest_api_id: Option<String>,
#[serde(rename = "stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BasePathMappings {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<BasePathMapping>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CanarySettings {
#[serde(rename = "deploymentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_id: Option<String>,
#[serde(rename = "percentTraffic")]
#[serde(skip_serializing_if = "Option::is_none")]
pub percent_traffic: Option<f64>,
#[serde(rename = "stageVariableOverrides")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_variable_overrides: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "useStageCache")]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_stage_cache: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ClientCertificate {
#[serde(rename = "clientCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_certificate_id: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "expirationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expiration_date: Option<f64>,
#[serde(rename = "pemEncodedCertificate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pem_encoded_certificate: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ClientCertificates {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<ClientCertificate>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateApiKeyRequest {
#[serde(rename = "customerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_id: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "generateDistinctId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub generate_distinct_id: Option<bool>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "stageKeys")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_keys: Option<Vec<StageKey>>,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateAuthorizerRequest {
#[serde(rename = "authType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_type: Option<String>,
#[serde(rename = "authorizerCredentials")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials: Option<String>,
#[serde(rename = "authorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "authorizerUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_uri: Option<String>,
#[serde(rename = "identitySource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_source: Option<String>,
#[serde(rename = "identityValidationExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_validation_expression: Option<String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "providerARNs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_ar_ns: Option<Vec<String>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateBasePathMappingRequest {
#[serde(rename = "basePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub base_path: Option<String>,
#[serde(rename = "domainName")]
pub domain_name: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDeploymentRequest {
#[serde(rename = "cacheClusterEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_cluster_enabled: Option<bool>,
#[serde(rename = "cacheClusterSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_cluster_size: Option<String>,
#[serde(rename = "canarySettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub canary_settings: Option<DeploymentCanarySettings>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_description: Option<String>,
#[serde(rename = "stageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<String>,
#[serde(rename = "tracingEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tracing_enabled: Option<bool>,
#[serde(rename = "variables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub variables: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDocumentationPartRequest {
#[serde(rename = "location")]
pub location: DocumentationPartLocation,
#[serde(rename = "properties")]
pub properties: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDocumentationVersionRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "documentationVersion")]
pub documentation_version: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDomainNameRequest {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_body: Option<String>,
#[serde(rename = "certificateChain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_chain: Option<String>,
#[serde(rename = "certificateName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_name: Option<String>,
#[serde(rename = "certificatePrivateKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_private_key: Option<String>,
#[serde(rename = "domainName")]
pub domain_name: String,
#[serde(rename = "endpointConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint_configuration: Option<EndpointConfiguration>,
#[serde(rename = "regionalCertificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub regional_certificate_arn: Option<String>,
#[serde(rename = "regionalCertificateName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub regional_certificate_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateModelRequest {
#[serde(rename = "contentType")]
pub content_type: String,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "schema")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateRequestValidatorRequest {
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "validateRequestBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validate_request_body: Option<bool>,
#[serde(rename = "validateRequestParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validate_request_parameters: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateResourceRequest {
#[serde(rename = "parentId")]
pub parent_id: String,
#[serde(rename = "pathPart")]
pub path_part: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateRestApiRequest {
#[serde(rename = "apiKeySource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_source: Option<String>,
#[serde(rename = "binaryMediaTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub binary_media_types: Option<Vec<String>>,
#[serde(rename = "cloneFrom")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clone_from: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "endpointConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint_configuration: Option<EndpointConfiguration>,
#[serde(rename = "minimumCompressionSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_compression_size: Option<i64>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "policy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateStageRequest {
#[serde(rename = "cacheClusterEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_cluster_enabled: Option<bool>,
#[serde(rename = "cacheClusterSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_cluster_size: Option<String>,
#[serde(rename = "canarySettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub canary_settings: Option<CanarySettings>,
#[serde(rename = "deploymentId")]
pub deployment_id: String,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "documentationVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub documentation_version: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
pub stage_name: String,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "tracingEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tracing_enabled: Option<bool>,
#[serde(rename = "variables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub variables: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUsagePlanKeyRequest {
#[serde(rename = "keyId")]
pub key_id: String,
#[serde(rename = "keyType")]
pub key_type: String,
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUsagePlanRequest {
#[serde(rename = "apiStages")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_stages: Option<Vec<ApiStage>>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "quota")]
#[serde(skip_serializing_if = "Option::is_none")]
pub quota: Option<QuotaSettings>,
#[serde(rename = "throttle")]
#[serde(skip_serializing_if = "Option::is_none")]
pub throttle: Option<ThrottleSettings>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateVpcLinkRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "targetArns")]
pub target_arns: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteApiKeyRequest {
#[serde(rename = "apiKey")]
pub api_key: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteAuthorizerRequest {
#[serde(rename = "authorizerId")]
pub authorizer_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBasePathMappingRequest {
#[serde(rename = "basePath")]
pub base_path: String,
#[serde(rename = "domainName")]
pub domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteClientCertificateRequest {
#[serde(rename = "clientCertificateId")]
pub client_certificate_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDeploymentRequest {
#[serde(rename = "deploymentId")]
pub deployment_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDocumentationPartRequest {
#[serde(rename = "documentationPartId")]
pub documentation_part_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDocumentationVersionRequest {
#[serde(rename = "documentationVersion")]
pub documentation_version: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDomainNameRequest {
#[serde(rename = "domainName")]
pub domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteGatewayResponseRequest {
#[serde(rename = "responseType")]
pub response_type: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteIntegrationRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteIntegrationResponseRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteMethodRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteMethodResponseRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteModelRequest {
#[serde(rename = "modelName")]
pub model_name: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRequestValidatorRequest {
#[serde(rename = "requestValidatorId")]
pub request_validator_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteResourceRequest {
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRestApiRequest {
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteStageRequest {
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUsagePlanKeyRequest {
#[serde(rename = "keyId")]
pub key_id: String,
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUsagePlanRequest {
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteVpcLinkRequest {
#[serde(rename = "vpcLinkId")]
pub vpc_link_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Deployment {
#[serde(rename = "apiSummary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_summary: Option<
::std::collections::HashMap<String, ::std::collections::HashMap<String, MethodSnapshot>>,
>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeploymentCanarySettings {
#[serde(rename = "percentTraffic")]
#[serde(skip_serializing_if = "Option::is_none")]
pub percent_traffic: Option<f64>,
#[serde(rename = "stageVariableOverrides")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_variable_overrides: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "useStageCache")]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_stage_cache: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Deployments {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Deployment>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DocumentationPart {
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<DocumentationPartLocation>,
#[serde(rename = "properties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub properties: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DocumentationPartIds {
#[serde(rename = "ids")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ids: Option<Vec<String>>,
#[serde(rename = "warnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub warnings: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DocumentationPartLocation {
#[serde(rename = "method")]
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
#[serde(rename = "statusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<String>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DocumentationParts {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<DocumentationPart>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DocumentationVersion {
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DocumentationVersions {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<DocumentationVersion>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DomainName {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_name: Option<String>,
#[serde(rename = "certificateUploadDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_upload_date: Option<f64>,
#[serde(rename = "distributionDomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub distribution_domain_name: Option<String>,
#[serde(rename = "distributionHostedZoneId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub distribution_hosted_zone_id: Option<String>,
#[serde(rename = "domainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name: Option<String>,
#[serde(rename = "endpointConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint_configuration: Option<EndpointConfiguration>,
#[serde(rename = "regionalCertificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub regional_certificate_arn: Option<String>,
#[serde(rename = "regionalCertificateName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub regional_certificate_name: Option<String>,
#[serde(rename = "regionalDomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub regional_domain_name: Option<String>,
#[serde(rename = "regionalHostedZoneId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub regional_hosted_zone_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DomainNames {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<DomainName>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EndpointConfiguration {
#[serde(rename = "types")]
#[serde(skip_serializing_if = "Option::is_none")]
pub types: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ExportResponse {
pub body: Option<Vec<u8>>,
pub content_disposition: Option<String>,
pub content_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct FlushStageAuthorizersCacheRequest {
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct FlushStageCacheRequest {
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GatewayResponse {
#[serde(rename = "defaultResponse")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_response: Option<bool>,
#[serde(rename = "responseParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_templates: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_type: Option<String>,
#[serde(rename = "statusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GatewayResponses {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<GatewayResponse>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GenerateClientCertificateRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAccountRequest {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetApiKeyRequest {
#[serde(rename = "apiKey")]
pub api_key: String,
#[serde(rename = "includeValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetApiKeysRequest {
#[serde(rename = "customerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_id: Option<String>,
#[serde(rename = "includeValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_values: Option<bool>,
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "nameQuery")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_query: Option<String>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAuthorizerRequest {
#[serde(rename = "authorizerId")]
pub authorizer_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAuthorizersRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBasePathMappingRequest {
#[serde(rename = "basePath")]
pub base_path: String,
#[serde(rename = "domainName")]
pub domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBasePathMappingsRequest {
#[serde(rename = "domainName")]
pub domain_name: String,
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetClientCertificateRequest {
#[serde(rename = "clientCertificateId")]
pub client_certificate_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetClientCertificatesRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDeploymentRequest {
#[serde(rename = "deploymentId")]
pub deployment_id: String,
#[serde(rename = "embed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub embed: Option<Vec<String>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDeploymentsRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDocumentationPartRequest {
#[serde(rename = "documentationPartId")]
pub documentation_part_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDocumentationPartsRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "locationStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location_status: Option<String>,
#[serde(rename = "nameQuery")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_query: Option<String>,
#[serde(rename = "path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDocumentationVersionRequest {
#[serde(rename = "documentationVersion")]
pub documentation_version: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDocumentationVersionsRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDomainNameRequest {
#[serde(rename = "domainName")]
pub domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDomainNamesRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetExportRequest {
#[serde(rename = "accepts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub accepts: Option<String>,
#[serde(rename = "exportType")]
pub export_type: String,
#[serde(rename = "parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetGatewayResponseRequest {
#[serde(rename = "responseType")]
pub response_type: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetGatewayResponsesRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntegrationRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntegrationResponseRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetMethodRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetMethodResponseRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetModelRequest {
#[serde(rename = "flatten")]
#[serde(skip_serializing_if = "Option::is_none")]
pub flatten: Option<bool>,
#[serde(rename = "modelName")]
pub model_name: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetModelTemplateRequest {
#[serde(rename = "modelName")]
pub model_name: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetModelsRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRequestValidatorRequest {
#[serde(rename = "requestValidatorId")]
pub request_validator_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRequestValidatorsRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetResourceRequest {
#[serde(rename = "embed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub embed: Option<Vec<String>>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetResourcesRequest {
#[serde(rename = "embed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub embed: Option<Vec<String>>,
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRestApiRequest {
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRestApisRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSdkRequest {
#[serde(rename = "parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "sdkType")]
pub sdk_type: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSdkTypeRequest {
#[serde(rename = "id")]
pub id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSdkTypesRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetStageRequest {
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetStagesRequest {
#[serde(rename = "deploymentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_id: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetTagsRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "resourceArn")]
pub resource_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUsagePlanKeyRequest {
#[serde(rename = "keyId")]
pub key_id: String,
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUsagePlanKeysRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "nameQuery")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_query: Option<String>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUsagePlanRequest {
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUsagePlansRequest {
#[serde(rename = "keyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key_id: Option<String>,
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUsageRequest {
#[serde(rename = "endDate")]
pub end_date: String,
#[serde(rename = "keyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key_id: Option<String>,
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "startDate")]
pub start_date: String,
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetVpcLinkRequest {
#[serde(rename = "vpcLinkId")]
pub vpc_link_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetVpcLinksRequest {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ImportApiKeysRequest {
#[serde(rename = "body")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub body: Vec<u8>,
#[serde(rename = "failOnWarnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fail_on_warnings: Option<bool>,
#[serde(rename = "format")]
pub format: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ImportDocumentationPartsRequest {
#[serde(rename = "body")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub body: Vec<u8>,
#[serde(rename = "failOnWarnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fail_on_warnings: Option<bool>,
#[serde(rename = "mode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mode: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ImportRestApiRequest {
#[serde(rename = "body")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub body: Vec<u8>,
#[serde(rename = "failOnWarnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fail_on_warnings: Option<bool>,
#[serde(rename = "parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Integration {
#[serde(rename = "cacheKeyParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_key_parameters: Option<Vec<String>>,
#[serde(rename = "cacheNamespace")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_namespace: Option<String>,
#[serde(rename = "connectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_id: Option<String>,
#[serde(rename = "connectionType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_type: Option<String>,
#[serde(rename = "contentHandling")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling: Option<String>,
#[serde(rename = "credentials")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials: Option<String>,
#[serde(rename = "httpMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub http_method: Option<String>,
#[serde(rename = "integrationResponses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_responses: Option<::std::collections::HashMap<String, IntegrationResponse>>,
#[serde(rename = "passthroughBehavior")]
#[serde(skip_serializing_if = "Option::is_none")]
pub passthrough_behavior: Option<String>,
#[serde(rename = "requestParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "requestTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_templates: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "timeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[serde(rename = "uri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub uri: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IntegrationResponse {
#[serde(rename = "contentHandling")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling: Option<String>,
#[serde(rename = "responseParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_templates: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "selectionPattern")]
#[serde(skip_serializing_if = "Option::is_none")]
pub selection_pattern: Option<String>,
#[serde(rename = "statusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Method {
#[serde(rename = "apiKeyRequired")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_required: Option<bool>,
#[serde(rename = "authorizationScopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorization_scopes: Option<Vec<String>>,
#[serde(rename = "authorizationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorization_type: Option<String>,
#[serde(rename = "authorizerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_id: Option<String>,
#[serde(rename = "httpMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub http_method: Option<String>,
#[serde(rename = "methodIntegration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub method_integration: Option<Integration>,
#[serde(rename = "methodResponses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub method_responses: Option<::std::collections::HashMap<String, MethodResponse>>,
#[serde(rename = "operationName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub operation_name: Option<String>,
#[serde(rename = "requestModels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_models: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "requestParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_parameters: Option<::std::collections::HashMap<String, bool>>,
#[serde(rename = "requestValidatorId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_validator_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct MethodResponse {
#[serde(rename = "responseModels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_models: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_parameters: Option<::std::collections::HashMap<String, bool>>,
#[serde(rename = "statusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct MethodSetting {
#[serde(rename = "cacheDataEncrypted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_data_encrypted: Option<bool>,
#[serde(rename = "cacheTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_ttl_in_seconds: Option<i64>,
#[serde(rename = "cachingEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub caching_enabled: Option<bool>,
#[serde(rename = "dataTraceEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_trace_enabled: Option<bool>,
#[serde(rename = "loggingLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logging_level: Option<String>,
#[serde(rename = "metricsEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub metrics_enabled: Option<bool>,
#[serde(rename = "requireAuthorizationForCacheControl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub require_authorization_for_cache_control: Option<bool>,
#[serde(rename = "throttlingBurstLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub throttling_burst_limit: Option<i64>,
#[serde(rename = "throttlingRateLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub throttling_rate_limit: Option<f64>,
#[serde(rename = "unauthorizedCacheControlHeaderStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unauthorized_cache_control_header_strategy: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct MethodSnapshot {
#[serde(rename = "apiKeyRequired")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_required: Option<bool>,
#[serde(rename = "authorizationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorization_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Model {
#[serde(rename = "contentType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "schema")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Models {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Model>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PatchOperation {
#[serde(rename = "from")]
#[serde(skip_serializing_if = "Option::is_none")]
pub from: Option<String>,
#[serde(rename = "op")]
#[serde(skip_serializing_if = "Option::is_none")]
pub op: Option<String>,
#[serde(rename = "path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutGatewayResponseRequest {
#[serde(rename = "responseParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_templates: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseType")]
pub response_type: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutIntegrationRequest {
#[serde(rename = "cacheKeyParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_key_parameters: Option<Vec<String>>,
#[serde(rename = "cacheNamespace")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_namespace: Option<String>,
#[serde(rename = "connectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_id: Option<String>,
#[serde(rename = "connectionType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_type: Option<String>,
#[serde(rename = "contentHandling")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling: Option<String>,
#[serde(rename = "credentials")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials: Option<String>,
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "integrationHttpMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_http_method: Option<String>,
#[serde(rename = "passthroughBehavior")]
#[serde(skip_serializing_if = "Option::is_none")]
pub passthrough_behavior: Option<String>,
#[serde(rename = "requestParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "requestTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_templates: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "timeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
#[serde(rename = "type")]
pub type_: String,
#[serde(rename = "uri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub uri: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutIntegrationResponseRequest {
#[serde(rename = "contentHandling")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling: Option<String>,
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "responseParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_templates: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "selectionPattern")]
#[serde(skip_serializing_if = "Option::is_none")]
pub selection_pattern: Option<String>,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutMethodRequest {
#[serde(rename = "apiKeyRequired")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_required: Option<bool>,
#[serde(rename = "authorizationScopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorization_scopes: Option<Vec<String>>,
#[serde(rename = "authorizationType")]
pub authorization_type: String,
#[serde(rename = "authorizerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_id: Option<String>,
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "operationName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub operation_name: Option<String>,
#[serde(rename = "requestModels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_models: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "requestParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_parameters: Option<::std::collections::HashMap<String, bool>>,
#[serde(rename = "requestValidatorId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_validator_id: Option<String>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutMethodResponseRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "responseModels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_models: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "responseParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_parameters: Option<::std::collections::HashMap<String, bool>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutRestApiRequest {
#[serde(rename = "body")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub body: Vec<u8>,
#[serde(rename = "failOnWarnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fail_on_warnings: Option<bool>,
#[serde(rename = "mode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mode: Option<String>,
#[serde(rename = "parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct QuotaSettings {
#[serde(rename = "limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "offset")]
#[serde(skip_serializing_if = "Option::is_none")]
pub offset: Option<i64>,
#[serde(rename = "period")]
#[serde(skip_serializing_if = "Option::is_none")]
pub period: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RequestValidator {
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "validateRequestBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validate_request_body: Option<bool>,
#[serde(rename = "validateRequestParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validate_request_parameters: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RequestValidators {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<RequestValidator>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Resource {
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "parentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_id: Option<String>,
#[serde(rename = "path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
#[serde(rename = "pathPart")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path_part: Option<String>,
#[serde(rename = "resourceMethods")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_methods: Option<::std::collections::HashMap<String, Method>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Resources {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Resource>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RestApi {
#[serde(rename = "apiKeySource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_source: Option<String>,
#[serde(rename = "binaryMediaTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub binary_media_types: Option<Vec<String>>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "endpointConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint_configuration: Option<EndpointConfiguration>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "minimumCompressionSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_compression_size: Option<i64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "policy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(rename = "warnings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub warnings: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RestApis {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<RestApi>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SdkConfigurationProperty {
#[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 = "friendlyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub friendly_name: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "required")]
#[serde(skip_serializing_if = "Option::is_none")]
pub required: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SdkResponse {
pub body: Option<Vec<u8>>,
pub content_disposition: Option<String>,
pub content_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SdkType {
#[serde(rename = "configurationProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub configuration_properties: Option<Vec<SdkConfigurationProperty>>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "friendlyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub friendly_name: Option<String>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SdkTypes {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<SdkType>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Stage {
#[serde(rename = "accessLogSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_log_settings: Option<AccessLogSettings>,
#[serde(rename = "cacheClusterEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_cluster_enabled: Option<bool>,
#[serde(rename = "cacheClusterSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_cluster_size: Option<String>,
#[serde(rename = "cacheClusterStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_cluster_status: Option<String>,
#[serde(rename = "canarySettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub canary_settings: Option<CanarySettings>,
#[serde(rename = "clientCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_certificate_id: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "deploymentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_id: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "documentationVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub documentation_version: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "methodSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub method_settings: Option<::std::collections::HashMap<String, MethodSetting>>,
#[serde(rename = "stageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<String>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "tracingEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tracing_enabled: Option<bool>,
#[serde(rename = "variables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub variables: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "webAclArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub web_acl_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StageKey {
#[serde(rename = "restApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rest_api_id: Option<String>,
#[serde(rename = "stageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Stages {
#[serde(rename = "item")]
#[serde(skip_serializing_if = "Option::is_none")]
pub item: Option<Vec<Stage>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tags")]
pub tags: ::std::collections::HashMap<String, String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Tags {
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Template {
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TestInvokeAuthorizerRequest {
#[serde(rename = "additionalContext")]
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_context: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "authorizerId")]
pub authorizer_id: String,
#[serde(rename = "body")]
#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
#[serde(rename = "headers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub headers: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "multiValueHeaders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub multi_value_headers: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "pathWithQueryString")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path_with_query_string: Option<String>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageVariables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_variables: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TestInvokeAuthorizerResponse {
#[serde(rename = "authorization")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorization: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "claims")]
#[serde(skip_serializing_if = "Option::is_none")]
pub claims: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "clientStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_status: Option<i64>,
#[serde(rename = "latency")]
#[serde(skip_serializing_if = "Option::is_none")]
pub latency: Option<i64>,
#[serde(rename = "log")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log: Option<String>,
#[serde(rename = "policy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy: Option<String>,
#[serde(rename = "principalId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principal_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TestInvokeMethodRequest {
#[serde(rename = "body")]
#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
#[serde(rename = "clientCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_certificate_id: Option<String>,
#[serde(rename = "headers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub headers: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "multiValueHeaders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub multi_value_headers: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "pathWithQueryString")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path_with_query_string: Option<String>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageVariables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_variables: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TestInvokeMethodResponse {
#[serde(rename = "body")]
#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
#[serde(rename = "headers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub headers: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "latency")]
#[serde(skip_serializing_if = "Option::is_none")]
pub latency: Option<i64>,
#[serde(rename = "log")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log: Option<String>,
#[serde(rename = "multiValueHeaders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub multi_value_headers: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ThrottleSettings {
#[serde(rename = "burstLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub burst_limit: Option<i64>,
#[serde(rename = "rateLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rate_limit: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateAccountRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateApiKeyRequest {
#[serde(rename = "apiKey")]
pub api_key: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateAuthorizerRequest {
#[serde(rename = "authorizerId")]
pub authorizer_id: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateBasePathMappingRequest {
#[serde(rename = "basePath")]
pub base_path: String,
#[serde(rename = "domainName")]
pub domain_name: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateClientCertificateRequest {
#[serde(rename = "clientCertificateId")]
pub client_certificate_id: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDeploymentRequest {
#[serde(rename = "deploymentId")]
pub deployment_id: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDocumentationPartRequest {
#[serde(rename = "documentationPartId")]
pub documentation_part_id: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDocumentationVersionRequest {
#[serde(rename = "documentationVersion")]
pub documentation_version: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDomainNameRequest {
#[serde(rename = "domainName")]
pub domain_name: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateGatewayResponseRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "responseType")]
pub response_type: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateIntegrationRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateIntegrationResponseRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateMethodRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateMethodResponseRequest {
#[serde(rename = "httpMethod")]
pub http_method: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "statusCode")]
pub status_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateModelRequest {
#[serde(rename = "modelName")]
pub model_name: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRequestValidatorRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "requestValidatorId")]
pub request_validator_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateResourceRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRestApiRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateStageRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "restApiId")]
pub rest_api_id: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateUsagePlanRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateUsageRequest {
#[serde(rename = "keyId")]
pub key_id: String,
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "usagePlanId")]
pub usage_plan_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateVpcLinkRequest {
#[serde(rename = "patchOperations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_operations: Option<Vec<PatchOperation>>,
#[serde(rename = "vpcLinkId")]
pub vpc_link_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Usage {
#[serde(rename = "endDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<String>,
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<::std::collections::HashMap<String, Vec<Vec<i64>>>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(rename = "startDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_date: Option<String>,
#[serde(rename = "usagePlanId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub usage_plan_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UsagePlan {
#[serde(rename = "apiStages")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_stages: Option<Vec<ApiStage>>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "productCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub product_code: Option<String>,
#[serde(rename = "quota")]
#[serde(skip_serializing_if = "Option::is_none")]
pub quota: Option<QuotaSettings>,
#[serde(rename = "throttle")]
#[serde(skip_serializing_if = "Option::is_none")]
pub throttle: Option<ThrottleSettings>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UsagePlanKey {
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UsagePlanKeys {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<UsagePlanKey>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UsagePlans {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<UsagePlan>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VpcLink {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "statusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "targetArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VpcLinks {
#[serde(rename = "items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<VpcLink>>,
#[serde(rename = "position")]
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum CreateApiKeyError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateApiKeyError {
pub fn from_response(res: BufferedHttpResponse) -> CreateApiKeyError {
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 CreateApiKeyError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateApiKeyError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateApiKeyError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateApiKeyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateApiKeyError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateApiKeyError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateApiKeyError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateApiKeyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateApiKeyError {
fn from(err: serde_json::error::Error) -> CreateApiKeyError {
CreateApiKeyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateApiKeyError {
fn from(err: CredentialsError) -> CreateApiKeyError {
CreateApiKeyError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateApiKeyError {
fn from(err: HttpDispatchError) -> CreateApiKeyError {
CreateApiKeyError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateApiKeyError {
fn from(err: io::Error) -> CreateApiKeyError {
CreateApiKeyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateApiKeyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateApiKeyError {
fn description(&self) -> &str {
match *self {
CreateApiKeyError::BadRequest(ref cause) => cause,
CreateApiKeyError::Conflict(ref cause) => cause,
CreateApiKeyError::LimitExceeded(ref cause) => cause,
CreateApiKeyError::NotFound(ref cause) => cause,
CreateApiKeyError::TooManyRequests(ref cause) => cause,
CreateApiKeyError::Unauthorized(ref cause) => cause,
CreateApiKeyError::Validation(ref cause) => cause,
CreateApiKeyError::Credentials(ref err) => err.description(),
CreateApiKeyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateApiKeyError::ParseError(ref cause) => cause,
CreateApiKeyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateAuthorizerError {
BadRequest(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> CreateAuthorizerError {
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 CreateAuthorizerError::BadRequest(String::from(error_message));
}
"LimitExceededException" => {
return CreateAuthorizerError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateAuthorizerError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateAuthorizerError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateAuthorizerError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateAuthorizerError {
fn from(err: serde_json::error::Error) -> CreateAuthorizerError {
CreateAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateAuthorizerError {
fn from(err: CredentialsError) -> CreateAuthorizerError {
CreateAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateAuthorizerError {
fn from(err: HttpDispatchError) -> CreateAuthorizerError {
CreateAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateAuthorizerError {
fn from(err: io::Error) -> CreateAuthorizerError {
CreateAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateAuthorizerError {
fn description(&self) -> &str {
match *self {
CreateAuthorizerError::BadRequest(ref cause) => cause,
CreateAuthorizerError::LimitExceeded(ref cause) => cause,
CreateAuthorizerError::NotFound(ref cause) => cause,
CreateAuthorizerError::TooManyRequests(ref cause) => cause,
CreateAuthorizerError::Unauthorized(ref cause) => cause,
CreateAuthorizerError::Validation(ref cause) => cause,
CreateAuthorizerError::Credentials(ref err) => err.description(),
CreateAuthorizerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateAuthorizerError::ParseError(ref cause) => cause,
CreateAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateBasePathMappingError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateBasePathMappingError {
pub fn from_response(res: BufferedHttpResponse) -> CreateBasePathMappingError {
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 CreateBasePathMappingError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateBasePathMappingError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateBasePathMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateBasePathMappingError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateBasePathMappingError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateBasePathMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateBasePathMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateBasePathMappingError {
fn from(err: serde_json::error::Error) -> CreateBasePathMappingError {
CreateBasePathMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateBasePathMappingError {
fn from(err: CredentialsError) -> CreateBasePathMappingError {
CreateBasePathMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateBasePathMappingError {
fn from(err: HttpDispatchError) -> CreateBasePathMappingError {
CreateBasePathMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateBasePathMappingError {
fn from(err: io::Error) -> CreateBasePathMappingError {
CreateBasePathMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateBasePathMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateBasePathMappingError {
fn description(&self) -> &str {
match *self {
CreateBasePathMappingError::BadRequest(ref cause) => cause,
CreateBasePathMappingError::Conflict(ref cause) => cause,
CreateBasePathMappingError::NotFound(ref cause) => cause,
CreateBasePathMappingError::TooManyRequests(ref cause) => cause,
CreateBasePathMappingError::Unauthorized(ref cause) => cause,
CreateBasePathMappingError::Validation(ref cause) => cause,
CreateBasePathMappingError::Credentials(ref err) => err.description(),
CreateBasePathMappingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateBasePathMappingError::ParseError(ref cause) => cause,
CreateBasePathMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDeploymentError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
ServiceUnavailable(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDeploymentError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDeploymentError {
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 CreateDeploymentError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateDeploymentError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateDeploymentError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateDeploymentError::NotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return CreateDeploymentError::ServiceUnavailable(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateDeploymentError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateDeploymentError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateDeploymentError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDeploymentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDeploymentError {
fn from(err: serde_json::error::Error) -> CreateDeploymentError {
CreateDeploymentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDeploymentError {
fn from(err: CredentialsError) -> CreateDeploymentError {
CreateDeploymentError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDeploymentError {
fn from(err: HttpDispatchError) -> CreateDeploymentError {
CreateDeploymentError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDeploymentError {
fn from(err: io::Error) -> CreateDeploymentError {
CreateDeploymentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDeploymentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDeploymentError {
fn description(&self) -> &str {
match *self {
CreateDeploymentError::BadRequest(ref cause) => cause,
CreateDeploymentError::Conflict(ref cause) => cause,
CreateDeploymentError::LimitExceeded(ref cause) => cause,
CreateDeploymentError::NotFound(ref cause) => cause,
CreateDeploymentError::ServiceUnavailable(ref cause) => cause,
CreateDeploymentError::TooManyRequests(ref cause) => cause,
CreateDeploymentError::Unauthorized(ref cause) => cause,
CreateDeploymentError::Validation(ref cause) => cause,
CreateDeploymentError::Credentials(ref err) => err.description(),
CreateDeploymentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateDeploymentError::ParseError(ref cause) => cause,
CreateDeploymentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDocumentationPartError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDocumentationPartError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDocumentationPartError {
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 CreateDocumentationPartError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateDocumentationPartError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateDocumentationPartError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateDocumentationPartError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateDocumentationPartError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return CreateDocumentationPartError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateDocumentationPartError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDocumentationPartError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDocumentationPartError {
fn from(err: serde_json::error::Error) -> CreateDocumentationPartError {
CreateDocumentationPartError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDocumentationPartError {
fn from(err: CredentialsError) -> CreateDocumentationPartError {
CreateDocumentationPartError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDocumentationPartError {
fn from(err: HttpDispatchError) -> CreateDocumentationPartError {
CreateDocumentationPartError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDocumentationPartError {
fn from(err: io::Error) -> CreateDocumentationPartError {
CreateDocumentationPartError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDocumentationPartError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDocumentationPartError {
fn description(&self) -> &str {
match *self {
CreateDocumentationPartError::BadRequest(ref cause) => cause,
CreateDocumentationPartError::Conflict(ref cause) => cause,
CreateDocumentationPartError::LimitExceeded(ref cause) => cause,
CreateDocumentationPartError::NotFound(ref cause) => cause,
CreateDocumentationPartError::TooManyRequests(ref cause) => cause,
CreateDocumentationPartError::Unauthorized(ref cause) => cause,
CreateDocumentationPartError::Validation(ref cause) => cause,
CreateDocumentationPartError::Credentials(ref err) => err.description(),
CreateDocumentationPartError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateDocumentationPartError::ParseError(ref cause) => cause,
CreateDocumentationPartError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDocumentationVersionError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDocumentationVersionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDocumentationVersionError {
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 CreateDocumentationVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateDocumentationVersionError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateDocumentationVersionError::LimitExceeded(String::from(
error_message,
));
}
"NotFoundException" => {
return CreateDocumentationVersionError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateDocumentationVersionError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return CreateDocumentationVersionError::Unauthorized(String::from(
error_message,
));
}
"ValidationException" => {
return CreateDocumentationVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDocumentationVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDocumentationVersionError {
fn from(err: serde_json::error::Error) -> CreateDocumentationVersionError {
CreateDocumentationVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDocumentationVersionError {
fn from(err: CredentialsError) -> CreateDocumentationVersionError {
CreateDocumentationVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDocumentationVersionError {
fn from(err: HttpDispatchError) -> CreateDocumentationVersionError {
CreateDocumentationVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDocumentationVersionError {
fn from(err: io::Error) -> CreateDocumentationVersionError {
CreateDocumentationVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDocumentationVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDocumentationVersionError {
fn description(&self) -> &str {
match *self {
CreateDocumentationVersionError::BadRequest(ref cause) => cause,
CreateDocumentationVersionError::Conflict(ref cause) => cause,
CreateDocumentationVersionError::LimitExceeded(ref cause) => cause,
CreateDocumentationVersionError::NotFound(ref cause) => cause,
CreateDocumentationVersionError::TooManyRequests(ref cause) => cause,
CreateDocumentationVersionError::Unauthorized(ref cause) => cause,
CreateDocumentationVersionError::Validation(ref cause) => cause,
CreateDocumentationVersionError::Credentials(ref err) => err.description(),
CreateDocumentationVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateDocumentationVersionError::ParseError(ref cause) => cause,
CreateDocumentationVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDomainNameError {
BadRequest(String),
Conflict(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDomainNameError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDomainNameError {
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 CreateDomainNameError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateDomainNameError::Conflict(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateDomainNameError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateDomainNameError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateDomainNameError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDomainNameError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDomainNameError {
fn from(err: serde_json::error::Error) -> CreateDomainNameError {
CreateDomainNameError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDomainNameError {
fn from(err: CredentialsError) -> CreateDomainNameError {
CreateDomainNameError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDomainNameError {
fn from(err: HttpDispatchError) -> CreateDomainNameError {
CreateDomainNameError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDomainNameError {
fn from(err: io::Error) -> CreateDomainNameError {
CreateDomainNameError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDomainNameError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDomainNameError {
fn description(&self) -> &str {
match *self {
CreateDomainNameError::BadRequest(ref cause) => cause,
CreateDomainNameError::Conflict(ref cause) => cause,
CreateDomainNameError::TooManyRequests(ref cause) => cause,
CreateDomainNameError::Unauthorized(ref cause) => cause,
CreateDomainNameError::Validation(ref cause) => cause,
CreateDomainNameError::Credentials(ref err) => err.description(),
CreateDomainNameError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateDomainNameError::ParseError(ref cause) => cause,
CreateDomainNameError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateModelError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateModelError {
pub fn from_response(res: BufferedHttpResponse) -> CreateModelError {
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 CreateModelError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateModelError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateModelError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateModelError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateModelError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateModelError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateModelError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateModelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateModelError {
fn from(err: serde_json::error::Error) -> CreateModelError {
CreateModelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateModelError {
fn from(err: CredentialsError) -> CreateModelError {
CreateModelError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateModelError {
fn from(err: HttpDispatchError) -> CreateModelError {
CreateModelError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateModelError {
fn from(err: io::Error) -> CreateModelError {
CreateModelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateModelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateModelError {
fn description(&self) -> &str {
match *self {
CreateModelError::BadRequest(ref cause) => cause,
CreateModelError::Conflict(ref cause) => cause,
CreateModelError::LimitExceeded(ref cause) => cause,
CreateModelError::NotFound(ref cause) => cause,
CreateModelError::TooManyRequests(ref cause) => cause,
CreateModelError::Unauthorized(ref cause) => cause,
CreateModelError::Validation(ref cause) => cause,
CreateModelError::Credentials(ref err) => err.description(),
CreateModelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateModelError::ParseError(ref cause) => cause,
CreateModelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateRequestValidatorError {
BadRequest(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateRequestValidatorError {
pub fn from_response(res: BufferedHttpResponse) -> CreateRequestValidatorError {
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 CreateRequestValidatorError::BadRequest(String::from(error_message));
}
"LimitExceededException" => {
return CreateRequestValidatorError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateRequestValidatorError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateRequestValidatorError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateRequestValidatorError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateRequestValidatorError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateRequestValidatorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateRequestValidatorError {
fn from(err: serde_json::error::Error) -> CreateRequestValidatorError {
CreateRequestValidatorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateRequestValidatorError {
fn from(err: CredentialsError) -> CreateRequestValidatorError {
CreateRequestValidatorError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateRequestValidatorError {
fn from(err: HttpDispatchError) -> CreateRequestValidatorError {
CreateRequestValidatorError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateRequestValidatorError {
fn from(err: io::Error) -> CreateRequestValidatorError {
CreateRequestValidatorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateRequestValidatorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateRequestValidatorError {
fn description(&self) -> &str {
match *self {
CreateRequestValidatorError::BadRequest(ref cause) => cause,
CreateRequestValidatorError::LimitExceeded(ref cause) => cause,
CreateRequestValidatorError::NotFound(ref cause) => cause,
CreateRequestValidatorError::TooManyRequests(ref cause) => cause,
CreateRequestValidatorError::Unauthorized(ref cause) => cause,
CreateRequestValidatorError::Validation(ref cause) => cause,
CreateRequestValidatorError::Credentials(ref err) => err.description(),
CreateRequestValidatorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateRequestValidatorError::ParseError(ref cause) => cause,
CreateRequestValidatorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateResourceError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateResourceError {
pub fn from_response(res: BufferedHttpResponse) -> CreateResourceError {
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 CreateResourceError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateResourceError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateResourceError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateResourceError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateResourceError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateResourceError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateResourceError {
fn from(err: serde_json::error::Error) -> CreateResourceError {
CreateResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateResourceError {
fn from(err: CredentialsError) -> CreateResourceError {
CreateResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateResourceError {
fn from(err: HttpDispatchError) -> CreateResourceError {
CreateResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateResourceError {
fn from(err: io::Error) -> CreateResourceError {
CreateResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateResourceError {
fn description(&self) -> &str {
match *self {
CreateResourceError::BadRequest(ref cause) => cause,
CreateResourceError::Conflict(ref cause) => cause,
CreateResourceError::LimitExceeded(ref cause) => cause,
CreateResourceError::NotFound(ref cause) => cause,
CreateResourceError::TooManyRequests(ref cause) => cause,
CreateResourceError::Unauthorized(ref cause) => cause,
CreateResourceError::Validation(ref cause) => cause,
CreateResourceError::Credentials(ref err) => err.description(),
CreateResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateResourceError::ParseError(ref cause) => cause,
CreateResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateRestApiError {
BadRequest(String),
LimitExceeded(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateRestApiError {
pub fn from_response(res: BufferedHttpResponse) -> CreateRestApiError {
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 CreateRestApiError::BadRequest(String::from(error_message));
}
"LimitExceededException" => {
return CreateRestApiError::LimitExceeded(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateRestApiError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateRestApiError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateRestApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateRestApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateRestApiError {
fn from(err: serde_json::error::Error) -> CreateRestApiError {
CreateRestApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateRestApiError {
fn from(err: CredentialsError) -> CreateRestApiError {
CreateRestApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateRestApiError {
fn from(err: HttpDispatchError) -> CreateRestApiError {
CreateRestApiError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateRestApiError {
fn from(err: io::Error) -> CreateRestApiError {
CreateRestApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateRestApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateRestApiError {
fn description(&self) -> &str {
match *self {
CreateRestApiError::BadRequest(ref cause) => cause,
CreateRestApiError::LimitExceeded(ref cause) => cause,
CreateRestApiError::TooManyRequests(ref cause) => cause,
CreateRestApiError::Unauthorized(ref cause) => cause,
CreateRestApiError::Validation(ref cause) => cause,
CreateRestApiError::Credentials(ref err) => err.description(),
CreateRestApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateRestApiError::ParseError(ref cause) => cause,
CreateRestApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateStageError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateStageError {
pub fn from_response(res: BufferedHttpResponse) -> CreateStageError {
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 CreateStageError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateStageError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateStageError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateStageError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateStageError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateStageError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateStageError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateStageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateStageError {
fn from(err: serde_json::error::Error) -> CreateStageError {
CreateStageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateStageError {
fn from(err: CredentialsError) -> CreateStageError {
CreateStageError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateStageError {
fn from(err: HttpDispatchError) -> CreateStageError {
CreateStageError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateStageError {
fn from(err: io::Error) -> CreateStageError {
CreateStageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateStageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateStageError {
fn description(&self) -> &str {
match *self {
CreateStageError::BadRequest(ref cause) => cause,
CreateStageError::Conflict(ref cause) => cause,
CreateStageError::LimitExceeded(ref cause) => cause,
CreateStageError::NotFound(ref cause) => cause,
CreateStageError::TooManyRequests(ref cause) => cause,
CreateStageError::Unauthorized(ref cause) => cause,
CreateStageError::Validation(ref cause) => cause,
CreateStageError::Credentials(ref err) => err.description(),
CreateStageError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateStageError::ParseError(ref cause) => cause,
CreateStageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateUsagePlanError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUsagePlanError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUsagePlanError {
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 CreateUsagePlanError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateUsagePlanError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return CreateUsagePlanError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateUsagePlanError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateUsagePlanError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateUsagePlanError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateUsagePlanError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateUsagePlanError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUsagePlanError {
fn from(err: serde_json::error::Error) -> CreateUsagePlanError {
CreateUsagePlanError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUsagePlanError {
fn from(err: CredentialsError) -> CreateUsagePlanError {
CreateUsagePlanError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUsagePlanError {
fn from(err: HttpDispatchError) -> CreateUsagePlanError {
CreateUsagePlanError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUsagePlanError {
fn from(err: io::Error) -> CreateUsagePlanError {
CreateUsagePlanError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUsagePlanError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUsagePlanError {
fn description(&self) -> &str {
match *self {
CreateUsagePlanError::BadRequest(ref cause) => cause,
CreateUsagePlanError::Conflict(ref cause) => cause,
CreateUsagePlanError::LimitExceeded(ref cause) => cause,
CreateUsagePlanError::NotFound(ref cause) => cause,
CreateUsagePlanError::TooManyRequests(ref cause) => cause,
CreateUsagePlanError::Unauthorized(ref cause) => cause,
CreateUsagePlanError::Validation(ref cause) => cause,
CreateUsagePlanError::Credentials(ref err) => err.description(),
CreateUsagePlanError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateUsagePlanError::ParseError(ref cause) => cause,
CreateUsagePlanError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateUsagePlanKeyError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUsagePlanKeyError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUsagePlanKeyError {
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 CreateUsagePlanKeyError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateUsagePlanKeyError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateUsagePlanKeyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateUsagePlanKeyError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateUsagePlanKeyError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateUsagePlanKeyError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateUsagePlanKeyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUsagePlanKeyError {
fn from(err: serde_json::error::Error) -> CreateUsagePlanKeyError {
CreateUsagePlanKeyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUsagePlanKeyError {
fn from(err: CredentialsError) -> CreateUsagePlanKeyError {
CreateUsagePlanKeyError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUsagePlanKeyError {
fn from(err: HttpDispatchError) -> CreateUsagePlanKeyError {
CreateUsagePlanKeyError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUsagePlanKeyError {
fn from(err: io::Error) -> CreateUsagePlanKeyError {
CreateUsagePlanKeyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUsagePlanKeyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUsagePlanKeyError {
fn description(&self) -> &str {
match *self {
CreateUsagePlanKeyError::BadRequest(ref cause) => cause,
CreateUsagePlanKeyError::Conflict(ref cause) => cause,
CreateUsagePlanKeyError::NotFound(ref cause) => cause,
CreateUsagePlanKeyError::TooManyRequests(ref cause) => cause,
CreateUsagePlanKeyError::Unauthorized(ref cause) => cause,
CreateUsagePlanKeyError::Validation(ref cause) => cause,
CreateUsagePlanKeyError::Credentials(ref err) => err.description(),
CreateUsagePlanKeyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateUsagePlanKeyError::ParseError(ref cause) => cause,
CreateUsagePlanKeyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateVpcLinkError {
BadRequest(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateVpcLinkError {
pub fn from_response(res: BufferedHttpResponse) -> CreateVpcLinkError {
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 CreateVpcLinkError::BadRequest(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateVpcLinkError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return CreateVpcLinkError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return CreateVpcLinkError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateVpcLinkError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateVpcLinkError {
fn from(err: serde_json::error::Error) -> CreateVpcLinkError {
CreateVpcLinkError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateVpcLinkError {
fn from(err: CredentialsError) -> CreateVpcLinkError {
CreateVpcLinkError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateVpcLinkError {
fn from(err: HttpDispatchError) -> CreateVpcLinkError {
CreateVpcLinkError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateVpcLinkError {
fn from(err: io::Error) -> CreateVpcLinkError {
CreateVpcLinkError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateVpcLinkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateVpcLinkError {
fn description(&self) -> &str {
match *self {
CreateVpcLinkError::BadRequest(ref cause) => cause,
CreateVpcLinkError::TooManyRequests(ref cause) => cause,
CreateVpcLinkError::Unauthorized(ref cause) => cause,
CreateVpcLinkError::Validation(ref cause) => cause,
CreateVpcLinkError::Credentials(ref err) => err.description(),
CreateVpcLinkError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateVpcLinkError::ParseError(ref cause) => cause,
CreateVpcLinkError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteApiKeyError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteApiKeyError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteApiKeyError {
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 {
"NotFoundException" => {
return DeleteApiKeyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteApiKeyError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteApiKeyError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteApiKeyError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteApiKeyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteApiKeyError {
fn from(err: serde_json::error::Error) -> DeleteApiKeyError {
DeleteApiKeyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteApiKeyError {
fn from(err: CredentialsError) -> DeleteApiKeyError {
DeleteApiKeyError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteApiKeyError {
fn from(err: HttpDispatchError) -> DeleteApiKeyError {
DeleteApiKeyError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteApiKeyError {
fn from(err: io::Error) -> DeleteApiKeyError {
DeleteApiKeyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteApiKeyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteApiKeyError {
fn description(&self) -> &str {
match *self {
DeleteApiKeyError::NotFound(ref cause) => cause,
DeleteApiKeyError::TooManyRequests(ref cause) => cause,
DeleteApiKeyError::Unauthorized(ref cause) => cause,
DeleteApiKeyError::Validation(ref cause) => cause,
DeleteApiKeyError::Credentials(ref err) => err.description(),
DeleteApiKeyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteApiKeyError::ParseError(ref cause) => cause,
DeleteApiKeyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteAuthorizerError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteAuthorizerError {
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 DeleteAuthorizerError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteAuthorizerError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteAuthorizerError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteAuthorizerError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteAuthorizerError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteAuthorizerError {
fn from(err: serde_json::error::Error) -> DeleteAuthorizerError {
DeleteAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteAuthorizerError {
fn from(err: CredentialsError) -> DeleteAuthorizerError {
DeleteAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteAuthorizerError {
fn from(err: HttpDispatchError) -> DeleteAuthorizerError {
DeleteAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteAuthorizerError {
fn from(err: io::Error) -> DeleteAuthorizerError {
DeleteAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteAuthorizerError {
fn description(&self) -> &str {
match *self {
DeleteAuthorizerError::BadRequest(ref cause) => cause,
DeleteAuthorizerError::Conflict(ref cause) => cause,
DeleteAuthorizerError::NotFound(ref cause) => cause,
DeleteAuthorizerError::TooManyRequests(ref cause) => cause,
DeleteAuthorizerError::Unauthorized(ref cause) => cause,
DeleteAuthorizerError::Validation(ref cause) => cause,
DeleteAuthorizerError::Credentials(ref err) => err.description(),
DeleteAuthorizerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteAuthorizerError::ParseError(ref cause) => cause,
DeleteAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBasePathMappingError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteBasePathMappingError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteBasePathMappingError {
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 DeleteBasePathMappingError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteBasePathMappingError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteBasePathMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteBasePathMappingError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteBasePathMappingError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteBasePathMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteBasePathMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteBasePathMappingError {
fn from(err: serde_json::error::Error) -> DeleteBasePathMappingError {
DeleteBasePathMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteBasePathMappingError {
fn from(err: CredentialsError) -> DeleteBasePathMappingError {
DeleteBasePathMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteBasePathMappingError {
fn from(err: HttpDispatchError) -> DeleteBasePathMappingError {
DeleteBasePathMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteBasePathMappingError {
fn from(err: io::Error) -> DeleteBasePathMappingError {
DeleteBasePathMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteBasePathMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBasePathMappingError {
fn description(&self) -> &str {
match *self {
DeleteBasePathMappingError::BadRequest(ref cause) => cause,
DeleteBasePathMappingError::Conflict(ref cause) => cause,
DeleteBasePathMappingError::NotFound(ref cause) => cause,
DeleteBasePathMappingError::TooManyRequests(ref cause) => cause,
DeleteBasePathMappingError::Unauthorized(ref cause) => cause,
DeleteBasePathMappingError::Validation(ref cause) => cause,
DeleteBasePathMappingError::Credentials(ref err) => err.description(),
DeleteBasePathMappingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteBasePathMappingError::ParseError(ref cause) => cause,
DeleteBasePathMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteClientCertificateError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteClientCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteClientCertificateError {
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 DeleteClientCertificateError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return DeleteClientCertificateError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteClientCertificateError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return DeleteClientCertificateError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteClientCertificateError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteClientCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteClientCertificateError {
fn from(err: serde_json::error::Error) -> DeleteClientCertificateError {
DeleteClientCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteClientCertificateError {
fn from(err: CredentialsError) -> DeleteClientCertificateError {
DeleteClientCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteClientCertificateError {
fn from(err: HttpDispatchError) -> DeleteClientCertificateError {
DeleteClientCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteClientCertificateError {
fn from(err: io::Error) -> DeleteClientCertificateError {
DeleteClientCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteClientCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteClientCertificateError {
fn description(&self) -> &str {
match *self {
DeleteClientCertificateError::BadRequest(ref cause) => cause,
DeleteClientCertificateError::NotFound(ref cause) => cause,
DeleteClientCertificateError::TooManyRequests(ref cause) => cause,
DeleteClientCertificateError::Unauthorized(ref cause) => cause,
DeleteClientCertificateError::Validation(ref cause) => cause,
DeleteClientCertificateError::Credentials(ref err) => err.description(),
DeleteClientCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteClientCertificateError::ParseError(ref cause) => cause,
DeleteClientCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDeploymentError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDeploymentError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDeploymentError {
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 DeleteDeploymentError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return DeleteDeploymentError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteDeploymentError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteDeploymentError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteDeploymentError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDeploymentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDeploymentError {
fn from(err: serde_json::error::Error) -> DeleteDeploymentError {
DeleteDeploymentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDeploymentError {
fn from(err: CredentialsError) -> DeleteDeploymentError {
DeleteDeploymentError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDeploymentError {
fn from(err: HttpDispatchError) -> DeleteDeploymentError {
DeleteDeploymentError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDeploymentError {
fn from(err: io::Error) -> DeleteDeploymentError {
DeleteDeploymentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDeploymentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDeploymentError {
fn description(&self) -> &str {
match *self {
DeleteDeploymentError::BadRequest(ref cause) => cause,
DeleteDeploymentError::NotFound(ref cause) => cause,
DeleteDeploymentError::TooManyRequests(ref cause) => cause,
DeleteDeploymentError::Unauthorized(ref cause) => cause,
DeleteDeploymentError::Validation(ref cause) => cause,
DeleteDeploymentError::Credentials(ref err) => err.description(),
DeleteDeploymentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteDeploymentError::ParseError(ref cause) => cause,
DeleteDeploymentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDocumentationPartError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDocumentationPartError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDocumentationPartError {
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 DeleteDocumentationPartError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteDocumentationPartError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteDocumentationPartError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteDocumentationPartError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return DeleteDocumentationPartError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteDocumentationPartError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDocumentationPartError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDocumentationPartError {
fn from(err: serde_json::error::Error) -> DeleteDocumentationPartError {
DeleteDocumentationPartError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDocumentationPartError {
fn from(err: CredentialsError) -> DeleteDocumentationPartError {
DeleteDocumentationPartError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDocumentationPartError {
fn from(err: HttpDispatchError) -> DeleteDocumentationPartError {
DeleteDocumentationPartError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDocumentationPartError {
fn from(err: io::Error) -> DeleteDocumentationPartError {
DeleteDocumentationPartError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDocumentationPartError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDocumentationPartError {
fn description(&self) -> &str {
match *self {
DeleteDocumentationPartError::BadRequest(ref cause) => cause,
DeleteDocumentationPartError::Conflict(ref cause) => cause,
DeleteDocumentationPartError::NotFound(ref cause) => cause,
DeleteDocumentationPartError::TooManyRequests(ref cause) => cause,
DeleteDocumentationPartError::Unauthorized(ref cause) => cause,
DeleteDocumentationPartError::Validation(ref cause) => cause,
DeleteDocumentationPartError::Credentials(ref err) => err.description(),
DeleteDocumentationPartError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteDocumentationPartError::ParseError(ref cause) => cause,
DeleteDocumentationPartError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDocumentationVersionError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDocumentationVersionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDocumentationVersionError {
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 DeleteDocumentationVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteDocumentationVersionError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteDocumentationVersionError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteDocumentationVersionError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return DeleteDocumentationVersionError::Unauthorized(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteDocumentationVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDocumentationVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDocumentationVersionError {
fn from(err: serde_json::error::Error) -> DeleteDocumentationVersionError {
DeleteDocumentationVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDocumentationVersionError {
fn from(err: CredentialsError) -> DeleteDocumentationVersionError {
DeleteDocumentationVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDocumentationVersionError {
fn from(err: HttpDispatchError) -> DeleteDocumentationVersionError {
DeleteDocumentationVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDocumentationVersionError {
fn from(err: io::Error) -> DeleteDocumentationVersionError {
DeleteDocumentationVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDocumentationVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDocumentationVersionError {
fn description(&self) -> &str {
match *self {
DeleteDocumentationVersionError::BadRequest(ref cause) => cause,
DeleteDocumentationVersionError::Conflict(ref cause) => cause,
DeleteDocumentationVersionError::NotFound(ref cause) => cause,
DeleteDocumentationVersionError::TooManyRequests(ref cause) => cause,
DeleteDocumentationVersionError::Unauthorized(ref cause) => cause,
DeleteDocumentationVersionError::Validation(ref cause) => cause,
DeleteDocumentationVersionError::Credentials(ref err) => err.description(),
DeleteDocumentationVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteDocumentationVersionError::ParseError(ref cause) => cause,
DeleteDocumentationVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDomainNameError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDomainNameError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDomainNameError {
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 {
"NotFoundException" => {
return DeleteDomainNameError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteDomainNameError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteDomainNameError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteDomainNameError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDomainNameError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDomainNameError {
fn from(err: serde_json::error::Error) -> DeleteDomainNameError {
DeleteDomainNameError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDomainNameError {
fn from(err: CredentialsError) -> DeleteDomainNameError {
DeleteDomainNameError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDomainNameError {
fn from(err: HttpDispatchError) -> DeleteDomainNameError {
DeleteDomainNameError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDomainNameError {
fn from(err: io::Error) -> DeleteDomainNameError {
DeleteDomainNameError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDomainNameError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDomainNameError {
fn description(&self) -> &str {
match *self {
DeleteDomainNameError::NotFound(ref cause) => cause,
DeleteDomainNameError::TooManyRequests(ref cause) => cause,
DeleteDomainNameError::Unauthorized(ref cause) => cause,
DeleteDomainNameError::Validation(ref cause) => cause,
DeleteDomainNameError::Credentials(ref err) => err.description(),
DeleteDomainNameError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteDomainNameError::ParseError(ref cause) => cause,
DeleteDomainNameError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteGatewayResponseError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteGatewayResponseError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteGatewayResponseError {
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 DeleteGatewayResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteGatewayResponseError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteGatewayResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteGatewayResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteGatewayResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteGatewayResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteGatewayResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteGatewayResponseError {
fn from(err: serde_json::error::Error) -> DeleteGatewayResponseError {
DeleteGatewayResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteGatewayResponseError {
fn from(err: CredentialsError) -> DeleteGatewayResponseError {
DeleteGatewayResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteGatewayResponseError {
fn from(err: HttpDispatchError) -> DeleteGatewayResponseError {
DeleteGatewayResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteGatewayResponseError {
fn from(err: io::Error) -> DeleteGatewayResponseError {
DeleteGatewayResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteGatewayResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteGatewayResponseError {
fn description(&self) -> &str {
match *self {
DeleteGatewayResponseError::BadRequest(ref cause) => cause,
DeleteGatewayResponseError::Conflict(ref cause) => cause,
DeleteGatewayResponseError::NotFound(ref cause) => cause,
DeleteGatewayResponseError::TooManyRequests(ref cause) => cause,
DeleteGatewayResponseError::Unauthorized(ref cause) => cause,
DeleteGatewayResponseError::Validation(ref cause) => cause,
DeleteGatewayResponseError::Credentials(ref err) => err.description(),
DeleteGatewayResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteGatewayResponseError::ParseError(ref cause) => cause,
DeleteGatewayResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteIntegrationError {
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteIntegrationError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteIntegrationError {
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 {
"ConflictException" => {
return DeleteIntegrationError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteIntegrationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteIntegrationError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteIntegrationError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteIntegrationError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteIntegrationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteIntegrationError {
fn from(err: serde_json::error::Error) -> DeleteIntegrationError {
DeleteIntegrationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteIntegrationError {
fn from(err: CredentialsError) -> DeleteIntegrationError {
DeleteIntegrationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteIntegrationError {
fn from(err: HttpDispatchError) -> DeleteIntegrationError {
DeleteIntegrationError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteIntegrationError {
fn from(err: io::Error) -> DeleteIntegrationError {
DeleteIntegrationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteIntegrationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteIntegrationError {
fn description(&self) -> &str {
match *self {
DeleteIntegrationError::Conflict(ref cause) => cause,
DeleteIntegrationError::NotFound(ref cause) => cause,
DeleteIntegrationError::TooManyRequests(ref cause) => cause,
DeleteIntegrationError::Unauthorized(ref cause) => cause,
DeleteIntegrationError::Validation(ref cause) => cause,
DeleteIntegrationError::Credentials(ref err) => err.description(),
DeleteIntegrationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteIntegrationError::ParseError(ref cause) => cause,
DeleteIntegrationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteIntegrationResponseError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteIntegrationResponseError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteIntegrationResponseError {
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 DeleteIntegrationResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteIntegrationResponseError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteIntegrationResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteIntegrationResponseError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return DeleteIntegrationResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteIntegrationResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteIntegrationResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteIntegrationResponseError {
fn from(err: serde_json::error::Error) -> DeleteIntegrationResponseError {
DeleteIntegrationResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteIntegrationResponseError {
fn from(err: CredentialsError) -> DeleteIntegrationResponseError {
DeleteIntegrationResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteIntegrationResponseError {
fn from(err: HttpDispatchError) -> DeleteIntegrationResponseError {
DeleteIntegrationResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteIntegrationResponseError {
fn from(err: io::Error) -> DeleteIntegrationResponseError {
DeleteIntegrationResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteIntegrationResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteIntegrationResponseError {
fn description(&self) -> &str {
match *self {
DeleteIntegrationResponseError::BadRequest(ref cause) => cause,
DeleteIntegrationResponseError::Conflict(ref cause) => cause,
DeleteIntegrationResponseError::NotFound(ref cause) => cause,
DeleteIntegrationResponseError::TooManyRequests(ref cause) => cause,
DeleteIntegrationResponseError::Unauthorized(ref cause) => cause,
DeleteIntegrationResponseError::Validation(ref cause) => cause,
DeleteIntegrationResponseError::Credentials(ref err) => err.description(),
DeleteIntegrationResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteIntegrationResponseError::ParseError(ref cause) => cause,
DeleteIntegrationResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteMethodError {
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteMethodError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteMethodError {
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 {
"ConflictException" => {
return DeleteMethodError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteMethodError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteMethodError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteMethodError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteMethodError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteMethodError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteMethodError {
fn from(err: serde_json::error::Error) -> DeleteMethodError {
DeleteMethodError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteMethodError {
fn from(err: CredentialsError) -> DeleteMethodError {
DeleteMethodError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteMethodError {
fn from(err: HttpDispatchError) -> DeleteMethodError {
DeleteMethodError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteMethodError {
fn from(err: io::Error) -> DeleteMethodError {
DeleteMethodError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteMethodError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteMethodError {
fn description(&self) -> &str {
match *self {
DeleteMethodError::Conflict(ref cause) => cause,
DeleteMethodError::NotFound(ref cause) => cause,
DeleteMethodError::TooManyRequests(ref cause) => cause,
DeleteMethodError::Unauthorized(ref cause) => cause,
DeleteMethodError::Validation(ref cause) => cause,
DeleteMethodError::Credentials(ref err) => err.description(),
DeleteMethodError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteMethodError::ParseError(ref cause) => cause,
DeleteMethodError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteMethodResponseError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteMethodResponseError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteMethodResponseError {
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 DeleteMethodResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteMethodResponseError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteMethodResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteMethodResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteMethodResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteMethodResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteMethodResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteMethodResponseError {
fn from(err: serde_json::error::Error) -> DeleteMethodResponseError {
DeleteMethodResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteMethodResponseError {
fn from(err: CredentialsError) -> DeleteMethodResponseError {
DeleteMethodResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteMethodResponseError {
fn from(err: HttpDispatchError) -> DeleteMethodResponseError {
DeleteMethodResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteMethodResponseError {
fn from(err: io::Error) -> DeleteMethodResponseError {
DeleteMethodResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteMethodResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteMethodResponseError {
fn description(&self) -> &str {
match *self {
DeleteMethodResponseError::BadRequest(ref cause) => cause,
DeleteMethodResponseError::Conflict(ref cause) => cause,
DeleteMethodResponseError::NotFound(ref cause) => cause,
DeleteMethodResponseError::TooManyRequests(ref cause) => cause,
DeleteMethodResponseError::Unauthorized(ref cause) => cause,
DeleteMethodResponseError::Validation(ref cause) => cause,
DeleteMethodResponseError::Credentials(ref err) => err.description(),
DeleteMethodResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteMethodResponseError::ParseError(ref cause) => cause,
DeleteMethodResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteModelError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteModelError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteModelError {
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 DeleteModelError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteModelError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteModelError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteModelError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteModelError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteModelError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteModelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteModelError {
fn from(err: serde_json::error::Error) -> DeleteModelError {
DeleteModelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteModelError {
fn from(err: CredentialsError) -> DeleteModelError {
DeleteModelError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteModelError {
fn from(err: HttpDispatchError) -> DeleteModelError {
DeleteModelError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteModelError {
fn from(err: io::Error) -> DeleteModelError {
DeleteModelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteModelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteModelError {
fn description(&self) -> &str {
match *self {
DeleteModelError::BadRequest(ref cause) => cause,
DeleteModelError::Conflict(ref cause) => cause,
DeleteModelError::NotFound(ref cause) => cause,
DeleteModelError::TooManyRequests(ref cause) => cause,
DeleteModelError::Unauthorized(ref cause) => cause,
DeleteModelError::Validation(ref cause) => cause,
DeleteModelError::Credentials(ref err) => err.description(),
DeleteModelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteModelError::ParseError(ref cause) => cause,
DeleteModelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRequestValidatorError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRequestValidatorError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRequestValidatorError {
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 DeleteRequestValidatorError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteRequestValidatorError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteRequestValidatorError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteRequestValidatorError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteRequestValidatorError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteRequestValidatorError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteRequestValidatorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRequestValidatorError {
fn from(err: serde_json::error::Error) -> DeleteRequestValidatorError {
DeleteRequestValidatorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRequestValidatorError {
fn from(err: CredentialsError) -> DeleteRequestValidatorError {
DeleteRequestValidatorError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRequestValidatorError {
fn from(err: HttpDispatchError) -> DeleteRequestValidatorError {
DeleteRequestValidatorError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRequestValidatorError {
fn from(err: io::Error) -> DeleteRequestValidatorError {
DeleteRequestValidatorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRequestValidatorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRequestValidatorError {
fn description(&self) -> &str {
match *self {
DeleteRequestValidatorError::BadRequest(ref cause) => cause,
DeleteRequestValidatorError::Conflict(ref cause) => cause,
DeleteRequestValidatorError::NotFound(ref cause) => cause,
DeleteRequestValidatorError::TooManyRequests(ref cause) => cause,
DeleteRequestValidatorError::Unauthorized(ref cause) => cause,
DeleteRequestValidatorError::Validation(ref cause) => cause,
DeleteRequestValidatorError::Credentials(ref err) => err.description(),
DeleteRequestValidatorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteRequestValidatorError::ParseError(ref cause) => cause,
DeleteRequestValidatorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteResourceError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteResourceError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteResourceError {
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 DeleteResourceError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteResourceError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteResourceError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteResourceError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteResourceError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteResourceError {
fn from(err: serde_json::error::Error) -> DeleteResourceError {
DeleteResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteResourceError {
fn from(err: CredentialsError) -> DeleteResourceError {
DeleteResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteResourceError {
fn from(err: HttpDispatchError) -> DeleteResourceError {
DeleteResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteResourceError {
fn from(err: io::Error) -> DeleteResourceError {
DeleteResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteResourceError {
fn description(&self) -> &str {
match *self {
DeleteResourceError::BadRequest(ref cause) => cause,
DeleteResourceError::Conflict(ref cause) => cause,
DeleteResourceError::NotFound(ref cause) => cause,
DeleteResourceError::TooManyRequests(ref cause) => cause,
DeleteResourceError::Unauthorized(ref cause) => cause,
DeleteResourceError::Validation(ref cause) => cause,
DeleteResourceError::Credentials(ref err) => err.description(),
DeleteResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteResourceError::ParseError(ref cause) => cause,
DeleteResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRestApiError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRestApiError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRestApiError {
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 DeleteRestApiError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return DeleteRestApiError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteRestApiError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteRestApiError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteRestApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteRestApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRestApiError {
fn from(err: serde_json::error::Error) -> DeleteRestApiError {
DeleteRestApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRestApiError {
fn from(err: CredentialsError) -> DeleteRestApiError {
DeleteRestApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRestApiError {
fn from(err: HttpDispatchError) -> DeleteRestApiError {
DeleteRestApiError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRestApiError {
fn from(err: io::Error) -> DeleteRestApiError {
DeleteRestApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRestApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRestApiError {
fn description(&self) -> &str {
match *self {
DeleteRestApiError::BadRequest(ref cause) => cause,
DeleteRestApiError::NotFound(ref cause) => cause,
DeleteRestApiError::TooManyRequests(ref cause) => cause,
DeleteRestApiError::Unauthorized(ref cause) => cause,
DeleteRestApiError::Validation(ref cause) => cause,
DeleteRestApiError::Credentials(ref err) => err.description(),
DeleteRestApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteRestApiError::ParseError(ref cause) => cause,
DeleteRestApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteStageError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteStageError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteStageError {
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 DeleteStageError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return DeleteStageError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteStageError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteStageError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteStageError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteStageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteStageError {
fn from(err: serde_json::error::Error) -> DeleteStageError {
DeleteStageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteStageError {
fn from(err: CredentialsError) -> DeleteStageError {
DeleteStageError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteStageError {
fn from(err: HttpDispatchError) -> DeleteStageError {
DeleteStageError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteStageError {
fn from(err: io::Error) -> DeleteStageError {
DeleteStageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteStageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteStageError {
fn description(&self) -> &str {
match *self {
DeleteStageError::BadRequest(ref cause) => cause,
DeleteStageError::NotFound(ref cause) => cause,
DeleteStageError::TooManyRequests(ref cause) => cause,
DeleteStageError::Unauthorized(ref cause) => cause,
DeleteStageError::Validation(ref cause) => cause,
DeleteStageError::Credentials(ref err) => err.description(),
DeleteStageError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteStageError::ParseError(ref cause) => cause,
DeleteStageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUsagePlanError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUsagePlanError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUsagePlanError {
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 DeleteUsagePlanError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return DeleteUsagePlanError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteUsagePlanError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteUsagePlanError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteUsagePlanError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUsagePlanError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUsagePlanError {
fn from(err: serde_json::error::Error) -> DeleteUsagePlanError {
DeleteUsagePlanError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUsagePlanError {
fn from(err: CredentialsError) -> DeleteUsagePlanError {
DeleteUsagePlanError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUsagePlanError {
fn from(err: HttpDispatchError) -> DeleteUsagePlanError {
DeleteUsagePlanError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUsagePlanError {
fn from(err: io::Error) -> DeleteUsagePlanError {
DeleteUsagePlanError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUsagePlanError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUsagePlanError {
fn description(&self) -> &str {
match *self {
DeleteUsagePlanError::BadRequest(ref cause) => cause,
DeleteUsagePlanError::NotFound(ref cause) => cause,
DeleteUsagePlanError::TooManyRequests(ref cause) => cause,
DeleteUsagePlanError::Unauthorized(ref cause) => cause,
DeleteUsagePlanError::Validation(ref cause) => cause,
DeleteUsagePlanError::Credentials(ref err) => err.description(),
DeleteUsagePlanError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteUsagePlanError::ParseError(ref cause) => cause,
DeleteUsagePlanError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUsagePlanKeyError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUsagePlanKeyError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUsagePlanKeyError {
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 DeleteUsagePlanKeyError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteUsagePlanKeyError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return DeleteUsagePlanKeyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteUsagePlanKeyError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteUsagePlanKeyError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteUsagePlanKeyError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUsagePlanKeyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUsagePlanKeyError {
fn from(err: serde_json::error::Error) -> DeleteUsagePlanKeyError {
DeleteUsagePlanKeyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUsagePlanKeyError {
fn from(err: CredentialsError) -> DeleteUsagePlanKeyError {
DeleteUsagePlanKeyError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUsagePlanKeyError {
fn from(err: HttpDispatchError) -> DeleteUsagePlanKeyError {
DeleteUsagePlanKeyError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUsagePlanKeyError {
fn from(err: io::Error) -> DeleteUsagePlanKeyError {
DeleteUsagePlanKeyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUsagePlanKeyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUsagePlanKeyError {
fn description(&self) -> &str {
match *self {
DeleteUsagePlanKeyError::BadRequest(ref cause) => cause,
DeleteUsagePlanKeyError::Conflict(ref cause) => cause,
DeleteUsagePlanKeyError::NotFound(ref cause) => cause,
DeleteUsagePlanKeyError::TooManyRequests(ref cause) => cause,
DeleteUsagePlanKeyError::Unauthorized(ref cause) => cause,
DeleteUsagePlanKeyError::Validation(ref cause) => cause,
DeleteUsagePlanKeyError::Credentials(ref err) => err.description(),
DeleteUsagePlanKeyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteUsagePlanKeyError::ParseError(ref cause) => cause,
DeleteUsagePlanKeyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteVpcLinkError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteVpcLinkError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteVpcLinkError {
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 DeleteVpcLinkError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return DeleteVpcLinkError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteVpcLinkError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return DeleteVpcLinkError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return DeleteVpcLinkError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteVpcLinkError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteVpcLinkError {
fn from(err: serde_json::error::Error) -> DeleteVpcLinkError {
DeleteVpcLinkError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteVpcLinkError {
fn from(err: CredentialsError) -> DeleteVpcLinkError {
DeleteVpcLinkError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteVpcLinkError {
fn from(err: HttpDispatchError) -> DeleteVpcLinkError {
DeleteVpcLinkError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteVpcLinkError {
fn from(err: io::Error) -> DeleteVpcLinkError {
DeleteVpcLinkError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteVpcLinkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteVpcLinkError {
fn description(&self) -> &str {
match *self {
DeleteVpcLinkError::BadRequest(ref cause) => cause,
DeleteVpcLinkError::NotFound(ref cause) => cause,
DeleteVpcLinkError::TooManyRequests(ref cause) => cause,
DeleteVpcLinkError::Unauthorized(ref cause) => cause,
DeleteVpcLinkError::Validation(ref cause) => cause,
DeleteVpcLinkError::Credentials(ref err) => err.description(),
DeleteVpcLinkError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteVpcLinkError::ParseError(ref cause) => cause,
DeleteVpcLinkError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum FlushStageAuthorizersCacheError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl FlushStageAuthorizersCacheError {
pub fn from_response(res: BufferedHttpResponse) -> FlushStageAuthorizersCacheError {
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 FlushStageAuthorizersCacheError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return FlushStageAuthorizersCacheError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return FlushStageAuthorizersCacheError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return FlushStageAuthorizersCacheError::Unauthorized(String::from(
error_message,
));
}
"ValidationException" => {
return FlushStageAuthorizersCacheError::Validation(error_message.to_string());
}
_ => {}
}
}
return FlushStageAuthorizersCacheError::Unknown(res);
}
}
impl From<serde_json::error::Error> for FlushStageAuthorizersCacheError {
fn from(err: serde_json::error::Error) -> FlushStageAuthorizersCacheError {
FlushStageAuthorizersCacheError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for FlushStageAuthorizersCacheError {
fn from(err: CredentialsError) -> FlushStageAuthorizersCacheError {
FlushStageAuthorizersCacheError::Credentials(err)
}
}
impl From<HttpDispatchError> for FlushStageAuthorizersCacheError {
fn from(err: HttpDispatchError) -> FlushStageAuthorizersCacheError {
FlushStageAuthorizersCacheError::HttpDispatch(err)
}
}
impl From<io::Error> for FlushStageAuthorizersCacheError {
fn from(err: io::Error) -> FlushStageAuthorizersCacheError {
FlushStageAuthorizersCacheError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for FlushStageAuthorizersCacheError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for FlushStageAuthorizersCacheError {
fn description(&self) -> &str {
match *self {
FlushStageAuthorizersCacheError::BadRequest(ref cause) => cause,
FlushStageAuthorizersCacheError::NotFound(ref cause) => cause,
FlushStageAuthorizersCacheError::TooManyRequests(ref cause) => cause,
FlushStageAuthorizersCacheError::Unauthorized(ref cause) => cause,
FlushStageAuthorizersCacheError::Validation(ref cause) => cause,
FlushStageAuthorizersCacheError::Credentials(ref err) => err.description(),
FlushStageAuthorizersCacheError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
FlushStageAuthorizersCacheError::ParseError(ref cause) => cause,
FlushStageAuthorizersCacheError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum FlushStageCacheError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl FlushStageCacheError {
pub fn from_response(res: BufferedHttpResponse) -> FlushStageCacheError {
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 FlushStageCacheError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return FlushStageCacheError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return FlushStageCacheError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return FlushStageCacheError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return FlushStageCacheError::Validation(error_message.to_string());
}
_ => {}
}
}
return FlushStageCacheError::Unknown(res);
}
}
impl From<serde_json::error::Error> for FlushStageCacheError {
fn from(err: serde_json::error::Error) -> FlushStageCacheError {
FlushStageCacheError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for FlushStageCacheError {
fn from(err: CredentialsError) -> FlushStageCacheError {
FlushStageCacheError::Credentials(err)
}
}
impl From<HttpDispatchError> for FlushStageCacheError {
fn from(err: HttpDispatchError) -> FlushStageCacheError {
FlushStageCacheError::HttpDispatch(err)
}
}
impl From<io::Error> for FlushStageCacheError {
fn from(err: io::Error) -> FlushStageCacheError {
FlushStageCacheError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for FlushStageCacheError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for FlushStageCacheError {
fn description(&self) -> &str {
match *self {
FlushStageCacheError::BadRequest(ref cause) => cause,
FlushStageCacheError::NotFound(ref cause) => cause,
FlushStageCacheError::TooManyRequests(ref cause) => cause,
FlushStageCacheError::Unauthorized(ref cause) => cause,
FlushStageCacheError::Validation(ref cause) => cause,
FlushStageCacheError::Credentials(ref err) => err.description(),
FlushStageCacheError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
FlushStageCacheError::ParseError(ref cause) => cause,
FlushStageCacheError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GenerateClientCertificateError {
LimitExceeded(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GenerateClientCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> GenerateClientCertificateError {
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 {
"LimitExceededException" => {
return GenerateClientCertificateError::LimitExceeded(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return GenerateClientCertificateError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return GenerateClientCertificateError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GenerateClientCertificateError::Validation(error_message.to_string());
}
_ => {}
}
}
return GenerateClientCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GenerateClientCertificateError {
fn from(err: serde_json::error::Error) -> GenerateClientCertificateError {
GenerateClientCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GenerateClientCertificateError {
fn from(err: CredentialsError) -> GenerateClientCertificateError {
GenerateClientCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for GenerateClientCertificateError {
fn from(err: HttpDispatchError) -> GenerateClientCertificateError {
GenerateClientCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for GenerateClientCertificateError {
fn from(err: io::Error) -> GenerateClientCertificateError {
GenerateClientCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GenerateClientCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GenerateClientCertificateError {
fn description(&self) -> &str {
match *self {
GenerateClientCertificateError::LimitExceeded(ref cause) => cause,
GenerateClientCertificateError::TooManyRequests(ref cause) => cause,
GenerateClientCertificateError::Unauthorized(ref cause) => cause,
GenerateClientCertificateError::Validation(ref cause) => cause,
GenerateClientCertificateError::Credentials(ref err) => err.description(),
GenerateClientCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GenerateClientCertificateError::ParseError(ref cause) => cause,
GenerateClientCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAccountError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetAccountError {
pub fn from_response(res: BufferedHttpResponse) -> GetAccountError {
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 {
"NotFoundException" => {
return GetAccountError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetAccountError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetAccountError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetAccountError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetAccountError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetAccountError {
fn from(err: serde_json::error::Error) -> GetAccountError {
GetAccountError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetAccountError {
fn from(err: CredentialsError) -> GetAccountError {
GetAccountError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetAccountError {
fn from(err: HttpDispatchError) -> GetAccountError {
GetAccountError::HttpDispatch(err)
}
}
impl From<io::Error> for GetAccountError {
fn from(err: io::Error) -> GetAccountError {
GetAccountError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetAccountError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetAccountError {
fn description(&self) -> &str {
match *self {
GetAccountError::NotFound(ref cause) => cause,
GetAccountError::TooManyRequests(ref cause) => cause,
GetAccountError::Unauthorized(ref cause) => cause,
GetAccountError::Validation(ref cause) => cause,
GetAccountError::Credentials(ref err) => err.description(),
GetAccountError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetAccountError::ParseError(ref cause) => cause,
GetAccountError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetApiKeyError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApiKeyError {
pub fn from_response(res: BufferedHttpResponse) -> GetApiKeyError {
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 {
"NotFoundException" => return GetApiKeyError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetApiKeyError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetApiKeyError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetApiKeyError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetApiKeyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApiKeyError {
fn from(err: serde_json::error::Error) -> GetApiKeyError {
GetApiKeyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApiKeyError {
fn from(err: CredentialsError) -> GetApiKeyError {
GetApiKeyError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApiKeyError {
fn from(err: HttpDispatchError) -> GetApiKeyError {
GetApiKeyError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApiKeyError {
fn from(err: io::Error) -> GetApiKeyError {
GetApiKeyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApiKeyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApiKeyError {
fn description(&self) -> &str {
match *self {
GetApiKeyError::NotFound(ref cause) => cause,
GetApiKeyError::TooManyRequests(ref cause) => cause,
GetApiKeyError::Unauthorized(ref cause) => cause,
GetApiKeyError::Validation(ref cause) => cause,
GetApiKeyError::Credentials(ref err) => err.description(),
GetApiKeyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetApiKeyError::ParseError(ref cause) => cause,
GetApiKeyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetApiKeysError {
BadRequest(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApiKeysError {
pub fn from_response(res: BufferedHttpResponse) -> GetApiKeysError {
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 GetApiKeysError::BadRequest(String::from(error_message));
}
"TooManyRequestsException" => {
return GetApiKeysError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetApiKeysError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetApiKeysError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetApiKeysError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApiKeysError {
fn from(err: serde_json::error::Error) -> GetApiKeysError {
GetApiKeysError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApiKeysError {
fn from(err: CredentialsError) -> GetApiKeysError {
GetApiKeysError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApiKeysError {
fn from(err: HttpDispatchError) -> GetApiKeysError {
GetApiKeysError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApiKeysError {
fn from(err: io::Error) -> GetApiKeysError {
GetApiKeysError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApiKeysError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApiKeysError {
fn description(&self) -> &str {
match *self {
GetApiKeysError::BadRequest(ref cause) => cause,
GetApiKeysError::TooManyRequests(ref cause) => cause,
GetApiKeysError::Unauthorized(ref cause) => cause,
GetApiKeysError::Validation(ref cause) => cause,
GetApiKeysError::Credentials(ref err) => err.description(),
GetApiKeysError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetApiKeysError::ParseError(ref cause) => cause,
GetApiKeysError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAuthorizerError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> GetAuthorizerError {
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 {
"NotFoundException" => {
return GetAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetAuthorizerError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetAuthorizerError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetAuthorizerError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetAuthorizerError {
fn from(err: serde_json::error::Error) -> GetAuthorizerError {
GetAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetAuthorizerError {
fn from(err: CredentialsError) -> GetAuthorizerError {
GetAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetAuthorizerError {
fn from(err: HttpDispatchError) -> GetAuthorizerError {
GetAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for GetAuthorizerError {
fn from(err: io::Error) -> GetAuthorizerError {
GetAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetAuthorizerError {
fn description(&self) -> &str {
match *self {
GetAuthorizerError::NotFound(ref cause) => cause,
GetAuthorizerError::TooManyRequests(ref cause) => cause,
GetAuthorizerError::Unauthorized(ref cause) => cause,
GetAuthorizerError::Validation(ref cause) => cause,
GetAuthorizerError::Credentials(ref err) => err.description(),
GetAuthorizerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetAuthorizerError::ParseError(ref cause) => cause,
GetAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAuthorizersError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetAuthorizersError {
pub fn from_response(res: BufferedHttpResponse) -> GetAuthorizersError {
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 GetAuthorizersError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetAuthorizersError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetAuthorizersError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetAuthorizersError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetAuthorizersError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetAuthorizersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetAuthorizersError {
fn from(err: serde_json::error::Error) -> GetAuthorizersError {
GetAuthorizersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetAuthorizersError {
fn from(err: CredentialsError) -> GetAuthorizersError {
GetAuthorizersError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetAuthorizersError {
fn from(err: HttpDispatchError) -> GetAuthorizersError {
GetAuthorizersError::HttpDispatch(err)
}
}
impl From<io::Error> for GetAuthorizersError {
fn from(err: io::Error) -> GetAuthorizersError {
GetAuthorizersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetAuthorizersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetAuthorizersError {
fn description(&self) -> &str {
match *self {
GetAuthorizersError::BadRequest(ref cause) => cause,
GetAuthorizersError::NotFound(ref cause) => cause,
GetAuthorizersError::TooManyRequests(ref cause) => cause,
GetAuthorizersError::Unauthorized(ref cause) => cause,
GetAuthorizersError::Validation(ref cause) => cause,
GetAuthorizersError::Credentials(ref err) => err.description(),
GetAuthorizersError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetAuthorizersError::ParseError(ref cause) => cause,
GetAuthorizersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBasePathMappingError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBasePathMappingError {
pub fn from_response(res: BufferedHttpResponse) -> GetBasePathMappingError {
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 {
"NotFoundException" => {
return GetBasePathMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetBasePathMappingError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetBasePathMappingError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetBasePathMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBasePathMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBasePathMappingError {
fn from(err: serde_json::error::Error) -> GetBasePathMappingError {
GetBasePathMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBasePathMappingError {
fn from(err: CredentialsError) -> GetBasePathMappingError {
GetBasePathMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBasePathMappingError {
fn from(err: HttpDispatchError) -> GetBasePathMappingError {
GetBasePathMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBasePathMappingError {
fn from(err: io::Error) -> GetBasePathMappingError {
GetBasePathMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBasePathMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBasePathMappingError {
fn description(&self) -> &str {
match *self {
GetBasePathMappingError::NotFound(ref cause) => cause,
GetBasePathMappingError::TooManyRequests(ref cause) => cause,
GetBasePathMappingError::Unauthorized(ref cause) => cause,
GetBasePathMappingError::Validation(ref cause) => cause,
GetBasePathMappingError::Credentials(ref err) => err.description(),
GetBasePathMappingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetBasePathMappingError::ParseError(ref cause) => cause,
GetBasePathMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBasePathMappingsError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBasePathMappingsError {
pub fn from_response(res: BufferedHttpResponse) -> GetBasePathMappingsError {
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 {
"NotFoundException" => {
return GetBasePathMappingsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetBasePathMappingsError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetBasePathMappingsError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetBasePathMappingsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBasePathMappingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBasePathMappingsError {
fn from(err: serde_json::error::Error) -> GetBasePathMappingsError {
GetBasePathMappingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBasePathMappingsError {
fn from(err: CredentialsError) -> GetBasePathMappingsError {
GetBasePathMappingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBasePathMappingsError {
fn from(err: HttpDispatchError) -> GetBasePathMappingsError {
GetBasePathMappingsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBasePathMappingsError {
fn from(err: io::Error) -> GetBasePathMappingsError {
GetBasePathMappingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBasePathMappingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBasePathMappingsError {
fn description(&self) -> &str {
match *self {
GetBasePathMappingsError::NotFound(ref cause) => cause,
GetBasePathMappingsError::TooManyRequests(ref cause) => cause,
GetBasePathMappingsError::Unauthorized(ref cause) => cause,
GetBasePathMappingsError::Validation(ref cause) => cause,
GetBasePathMappingsError::Credentials(ref err) => err.description(),
GetBasePathMappingsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetBasePathMappingsError::ParseError(ref cause) => cause,
GetBasePathMappingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetClientCertificateError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetClientCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> GetClientCertificateError {
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 {
"NotFoundException" => {
return GetClientCertificateError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetClientCertificateError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetClientCertificateError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetClientCertificateError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetClientCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetClientCertificateError {
fn from(err: serde_json::error::Error) -> GetClientCertificateError {
GetClientCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetClientCertificateError {
fn from(err: CredentialsError) -> GetClientCertificateError {
GetClientCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetClientCertificateError {
fn from(err: HttpDispatchError) -> GetClientCertificateError {
GetClientCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for GetClientCertificateError {
fn from(err: io::Error) -> GetClientCertificateError {
GetClientCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetClientCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetClientCertificateError {
fn description(&self) -> &str {
match *self {
GetClientCertificateError::NotFound(ref cause) => cause,
GetClientCertificateError::TooManyRequests(ref cause) => cause,
GetClientCertificateError::Unauthorized(ref cause) => cause,
GetClientCertificateError::Validation(ref cause) => cause,
GetClientCertificateError::Credentials(ref err) => err.description(),
GetClientCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetClientCertificateError::ParseError(ref cause) => cause,
GetClientCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetClientCertificatesError {
BadRequest(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetClientCertificatesError {
pub fn from_response(res: BufferedHttpResponse) -> GetClientCertificatesError {
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 GetClientCertificatesError::BadRequest(String::from(error_message));
}
"TooManyRequestsException" => {
return GetClientCertificatesError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetClientCertificatesError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetClientCertificatesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetClientCertificatesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetClientCertificatesError {
fn from(err: serde_json::error::Error) -> GetClientCertificatesError {
GetClientCertificatesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetClientCertificatesError {
fn from(err: CredentialsError) -> GetClientCertificatesError {
GetClientCertificatesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetClientCertificatesError {
fn from(err: HttpDispatchError) -> GetClientCertificatesError {
GetClientCertificatesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetClientCertificatesError {
fn from(err: io::Error) -> GetClientCertificatesError {
GetClientCertificatesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetClientCertificatesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetClientCertificatesError {
fn description(&self) -> &str {
match *self {
GetClientCertificatesError::BadRequest(ref cause) => cause,
GetClientCertificatesError::TooManyRequests(ref cause) => cause,
GetClientCertificatesError::Unauthorized(ref cause) => cause,
GetClientCertificatesError::Validation(ref cause) => cause,
GetClientCertificatesError::Credentials(ref err) => err.description(),
GetClientCertificatesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetClientCertificatesError::ParseError(ref cause) => cause,
GetClientCertificatesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDeploymentError {
NotFound(String),
ServiceUnavailable(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDeploymentError {
pub fn from_response(res: BufferedHttpResponse) -> GetDeploymentError {
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 {
"NotFoundException" => {
return GetDeploymentError::NotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return GetDeploymentError::ServiceUnavailable(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDeploymentError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetDeploymentError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDeploymentError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDeploymentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDeploymentError {
fn from(err: serde_json::error::Error) -> GetDeploymentError {
GetDeploymentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDeploymentError {
fn from(err: CredentialsError) -> GetDeploymentError {
GetDeploymentError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDeploymentError {
fn from(err: HttpDispatchError) -> GetDeploymentError {
GetDeploymentError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDeploymentError {
fn from(err: io::Error) -> GetDeploymentError {
GetDeploymentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDeploymentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDeploymentError {
fn description(&self) -> &str {
match *self {
GetDeploymentError::NotFound(ref cause) => cause,
GetDeploymentError::ServiceUnavailable(ref cause) => cause,
GetDeploymentError::TooManyRequests(ref cause) => cause,
GetDeploymentError::Unauthorized(ref cause) => cause,
GetDeploymentError::Validation(ref cause) => cause,
GetDeploymentError::Credentials(ref err) => err.description(),
GetDeploymentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetDeploymentError::ParseError(ref cause) => cause,
GetDeploymentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDeploymentsError {
BadRequest(String),
ServiceUnavailable(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDeploymentsError {
pub fn from_response(res: BufferedHttpResponse) -> GetDeploymentsError {
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 GetDeploymentsError::BadRequest(String::from(error_message));
}
"ServiceUnavailableException" => {
return GetDeploymentsError::ServiceUnavailable(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDeploymentsError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetDeploymentsError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDeploymentsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDeploymentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDeploymentsError {
fn from(err: serde_json::error::Error) -> GetDeploymentsError {
GetDeploymentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDeploymentsError {
fn from(err: CredentialsError) -> GetDeploymentsError {
GetDeploymentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDeploymentsError {
fn from(err: HttpDispatchError) -> GetDeploymentsError {
GetDeploymentsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDeploymentsError {
fn from(err: io::Error) -> GetDeploymentsError {
GetDeploymentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDeploymentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDeploymentsError {
fn description(&self) -> &str {
match *self {
GetDeploymentsError::BadRequest(ref cause) => cause,
GetDeploymentsError::ServiceUnavailable(ref cause) => cause,
GetDeploymentsError::TooManyRequests(ref cause) => cause,
GetDeploymentsError::Unauthorized(ref cause) => cause,
GetDeploymentsError::Validation(ref cause) => cause,
GetDeploymentsError::Credentials(ref err) => err.description(),
GetDeploymentsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetDeploymentsError::ParseError(ref cause) => cause,
GetDeploymentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDocumentationPartError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDocumentationPartError {
pub fn from_response(res: BufferedHttpResponse) -> GetDocumentationPartError {
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 {
"NotFoundException" => {
return GetDocumentationPartError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDocumentationPartError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetDocumentationPartError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDocumentationPartError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDocumentationPartError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDocumentationPartError {
fn from(err: serde_json::error::Error) -> GetDocumentationPartError {
GetDocumentationPartError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDocumentationPartError {
fn from(err: CredentialsError) -> GetDocumentationPartError {
GetDocumentationPartError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDocumentationPartError {
fn from(err: HttpDispatchError) -> GetDocumentationPartError {
GetDocumentationPartError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDocumentationPartError {
fn from(err: io::Error) -> GetDocumentationPartError {
GetDocumentationPartError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDocumentationPartError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDocumentationPartError {
fn description(&self) -> &str {
match *self {
GetDocumentationPartError::NotFound(ref cause) => cause,
GetDocumentationPartError::TooManyRequests(ref cause) => cause,
GetDocumentationPartError::Unauthorized(ref cause) => cause,
GetDocumentationPartError::Validation(ref cause) => cause,
GetDocumentationPartError::Credentials(ref err) => err.description(),
GetDocumentationPartError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetDocumentationPartError::ParseError(ref cause) => cause,
GetDocumentationPartError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDocumentationPartsError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDocumentationPartsError {
pub fn from_response(res: BufferedHttpResponse) -> GetDocumentationPartsError {
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 GetDocumentationPartsError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetDocumentationPartsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDocumentationPartsError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetDocumentationPartsError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDocumentationPartsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDocumentationPartsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDocumentationPartsError {
fn from(err: serde_json::error::Error) -> GetDocumentationPartsError {
GetDocumentationPartsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDocumentationPartsError {
fn from(err: CredentialsError) -> GetDocumentationPartsError {
GetDocumentationPartsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDocumentationPartsError {
fn from(err: HttpDispatchError) -> GetDocumentationPartsError {
GetDocumentationPartsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDocumentationPartsError {
fn from(err: io::Error) -> GetDocumentationPartsError {
GetDocumentationPartsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDocumentationPartsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDocumentationPartsError {
fn description(&self) -> &str {
match *self {
GetDocumentationPartsError::BadRequest(ref cause) => cause,
GetDocumentationPartsError::NotFound(ref cause) => cause,
GetDocumentationPartsError::TooManyRequests(ref cause) => cause,
GetDocumentationPartsError::Unauthorized(ref cause) => cause,
GetDocumentationPartsError::Validation(ref cause) => cause,
GetDocumentationPartsError::Credentials(ref err) => err.description(),
GetDocumentationPartsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetDocumentationPartsError::ParseError(ref cause) => cause,
GetDocumentationPartsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDocumentationVersionError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDocumentationVersionError {
pub fn from_response(res: BufferedHttpResponse) -> GetDocumentationVersionError {
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 {
"NotFoundException" => {
return GetDocumentationVersionError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDocumentationVersionError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return GetDocumentationVersionError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDocumentationVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDocumentationVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDocumentationVersionError {
fn from(err: serde_json::error::Error) -> GetDocumentationVersionError {
GetDocumentationVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDocumentationVersionError {
fn from(err: CredentialsError) -> GetDocumentationVersionError {
GetDocumentationVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDocumentationVersionError {
fn from(err: HttpDispatchError) -> GetDocumentationVersionError {
GetDocumentationVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDocumentationVersionError {
fn from(err: io::Error) -> GetDocumentationVersionError {
GetDocumentationVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDocumentationVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDocumentationVersionError {
fn description(&self) -> &str {
match *self {
GetDocumentationVersionError::NotFound(ref cause) => cause,
GetDocumentationVersionError::TooManyRequests(ref cause) => cause,
GetDocumentationVersionError::Unauthorized(ref cause) => cause,
GetDocumentationVersionError::Validation(ref cause) => cause,
GetDocumentationVersionError::Credentials(ref err) => err.description(),
GetDocumentationVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetDocumentationVersionError::ParseError(ref cause) => cause,
GetDocumentationVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDocumentationVersionsError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDocumentationVersionsError {
pub fn from_response(res: BufferedHttpResponse) -> GetDocumentationVersionsError {
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 GetDocumentationVersionsError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetDocumentationVersionsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDocumentationVersionsError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return GetDocumentationVersionsError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDocumentationVersionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDocumentationVersionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDocumentationVersionsError {
fn from(err: serde_json::error::Error) -> GetDocumentationVersionsError {
GetDocumentationVersionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDocumentationVersionsError {
fn from(err: CredentialsError) -> GetDocumentationVersionsError {
GetDocumentationVersionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDocumentationVersionsError {
fn from(err: HttpDispatchError) -> GetDocumentationVersionsError {
GetDocumentationVersionsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDocumentationVersionsError {
fn from(err: io::Error) -> GetDocumentationVersionsError {
GetDocumentationVersionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDocumentationVersionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDocumentationVersionsError {
fn description(&self) -> &str {
match *self {
GetDocumentationVersionsError::BadRequest(ref cause) => cause,
GetDocumentationVersionsError::NotFound(ref cause) => cause,
GetDocumentationVersionsError::TooManyRequests(ref cause) => cause,
GetDocumentationVersionsError::Unauthorized(ref cause) => cause,
GetDocumentationVersionsError::Validation(ref cause) => cause,
GetDocumentationVersionsError::Credentials(ref err) => err.description(),
GetDocumentationVersionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetDocumentationVersionsError::ParseError(ref cause) => cause,
GetDocumentationVersionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDomainNameError {
NotFound(String),
ServiceUnavailable(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDomainNameError {
pub fn from_response(res: BufferedHttpResponse) -> GetDomainNameError {
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 {
"NotFoundException" => {
return GetDomainNameError::NotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return GetDomainNameError::ServiceUnavailable(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDomainNameError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetDomainNameError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDomainNameError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDomainNameError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDomainNameError {
fn from(err: serde_json::error::Error) -> GetDomainNameError {
GetDomainNameError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDomainNameError {
fn from(err: CredentialsError) -> GetDomainNameError {
GetDomainNameError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDomainNameError {
fn from(err: HttpDispatchError) -> GetDomainNameError {
GetDomainNameError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDomainNameError {
fn from(err: io::Error) -> GetDomainNameError {
GetDomainNameError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDomainNameError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDomainNameError {
fn description(&self) -> &str {
match *self {
GetDomainNameError::NotFound(ref cause) => cause,
GetDomainNameError::ServiceUnavailable(ref cause) => cause,
GetDomainNameError::TooManyRequests(ref cause) => cause,
GetDomainNameError::Unauthorized(ref cause) => cause,
GetDomainNameError::Validation(ref cause) => cause,
GetDomainNameError::Credentials(ref err) => err.description(),
GetDomainNameError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetDomainNameError::ParseError(ref cause) => cause,
GetDomainNameError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDomainNamesError {
BadRequest(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDomainNamesError {
pub fn from_response(res: BufferedHttpResponse) -> GetDomainNamesError {
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 GetDomainNamesError::BadRequest(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDomainNamesError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetDomainNamesError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetDomainNamesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDomainNamesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDomainNamesError {
fn from(err: serde_json::error::Error) -> GetDomainNamesError {
GetDomainNamesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDomainNamesError {
fn from(err: CredentialsError) -> GetDomainNamesError {
GetDomainNamesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDomainNamesError {
fn from(err: HttpDispatchError) -> GetDomainNamesError {
GetDomainNamesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDomainNamesError {
fn from(err: io::Error) -> GetDomainNamesError {
GetDomainNamesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDomainNamesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDomainNamesError {
fn description(&self) -> &str {
match *self {
GetDomainNamesError::BadRequest(ref cause) => cause,
GetDomainNamesError::TooManyRequests(ref cause) => cause,
GetDomainNamesError::Unauthorized(ref cause) => cause,
GetDomainNamesError::Validation(ref cause) => cause,
GetDomainNamesError::Credentials(ref err) => err.description(),
GetDomainNamesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetDomainNamesError::ParseError(ref cause) => cause,
GetDomainNamesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetExportError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetExportError {
pub fn from_response(res: BufferedHttpResponse) -> GetExportError {
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 GetExportError::BadRequest(String::from(error_message));
}
"ConflictException" => return GetExportError::Conflict(String::from(error_message)),
"NotFoundException" => return GetExportError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetExportError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetExportError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetExportError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetExportError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetExportError {
fn from(err: serde_json::error::Error) -> GetExportError {
GetExportError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetExportError {
fn from(err: CredentialsError) -> GetExportError {
GetExportError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetExportError {
fn from(err: HttpDispatchError) -> GetExportError {
GetExportError::HttpDispatch(err)
}
}
impl From<io::Error> for GetExportError {
fn from(err: io::Error) -> GetExportError {
GetExportError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetExportError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetExportError {
fn description(&self) -> &str {
match *self {
GetExportError::BadRequest(ref cause) => cause,
GetExportError::Conflict(ref cause) => cause,
GetExportError::NotFound(ref cause) => cause,
GetExportError::TooManyRequests(ref cause) => cause,
GetExportError::Unauthorized(ref cause) => cause,
GetExportError::Validation(ref cause) => cause,
GetExportError::Credentials(ref err) => err.description(),
GetExportError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetExportError::ParseError(ref cause) => cause,
GetExportError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetGatewayResponseError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetGatewayResponseError {
pub fn from_response(res: BufferedHttpResponse) -> GetGatewayResponseError {
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 {
"NotFoundException" => {
return GetGatewayResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetGatewayResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetGatewayResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetGatewayResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetGatewayResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetGatewayResponseError {
fn from(err: serde_json::error::Error) -> GetGatewayResponseError {
GetGatewayResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetGatewayResponseError {
fn from(err: CredentialsError) -> GetGatewayResponseError {
GetGatewayResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetGatewayResponseError {
fn from(err: HttpDispatchError) -> GetGatewayResponseError {
GetGatewayResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for GetGatewayResponseError {
fn from(err: io::Error) -> GetGatewayResponseError {
GetGatewayResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetGatewayResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetGatewayResponseError {
fn description(&self) -> &str {
match *self {
GetGatewayResponseError::NotFound(ref cause) => cause,
GetGatewayResponseError::TooManyRequests(ref cause) => cause,
GetGatewayResponseError::Unauthorized(ref cause) => cause,
GetGatewayResponseError::Validation(ref cause) => cause,
GetGatewayResponseError::Credentials(ref err) => err.description(),
GetGatewayResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetGatewayResponseError::ParseError(ref cause) => cause,
GetGatewayResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetGatewayResponsesError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetGatewayResponsesError {
pub fn from_response(res: BufferedHttpResponse) -> GetGatewayResponsesError {
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 GetGatewayResponsesError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetGatewayResponsesError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetGatewayResponsesError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetGatewayResponsesError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetGatewayResponsesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetGatewayResponsesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetGatewayResponsesError {
fn from(err: serde_json::error::Error) -> GetGatewayResponsesError {
GetGatewayResponsesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetGatewayResponsesError {
fn from(err: CredentialsError) -> GetGatewayResponsesError {
GetGatewayResponsesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetGatewayResponsesError {
fn from(err: HttpDispatchError) -> GetGatewayResponsesError {
GetGatewayResponsesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetGatewayResponsesError {
fn from(err: io::Error) -> GetGatewayResponsesError {
GetGatewayResponsesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetGatewayResponsesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetGatewayResponsesError {
fn description(&self) -> &str {
match *self {
GetGatewayResponsesError::BadRequest(ref cause) => cause,
GetGatewayResponsesError::NotFound(ref cause) => cause,
GetGatewayResponsesError::TooManyRequests(ref cause) => cause,
GetGatewayResponsesError::Unauthorized(ref cause) => cause,
GetGatewayResponsesError::Validation(ref cause) => cause,
GetGatewayResponsesError::Credentials(ref err) => err.description(),
GetGatewayResponsesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetGatewayResponsesError::ParseError(ref cause) => cause,
GetGatewayResponsesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIntegrationError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIntegrationError {
pub fn from_response(res: BufferedHttpResponse) -> GetIntegrationError {
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 {
"NotFoundException" => {
return GetIntegrationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetIntegrationError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetIntegrationError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetIntegrationError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetIntegrationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIntegrationError {
fn from(err: serde_json::error::Error) -> GetIntegrationError {
GetIntegrationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIntegrationError {
fn from(err: CredentialsError) -> GetIntegrationError {
GetIntegrationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIntegrationError {
fn from(err: HttpDispatchError) -> GetIntegrationError {
GetIntegrationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIntegrationError {
fn from(err: io::Error) -> GetIntegrationError {
GetIntegrationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIntegrationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIntegrationError {
fn description(&self) -> &str {
match *self {
GetIntegrationError::NotFound(ref cause) => cause,
GetIntegrationError::TooManyRequests(ref cause) => cause,
GetIntegrationError::Unauthorized(ref cause) => cause,
GetIntegrationError::Validation(ref cause) => cause,
GetIntegrationError::Credentials(ref err) => err.description(),
GetIntegrationError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetIntegrationError::ParseError(ref cause) => cause,
GetIntegrationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIntegrationResponseError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIntegrationResponseError {
pub fn from_response(res: BufferedHttpResponse) -> GetIntegrationResponseError {
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 {
"NotFoundException" => {
return GetIntegrationResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetIntegrationResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetIntegrationResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetIntegrationResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetIntegrationResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIntegrationResponseError {
fn from(err: serde_json::error::Error) -> GetIntegrationResponseError {
GetIntegrationResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIntegrationResponseError {
fn from(err: CredentialsError) -> GetIntegrationResponseError {
GetIntegrationResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIntegrationResponseError {
fn from(err: HttpDispatchError) -> GetIntegrationResponseError {
GetIntegrationResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIntegrationResponseError {
fn from(err: io::Error) -> GetIntegrationResponseError {
GetIntegrationResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIntegrationResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIntegrationResponseError {
fn description(&self) -> &str {
match *self {
GetIntegrationResponseError::NotFound(ref cause) => cause,
GetIntegrationResponseError::TooManyRequests(ref cause) => cause,
GetIntegrationResponseError::Unauthorized(ref cause) => cause,
GetIntegrationResponseError::Validation(ref cause) => cause,
GetIntegrationResponseError::Credentials(ref err) => err.description(),
GetIntegrationResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetIntegrationResponseError::ParseError(ref cause) => cause,
GetIntegrationResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetMethodError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetMethodError {
pub fn from_response(res: BufferedHttpResponse) -> GetMethodError {
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 {
"NotFoundException" => return GetMethodError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetMethodError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetMethodError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetMethodError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetMethodError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetMethodError {
fn from(err: serde_json::error::Error) -> GetMethodError {
GetMethodError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetMethodError {
fn from(err: CredentialsError) -> GetMethodError {
GetMethodError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetMethodError {
fn from(err: HttpDispatchError) -> GetMethodError {
GetMethodError::HttpDispatch(err)
}
}
impl From<io::Error> for GetMethodError {
fn from(err: io::Error) -> GetMethodError {
GetMethodError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetMethodError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetMethodError {
fn description(&self) -> &str {
match *self {
GetMethodError::NotFound(ref cause) => cause,
GetMethodError::TooManyRequests(ref cause) => cause,
GetMethodError::Unauthorized(ref cause) => cause,
GetMethodError::Validation(ref cause) => cause,
GetMethodError::Credentials(ref err) => err.description(),
GetMethodError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetMethodError::ParseError(ref cause) => cause,
GetMethodError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetMethodResponseError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetMethodResponseError {
pub fn from_response(res: BufferedHttpResponse) -> GetMethodResponseError {
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 {
"NotFoundException" => {
return GetMethodResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetMethodResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetMethodResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetMethodResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetMethodResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetMethodResponseError {
fn from(err: serde_json::error::Error) -> GetMethodResponseError {
GetMethodResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetMethodResponseError {
fn from(err: CredentialsError) -> GetMethodResponseError {
GetMethodResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetMethodResponseError {
fn from(err: HttpDispatchError) -> GetMethodResponseError {
GetMethodResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for GetMethodResponseError {
fn from(err: io::Error) -> GetMethodResponseError {
GetMethodResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetMethodResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetMethodResponseError {
fn description(&self) -> &str {
match *self {
GetMethodResponseError::NotFound(ref cause) => cause,
GetMethodResponseError::TooManyRequests(ref cause) => cause,
GetMethodResponseError::Unauthorized(ref cause) => cause,
GetMethodResponseError::Validation(ref cause) => cause,
GetMethodResponseError::Credentials(ref err) => err.description(),
GetMethodResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetMethodResponseError::ParseError(ref cause) => cause,
GetMethodResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetModelError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetModelError {
pub fn from_response(res: BufferedHttpResponse) -> GetModelError {
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 {
"NotFoundException" => return GetModelError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetModelError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetModelError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetModelError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetModelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetModelError {
fn from(err: serde_json::error::Error) -> GetModelError {
GetModelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetModelError {
fn from(err: CredentialsError) -> GetModelError {
GetModelError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetModelError {
fn from(err: HttpDispatchError) -> GetModelError {
GetModelError::HttpDispatch(err)
}
}
impl From<io::Error> for GetModelError {
fn from(err: io::Error) -> GetModelError {
GetModelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetModelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetModelError {
fn description(&self) -> &str {
match *self {
GetModelError::NotFound(ref cause) => cause,
GetModelError::TooManyRequests(ref cause) => cause,
GetModelError::Unauthorized(ref cause) => cause,
GetModelError::Validation(ref cause) => cause,
GetModelError::Credentials(ref err) => err.description(),
GetModelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetModelError::ParseError(ref cause) => cause,
GetModelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetModelTemplateError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetModelTemplateError {
pub fn from_response(res: BufferedHttpResponse) -> GetModelTemplateError {
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 GetModelTemplateError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetModelTemplateError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetModelTemplateError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetModelTemplateError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetModelTemplateError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetModelTemplateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetModelTemplateError {
fn from(err: serde_json::error::Error) -> GetModelTemplateError {
GetModelTemplateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetModelTemplateError {
fn from(err: CredentialsError) -> GetModelTemplateError {
GetModelTemplateError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetModelTemplateError {
fn from(err: HttpDispatchError) -> GetModelTemplateError {
GetModelTemplateError::HttpDispatch(err)
}
}
impl From<io::Error> for GetModelTemplateError {
fn from(err: io::Error) -> GetModelTemplateError {
GetModelTemplateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetModelTemplateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetModelTemplateError {
fn description(&self) -> &str {
match *self {
GetModelTemplateError::BadRequest(ref cause) => cause,
GetModelTemplateError::NotFound(ref cause) => cause,
GetModelTemplateError::TooManyRequests(ref cause) => cause,
GetModelTemplateError::Unauthorized(ref cause) => cause,
GetModelTemplateError::Validation(ref cause) => cause,
GetModelTemplateError::Credentials(ref err) => err.description(),
GetModelTemplateError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetModelTemplateError::ParseError(ref cause) => cause,
GetModelTemplateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetModelsError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetModelsError {
pub fn from_response(res: BufferedHttpResponse) -> GetModelsError {
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 GetModelsError::BadRequest(String::from(error_message));
}
"NotFoundException" => return GetModelsError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetModelsError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetModelsError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetModelsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetModelsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetModelsError {
fn from(err: serde_json::error::Error) -> GetModelsError {
GetModelsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetModelsError {
fn from(err: CredentialsError) -> GetModelsError {
GetModelsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetModelsError {
fn from(err: HttpDispatchError) -> GetModelsError {
GetModelsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetModelsError {
fn from(err: io::Error) -> GetModelsError {
GetModelsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetModelsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetModelsError {
fn description(&self) -> &str {
match *self {
GetModelsError::BadRequest(ref cause) => cause,
GetModelsError::NotFound(ref cause) => cause,
GetModelsError::TooManyRequests(ref cause) => cause,
GetModelsError::Unauthorized(ref cause) => cause,
GetModelsError::Validation(ref cause) => cause,
GetModelsError::Credentials(ref err) => err.description(),
GetModelsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetModelsError::ParseError(ref cause) => cause,
GetModelsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRequestValidatorError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRequestValidatorError {
pub fn from_response(res: BufferedHttpResponse) -> GetRequestValidatorError {
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 {
"NotFoundException" => {
return GetRequestValidatorError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetRequestValidatorError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetRequestValidatorError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetRequestValidatorError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRequestValidatorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRequestValidatorError {
fn from(err: serde_json::error::Error) -> GetRequestValidatorError {
GetRequestValidatorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRequestValidatorError {
fn from(err: CredentialsError) -> GetRequestValidatorError {
GetRequestValidatorError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRequestValidatorError {
fn from(err: HttpDispatchError) -> GetRequestValidatorError {
GetRequestValidatorError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRequestValidatorError {
fn from(err: io::Error) -> GetRequestValidatorError {
GetRequestValidatorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRequestValidatorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRequestValidatorError {
fn description(&self) -> &str {
match *self {
GetRequestValidatorError::NotFound(ref cause) => cause,
GetRequestValidatorError::TooManyRequests(ref cause) => cause,
GetRequestValidatorError::Unauthorized(ref cause) => cause,
GetRequestValidatorError::Validation(ref cause) => cause,
GetRequestValidatorError::Credentials(ref err) => err.description(),
GetRequestValidatorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetRequestValidatorError::ParseError(ref cause) => cause,
GetRequestValidatorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRequestValidatorsError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRequestValidatorsError {
pub fn from_response(res: BufferedHttpResponse) -> GetRequestValidatorsError {
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 GetRequestValidatorsError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetRequestValidatorsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetRequestValidatorsError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetRequestValidatorsError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetRequestValidatorsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRequestValidatorsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRequestValidatorsError {
fn from(err: serde_json::error::Error) -> GetRequestValidatorsError {
GetRequestValidatorsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRequestValidatorsError {
fn from(err: CredentialsError) -> GetRequestValidatorsError {
GetRequestValidatorsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRequestValidatorsError {
fn from(err: HttpDispatchError) -> GetRequestValidatorsError {
GetRequestValidatorsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRequestValidatorsError {
fn from(err: io::Error) -> GetRequestValidatorsError {
GetRequestValidatorsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRequestValidatorsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRequestValidatorsError {
fn description(&self) -> &str {
match *self {
GetRequestValidatorsError::BadRequest(ref cause) => cause,
GetRequestValidatorsError::NotFound(ref cause) => cause,
GetRequestValidatorsError::TooManyRequests(ref cause) => cause,
GetRequestValidatorsError::Unauthorized(ref cause) => cause,
GetRequestValidatorsError::Validation(ref cause) => cause,
GetRequestValidatorsError::Credentials(ref err) => err.description(),
GetRequestValidatorsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetRequestValidatorsError::ParseError(ref cause) => cause,
GetRequestValidatorsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetResourceError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetResourceError {
pub fn from_response(res: BufferedHttpResponse) -> GetResourceError {
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 {
"NotFoundException" => {
return GetResourceError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetResourceError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetResourceError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetResourceError {
fn from(err: serde_json::error::Error) -> GetResourceError {
GetResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetResourceError {
fn from(err: CredentialsError) -> GetResourceError {
GetResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetResourceError {
fn from(err: HttpDispatchError) -> GetResourceError {
GetResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for GetResourceError {
fn from(err: io::Error) -> GetResourceError {
GetResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetResourceError {
fn description(&self) -> &str {
match *self {
GetResourceError::NotFound(ref cause) => cause,
GetResourceError::TooManyRequests(ref cause) => cause,
GetResourceError::Unauthorized(ref cause) => cause,
GetResourceError::Validation(ref cause) => cause,
GetResourceError::Credentials(ref err) => err.description(),
GetResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetResourceError::ParseError(ref cause) => cause,
GetResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetResourcesError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetResourcesError {
pub fn from_response(res: BufferedHttpResponse) -> GetResourcesError {
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 GetResourcesError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetResourcesError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetResourcesError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetResourcesError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetResourcesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetResourcesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetResourcesError {
fn from(err: serde_json::error::Error) -> GetResourcesError {
GetResourcesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetResourcesError {
fn from(err: CredentialsError) -> GetResourcesError {
GetResourcesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetResourcesError {
fn from(err: HttpDispatchError) -> GetResourcesError {
GetResourcesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetResourcesError {
fn from(err: io::Error) -> GetResourcesError {
GetResourcesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetResourcesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetResourcesError {
fn description(&self) -> &str {
match *self {
GetResourcesError::BadRequest(ref cause) => cause,
GetResourcesError::NotFound(ref cause) => cause,
GetResourcesError::TooManyRequests(ref cause) => cause,
GetResourcesError::Unauthorized(ref cause) => cause,
GetResourcesError::Validation(ref cause) => cause,
GetResourcesError::Credentials(ref err) => err.description(),
GetResourcesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetResourcesError::ParseError(ref cause) => cause,
GetResourcesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRestApiError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRestApiError {
pub fn from_response(res: BufferedHttpResponse) -> GetRestApiError {
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 {
"NotFoundException" => {
return GetRestApiError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetRestApiError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetRestApiError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetRestApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRestApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRestApiError {
fn from(err: serde_json::error::Error) -> GetRestApiError {
GetRestApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRestApiError {
fn from(err: CredentialsError) -> GetRestApiError {
GetRestApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRestApiError {
fn from(err: HttpDispatchError) -> GetRestApiError {
GetRestApiError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRestApiError {
fn from(err: io::Error) -> GetRestApiError {
GetRestApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRestApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRestApiError {
fn description(&self) -> &str {
match *self {
GetRestApiError::NotFound(ref cause) => cause,
GetRestApiError::TooManyRequests(ref cause) => cause,
GetRestApiError::Unauthorized(ref cause) => cause,
GetRestApiError::Validation(ref cause) => cause,
GetRestApiError::Credentials(ref err) => err.description(),
GetRestApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetRestApiError::ParseError(ref cause) => cause,
GetRestApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRestApisError {
BadRequest(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRestApisError {
pub fn from_response(res: BufferedHttpResponse) -> GetRestApisError {
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 GetRestApisError::BadRequest(String::from(error_message));
}
"TooManyRequestsException" => {
return GetRestApisError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetRestApisError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetRestApisError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRestApisError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRestApisError {
fn from(err: serde_json::error::Error) -> GetRestApisError {
GetRestApisError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRestApisError {
fn from(err: CredentialsError) -> GetRestApisError {
GetRestApisError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRestApisError {
fn from(err: HttpDispatchError) -> GetRestApisError {
GetRestApisError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRestApisError {
fn from(err: io::Error) -> GetRestApisError {
GetRestApisError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRestApisError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRestApisError {
fn description(&self) -> &str {
match *self {
GetRestApisError::BadRequest(ref cause) => cause,
GetRestApisError::TooManyRequests(ref cause) => cause,
GetRestApisError::Unauthorized(ref cause) => cause,
GetRestApisError::Validation(ref cause) => cause,
GetRestApisError::Credentials(ref err) => err.description(),
GetRestApisError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetRestApisError::ParseError(ref cause) => cause,
GetRestApisError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSdkError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSdkError {
pub fn from_response(res: BufferedHttpResponse) -> GetSdkError {
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 GetSdkError::BadRequest(String::from(error_message));
}
"ConflictException" => return GetSdkError::Conflict(String::from(error_message)),
"NotFoundException" => return GetSdkError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetSdkError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetSdkError::Unauthorized(String::from(error_message));
}
"ValidationException" => return GetSdkError::Validation(error_message.to_string()),
_ => {}
}
}
return GetSdkError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSdkError {
fn from(err: serde_json::error::Error) -> GetSdkError {
GetSdkError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSdkError {
fn from(err: CredentialsError) -> GetSdkError {
GetSdkError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSdkError {
fn from(err: HttpDispatchError) -> GetSdkError {
GetSdkError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSdkError {
fn from(err: io::Error) -> GetSdkError {
GetSdkError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSdkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSdkError {
fn description(&self) -> &str {
match *self {
GetSdkError::BadRequest(ref cause) => cause,
GetSdkError::Conflict(ref cause) => cause,
GetSdkError::NotFound(ref cause) => cause,
GetSdkError::TooManyRequests(ref cause) => cause,
GetSdkError::Unauthorized(ref cause) => cause,
GetSdkError::Validation(ref cause) => cause,
GetSdkError::Credentials(ref err) => err.description(),
GetSdkError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSdkError::ParseError(ref cause) => cause,
GetSdkError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSdkTypeError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSdkTypeError {
pub fn from_response(res: BufferedHttpResponse) -> GetSdkTypeError {
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 {
"NotFoundException" => {
return GetSdkTypeError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetSdkTypeError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetSdkTypeError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetSdkTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSdkTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSdkTypeError {
fn from(err: serde_json::error::Error) -> GetSdkTypeError {
GetSdkTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSdkTypeError {
fn from(err: CredentialsError) -> GetSdkTypeError {
GetSdkTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSdkTypeError {
fn from(err: HttpDispatchError) -> GetSdkTypeError {
GetSdkTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSdkTypeError {
fn from(err: io::Error) -> GetSdkTypeError {
GetSdkTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSdkTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSdkTypeError {
fn description(&self) -> &str {
match *self {
GetSdkTypeError::NotFound(ref cause) => cause,
GetSdkTypeError::TooManyRequests(ref cause) => cause,
GetSdkTypeError::Unauthorized(ref cause) => cause,
GetSdkTypeError::Validation(ref cause) => cause,
GetSdkTypeError::Credentials(ref err) => err.description(),
GetSdkTypeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSdkTypeError::ParseError(ref cause) => cause,
GetSdkTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSdkTypesError {
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSdkTypesError {
pub fn from_response(res: BufferedHttpResponse) -> GetSdkTypesError {
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 {
"TooManyRequestsException" => {
return GetSdkTypesError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetSdkTypesError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetSdkTypesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSdkTypesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSdkTypesError {
fn from(err: serde_json::error::Error) -> GetSdkTypesError {
GetSdkTypesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSdkTypesError {
fn from(err: CredentialsError) -> GetSdkTypesError {
GetSdkTypesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSdkTypesError {
fn from(err: HttpDispatchError) -> GetSdkTypesError {
GetSdkTypesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSdkTypesError {
fn from(err: io::Error) -> GetSdkTypesError {
GetSdkTypesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSdkTypesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSdkTypesError {
fn description(&self) -> &str {
match *self {
GetSdkTypesError::TooManyRequests(ref cause) => cause,
GetSdkTypesError::Unauthorized(ref cause) => cause,
GetSdkTypesError::Validation(ref cause) => cause,
GetSdkTypesError::Credentials(ref err) => err.description(),
GetSdkTypesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSdkTypesError::ParseError(ref cause) => cause,
GetSdkTypesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetStageError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetStageError {
pub fn from_response(res: BufferedHttpResponse) -> GetStageError {
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 {
"NotFoundException" => return GetStageError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetStageError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetStageError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetStageError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetStageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetStageError {
fn from(err: serde_json::error::Error) -> GetStageError {
GetStageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetStageError {
fn from(err: CredentialsError) -> GetStageError {
GetStageError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetStageError {
fn from(err: HttpDispatchError) -> GetStageError {
GetStageError::HttpDispatch(err)
}
}
impl From<io::Error> for GetStageError {
fn from(err: io::Error) -> GetStageError {
GetStageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetStageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetStageError {
fn description(&self) -> &str {
match *self {
GetStageError::NotFound(ref cause) => cause,
GetStageError::TooManyRequests(ref cause) => cause,
GetStageError::Unauthorized(ref cause) => cause,
GetStageError::Validation(ref cause) => cause,
GetStageError::Credentials(ref err) => err.description(),
GetStageError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetStageError::ParseError(ref cause) => cause,
GetStageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetStagesError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetStagesError {
pub fn from_response(res: BufferedHttpResponse) -> GetStagesError {
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 {
"NotFoundException" => return GetStagesError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetStagesError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetStagesError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetStagesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetStagesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetStagesError {
fn from(err: serde_json::error::Error) -> GetStagesError {
GetStagesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetStagesError {
fn from(err: CredentialsError) -> GetStagesError {
GetStagesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetStagesError {
fn from(err: HttpDispatchError) -> GetStagesError {
GetStagesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetStagesError {
fn from(err: io::Error) -> GetStagesError {
GetStagesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetStagesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetStagesError {
fn description(&self) -> &str {
match *self {
GetStagesError::NotFound(ref cause) => cause,
GetStagesError::TooManyRequests(ref cause) => cause,
GetStagesError::Unauthorized(ref cause) => cause,
GetStagesError::Validation(ref cause) => cause,
GetStagesError::Credentials(ref err) => err.description(),
GetStagesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetStagesError::ParseError(ref cause) => cause,
GetStagesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetTagsError {
BadRequest(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetTagsError {
pub fn from_response(res: BufferedHttpResponse) -> GetTagsError {
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 GetTagsError::BadRequest(String::from(error_message));
}
"LimitExceededException" => {
return GetTagsError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return GetTagsError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetTagsError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetTagsError::Unauthorized(String::from(error_message));
}
"ValidationException" => return GetTagsError::Validation(error_message.to_string()),
_ => {}
}
}
return GetTagsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetTagsError {
fn from(err: serde_json::error::Error) -> GetTagsError {
GetTagsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetTagsError {
fn from(err: CredentialsError) -> GetTagsError {
GetTagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetTagsError {
fn from(err: HttpDispatchError) -> GetTagsError {
GetTagsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetTagsError {
fn from(err: io::Error) -> GetTagsError {
GetTagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetTagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetTagsError {
fn description(&self) -> &str {
match *self {
GetTagsError::BadRequest(ref cause) => cause,
GetTagsError::LimitExceeded(ref cause) => cause,
GetTagsError::NotFound(ref cause) => cause,
GetTagsError::TooManyRequests(ref cause) => cause,
GetTagsError::Unauthorized(ref cause) => cause,
GetTagsError::Validation(ref cause) => cause,
GetTagsError::Credentials(ref err) => err.description(),
GetTagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetTagsError::ParseError(ref cause) => cause,
GetTagsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUsageError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUsageError {
pub fn from_response(res: BufferedHttpResponse) -> GetUsageError {
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 GetUsageError::BadRequest(String::from(error_message));
}
"NotFoundException" => return GetUsageError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetUsageError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetUsageError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetUsageError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUsageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUsageError {
fn from(err: serde_json::error::Error) -> GetUsageError {
GetUsageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUsageError {
fn from(err: CredentialsError) -> GetUsageError {
GetUsageError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUsageError {
fn from(err: HttpDispatchError) -> GetUsageError {
GetUsageError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUsageError {
fn from(err: io::Error) -> GetUsageError {
GetUsageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUsageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUsageError {
fn description(&self) -> &str {
match *self {
GetUsageError::BadRequest(ref cause) => cause,
GetUsageError::NotFound(ref cause) => cause,
GetUsageError::TooManyRequests(ref cause) => cause,
GetUsageError::Unauthorized(ref cause) => cause,
GetUsageError::Validation(ref cause) => cause,
GetUsageError::Credentials(ref err) => err.description(),
GetUsageError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetUsageError::ParseError(ref cause) => cause,
GetUsageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUsagePlanError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUsagePlanError {
pub fn from_response(res: BufferedHttpResponse) -> GetUsagePlanError {
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 GetUsagePlanError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetUsagePlanError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetUsagePlanError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetUsagePlanError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetUsagePlanError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUsagePlanError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUsagePlanError {
fn from(err: serde_json::error::Error) -> GetUsagePlanError {
GetUsagePlanError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUsagePlanError {
fn from(err: CredentialsError) -> GetUsagePlanError {
GetUsagePlanError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUsagePlanError {
fn from(err: HttpDispatchError) -> GetUsagePlanError {
GetUsagePlanError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUsagePlanError {
fn from(err: io::Error) -> GetUsagePlanError {
GetUsagePlanError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUsagePlanError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUsagePlanError {
fn description(&self) -> &str {
match *self {
GetUsagePlanError::BadRequest(ref cause) => cause,
GetUsagePlanError::NotFound(ref cause) => cause,
GetUsagePlanError::TooManyRequests(ref cause) => cause,
GetUsagePlanError::Unauthorized(ref cause) => cause,
GetUsagePlanError::Validation(ref cause) => cause,
GetUsagePlanError::Credentials(ref err) => err.description(),
GetUsagePlanError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetUsagePlanError::ParseError(ref cause) => cause,
GetUsagePlanError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUsagePlanKeyError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUsagePlanKeyError {
pub fn from_response(res: BufferedHttpResponse) -> GetUsagePlanKeyError {
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 GetUsagePlanKeyError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetUsagePlanKeyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetUsagePlanKeyError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetUsagePlanKeyError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetUsagePlanKeyError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUsagePlanKeyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUsagePlanKeyError {
fn from(err: serde_json::error::Error) -> GetUsagePlanKeyError {
GetUsagePlanKeyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUsagePlanKeyError {
fn from(err: CredentialsError) -> GetUsagePlanKeyError {
GetUsagePlanKeyError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUsagePlanKeyError {
fn from(err: HttpDispatchError) -> GetUsagePlanKeyError {
GetUsagePlanKeyError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUsagePlanKeyError {
fn from(err: io::Error) -> GetUsagePlanKeyError {
GetUsagePlanKeyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUsagePlanKeyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUsagePlanKeyError {
fn description(&self) -> &str {
match *self {
GetUsagePlanKeyError::BadRequest(ref cause) => cause,
GetUsagePlanKeyError::NotFound(ref cause) => cause,
GetUsagePlanKeyError::TooManyRequests(ref cause) => cause,
GetUsagePlanKeyError::Unauthorized(ref cause) => cause,
GetUsagePlanKeyError::Validation(ref cause) => cause,
GetUsagePlanKeyError::Credentials(ref err) => err.description(),
GetUsagePlanKeyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetUsagePlanKeyError::ParseError(ref cause) => cause,
GetUsagePlanKeyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUsagePlanKeysError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUsagePlanKeysError {
pub fn from_response(res: BufferedHttpResponse) -> GetUsagePlanKeysError {
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 GetUsagePlanKeysError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetUsagePlanKeysError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetUsagePlanKeysError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetUsagePlanKeysError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetUsagePlanKeysError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUsagePlanKeysError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUsagePlanKeysError {
fn from(err: serde_json::error::Error) -> GetUsagePlanKeysError {
GetUsagePlanKeysError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUsagePlanKeysError {
fn from(err: CredentialsError) -> GetUsagePlanKeysError {
GetUsagePlanKeysError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUsagePlanKeysError {
fn from(err: HttpDispatchError) -> GetUsagePlanKeysError {
GetUsagePlanKeysError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUsagePlanKeysError {
fn from(err: io::Error) -> GetUsagePlanKeysError {
GetUsagePlanKeysError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUsagePlanKeysError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUsagePlanKeysError {
fn description(&self) -> &str {
match *self {
GetUsagePlanKeysError::BadRequest(ref cause) => cause,
GetUsagePlanKeysError::NotFound(ref cause) => cause,
GetUsagePlanKeysError::TooManyRequests(ref cause) => cause,
GetUsagePlanKeysError::Unauthorized(ref cause) => cause,
GetUsagePlanKeysError::Validation(ref cause) => cause,
GetUsagePlanKeysError::Credentials(ref err) => err.description(),
GetUsagePlanKeysError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetUsagePlanKeysError::ParseError(ref cause) => cause,
GetUsagePlanKeysError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUsagePlansError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUsagePlansError {
pub fn from_response(res: BufferedHttpResponse) -> GetUsagePlansError {
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 GetUsagePlansError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return GetUsagePlansError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return GetUsagePlansError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetUsagePlansError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetUsagePlansError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetUsagePlansError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUsagePlansError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUsagePlansError {
fn from(err: serde_json::error::Error) -> GetUsagePlansError {
GetUsagePlansError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUsagePlansError {
fn from(err: CredentialsError) -> GetUsagePlansError {
GetUsagePlansError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUsagePlansError {
fn from(err: HttpDispatchError) -> GetUsagePlansError {
GetUsagePlansError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUsagePlansError {
fn from(err: io::Error) -> GetUsagePlansError {
GetUsagePlansError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUsagePlansError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUsagePlansError {
fn description(&self) -> &str {
match *self {
GetUsagePlansError::BadRequest(ref cause) => cause,
GetUsagePlansError::Conflict(ref cause) => cause,
GetUsagePlansError::NotFound(ref cause) => cause,
GetUsagePlansError::TooManyRequests(ref cause) => cause,
GetUsagePlansError::Unauthorized(ref cause) => cause,
GetUsagePlansError::Validation(ref cause) => cause,
GetUsagePlansError::Credentials(ref err) => err.description(),
GetUsagePlansError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetUsagePlansError::ParseError(ref cause) => cause,
GetUsagePlansError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetVpcLinkError {
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetVpcLinkError {
pub fn from_response(res: BufferedHttpResponse) -> GetVpcLinkError {
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 {
"NotFoundException" => {
return GetVpcLinkError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetVpcLinkError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetVpcLinkError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetVpcLinkError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetVpcLinkError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetVpcLinkError {
fn from(err: serde_json::error::Error) -> GetVpcLinkError {
GetVpcLinkError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetVpcLinkError {
fn from(err: CredentialsError) -> GetVpcLinkError {
GetVpcLinkError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetVpcLinkError {
fn from(err: HttpDispatchError) -> GetVpcLinkError {
GetVpcLinkError::HttpDispatch(err)
}
}
impl From<io::Error> for GetVpcLinkError {
fn from(err: io::Error) -> GetVpcLinkError {
GetVpcLinkError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetVpcLinkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetVpcLinkError {
fn description(&self) -> &str {
match *self {
GetVpcLinkError::NotFound(ref cause) => cause,
GetVpcLinkError::TooManyRequests(ref cause) => cause,
GetVpcLinkError::Unauthorized(ref cause) => cause,
GetVpcLinkError::Validation(ref cause) => cause,
GetVpcLinkError::Credentials(ref err) => err.description(),
GetVpcLinkError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetVpcLinkError::ParseError(ref cause) => cause,
GetVpcLinkError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetVpcLinksError {
BadRequest(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetVpcLinksError {
pub fn from_response(res: BufferedHttpResponse) -> GetVpcLinksError {
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 GetVpcLinksError::BadRequest(String::from(error_message));
}
"TooManyRequestsException" => {
return GetVpcLinksError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return GetVpcLinksError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return GetVpcLinksError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetVpcLinksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetVpcLinksError {
fn from(err: serde_json::error::Error) -> GetVpcLinksError {
GetVpcLinksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetVpcLinksError {
fn from(err: CredentialsError) -> GetVpcLinksError {
GetVpcLinksError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetVpcLinksError {
fn from(err: HttpDispatchError) -> GetVpcLinksError {
GetVpcLinksError::HttpDispatch(err)
}
}
impl From<io::Error> for GetVpcLinksError {
fn from(err: io::Error) -> GetVpcLinksError {
GetVpcLinksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetVpcLinksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetVpcLinksError {
fn description(&self) -> &str {
match *self {
GetVpcLinksError::BadRequest(ref cause) => cause,
GetVpcLinksError::TooManyRequests(ref cause) => cause,
GetVpcLinksError::Unauthorized(ref cause) => cause,
GetVpcLinksError::Validation(ref cause) => cause,
GetVpcLinksError::Credentials(ref err) => err.description(),
GetVpcLinksError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetVpcLinksError::ParseError(ref cause) => cause,
GetVpcLinksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ImportApiKeysError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ImportApiKeysError {
pub fn from_response(res: BufferedHttpResponse) -> ImportApiKeysError {
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 ImportApiKeysError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return ImportApiKeysError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return ImportApiKeysError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return ImportApiKeysError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ImportApiKeysError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return ImportApiKeysError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return ImportApiKeysError::Validation(error_message.to_string());
}
_ => {}
}
}
return ImportApiKeysError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ImportApiKeysError {
fn from(err: serde_json::error::Error) -> ImportApiKeysError {
ImportApiKeysError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ImportApiKeysError {
fn from(err: CredentialsError) -> ImportApiKeysError {
ImportApiKeysError::Credentials(err)
}
}
impl From<HttpDispatchError> for ImportApiKeysError {
fn from(err: HttpDispatchError) -> ImportApiKeysError {
ImportApiKeysError::HttpDispatch(err)
}
}
impl From<io::Error> for ImportApiKeysError {
fn from(err: io::Error) -> ImportApiKeysError {
ImportApiKeysError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ImportApiKeysError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ImportApiKeysError {
fn description(&self) -> &str {
match *self {
ImportApiKeysError::BadRequest(ref cause) => cause,
ImportApiKeysError::Conflict(ref cause) => cause,
ImportApiKeysError::LimitExceeded(ref cause) => cause,
ImportApiKeysError::NotFound(ref cause) => cause,
ImportApiKeysError::TooManyRequests(ref cause) => cause,
ImportApiKeysError::Unauthorized(ref cause) => cause,
ImportApiKeysError::Validation(ref cause) => cause,
ImportApiKeysError::Credentials(ref err) => err.description(),
ImportApiKeysError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ImportApiKeysError::ParseError(ref cause) => cause,
ImportApiKeysError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ImportDocumentationPartsError {
BadRequest(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ImportDocumentationPartsError {
pub fn from_response(res: BufferedHttpResponse) -> ImportDocumentationPartsError {
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 ImportDocumentationPartsError::BadRequest(String::from(error_message));
}
"LimitExceededException" => {
return ImportDocumentationPartsError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return ImportDocumentationPartsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ImportDocumentationPartsError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return ImportDocumentationPartsError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return ImportDocumentationPartsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ImportDocumentationPartsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ImportDocumentationPartsError {
fn from(err: serde_json::error::Error) -> ImportDocumentationPartsError {
ImportDocumentationPartsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ImportDocumentationPartsError {
fn from(err: CredentialsError) -> ImportDocumentationPartsError {
ImportDocumentationPartsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ImportDocumentationPartsError {
fn from(err: HttpDispatchError) -> ImportDocumentationPartsError {
ImportDocumentationPartsError::HttpDispatch(err)
}
}
impl From<io::Error> for ImportDocumentationPartsError {
fn from(err: io::Error) -> ImportDocumentationPartsError {
ImportDocumentationPartsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ImportDocumentationPartsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ImportDocumentationPartsError {
fn description(&self) -> &str {
match *self {
ImportDocumentationPartsError::BadRequest(ref cause) => cause,
ImportDocumentationPartsError::LimitExceeded(ref cause) => cause,
ImportDocumentationPartsError::NotFound(ref cause) => cause,
ImportDocumentationPartsError::TooManyRequests(ref cause) => cause,
ImportDocumentationPartsError::Unauthorized(ref cause) => cause,
ImportDocumentationPartsError::Validation(ref cause) => cause,
ImportDocumentationPartsError::Credentials(ref err) => err.description(),
ImportDocumentationPartsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ImportDocumentationPartsError::ParseError(ref cause) => cause,
ImportDocumentationPartsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ImportRestApiError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ImportRestApiError {
pub fn from_response(res: BufferedHttpResponse) -> ImportRestApiError {
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 ImportRestApiError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return ImportRestApiError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return ImportRestApiError::LimitExceeded(String::from(error_message));
}
"TooManyRequestsException" => {
return ImportRestApiError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return ImportRestApiError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return ImportRestApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return ImportRestApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ImportRestApiError {
fn from(err: serde_json::error::Error) -> ImportRestApiError {
ImportRestApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ImportRestApiError {
fn from(err: CredentialsError) -> ImportRestApiError {
ImportRestApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for ImportRestApiError {
fn from(err: HttpDispatchError) -> ImportRestApiError {
ImportRestApiError::HttpDispatch(err)
}
}
impl From<io::Error> for ImportRestApiError {
fn from(err: io::Error) -> ImportRestApiError {
ImportRestApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ImportRestApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ImportRestApiError {
fn description(&self) -> &str {
match *self {
ImportRestApiError::BadRequest(ref cause) => cause,
ImportRestApiError::Conflict(ref cause) => cause,
ImportRestApiError::LimitExceeded(ref cause) => cause,
ImportRestApiError::TooManyRequests(ref cause) => cause,
ImportRestApiError::Unauthorized(ref cause) => cause,
ImportRestApiError::Validation(ref cause) => cause,
ImportRestApiError::Credentials(ref err) => err.description(),
ImportRestApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ImportRestApiError::ParseError(ref cause) => cause,
ImportRestApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutGatewayResponseError {
BadRequest(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutGatewayResponseError {
pub fn from_response(res: BufferedHttpResponse) -> PutGatewayResponseError {
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 PutGatewayResponseError::BadRequest(String::from(error_message));
}
"LimitExceededException" => {
return PutGatewayResponseError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return PutGatewayResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return PutGatewayResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return PutGatewayResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return PutGatewayResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutGatewayResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutGatewayResponseError {
fn from(err: serde_json::error::Error) -> PutGatewayResponseError {
PutGatewayResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutGatewayResponseError {
fn from(err: CredentialsError) -> PutGatewayResponseError {
PutGatewayResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutGatewayResponseError {
fn from(err: HttpDispatchError) -> PutGatewayResponseError {
PutGatewayResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for PutGatewayResponseError {
fn from(err: io::Error) -> PutGatewayResponseError {
PutGatewayResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutGatewayResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutGatewayResponseError {
fn description(&self) -> &str {
match *self {
PutGatewayResponseError::BadRequest(ref cause) => cause,
PutGatewayResponseError::LimitExceeded(ref cause) => cause,
PutGatewayResponseError::NotFound(ref cause) => cause,
PutGatewayResponseError::TooManyRequests(ref cause) => cause,
PutGatewayResponseError::Unauthorized(ref cause) => cause,
PutGatewayResponseError::Validation(ref cause) => cause,
PutGatewayResponseError::Credentials(ref err) => err.description(),
PutGatewayResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutGatewayResponseError::ParseError(ref cause) => cause,
PutGatewayResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutIntegrationError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutIntegrationError {
pub fn from_response(res: BufferedHttpResponse) -> PutIntegrationError {
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 PutIntegrationError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return PutIntegrationError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return PutIntegrationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return PutIntegrationError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return PutIntegrationError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return PutIntegrationError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutIntegrationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutIntegrationError {
fn from(err: serde_json::error::Error) -> PutIntegrationError {
PutIntegrationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutIntegrationError {
fn from(err: CredentialsError) -> PutIntegrationError {
PutIntegrationError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutIntegrationError {
fn from(err: HttpDispatchError) -> PutIntegrationError {
PutIntegrationError::HttpDispatch(err)
}
}
impl From<io::Error> for PutIntegrationError {
fn from(err: io::Error) -> PutIntegrationError {
PutIntegrationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutIntegrationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutIntegrationError {
fn description(&self) -> &str {
match *self {
PutIntegrationError::BadRequest(ref cause) => cause,
PutIntegrationError::Conflict(ref cause) => cause,
PutIntegrationError::NotFound(ref cause) => cause,
PutIntegrationError::TooManyRequests(ref cause) => cause,
PutIntegrationError::Unauthorized(ref cause) => cause,
PutIntegrationError::Validation(ref cause) => cause,
PutIntegrationError::Credentials(ref err) => err.description(),
PutIntegrationError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutIntegrationError::ParseError(ref cause) => cause,
PutIntegrationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutIntegrationResponseError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutIntegrationResponseError {
pub fn from_response(res: BufferedHttpResponse) -> PutIntegrationResponseError {
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 PutIntegrationResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return PutIntegrationResponseError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return PutIntegrationResponseError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return PutIntegrationResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return PutIntegrationResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return PutIntegrationResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return PutIntegrationResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutIntegrationResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutIntegrationResponseError {
fn from(err: serde_json::error::Error) -> PutIntegrationResponseError {
PutIntegrationResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutIntegrationResponseError {
fn from(err: CredentialsError) -> PutIntegrationResponseError {
PutIntegrationResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutIntegrationResponseError {
fn from(err: HttpDispatchError) -> PutIntegrationResponseError {
PutIntegrationResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for PutIntegrationResponseError {
fn from(err: io::Error) -> PutIntegrationResponseError {
PutIntegrationResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutIntegrationResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutIntegrationResponseError {
fn description(&self) -> &str {
match *self {
PutIntegrationResponseError::BadRequest(ref cause) => cause,
PutIntegrationResponseError::Conflict(ref cause) => cause,
PutIntegrationResponseError::LimitExceeded(ref cause) => cause,
PutIntegrationResponseError::NotFound(ref cause) => cause,
PutIntegrationResponseError::TooManyRequests(ref cause) => cause,
PutIntegrationResponseError::Unauthorized(ref cause) => cause,
PutIntegrationResponseError::Validation(ref cause) => cause,
PutIntegrationResponseError::Credentials(ref err) => err.description(),
PutIntegrationResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutIntegrationResponseError::ParseError(ref cause) => cause,
PutIntegrationResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutMethodError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutMethodError {
pub fn from_response(res: BufferedHttpResponse) -> PutMethodError {
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 PutMethodError::BadRequest(String::from(error_message));
}
"ConflictException" => return PutMethodError::Conflict(String::from(error_message)),
"LimitExceededException" => {
return PutMethodError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return PutMethodError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return PutMethodError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return PutMethodError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return PutMethodError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutMethodError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutMethodError {
fn from(err: serde_json::error::Error) -> PutMethodError {
PutMethodError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutMethodError {
fn from(err: CredentialsError) -> PutMethodError {
PutMethodError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutMethodError {
fn from(err: HttpDispatchError) -> PutMethodError {
PutMethodError::HttpDispatch(err)
}
}
impl From<io::Error> for PutMethodError {
fn from(err: io::Error) -> PutMethodError {
PutMethodError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutMethodError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutMethodError {
fn description(&self) -> &str {
match *self {
PutMethodError::BadRequest(ref cause) => cause,
PutMethodError::Conflict(ref cause) => cause,
PutMethodError::LimitExceeded(ref cause) => cause,
PutMethodError::NotFound(ref cause) => cause,
PutMethodError::TooManyRequests(ref cause) => cause,
PutMethodError::Unauthorized(ref cause) => cause,
PutMethodError::Validation(ref cause) => cause,
PutMethodError::Credentials(ref err) => err.description(),
PutMethodError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutMethodError::ParseError(ref cause) => cause,
PutMethodError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutMethodResponseError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutMethodResponseError {
pub fn from_response(res: BufferedHttpResponse) -> PutMethodResponseError {
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 PutMethodResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return PutMethodResponseError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return PutMethodResponseError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return PutMethodResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return PutMethodResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return PutMethodResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return PutMethodResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutMethodResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutMethodResponseError {
fn from(err: serde_json::error::Error) -> PutMethodResponseError {
PutMethodResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutMethodResponseError {
fn from(err: CredentialsError) -> PutMethodResponseError {
PutMethodResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutMethodResponseError {
fn from(err: HttpDispatchError) -> PutMethodResponseError {
PutMethodResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for PutMethodResponseError {
fn from(err: io::Error) -> PutMethodResponseError {
PutMethodResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutMethodResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutMethodResponseError {
fn description(&self) -> &str {
match *self {
PutMethodResponseError::BadRequest(ref cause) => cause,
PutMethodResponseError::Conflict(ref cause) => cause,
PutMethodResponseError::LimitExceeded(ref cause) => cause,
PutMethodResponseError::NotFound(ref cause) => cause,
PutMethodResponseError::TooManyRequests(ref cause) => cause,
PutMethodResponseError::Unauthorized(ref cause) => cause,
PutMethodResponseError::Validation(ref cause) => cause,
PutMethodResponseError::Credentials(ref err) => err.description(),
PutMethodResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutMethodResponseError::ParseError(ref cause) => cause,
PutMethodResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutRestApiError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutRestApiError {
pub fn from_response(res: BufferedHttpResponse) -> PutRestApiError {
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 PutRestApiError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return PutRestApiError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return PutRestApiError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return PutRestApiError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return PutRestApiError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return PutRestApiError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return PutRestApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutRestApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutRestApiError {
fn from(err: serde_json::error::Error) -> PutRestApiError {
PutRestApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutRestApiError {
fn from(err: CredentialsError) -> PutRestApiError {
PutRestApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutRestApiError {
fn from(err: HttpDispatchError) -> PutRestApiError {
PutRestApiError::HttpDispatch(err)
}
}
impl From<io::Error> for PutRestApiError {
fn from(err: io::Error) -> PutRestApiError {
PutRestApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutRestApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutRestApiError {
fn description(&self) -> &str {
match *self {
PutRestApiError::BadRequest(ref cause) => cause,
PutRestApiError::Conflict(ref cause) => cause,
PutRestApiError::LimitExceeded(ref cause) => cause,
PutRestApiError::NotFound(ref cause) => cause,
PutRestApiError::TooManyRequests(ref cause) => cause,
PutRestApiError::Unauthorized(ref cause) => cause,
PutRestApiError::Validation(ref cause) => cause,
PutRestApiError::Credentials(ref err) => err.description(),
PutRestApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutRestApiError::ParseError(ref cause) => cause,
PutRestApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> TagResourceError {
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 TagResourceError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return TagResourceError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return TagResourceError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return TagResourceError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return TagResourceError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return TagResourceError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return TagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return TagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TagResourceError {
fn from(err: serde_json::error::Error) -> TagResourceError {
TagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TagResourceError {
fn from(err: CredentialsError) -> TagResourceError {
TagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for TagResourceError {
fn from(err: HttpDispatchError) -> TagResourceError {
TagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for TagResourceError {
fn from(err: io::Error) -> TagResourceError {
TagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::BadRequest(ref cause) => cause,
TagResourceError::Conflict(ref cause) => cause,
TagResourceError::LimitExceeded(ref cause) => cause,
TagResourceError::NotFound(ref cause) => cause,
TagResourceError::TooManyRequests(ref cause) => cause,
TagResourceError::Unauthorized(ref cause) => cause,
TagResourceError::Validation(ref cause) => cause,
TagResourceError::Credentials(ref err) => err.description(),
TagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TagResourceError::ParseError(ref cause) => cause,
TagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TestInvokeAuthorizerError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TestInvokeAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> TestInvokeAuthorizerError {
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 TestInvokeAuthorizerError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return TestInvokeAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return TestInvokeAuthorizerError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return TestInvokeAuthorizerError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return TestInvokeAuthorizerError::Validation(error_message.to_string());
}
_ => {}
}
}
return TestInvokeAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TestInvokeAuthorizerError {
fn from(err: serde_json::error::Error) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TestInvokeAuthorizerError {
fn from(err: CredentialsError) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for TestInvokeAuthorizerError {
fn from(err: HttpDispatchError) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for TestInvokeAuthorizerError {
fn from(err: io::Error) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TestInvokeAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TestInvokeAuthorizerError {
fn description(&self) -> &str {
match *self {
TestInvokeAuthorizerError::BadRequest(ref cause) => cause,
TestInvokeAuthorizerError::NotFound(ref cause) => cause,
TestInvokeAuthorizerError::TooManyRequests(ref cause) => cause,
TestInvokeAuthorizerError::Unauthorized(ref cause) => cause,
TestInvokeAuthorizerError::Validation(ref cause) => cause,
TestInvokeAuthorizerError::Credentials(ref err) => err.description(),
TestInvokeAuthorizerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
TestInvokeAuthorizerError::ParseError(ref cause) => cause,
TestInvokeAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TestInvokeMethodError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TestInvokeMethodError {
pub fn from_response(res: BufferedHttpResponse) -> TestInvokeMethodError {
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 TestInvokeMethodError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return TestInvokeMethodError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return TestInvokeMethodError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return TestInvokeMethodError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return TestInvokeMethodError::Validation(error_message.to_string());
}
_ => {}
}
}
return TestInvokeMethodError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TestInvokeMethodError {
fn from(err: serde_json::error::Error) -> TestInvokeMethodError {
TestInvokeMethodError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TestInvokeMethodError {
fn from(err: CredentialsError) -> TestInvokeMethodError {
TestInvokeMethodError::Credentials(err)
}
}
impl From<HttpDispatchError> for TestInvokeMethodError {
fn from(err: HttpDispatchError) -> TestInvokeMethodError {
TestInvokeMethodError::HttpDispatch(err)
}
}
impl From<io::Error> for TestInvokeMethodError {
fn from(err: io::Error) -> TestInvokeMethodError {
TestInvokeMethodError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TestInvokeMethodError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TestInvokeMethodError {
fn description(&self) -> &str {
match *self {
TestInvokeMethodError::BadRequest(ref cause) => cause,
TestInvokeMethodError::NotFound(ref cause) => cause,
TestInvokeMethodError::TooManyRequests(ref cause) => cause,
TestInvokeMethodError::Unauthorized(ref cause) => cause,
TestInvokeMethodError::Validation(ref cause) => cause,
TestInvokeMethodError::Credentials(ref err) => err.description(),
TestInvokeMethodError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TestInvokeMethodError::ParseError(ref cause) => cause,
TestInvokeMethodError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> UntagResourceError {
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 UntagResourceError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UntagResourceError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UntagResourceError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UntagResourceError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UntagResourceError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UntagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return UntagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UntagResourceError {
fn from(err: serde_json::error::Error) -> UntagResourceError {
UntagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UntagResourceError {
fn from(err: CredentialsError) -> UntagResourceError {
UntagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UntagResourceError {
fn from(err: HttpDispatchError) -> UntagResourceError {
UntagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for UntagResourceError {
fn from(err: io::Error) -> UntagResourceError {
UntagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::BadRequest(ref cause) => cause,
UntagResourceError::Conflict(ref cause) => cause,
UntagResourceError::NotFound(ref cause) => cause,
UntagResourceError::TooManyRequests(ref cause) => cause,
UntagResourceError::Unauthorized(ref cause) => cause,
UntagResourceError::Validation(ref cause) => cause,
UntagResourceError::Credentials(ref err) => err.description(),
UntagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UntagResourceError::ParseError(ref cause) => cause,
UntagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateAccountError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateAccountError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateAccountError {
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 UpdateAccountError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return UpdateAccountError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateAccountError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateAccountError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateAccountError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateAccountError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateAccountError {
fn from(err: serde_json::error::Error) -> UpdateAccountError {
UpdateAccountError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateAccountError {
fn from(err: CredentialsError) -> UpdateAccountError {
UpdateAccountError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateAccountError {
fn from(err: HttpDispatchError) -> UpdateAccountError {
UpdateAccountError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateAccountError {
fn from(err: io::Error) -> UpdateAccountError {
UpdateAccountError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateAccountError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateAccountError {
fn description(&self) -> &str {
match *self {
UpdateAccountError::BadRequest(ref cause) => cause,
UpdateAccountError::NotFound(ref cause) => cause,
UpdateAccountError::TooManyRequests(ref cause) => cause,
UpdateAccountError::Unauthorized(ref cause) => cause,
UpdateAccountError::Validation(ref cause) => cause,
UpdateAccountError::Credentials(ref err) => err.description(),
UpdateAccountError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateAccountError::ParseError(ref cause) => cause,
UpdateAccountError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateApiKeyError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateApiKeyError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateApiKeyError {
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 UpdateApiKeyError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateApiKeyError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateApiKeyError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateApiKeyError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateApiKeyError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateApiKeyError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateApiKeyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateApiKeyError {
fn from(err: serde_json::error::Error) -> UpdateApiKeyError {
UpdateApiKeyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateApiKeyError {
fn from(err: CredentialsError) -> UpdateApiKeyError {
UpdateApiKeyError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateApiKeyError {
fn from(err: HttpDispatchError) -> UpdateApiKeyError {
UpdateApiKeyError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateApiKeyError {
fn from(err: io::Error) -> UpdateApiKeyError {
UpdateApiKeyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateApiKeyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateApiKeyError {
fn description(&self) -> &str {
match *self {
UpdateApiKeyError::BadRequest(ref cause) => cause,
UpdateApiKeyError::Conflict(ref cause) => cause,
UpdateApiKeyError::NotFound(ref cause) => cause,
UpdateApiKeyError::TooManyRequests(ref cause) => cause,
UpdateApiKeyError::Unauthorized(ref cause) => cause,
UpdateApiKeyError::Validation(ref cause) => cause,
UpdateApiKeyError::Credentials(ref err) => err.description(),
UpdateApiKeyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateApiKeyError::ParseError(ref cause) => cause,
UpdateApiKeyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateAuthorizerError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateAuthorizerError {
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 UpdateAuthorizerError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return UpdateAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateAuthorizerError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateAuthorizerError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateAuthorizerError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateAuthorizerError {
fn from(err: serde_json::error::Error) -> UpdateAuthorizerError {
UpdateAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateAuthorizerError {
fn from(err: CredentialsError) -> UpdateAuthorizerError {
UpdateAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateAuthorizerError {
fn from(err: HttpDispatchError) -> UpdateAuthorizerError {
UpdateAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateAuthorizerError {
fn from(err: io::Error) -> UpdateAuthorizerError {
UpdateAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateAuthorizerError {
fn description(&self) -> &str {
match *self {
UpdateAuthorizerError::BadRequest(ref cause) => cause,
UpdateAuthorizerError::NotFound(ref cause) => cause,
UpdateAuthorizerError::TooManyRequests(ref cause) => cause,
UpdateAuthorizerError::Unauthorized(ref cause) => cause,
UpdateAuthorizerError::Validation(ref cause) => cause,
UpdateAuthorizerError::Credentials(ref err) => err.description(),
UpdateAuthorizerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateAuthorizerError::ParseError(ref cause) => cause,
UpdateAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateBasePathMappingError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateBasePathMappingError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateBasePathMappingError {
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 UpdateBasePathMappingError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateBasePathMappingError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateBasePathMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateBasePathMappingError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateBasePathMappingError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateBasePathMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateBasePathMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateBasePathMappingError {
fn from(err: serde_json::error::Error) -> UpdateBasePathMappingError {
UpdateBasePathMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateBasePathMappingError {
fn from(err: CredentialsError) -> UpdateBasePathMappingError {
UpdateBasePathMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateBasePathMappingError {
fn from(err: HttpDispatchError) -> UpdateBasePathMappingError {
UpdateBasePathMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateBasePathMappingError {
fn from(err: io::Error) -> UpdateBasePathMappingError {
UpdateBasePathMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateBasePathMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateBasePathMappingError {
fn description(&self) -> &str {
match *self {
UpdateBasePathMappingError::BadRequest(ref cause) => cause,
UpdateBasePathMappingError::Conflict(ref cause) => cause,
UpdateBasePathMappingError::NotFound(ref cause) => cause,
UpdateBasePathMappingError::TooManyRequests(ref cause) => cause,
UpdateBasePathMappingError::Unauthorized(ref cause) => cause,
UpdateBasePathMappingError::Validation(ref cause) => cause,
UpdateBasePathMappingError::Credentials(ref err) => err.description(),
UpdateBasePathMappingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateBasePathMappingError::ParseError(ref cause) => cause,
UpdateBasePathMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateClientCertificateError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateClientCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateClientCertificateError {
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 UpdateClientCertificateError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return UpdateClientCertificateError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateClientCertificateError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return UpdateClientCertificateError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateClientCertificateError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateClientCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateClientCertificateError {
fn from(err: serde_json::error::Error) -> UpdateClientCertificateError {
UpdateClientCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateClientCertificateError {
fn from(err: CredentialsError) -> UpdateClientCertificateError {
UpdateClientCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateClientCertificateError {
fn from(err: HttpDispatchError) -> UpdateClientCertificateError {
UpdateClientCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateClientCertificateError {
fn from(err: io::Error) -> UpdateClientCertificateError {
UpdateClientCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateClientCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateClientCertificateError {
fn description(&self) -> &str {
match *self {
UpdateClientCertificateError::BadRequest(ref cause) => cause,
UpdateClientCertificateError::NotFound(ref cause) => cause,
UpdateClientCertificateError::TooManyRequests(ref cause) => cause,
UpdateClientCertificateError::Unauthorized(ref cause) => cause,
UpdateClientCertificateError::Validation(ref cause) => cause,
UpdateClientCertificateError::Credentials(ref err) => err.description(),
UpdateClientCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateClientCertificateError::ParseError(ref cause) => cause,
UpdateClientCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDeploymentError {
BadRequest(String),
NotFound(String),
ServiceUnavailable(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDeploymentError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDeploymentError {
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 UpdateDeploymentError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return UpdateDeploymentError::NotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return UpdateDeploymentError::ServiceUnavailable(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateDeploymentError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateDeploymentError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateDeploymentError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDeploymentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDeploymentError {
fn from(err: serde_json::error::Error) -> UpdateDeploymentError {
UpdateDeploymentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDeploymentError {
fn from(err: CredentialsError) -> UpdateDeploymentError {
UpdateDeploymentError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDeploymentError {
fn from(err: HttpDispatchError) -> UpdateDeploymentError {
UpdateDeploymentError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDeploymentError {
fn from(err: io::Error) -> UpdateDeploymentError {
UpdateDeploymentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDeploymentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDeploymentError {
fn description(&self) -> &str {
match *self {
UpdateDeploymentError::BadRequest(ref cause) => cause,
UpdateDeploymentError::NotFound(ref cause) => cause,
UpdateDeploymentError::ServiceUnavailable(ref cause) => cause,
UpdateDeploymentError::TooManyRequests(ref cause) => cause,
UpdateDeploymentError::Unauthorized(ref cause) => cause,
UpdateDeploymentError::Validation(ref cause) => cause,
UpdateDeploymentError::Credentials(ref err) => err.description(),
UpdateDeploymentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateDeploymentError::ParseError(ref cause) => cause,
UpdateDeploymentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDocumentationPartError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDocumentationPartError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDocumentationPartError {
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 UpdateDocumentationPartError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateDocumentationPartError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return UpdateDocumentationPartError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return UpdateDocumentationPartError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateDocumentationPartError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return UpdateDocumentationPartError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateDocumentationPartError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDocumentationPartError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDocumentationPartError {
fn from(err: serde_json::error::Error) -> UpdateDocumentationPartError {
UpdateDocumentationPartError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDocumentationPartError {
fn from(err: CredentialsError) -> UpdateDocumentationPartError {
UpdateDocumentationPartError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDocumentationPartError {
fn from(err: HttpDispatchError) -> UpdateDocumentationPartError {
UpdateDocumentationPartError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDocumentationPartError {
fn from(err: io::Error) -> UpdateDocumentationPartError {
UpdateDocumentationPartError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDocumentationPartError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDocumentationPartError {
fn description(&self) -> &str {
match *self {
UpdateDocumentationPartError::BadRequest(ref cause) => cause,
UpdateDocumentationPartError::Conflict(ref cause) => cause,
UpdateDocumentationPartError::LimitExceeded(ref cause) => cause,
UpdateDocumentationPartError::NotFound(ref cause) => cause,
UpdateDocumentationPartError::TooManyRequests(ref cause) => cause,
UpdateDocumentationPartError::Unauthorized(ref cause) => cause,
UpdateDocumentationPartError::Validation(ref cause) => cause,
UpdateDocumentationPartError::Credentials(ref err) => err.description(),
UpdateDocumentationPartError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateDocumentationPartError::ParseError(ref cause) => cause,
UpdateDocumentationPartError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDocumentationVersionError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDocumentationVersionError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDocumentationVersionError {
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 UpdateDocumentationVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateDocumentationVersionError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateDocumentationVersionError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateDocumentationVersionError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return UpdateDocumentationVersionError::Unauthorized(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateDocumentationVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDocumentationVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDocumentationVersionError {
fn from(err: serde_json::error::Error) -> UpdateDocumentationVersionError {
UpdateDocumentationVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDocumentationVersionError {
fn from(err: CredentialsError) -> UpdateDocumentationVersionError {
UpdateDocumentationVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDocumentationVersionError {
fn from(err: HttpDispatchError) -> UpdateDocumentationVersionError {
UpdateDocumentationVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDocumentationVersionError {
fn from(err: io::Error) -> UpdateDocumentationVersionError {
UpdateDocumentationVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDocumentationVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDocumentationVersionError {
fn description(&self) -> &str {
match *self {
UpdateDocumentationVersionError::BadRequest(ref cause) => cause,
UpdateDocumentationVersionError::Conflict(ref cause) => cause,
UpdateDocumentationVersionError::NotFound(ref cause) => cause,
UpdateDocumentationVersionError::TooManyRequests(ref cause) => cause,
UpdateDocumentationVersionError::Unauthorized(ref cause) => cause,
UpdateDocumentationVersionError::Validation(ref cause) => cause,
UpdateDocumentationVersionError::Credentials(ref err) => err.description(),
UpdateDocumentationVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateDocumentationVersionError::ParseError(ref cause) => cause,
UpdateDocumentationVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDomainNameError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDomainNameError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDomainNameError {
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 UpdateDomainNameError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateDomainNameError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateDomainNameError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateDomainNameError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateDomainNameError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateDomainNameError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDomainNameError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDomainNameError {
fn from(err: serde_json::error::Error) -> UpdateDomainNameError {
UpdateDomainNameError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDomainNameError {
fn from(err: CredentialsError) -> UpdateDomainNameError {
UpdateDomainNameError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDomainNameError {
fn from(err: HttpDispatchError) -> UpdateDomainNameError {
UpdateDomainNameError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDomainNameError {
fn from(err: io::Error) -> UpdateDomainNameError {
UpdateDomainNameError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDomainNameError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDomainNameError {
fn description(&self) -> &str {
match *self {
UpdateDomainNameError::BadRequest(ref cause) => cause,
UpdateDomainNameError::Conflict(ref cause) => cause,
UpdateDomainNameError::NotFound(ref cause) => cause,
UpdateDomainNameError::TooManyRequests(ref cause) => cause,
UpdateDomainNameError::Unauthorized(ref cause) => cause,
UpdateDomainNameError::Validation(ref cause) => cause,
UpdateDomainNameError::Credentials(ref err) => err.description(),
UpdateDomainNameError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateDomainNameError::ParseError(ref cause) => cause,
UpdateDomainNameError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateGatewayResponseError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateGatewayResponseError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateGatewayResponseError {
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 UpdateGatewayResponseError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return UpdateGatewayResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateGatewayResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateGatewayResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateGatewayResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateGatewayResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateGatewayResponseError {
fn from(err: serde_json::error::Error) -> UpdateGatewayResponseError {
UpdateGatewayResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateGatewayResponseError {
fn from(err: CredentialsError) -> UpdateGatewayResponseError {
UpdateGatewayResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateGatewayResponseError {
fn from(err: HttpDispatchError) -> UpdateGatewayResponseError {
UpdateGatewayResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateGatewayResponseError {
fn from(err: io::Error) -> UpdateGatewayResponseError {
UpdateGatewayResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateGatewayResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateGatewayResponseError {
fn description(&self) -> &str {
match *self {
UpdateGatewayResponseError::BadRequest(ref cause) => cause,
UpdateGatewayResponseError::NotFound(ref cause) => cause,
UpdateGatewayResponseError::TooManyRequests(ref cause) => cause,
UpdateGatewayResponseError::Unauthorized(ref cause) => cause,
UpdateGatewayResponseError::Validation(ref cause) => cause,
UpdateGatewayResponseError::Credentials(ref err) => err.description(),
UpdateGatewayResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateGatewayResponseError::ParseError(ref cause) => cause,
UpdateGatewayResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateIntegrationError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateIntegrationError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateIntegrationError {
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 UpdateIntegrationError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateIntegrationError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateIntegrationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateIntegrationError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateIntegrationError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateIntegrationError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateIntegrationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateIntegrationError {
fn from(err: serde_json::error::Error) -> UpdateIntegrationError {
UpdateIntegrationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateIntegrationError {
fn from(err: CredentialsError) -> UpdateIntegrationError {
UpdateIntegrationError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateIntegrationError {
fn from(err: HttpDispatchError) -> UpdateIntegrationError {
UpdateIntegrationError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateIntegrationError {
fn from(err: io::Error) -> UpdateIntegrationError {
UpdateIntegrationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateIntegrationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateIntegrationError {
fn description(&self) -> &str {
match *self {
UpdateIntegrationError::BadRequest(ref cause) => cause,
UpdateIntegrationError::Conflict(ref cause) => cause,
UpdateIntegrationError::NotFound(ref cause) => cause,
UpdateIntegrationError::TooManyRequests(ref cause) => cause,
UpdateIntegrationError::Unauthorized(ref cause) => cause,
UpdateIntegrationError::Validation(ref cause) => cause,
UpdateIntegrationError::Credentials(ref err) => err.description(),
UpdateIntegrationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateIntegrationError::ParseError(ref cause) => cause,
UpdateIntegrationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateIntegrationResponseError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateIntegrationResponseError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateIntegrationResponseError {
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 UpdateIntegrationResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateIntegrationResponseError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateIntegrationResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateIntegrationResponseError::TooManyRequests(String::from(
error_message,
));
}
"UnauthorizedException" => {
return UpdateIntegrationResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateIntegrationResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateIntegrationResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateIntegrationResponseError {
fn from(err: serde_json::error::Error) -> UpdateIntegrationResponseError {
UpdateIntegrationResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateIntegrationResponseError {
fn from(err: CredentialsError) -> UpdateIntegrationResponseError {
UpdateIntegrationResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateIntegrationResponseError {
fn from(err: HttpDispatchError) -> UpdateIntegrationResponseError {
UpdateIntegrationResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateIntegrationResponseError {
fn from(err: io::Error) -> UpdateIntegrationResponseError {
UpdateIntegrationResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateIntegrationResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateIntegrationResponseError {
fn description(&self) -> &str {
match *self {
UpdateIntegrationResponseError::BadRequest(ref cause) => cause,
UpdateIntegrationResponseError::Conflict(ref cause) => cause,
UpdateIntegrationResponseError::NotFound(ref cause) => cause,
UpdateIntegrationResponseError::TooManyRequests(ref cause) => cause,
UpdateIntegrationResponseError::Unauthorized(ref cause) => cause,
UpdateIntegrationResponseError::Validation(ref cause) => cause,
UpdateIntegrationResponseError::Credentials(ref err) => err.description(),
UpdateIntegrationResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateIntegrationResponseError::ParseError(ref cause) => cause,
UpdateIntegrationResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateMethodError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateMethodError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateMethodError {
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 UpdateMethodError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateMethodError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateMethodError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateMethodError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateMethodError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateMethodError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateMethodError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateMethodError {
fn from(err: serde_json::error::Error) -> UpdateMethodError {
UpdateMethodError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateMethodError {
fn from(err: CredentialsError) -> UpdateMethodError {
UpdateMethodError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateMethodError {
fn from(err: HttpDispatchError) -> UpdateMethodError {
UpdateMethodError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateMethodError {
fn from(err: io::Error) -> UpdateMethodError {
UpdateMethodError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateMethodError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateMethodError {
fn description(&self) -> &str {
match *self {
UpdateMethodError::BadRequest(ref cause) => cause,
UpdateMethodError::Conflict(ref cause) => cause,
UpdateMethodError::NotFound(ref cause) => cause,
UpdateMethodError::TooManyRequests(ref cause) => cause,
UpdateMethodError::Unauthorized(ref cause) => cause,
UpdateMethodError::Validation(ref cause) => cause,
UpdateMethodError::Credentials(ref err) => err.description(),
UpdateMethodError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateMethodError::ParseError(ref cause) => cause,
UpdateMethodError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateMethodResponseError {
BadRequest(String),
Conflict(String),
LimitExceeded(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateMethodResponseError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateMethodResponseError {
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 UpdateMethodResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateMethodResponseError::Conflict(String::from(error_message));
}
"LimitExceededException" => {
return UpdateMethodResponseError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return UpdateMethodResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateMethodResponseError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateMethodResponseError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateMethodResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateMethodResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateMethodResponseError {
fn from(err: serde_json::error::Error) -> UpdateMethodResponseError {
UpdateMethodResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateMethodResponseError {
fn from(err: CredentialsError) -> UpdateMethodResponseError {
UpdateMethodResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateMethodResponseError {
fn from(err: HttpDispatchError) -> UpdateMethodResponseError {
UpdateMethodResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateMethodResponseError {
fn from(err: io::Error) -> UpdateMethodResponseError {
UpdateMethodResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateMethodResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateMethodResponseError {
fn description(&self) -> &str {
match *self {
UpdateMethodResponseError::BadRequest(ref cause) => cause,
UpdateMethodResponseError::Conflict(ref cause) => cause,
UpdateMethodResponseError::LimitExceeded(ref cause) => cause,
UpdateMethodResponseError::NotFound(ref cause) => cause,
UpdateMethodResponseError::TooManyRequests(ref cause) => cause,
UpdateMethodResponseError::Unauthorized(ref cause) => cause,
UpdateMethodResponseError::Validation(ref cause) => cause,
UpdateMethodResponseError::Credentials(ref err) => err.description(),
UpdateMethodResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateMethodResponseError::ParseError(ref cause) => cause,
UpdateMethodResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateModelError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateModelError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateModelError {
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 UpdateModelError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateModelError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateModelError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateModelError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateModelError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateModelError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateModelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateModelError {
fn from(err: serde_json::error::Error) -> UpdateModelError {
UpdateModelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateModelError {
fn from(err: CredentialsError) -> UpdateModelError {
UpdateModelError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateModelError {
fn from(err: HttpDispatchError) -> UpdateModelError {
UpdateModelError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateModelError {
fn from(err: io::Error) -> UpdateModelError {
UpdateModelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateModelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateModelError {
fn description(&self) -> &str {
match *self {
UpdateModelError::BadRequest(ref cause) => cause,
UpdateModelError::Conflict(ref cause) => cause,
UpdateModelError::NotFound(ref cause) => cause,
UpdateModelError::TooManyRequests(ref cause) => cause,
UpdateModelError::Unauthorized(ref cause) => cause,
UpdateModelError::Validation(ref cause) => cause,
UpdateModelError::Credentials(ref err) => err.description(),
UpdateModelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateModelError::ParseError(ref cause) => cause,
UpdateModelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRequestValidatorError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRequestValidatorError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRequestValidatorError {
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 UpdateRequestValidatorError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return UpdateRequestValidatorError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateRequestValidatorError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateRequestValidatorError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateRequestValidatorError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateRequestValidatorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRequestValidatorError {
fn from(err: serde_json::error::Error) -> UpdateRequestValidatorError {
UpdateRequestValidatorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRequestValidatorError {
fn from(err: CredentialsError) -> UpdateRequestValidatorError {
UpdateRequestValidatorError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRequestValidatorError {
fn from(err: HttpDispatchError) -> UpdateRequestValidatorError {
UpdateRequestValidatorError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRequestValidatorError {
fn from(err: io::Error) -> UpdateRequestValidatorError {
UpdateRequestValidatorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRequestValidatorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRequestValidatorError {
fn description(&self) -> &str {
match *self {
UpdateRequestValidatorError::BadRequest(ref cause) => cause,
UpdateRequestValidatorError::NotFound(ref cause) => cause,
UpdateRequestValidatorError::TooManyRequests(ref cause) => cause,
UpdateRequestValidatorError::Unauthorized(ref cause) => cause,
UpdateRequestValidatorError::Validation(ref cause) => cause,
UpdateRequestValidatorError::Credentials(ref err) => err.description(),
UpdateRequestValidatorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateRequestValidatorError::ParseError(ref cause) => cause,
UpdateRequestValidatorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateResourceError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateResourceError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateResourceError {
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 UpdateResourceError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateResourceError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateResourceError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateResourceError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateResourceError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateResourceError {
fn from(err: serde_json::error::Error) -> UpdateResourceError {
UpdateResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateResourceError {
fn from(err: CredentialsError) -> UpdateResourceError {
UpdateResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateResourceError {
fn from(err: HttpDispatchError) -> UpdateResourceError {
UpdateResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateResourceError {
fn from(err: io::Error) -> UpdateResourceError {
UpdateResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateResourceError {
fn description(&self) -> &str {
match *self {
UpdateResourceError::BadRequest(ref cause) => cause,
UpdateResourceError::Conflict(ref cause) => cause,
UpdateResourceError::NotFound(ref cause) => cause,
UpdateResourceError::TooManyRequests(ref cause) => cause,
UpdateResourceError::Unauthorized(ref cause) => cause,
UpdateResourceError::Validation(ref cause) => cause,
UpdateResourceError::Credentials(ref err) => err.description(),
UpdateResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateResourceError::ParseError(ref cause) => cause,
UpdateResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRestApiError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRestApiError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRestApiError {
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 UpdateRestApiError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateRestApiError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateRestApiError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateRestApiError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateRestApiError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateRestApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateRestApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRestApiError {
fn from(err: serde_json::error::Error) -> UpdateRestApiError {
UpdateRestApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRestApiError {
fn from(err: CredentialsError) -> UpdateRestApiError {
UpdateRestApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRestApiError {
fn from(err: HttpDispatchError) -> UpdateRestApiError {
UpdateRestApiError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRestApiError {
fn from(err: io::Error) -> UpdateRestApiError {
UpdateRestApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRestApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRestApiError {
fn description(&self) -> &str {
match *self {
UpdateRestApiError::BadRequest(ref cause) => cause,
UpdateRestApiError::Conflict(ref cause) => cause,
UpdateRestApiError::NotFound(ref cause) => cause,
UpdateRestApiError::TooManyRequests(ref cause) => cause,
UpdateRestApiError::Unauthorized(ref cause) => cause,
UpdateRestApiError::Validation(ref cause) => cause,
UpdateRestApiError::Credentials(ref err) => err.description(),
UpdateRestApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateRestApiError::ParseError(ref cause) => cause,
UpdateRestApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateStageError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateStageError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateStageError {
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 UpdateStageError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateStageError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateStageError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateStageError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateStageError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateStageError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateStageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateStageError {
fn from(err: serde_json::error::Error) -> UpdateStageError {
UpdateStageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateStageError {
fn from(err: CredentialsError) -> UpdateStageError {
UpdateStageError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateStageError {
fn from(err: HttpDispatchError) -> UpdateStageError {
UpdateStageError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateStageError {
fn from(err: io::Error) -> UpdateStageError {
UpdateStageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateStageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateStageError {
fn description(&self) -> &str {
match *self {
UpdateStageError::BadRequest(ref cause) => cause,
UpdateStageError::Conflict(ref cause) => cause,
UpdateStageError::NotFound(ref cause) => cause,
UpdateStageError::TooManyRequests(ref cause) => cause,
UpdateStageError::Unauthorized(ref cause) => cause,
UpdateStageError::Validation(ref cause) => cause,
UpdateStageError::Credentials(ref err) => err.description(),
UpdateStageError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateStageError::ParseError(ref cause) => cause,
UpdateStageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateUsageError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateUsageError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateUsageError {
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 UpdateUsageError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return UpdateUsageError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateUsageError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateUsageError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateUsageError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateUsageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateUsageError {
fn from(err: serde_json::error::Error) -> UpdateUsageError {
UpdateUsageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateUsageError {
fn from(err: CredentialsError) -> UpdateUsageError {
UpdateUsageError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateUsageError {
fn from(err: HttpDispatchError) -> UpdateUsageError {
UpdateUsageError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateUsageError {
fn from(err: io::Error) -> UpdateUsageError {
UpdateUsageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateUsageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateUsageError {
fn description(&self) -> &str {
match *self {
UpdateUsageError::BadRequest(ref cause) => cause,
UpdateUsageError::NotFound(ref cause) => cause,
UpdateUsageError::TooManyRequests(ref cause) => cause,
UpdateUsageError::Unauthorized(ref cause) => cause,
UpdateUsageError::Validation(ref cause) => cause,
UpdateUsageError::Credentials(ref err) => err.description(),
UpdateUsageError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateUsageError::ParseError(ref cause) => cause,
UpdateUsageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateUsagePlanError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateUsagePlanError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateUsagePlanError {
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 UpdateUsagePlanError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateUsagePlanError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateUsagePlanError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateUsagePlanError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateUsagePlanError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateUsagePlanError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateUsagePlanError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateUsagePlanError {
fn from(err: serde_json::error::Error) -> UpdateUsagePlanError {
UpdateUsagePlanError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateUsagePlanError {
fn from(err: CredentialsError) -> UpdateUsagePlanError {
UpdateUsagePlanError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateUsagePlanError {
fn from(err: HttpDispatchError) -> UpdateUsagePlanError {
UpdateUsagePlanError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateUsagePlanError {
fn from(err: io::Error) -> UpdateUsagePlanError {
UpdateUsagePlanError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateUsagePlanError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateUsagePlanError {
fn description(&self) -> &str {
match *self {
UpdateUsagePlanError::BadRequest(ref cause) => cause,
UpdateUsagePlanError::Conflict(ref cause) => cause,
UpdateUsagePlanError::NotFound(ref cause) => cause,
UpdateUsagePlanError::TooManyRequests(ref cause) => cause,
UpdateUsagePlanError::Unauthorized(ref cause) => cause,
UpdateUsagePlanError::Validation(ref cause) => cause,
UpdateUsagePlanError::Credentials(ref err) => err.description(),
UpdateUsagePlanError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateUsagePlanError::ParseError(ref cause) => cause,
UpdateUsagePlanError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateVpcLinkError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateVpcLinkError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateVpcLinkError {
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 UpdateVpcLinkError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateVpcLinkError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateVpcLinkError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateVpcLinkError::TooManyRequests(String::from(error_message));
}
"UnauthorizedException" => {
return UpdateVpcLinkError::Unauthorized(String::from(error_message));
}
"ValidationException" => {
return UpdateVpcLinkError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateVpcLinkError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateVpcLinkError {
fn from(err: serde_json::error::Error) -> UpdateVpcLinkError {
UpdateVpcLinkError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateVpcLinkError {
fn from(err: CredentialsError) -> UpdateVpcLinkError {
UpdateVpcLinkError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateVpcLinkError {
fn from(err: HttpDispatchError) -> UpdateVpcLinkError {
UpdateVpcLinkError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateVpcLinkError {
fn from(err: io::Error) -> UpdateVpcLinkError {
UpdateVpcLinkError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateVpcLinkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateVpcLinkError {
fn description(&self) -> &str {
match *self {
UpdateVpcLinkError::BadRequest(ref cause) => cause,
UpdateVpcLinkError::Conflict(ref cause) => cause,
UpdateVpcLinkError::NotFound(ref cause) => cause,
UpdateVpcLinkError::TooManyRequests(ref cause) => cause,
UpdateVpcLinkError::Unauthorized(ref cause) => cause,
UpdateVpcLinkError::Validation(ref cause) => cause,
UpdateVpcLinkError::Credentials(ref err) => err.description(),
UpdateVpcLinkError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateVpcLinkError::ParseError(ref cause) => cause,
UpdateVpcLinkError::Unknown(_) => "unknown error",
}
}
}
pub trait ApiGateway {
fn create_api_key(&self, input: CreateApiKeyRequest)
-> RusotoFuture<ApiKey, CreateApiKeyError>;
fn create_authorizer(
&self,
input: CreateAuthorizerRequest,
) -> RusotoFuture<Authorizer, CreateAuthorizerError>;
fn create_base_path_mapping(
&self,
input: CreateBasePathMappingRequest,
) -> RusotoFuture<BasePathMapping, CreateBasePathMappingError>;
fn create_deployment(
&self,
input: CreateDeploymentRequest,
) -> RusotoFuture<Deployment, CreateDeploymentError>;
fn create_documentation_part(
&self,
input: CreateDocumentationPartRequest,
) -> RusotoFuture<DocumentationPart, CreateDocumentationPartError>;
fn create_documentation_version(
&self,
input: CreateDocumentationVersionRequest,
) -> RusotoFuture<DocumentationVersion, CreateDocumentationVersionError>;
fn create_domain_name(
&self,
input: CreateDomainNameRequest,
) -> RusotoFuture<DomainName, CreateDomainNameError>;
fn create_model(&self, input: CreateModelRequest) -> RusotoFuture<Model, CreateModelError>;
fn create_request_validator(
&self,
input: CreateRequestValidatorRequest,
) -> RusotoFuture<RequestValidator, CreateRequestValidatorError>;
fn create_resource(
&self,
input: CreateResourceRequest,
) -> RusotoFuture<Resource, CreateResourceError>;
fn create_rest_api(
&self,
input: CreateRestApiRequest,
) -> RusotoFuture<RestApi, CreateRestApiError>;
fn create_stage(&self, input: CreateStageRequest) -> RusotoFuture<Stage, CreateStageError>;
fn create_usage_plan(
&self,
input: CreateUsagePlanRequest,
) -> RusotoFuture<UsagePlan, CreateUsagePlanError>;
fn create_usage_plan_key(
&self,
input: CreateUsagePlanKeyRequest,
) -> RusotoFuture<UsagePlanKey, CreateUsagePlanKeyError>;
fn create_vpc_link(
&self,
input: CreateVpcLinkRequest,
) -> RusotoFuture<VpcLink, CreateVpcLinkError>;
fn delete_api_key(&self, input: DeleteApiKeyRequest) -> RusotoFuture<(), DeleteApiKeyError>;
fn delete_authorizer(
&self,
input: DeleteAuthorizerRequest,
) -> RusotoFuture<(), DeleteAuthorizerError>;
fn delete_base_path_mapping(
&self,
input: DeleteBasePathMappingRequest,
) -> RusotoFuture<(), DeleteBasePathMappingError>;
fn delete_client_certificate(
&self,
input: DeleteClientCertificateRequest,
) -> RusotoFuture<(), DeleteClientCertificateError>;
fn delete_deployment(
&self,
input: DeleteDeploymentRequest,
) -> RusotoFuture<(), DeleteDeploymentError>;
fn delete_documentation_part(
&self,
input: DeleteDocumentationPartRequest,
) -> RusotoFuture<(), DeleteDocumentationPartError>;
fn delete_documentation_version(
&self,
input: DeleteDocumentationVersionRequest,
) -> RusotoFuture<(), DeleteDocumentationVersionError>;
fn delete_domain_name(
&self,
input: DeleteDomainNameRequest,
) -> RusotoFuture<(), DeleteDomainNameError>;
fn delete_gateway_response(
&self,
input: DeleteGatewayResponseRequest,
) -> RusotoFuture<(), DeleteGatewayResponseError>;
fn delete_integration(
&self,
input: DeleteIntegrationRequest,
) -> RusotoFuture<(), DeleteIntegrationError>;
fn delete_integration_response(
&self,
input: DeleteIntegrationResponseRequest,
) -> RusotoFuture<(), DeleteIntegrationResponseError>;
fn delete_method(&self, input: DeleteMethodRequest) -> RusotoFuture<(), DeleteMethodError>;
fn delete_method_response(
&self,
input: DeleteMethodResponseRequest,
) -> RusotoFuture<(), DeleteMethodResponseError>;
fn delete_model(&self, input: DeleteModelRequest) -> RusotoFuture<(), DeleteModelError>;
fn delete_request_validator(
&self,
input: DeleteRequestValidatorRequest,
) -> RusotoFuture<(), DeleteRequestValidatorError>;
fn delete_resource(
&self,
input: DeleteResourceRequest,
) -> RusotoFuture<(), DeleteResourceError>;
fn delete_rest_api(&self, input: DeleteRestApiRequest) -> RusotoFuture<(), DeleteRestApiError>;
fn delete_stage(&self, input: DeleteStageRequest) -> RusotoFuture<(), DeleteStageError>;
fn delete_usage_plan(
&self,
input: DeleteUsagePlanRequest,
) -> RusotoFuture<(), DeleteUsagePlanError>;
fn delete_usage_plan_key(
&self,
input: DeleteUsagePlanKeyRequest,
) -> RusotoFuture<(), DeleteUsagePlanKeyError>;
fn delete_vpc_link(&self, input: DeleteVpcLinkRequest) -> RusotoFuture<(), DeleteVpcLinkError>;
fn flush_stage_authorizers_cache(
&self,
input: FlushStageAuthorizersCacheRequest,
) -> RusotoFuture<(), FlushStageAuthorizersCacheError>;
fn flush_stage_cache(
&self,
input: FlushStageCacheRequest,
) -> RusotoFuture<(), FlushStageCacheError>;
fn generate_client_certificate(
&self,
input: GenerateClientCertificateRequest,
) -> RusotoFuture<ClientCertificate, GenerateClientCertificateError>;
fn get_account(&self) -> RusotoFuture<Account, GetAccountError>;
fn get_api_key(&self, input: GetApiKeyRequest) -> RusotoFuture<ApiKey, GetApiKeyError>;
fn get_api_keys(&self, input: GetApiKeysRequest) -> RusotoFuture<ApiKeys, GetApiKeysError>;
fn get_authorizer(
&self,
input: GetAuthorizerRequest,
) -> RusotoFuture<Authorizer, GetAuthorizerError>;
fn get_authorizers(
&self,
input: GetAuthorizersRequest,
) -> RusotoFuture<Authorizers, GetAuthorizersError>;
fn get_base_path_mapping(
&self,
input: GetBasePathMappingRequest,
) -> RusotoFuture<BasePathMapping, GetBasePathMappingError>;
fn get_base_path_mappings(
&self,
input: GetBasePathMappingsRequest,
) -> RusotoFuture<BasePathMappings, GetBasePathMappingsError>;
fn get_client_certificate(
&self,
input: GetClientCertificateRequest,
) -> RusotoFuture<ClientCertificate, GetClientCertificateError>;
fn get_client_certificates(
&self,
input: GetClientCertificatesRequest,
) -> RusotoFuture<ClientCertificates, GetClientCertificatesError>;
fn get_deployment(
&self,
input: GetDeploymentRequest,
) -> RusotoFuture<Deployment, GetDeploymentError>;
fn get_deployments(
&self,
input: GetDeploymentsRequest,
) -> RusotoFuture<Deployments, GetDeploymentsError>;
fn get_documentation_part(
&self,
input: GetDocumentationPartRequest,
) -> RusotoFuture<DocumentationPart, GetDocumentationPartError>;
fn get_documentation_parts(
&self,
input: GetDocumentationPartsRequest,
) -> RusotoFuture<DocumentationParts, GetDocumentationPartsError>;
fn get_documentation_version(
&self,
input: GetDocumentationVersionRequest,
) -> RusotoFuture<DocumentationVersion, GetDocumentationVersionError>;
fn get_documentation_versions(
&self,
input: GetDocumentationVersionsRequest,
) -> RusotoFuture<DocumentationVersions, GetDocumentationVersionsError>;
fn get_domain_name(
&self,
input: GetDomainNameRequest,
) -> RusotoFuture<DomainName, GetDomainNameError>;
fn get_domain_names(
&self,
input: GetDomainNamesRequest,
) -> RusotoFuture<DomainNames, GetDomainNamesError>;
fn get_export(&self, input: GetExportRequest) -> RusotoFuture<ExportResponse, GetExportError>;
fn get_gateway_response(
&self,
input: GetGatewayResponseRequest,
) -> RusotoFuture<GatewayResponse, GetGatewayResponseError>;
fn get_gateway_responses(
&self,
input: GetGatewayResponsesRequest,
) -> RusotoFuture<GatewayResponses, GetGatewayResponsesError>;
fn get_integration(
&self,
input: GetIntegrationRequest,
) -> RusotoFuture<Integration, GetIntegrationError>;
fn get_integration_response(
&self,
input: GetIntegrationResponseRequest,
) -> RusotoFuture<IntegrationResponse, GetIntegrationResponseError>;
fn get_method(&self, input: GetMethodRequest) -> RusotoFuture<Method, GetMethodError>;
fn get_method_response(
&self,
input: GetMethodResponseRequest,
) -> RusotoFuture<MethodResponse, GetMethodResponseError>;
fn get_model(&self, input: GetModelRequest) -> RusotoFuture<Model, GetModelError>;
fn get_model_template(
&self,
input: GetModelTemplateRequest,
) -> RusotoFuture<Template, GetModelTemplateError>;
fn get_models(&self, input: GetModelsRequest) -> RusotoFuture<Models, GetModelsError>;
fn get_request_validator(
&self,
input: GetRequestValidatorRequest,
) -> RusotoFuture<RequestValidator, GetRequestValidatorError>;
fn get_request_validators(
&self,
input: GetRequestValidatorsRequest,
) -> RusotoFuture<RequestValidators, GetRequestValidatorsError>;
fn get_resource(&self, input: GetResourceRequest) -> RusotoFuture<Resource, GetResourceError>;
fn get_resources(
&self,
input: GetResourcesRequest,
) -> RusotoFuture<Resources, GetResourcesError>;
fn get_rest_api(&self, input: GetRestApiRequest) -> RusotoFuture<RestApi, GetRestApiError>;
fn get_rest_apis(&self, input: GetRestApisRequest) -> RusotoFuture<RestApis, GetRestApisError>;
fn get_sdk(&self, input: GetSdkRequest) -> RusotoFuture<SdkResponse, GetSdkError>;
fn get_sdk_type(&self, input: GetSdkTypeRequest) -> RusotoFuture<SdkType, GetSdkTypeError>;
fn get_sdk_types(&self, input: GetSdkTypesRequest) -> RusotoFuture<SdkTypes, GetSdkTypesError>;
fn get_stage(&self, input: GetStageRequest) -> RusotoFuture<Stage, GetStageError>;
fn get_stages(&self, input: GetStagesRequest) -> RusotoFuture<Stages, GetStagesError>;
fn get_tags(&self, input: GetTagsRequest) -> RusotoFuture<Tags, GetTagsError>;
fn get_usage(&self, input: GetUsageRequest) -> RusotoFuture<Usage, GetUsageError>;
fn get_usage_plan(
&self,
input: GetUsagePlanRequest,
) -> RusotoFuture<UsagePlan, GetUsagePlanError>;
fn get_usage_plan_key(
&self,
input: GetUsagePlanKeyRequest,
) -> RusotoFuture<UsagePlanKey, GetUsagePlanKeyError>;
fn get_usage_plan_keys(
&self,
input: GetUsagePlanKeysRequest,
) -> RusotoFuture<UsagePlanKeys, GetUsagePlanKeysError>;
fn get_usage_plans(
&self,
input: GetUsagePlansRequest,
) -> RusotoFuture<UsagePlans, GetUsagePlansError>;
fn get_vpc_link(&self, input: GetVpcLinkRequest) -> RusotoFuture<VpcLink, GetVpcLinkError>;
fn get_vpc_links(&self, input: GetVpcLinksRequest) -> RusotoFuture<VpcLinks, GetVpcLinksError>;
fn import_api_keys(
&self,
input: ImportApiKeysRequest,
) -> RusotoFuture<ApiKeyIds, ImportApiKeysError>;
fn import_documentation_parts(
&self,
input: ImportDocumentationPartsRequest,
) -> RusotoFuture<DocumentationPartIds, ImportDocumentationPartsError>;
fn import_rest_api(
&self,
input: ImportRestApiRequest,
) -> RusotoFuture<RestApi, ImportRestApiError>;
fn put_gateway_response(
&self,
input: PutGatewayResponseRequest,
) -> RusotoFuture<GatewayResponse, PutGatewayResponseError>;
fn put_integration(
&self,
input: PutIntegrationRequest,
) -> RusotoFuture<Integration, PutIntegrationError>;
fn put_integration_response(
&self,
input: PutIntegrationResponseRequest,
) -> RusotoFuture<IntegrationResponse, PutIntegrationResponseError>;
fn put_method(&self, input: PutMethodRequest) -> RusotoFuture<Method, PutMethodError>;
fn put_method_response(
&self,
input: PutMethodResponseRequest,
) -> RusotoFuture<MethodResponse, PutMethodResponseError>;
fn put_rest_api(&self, input: PutRestApiRequest) -> RusotoFuture<RestApi, PutRestApiError>;
fn tag_resource(&self, input: TagResourceRequest) -> RusotoFuture<(), TagResourceError>;
fn test_invoke_authorizer(
&self,
input: TestInvokeAuthorizerRequest,
) -> RusotoFuture<TestInvokeAuthorizerResponse, TestInvokeAuthorizerError>;
fn test_invoke_method(
&self,
input: TestInvokeMethodRequest,
) -> RusotoFuture<TestInvokeMethodResponse, TestInvokeMethodError>;
fn untag_resource(&self, input: UntagResourceRequest) -> RusotoFuture<(), UntagResourceError>;
fn update_account(
&self,
input: UpdateAccountRequest,
) -> RusotoFuture<Account, UpdateAccountError>;
fn update_api_key(&self, input: UpdateApiKeyRequest)
-> RusotoFuture<ApiKey, UpdateApiKeyError>;
fn update_authorizer(
&self,
input: UpdateAuthorizerRequest,
) -> RusotoFuture<Authorizer, UpdateAuthorizerError>;
fn update_base_path_mapping(
&self,
input: UpdateBasePathMappingRequest,
) -> RusotoFuture<BasePathMapping, UpdateBasePathMappingError>;
fn update_client_certificate(
&self,
input: UpdateClientCertificateRequest,
) -> RusotoFuture<ClientCertificate, UpdateClientCertificateError>;
fn update_deployment(
&self,
input: UpdateDeploymentRequest,
) -> RusotoFuture<Deployment, UpdateDeploymentError>;
fn update_documentation_part(
&self,
input: UpdateDocumentationPartRequest,
) -> RusotoFuture<DocumentationPart, UpdateDocumentationPartError>;
fn update_documentation_version(
&self,
input: UpdateDocumentationVersionRequest,
) -> RusotoFuture<DocumentationVersion, UpdateDocumentationVersionError>;
fn update_domain_name(
&self,
input: UpdateDomainNameRequest,
) -> RusotoFuture<DomainName, UpdateDomainNameError>;
fn update_gateway_response(
&self,
input: UpdateGatewayResponseRequest,
) -> RusotoFuture<GatewayResponse, UpdateGatewayResponseError>;
fn update_integration(
&self,
input: UpdateIntegrationRequest,
) -> RusotoFuture<Integration, UpdateIntegrationError>;
fn update_integration_response(
&self,
input: UpdateIntegrationResponseRequest,
) -> RusotoFuture<IntegrationResponse, UpdateIntegrationResponseError>;
fn update_method(&self, input: UpdateMethodRequest) -> RusotoFuture<Method, UpdateMethodError>;
fn update_method_response(
&self,
input: UpdateMethodResponseRequest,
) -> RusotoFuture<MethodResponse, UpdateMethodResponseError>;
fn update_model(&self, input: UpdateModelRequest) -> RusotoFuture<Model, UpdateModelError>;
fn update_request_validator(
&self,
input: UpdateRequestValidatorRequest,
) -> RusotoFuture<RequestValidator, UpdateRequestValidatorError>;
fn update_resource(
&self,
input: UpdateResourceRequest,
) -> RusotoFuture<Resource, UpdateResourceError>;
fn update_rest_api(
&self,
input: UpdateRestApiRequest,
) -> RusotoFuture<RestApi, UpdateRestApiError>;
fn update_stage(&self, input: UpdateStageRequest) -> RusotoFuture<Stage, UpdateStageError>;
fn update_usage(&self, input: UpdateUsageRequest) -> RusotoFuture<Usage, UpdateUsageError>;
fn update_usage_plan(
&self,
input: UpdateUsagePlanRequest,
) -> RusotoFuture<UsagePlan, UpdateUsagePlanError>;
fn update_vpc_link(
&self,
input: UpdateVpcLinkRequest,
) -> RusotoFuture<VpcLink, UpdateVpcLinkError>;
}
#[derive(Clone)]
pub struct ApiGatewayClient {
client: Client,
region: region::Region,
}
impl ApiGatewayClient {
pub fn new(region: region::Region) -> ApiGatewayClient {
ApiGatewayClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> ApiGatewayClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
ApiGatewayClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl ApiGateway for ApiGatewayClient {
fn create_api_key(
&self,
input: CreateApiKeyRequest,
) -> RusotoFuture<ApiKey, CreateApiKeyError> {
let request_uri = "/apikeys";
let mut request = SignedRequest::new("POST", "apigateway", &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::<ApiKey>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateApiKeyError::from_response(response))),
)
}
})
}
fn create_authorizer(
&self,
input: CreateAuthorizerRequest,
) -> RusotoFuture<Authorizer, CreateAuthorizerError> {
let request_uri = format!(
"/restapis/{restapi_id}/authorizers",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<Authorizer>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateAuthorizerError::from_response(response))),
)
}
})
}
fn create_base_path_mapping(
&self,
input: CreateBasePathMappingRequest,
) -> RusotoFuture<BasePathMapping, CreateBasePathMappingError> {
let request_uri = format!(
"/domainnames/{domain_name}/basepathmappings",
domain_name = input.domain_name
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<BasePathMapping>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateBasePathMappingError::from_response(response))
}),
)
}
})
}
fn create_deployment(
&self,
input: CreateDeploymentRequest,
) -> RusotoFuture<Deployment, CreateDeploymentError> {
let request_uri = format!(
"/restapis/{restapi_id}/deployments",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<Deployment>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDeploymentError::from_response(response))),
)
}
})
}
fn create_documentation_part(
&self,
input: CreateDocumentationPartRequest,
) -> RusotoFuture<DocumentationPart, CreateDocumentationPartError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/parts",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<DocumentationPart>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateDocumentationPartError::from_response(response))
}))
}
})
}
fn create_documentation_version(
&self,
input: CreateDocumentationVersionRequest,
) -> RusotoFuture<DocumentationVersion, CreateDocumentationVersionError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/versions",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<DocumentationVersion>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateDocumentationVersionError::from_response(response))
}))
}
})
}
fn create_domain_name(
&self,
input: CreateDomainNameRequest,
) -> RusotoFuture<DomainName, CreateDomainNameError> {
let request_uri = "/domainnames";
let mut request = SignedRequest::new("POST", "apigateway", &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::<DomainName>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDomainNameError::from_response(response))),
)
}
})
}
fn create_model(&self, input: CreateModelRequest) -> RusotoFuture<Model, CreateModelError> {
let request_uri = format!(
"/restapis/{restapi_id}/models",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<Model>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateModelError::from_response(response))),
)
}
})
}
fn create_request_validator(
&self,
input: CreateRequestValidatorRequest,
) -> RusotoFuture<RequestValidator, CreateRequestValidatorError> {
let request_uri = format!(
"/restapis/{restapi_id}/requestvalidators",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<RequestValidator>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateRequestValidatorError::from_response(response))
}),
)
}
})
}
fn create_resource(
&self,
input: CreateResourceRequest,
) -> RusotoFuture<Resource, CreateResourceError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{parent_id}",
parent_id = input.parent_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<Resource>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateResourceError::from_response(response))),
)
}
})
}
fn create_rest_api(
&self,
input: CreateRestApiRequest,
) -> RusotoFuture<RestApi, CreateRestApiError> {
let request_uri = "/restapis";
let mut request = SignedRequest::new("POST", "apigateway", &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::<RestApi>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateRestApiError::from_response(response))),
)
}
})
}
fn create_stage(&self, input: CreateStageRequest) -> RusotoFuture<Stage, CreateStageError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<Stage>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateStageError::from_response(response))),
)
}
})
}
fn create_usage_plan(
&self,
input: CreateUsagePlanRequest,
) -> RusotoFuture<UsagePlan, CreateUsagePlanError> {
let request_uri = "/usageplans";
let mut request = SignedRequest::new("POST", "apigateway", &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::<UsagePlan>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateUsagePlanError::from_response(response))),
)
}
})
}
fn create_usage_plan_key(
&self,
input: CreateUsagePlanKeyRequest,
) -> RusotoFuture<UsagePlanKey, CreateUsagePlanKeyError> {
let request_uri = format!(
"/usageplans/{usageplan_id}/keys",
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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::<UsagePlanKey>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateUsagePlanKeyError::from_response(response))),
)
}
})
}
fn create_vpc_link(
&self,
input: CreateVpcLinkRequest,
) -> RusotoFuture<VpcLink, CreateVpcLinkError> {
let request_uri = "/vpclinks";
let mut request = SignedRequest::new("POST", "apigateway", &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() == 202 {
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::<VpcLink>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateVpcLinkError::from_response(response))),
)
}
})
}
fn delete_api_key(&self, input: DeleteApiKeyRequest) -> RusotoFuture<(), DeleteApiKeyError> {
let request_uri = format!("/apikeys/{api_key}", api_key = input.api_key);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteApiKeyError::from_response(response))),
)
}
})
}
fn delete_authorizer(
&self,
input: DeleteAuthorizerRequest,
) -> RusotoFuture<(), DeleteAuthorizerError> {
let request_uri = format!(
"/restapis/{restapi_id}/authorizers/{authorizer_id}",
authorizer_id = input.authorizer_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteAuthorizerError::from_response(response))),
)
}
})
}
fn delete_base_path_mapping(
&self,
input: DeleteBasePathMappingRequest,
) -> RusotoFuture<(), DeleteBasePathMappingError> {
let request_uri = format!(
"/domainnames/{domain_name}/basepathmappings/{base_path}",
base_path = input.base_path,
domain_name = input.domain_name
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteBasePathMappingError::from_response(response))
}),
)
}
})
}
fn delete_client_certificate(
&self,
input: DeleteClientCertificateRequest,
) -> RusotoFuture<(), DeleteClientCertificateError> {
let request_uri = format!(
"/clientcertificates/{clientcertificate_id}",
clientcertificate_id = input.client_certificate_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteClientCertificateError::from_response(response))
}))
}
})
}
fn delete_deployment(
&self,
input: DeleteDeploymentRequest,
) -> RusotoFuture<(), DeleteDeploymentError> {
let request_uri = format!(
"/restapis/{restapi_id}/deployments/{deployment_id}",
deployment_id = input.deployment_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteDeploymentError::from_response(response))),
)
}
})
}
fn delete_documentation_part(
&self,
input: DeleteDocumentationPartRequest,
) -> RusotoFuture<(), DeleteDocumentationPartError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/parts/{part_id}",
part_id = input.documentation_part_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteDocumentationPartError::from_response(response))
}))
}
})
}
fn delete_documentation_version(
&self,
input: DeleteDocumentationVersionRequest,
) -> RusotoFuture<(), DeleteDocumentationVersionError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/versions/{doc_version}",
doc_version = input.documentation_version,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteDocumentationVersionError::from_response(response))
}))
}
})
}
fn delete_domain_name(
&self,
input: DeleteDomainNameRequest,
) -> RusotoFuture<(), DeleteDomainNameError> {
let request_uri = format!(
"/domainnames/{domain_name}",
domain_name = input.domain_name
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteDomainNameError::from_response(response))),
)
}
})
}
fn delete_gateway_response(
&self,
input: DeleteGatewayResponseRequest,
) -> RusotoFuture<(), DeleteGatewayResponseError> {
let request_uri = format!(
"/restapis/{restapi_id}/gatewayresponses/{response_type}",
response_type = input.response_type,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteGatewayResponseError::from_response(response))
}),
)
}
})
}
fn delete_integration(
&self,
input: DeleteIntegrationRequest,
) -> RusotoFuture<(), DeleteIntegrationError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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(DeleteIntegrationError::from_response(response))),
)
}
})
}
fn delete_integration_response(
&self,
input: DeleteIntegrationResponseRequest,
) -> RusotoFuture<(), DeleteIntegrationResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("DELETE", "apigateway", &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(DeleteIntegrationResponseError::from_response(response))
}))
}
})
}
fn delete_method(&self, input: DeleteMethodRequest) -> RusotoFuture<(), DeleteMethodError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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(DeleteMethodError::from_response(response))),
)
}
})
}
fn delete_method_response(
&self,
input: DeleteMethodResponseRequest,
) -> RusotoFuture<(), DeleteMethodResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("DELETE", "apigateway", &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(DeleteMethodResponseError::from_response(response))
}),
)
}
})
}
fn delete_model(&self, input: DeleteModelRequest) -> RusotoFuture<(), DeleteModelError> {
let request_uri = format!(
"/restapis/{restapi_id}/models/{model_name}",
model_name = input.model_name,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteModelError::from_response(response))),
)
}
})
}
fn delete_request_validator(
&self,
input: DeleteRequestValidatorRequest,
) -> RusotoFuture<(), DeleteRequestValidatorError> {
let request_uri = format!(
"/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}",
requestvalidator_id = input.request_validator_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteRequestValidatorError::from_response(response))
}),
)
}
})
}
fn delete_resource(
&self,
input: DeleteResourceRequest,
) -> RusotoFuture<(), DeleteResourceError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}",
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteResourceError::from_response(response))),
)
}
})
}
fn delete_rest_api(&self, input: DeleteRestApiRequest) -> RusotoFuture<(), DeleteRestApiError> {
let request_uri = format!("/restapis/{restapi_id}", restapi_id = input.rest_api_id);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteRestApiError::from_response(response))),
)
}
})
}
fn delete_stage(&self, input: DeleteStageRequest) -> RusotoFuture<(), DeleteStageError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages/{stage_name}",
restapi_id = input.rest_api_id,
stage_name = input.stage_name
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteStageError::from_response(response))),
)
}
})
}
fn delete_usage_plan(
&self,
input: DeleteUsagePlanRequest,
) -> RusotoFuture<(), DeleteUsagePlanError> {
let request_uri = format!(
"/usageplans/{usageplan_id}",
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteUsagePlanError::from_response(response))),
)
}
})
}
fn delete_usage_plan_key(
&self,
input: DeleteUsagePlanKeyRequest,
) -> RusotoFuture<(), DeleteUsagePlanKeyError> {
let request_uri = format!(
"/usageplans/{usageplan_id}/keys/{key_id}",
key_id = input.key_id,
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteUsagePlanKeyError::from_response(response))),
)
}
})
}
fn delete_vpc_link(&self, input: DeleteVpcLinkRequest) -> RusotoFuture<(), DeleteVpcLinkError> {
let request_uri = format!("/vpclinks/{vpclink_id}", vpclink_id = input.vpc_link_id);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(DeleteVpcLinkError::from_response(response))),
)
}
})
}
fn flush_stage_authorizers_cache(
&self,
input: FlushStageAuthorizersCacheRequest,
) -> RusotoFuture<(), FlushStageAuthorizersCacheError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages/{stage_name}/cache/authorizers",
restapi_id = input.rest_api_id,
stage_name = input.stage_name
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(FlushStageAuthorizersCacheError::from_response(response))
}))
}
})
}
fn flush_stage_cache(
&self,
input: FlushStageCacheRequest,
) -> RusotoFuture<(), FlushStageCacheError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages/{stage_name}/cache/data",
restapi_id = input.rest_api_id,
stage_name = input.stage_name
);
let mut request = SignedRequest::new("DELETE", "apigateway", &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() == 202 {
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(FlushStageCacheError::from_response(response))),
)
}
})
}
fn generate_client_certificate(
&self,
input: GenerateClientCertificateRequest,
) -> RusotoFuture<ClientCertificate, GenerateClientCertificateError> {
let request_uri = "/clientcertificates";
let mut request = SignedRequest::new("POST", "apigateway", &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::<ClientCertificate>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GenerateClientCertificateError::from_response(response))
}))
}
})
}
fn get_account(&self) -> RusotoFuture<Account, GetAccountError> {
let request_uri = "/account";
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<Account>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetAccountError::from_response(response))),
)
}
})
}
fn get_api_key(&self, input: GetApiKeyRequest) -> RusotoFuture<ApiKey, GetApiKeyError> {
let request_uri = format!("/apikeys/{api_key}", api_key = input.api_key);
let mut request = SignedRequest::new("GET", "apigateway", &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.include_value {
params.put("includeValue", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<ApiKey>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetApiKeyError::from_response(response))),
)
}
})
}
fn get_api_keys(&self, input: GetApiKeysRequest) -> RusotoFuture<ApiKeys, GetApiKeysError> {
let request_uri = "/apikeys";
let mut request = SignedRequest::new("GET", "apigateway", &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.customer_id {
params.put("customerId", x);
}
if let Some(ref x) = input.include_values {
params.put("includeValues", x);
}
if let Some(ref x) = input.limit {
params.put("limit", x);
}
if let Some(ref x) = input.name_query {
params.put("name", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<ApiKeys>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetApiKeysError::from_response(response))),
)
}
})
}
fn get_authorizer(
&self,
input: GetAuthorizerRequest,
) -> RusotoFuture<Authorizer, GetAuthorizerError> {
let request_uri = format!(
"/restapis/{restapi_id}/authorizers/{authorizer_id}",
authorizer_id = input.authorizer_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<Authorizer>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetAuthorizerError::from_response(response))),
)
}
})
}
fn get_authorizers(
&self,
input: GetAuthorizersRequest,
) -> RusotoFuture<Authorizers, GetAuthorizersError> {
let request_uri = format!(
"/restapis/{restapi_id}/authorizers",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Authorizers>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetAuthorizersError::from_response(response))),
)
}
})
}
fn get_base_path_mapping(
&self,
input: GetBasePathMappingRequest,
) -> RusotoFuture<BasePathMapping, GetBasePathMappingError> {
let request_uri = format!(
"/domainnames/{domain_name}/basepathmappings/{base_path}",
base_path = input.base_path,
domain_name = input.domain_name
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<BasePathMapping>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBasePathMappingError::from_response(response))),
)
}
})
}
fn get_base_path_mappings(
&self,
input: GetBasePathMappingsRequest,
) -> RusotoFuture<BasePathMappings, GetBasePathMappingsError> {
let request_uri = format!(
"/domainnames/{domain_name}/basepathmappings",
domain_name = input.domain_name
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<BasePathMappings>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetBasePathMappingsError::from_response(response))
}),
)
}
})
}
fn get_client_certificate(
&self,
input: GetClientCertificateRequest,
) -> RusotoFuture<ClientCertificate, GetClientCertificateError> {
let request_uri = format!(
"/clientcertificates/{clientcertificate_id}",
clientcertificate_id = input.client_certificate_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<ClientCertificate>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetClientCertificateError::from_response(response))
}),
)
}
})
}
fn get_client_certificates(
&self,
input: GetClientCertificatesRequest,
) -> RusotoFuture<ClientCertificates, GetClientCertificatesError> {
let request_uri = "/clientcertificates";
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<ClientCertificates>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetClientCertificatesError::from_response(response))
}),
)
}
})
}
fn get_deployment(
&self,
input: GetDeploymentRequest,
) -> RusotoFuture<Deployment, GetDeploymentError> {
let request_uri = format!(
"/restapis/{restapi_id}/deployments/{deployment_id}",
deployment_id = input.deployment_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.embed {
for item in x.iter() {
params.put("embed", item);
}
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Deployment>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDeploymentError::from_response(response))),
)
}
})
}
fn get_deployments(
&self,
input: GetDeploymentsRequest,
) -> RusotoFuture<Deployments, GetDeploymentsError> {
let request_uri = format!(
"/restapis/{restapi_id}/deployments",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Deployments>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDeploymentsError::from_response(response))),
)
}
})
}
fn get_documentation_part(
&self,
input: GetDocumentationPartRequest,
) -> RusotoFuture<DocumentationPart, GetDocumentationPartError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/parts/{part_id}",
part_id = input.documentation_part_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<DocumentationPart>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetDocumentationPartError::from_response(response))
}),
)
}
})
}
fn get_documentation_parts(
&self,
input: GetDocumentationPartsRequest,
) -> RusotoFuture<DocumentationParts, GetDocumentationPartsError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/parts",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.location_status {
params.put("locationStatus", x);
}
if let Some(ref x) = input.name_query {
params.put("name", x);
}
if let Some(ref x) = input.path {
params.put("path", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
if let Some(ref x) = input.type_ {
params.put("type", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<DocumentationParts>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetDocumentationPartsError::from_response(response))
}),
)
}
})
}
fn get_documentation_version(
&self,
input: GetDocumentationVersionRequest,
) -> RusotoFuture<DocumentationVersion, GetDocumentationVersionError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/versions/{doc_version}",
doc_version = input.documentation_version,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<DocumentationVersion>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetDocumentationVersionError::from_response(response))
}))
}
})
}
fn get_documentation_versions(
&self,
input: GetDocumentationVersionsRequest,
) -> RusotoFuture<DocumentationVersions, GetDocumentationVersionsError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/versions",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<DocumentationVersions>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetDocumentationVersionsError::from_response(response))
}))
}
})
}
fn get_domain_name(
&self,
input: GetDomainNameRequest,
) -> RusotoFuture<DomainName, GetDomainNameError> {
let request_uri = format!(
"/domainnames/{domain_name}",
domain_name = input.domain_name
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<DomainName>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDomainNameError::from_response(response))),
)
}
})
}
fn get_domain_names(
&self,
input: GetDomainNamesRequest,
) -> RusotoFuture<DomainNames, GetDomainNamesError> {
let request_uri = "/domainnames";
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<DomainNames>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDomainNamesError::from_response(response))),
)
}
})
}
fn get_export(&self, input: GetExportRequest) -> RusotoFuture<ExportResponse, GetExportError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages/{stage_name}/exports/{export_type}",
export_type = input.export_type,
restapi_id = input.rest_api_id,
stage_name = input.stage_name
);
let mut request = SignedRequest::new("GET", "apigateway", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
if let Some(ref accepts) = input.accepts {
request.add_header("Accept", &accepts.to_string());
}
let mut params = Params::new();
if let Some(ref x) = input.parameters {
for (key, val) in x.iter() {
params.put(key, val);
}
}
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 result = ExportResponse::default();
result.body = Some(response.body);
if let Some(content_disposition) = response.headers.get("Content-Disposition") {
let value = content_disposition.to_owned();
result.content_disposition = Some(value)
};
if let Some(content_type) = response.headers.get("Content-Type") {
let value = content_type.to_owned();
result.content_type = Some(value)
};
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetExportError::from_response(response))),
)
}
})
}
fn get_gateway_response(
&self,
input: GetGatewayResponseRequest,
) -> RusotoFuture<GatewayResponse, GetGatewayResponseError> {
let request_uri = format!(
"/restapis/{restapi_id}/gatewayresponses/{response_type}",
response_type = input.response_type,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<GatewayResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetGatewayResponseError::from_response(response))),
)
}
})
}
fn get_gateway_responses(
&self,
input: GetGatewayResponsesRequest,
) -> RusotoFuture<GatewayResponses, GetGatewayResponsesError> {
let request_uri = format!(
"/restapis/{restapi_id}/gatewayresponses",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<GatewayResponses>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetGatewayResponsesError::from_response(response))
}),
)
}
})
}
fn get_integration(
&self,
input: GetIntegrationRequest,
) -> RusotoFuture<Integration, GetIntegrationError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<Integration>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetIntegrationError::from_response(response))),
)
}
})
}
fn get_integration_response(
&self,
input: GetIntegrationResponseRequest,
) -> RusotoFuture<IntegrationResponse, GetIntegrationResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<IntegrationResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetIntegrationResponseError::from_response(response))
}),
)
}
})
}
fn get_method(&self, input: GetMethodRequest) -> RusotoFuture<Method, GetMethodError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<Method>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetMethodError::from_response(response))),
)
}
})
}
fn get_method_response(
&self,
input: GetMethodResponseRequest,
) -> RusotoFuture<MethodResponse, GetMethodResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<MethodResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetMethodResponseError::from_response(response))),
)
}
})
}
fn get_model(&self, input: GetModelRequest) -> RusotoFuture<Model, GetModelError> {
let request_uri = format!(
"/restapis/{restapi_id}/models/{model_name}",
model_name = input.model_name,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.flatten {
params.put("flatten", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Model>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetModelError::from_response(response))),
)
}
})
}
fn get_model_template(
&self,
input: GetModelTemplateRequest,
) -> RusotoFuture<Template, GetModelTemplateError> {
let request_uri = format!(
"/restapis/{restapi_id}/models/{model_name}/default_template",
model_name = input.model_name,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<Template>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetModelTemplateError::from_response(response))),
)
}
})
}
fn get_models(&self, input: GetModelsRequest) -> RusotoFuture<Models, GetModelsError> {
let request_uri = format!(
"/restapis/{restapi_id}/models",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Models>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetModelsError::from_response(response))),
)
}
})
}
fn get_request_validator(
&self,
input: GetRequestValidatorRequest,
) -> RusotoFuture<RequestValidator, GetRequestValidatorError> {
let request_uri = format!(
"/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}",
requestvalidator_id = input.request_validator_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<RequestValidator>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetRequestValidatorError::from_response(response))
}),
)
}
})
}
fn get_request_validators(
&self,
input: GetRequestValidatorsRequest,
) -> RusotoFuture<RequestValidators, GetRequestValidatorsError> {
let request_uri = format!(
"/restapis/{restapi_id}/requestvalidators",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<RequestValidators>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetRequestValidatorsError::from_response(response))
}),
)
}
})
}
fn get_resource(&self, input: GetResourceRequest) -> RusotoFuture<Resource, GetResourceError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}",
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.embed {
for item in x.iter() {
params.put("embed", item);
}
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Resource>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetResourceError::from_response(response))),
)
}
})
}
fn get_resources(
&self,
input: GetResourcesRequest,
) -> RusotoFuture<Resources, GetResourcesError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.embed {
for item in x.iter() {
params.put("embed", item);
}
}
if let Some(ref x) = input.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Resources>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetResourcesError::from_response(response))),
)
}
})
}
fn get_rest_api(&self, input: GetRestApiRequest) -> RusotoFuture<RestApi, GetRestApiError> {
let request_uri = format!("/restapis/{restapi_id}", restapi_id = input.rest_api_id);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<RestApi>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRestApiError::from_response(response))),
)
}
})
}
fn get_rest_apis(&self, input: GetRestApisRequest) -> RusotoFuture<RestApis, GetRestApisError> {
let request_uri = "/restapis";
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<RestApis>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRestApisError::from_response(response))),
)
}
})
}
fn get_sdk(&self, input: GetSdkRequest) -> RusotoFuture<SdkResponse, GetSdkError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages/{stage_name}/sdks/{sdk_type}",
restapi_id = input.rest_api_id,
sdk_type = input.sdk_type,
stage_name = input.stage_name
);
let mut request = SignedRequest::new("GET", "apigateway", &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.parameters {
for (key, val) in x.iter() {
params.put(key, val);
}
}
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 result = SdkResponse::default();
result.body = Some(response.body);
if let Some(content_disposition) = response.headers.get("Content-Disposition") {
let value = content_disposition.to_owned();
result.content_disposition = Some(value)
};
if let Some(content_type) = response.headers.get("Content-Type") {
let value = content_type.to_owned();
result.content_type = Some(value)
};
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSdkError::from_response(response))),
)
}
})
}
fn get_sdk_type(&self, input: GetSdkTypeRequest) -> RusotoFuture<SdkType, GetSdkTypeError> {
let request_uri = format!("/sdktypes/{sdktype_id}", sdktype_id = input.id);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<SdkType>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSdkTypeError::from_response(response))),
)
}
})
}
fn get_sdk_types(&self, input: GetSdkTypesRequest) -> RusotoFuture<SdkTypes, GetSdkTypesError> {
let request_uri = "/sdktypes";
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<SdkTypes>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSdkTypesError::from_response(response))),
)
}
})
}
fn get_stage(&self, input: GetStageRequest) -> RusotoFuture<Stage, GetStageError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages/{stage_name}",
restapi_id = input.rest_api_id,
stage_name = input.stage_name
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<Stage>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetStageError::from_response(response))),
)
}
})
}
fn get_stages(&self, input: GetStagesRequest) -> RusotoFuture<Stages, GetStagesError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.deployment_id {
params.put("deploymentId", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Stages>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetStagesError::from_response(response))),
)
}
})
}
fn get_tags(&self, input: GetTagsRequest) -> RusotoFuture<Tags, GetTagsError> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Tags>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetTagsError::from_response(response))),
)
}
})
}
fn get_usage(&self, input: GetUsageRequest) -> RusotoFuture<Usage, GetUsageError> {
let request_uri = format!(
"/usageplans/{usageplan_id}/usage",
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("GET", "apigateway", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
params.put("endDate", &input.end_date);
if let Some(ref x) = input.key_id {
params.put("keyId", x);
}
if let Some(ref x) = input.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
params.put("startDate", &input.start_date);
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<Usage>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUsageError::from_response(response))),
)
}
})
}
fn get_usage_plan(
&self,
input: GetUsagePlanRequest,
) -> RusotoFuture<UsagePlan, GetUsagePlanError> {
let request_uri = format!(
"/usageplans/{usageplan_id}",
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<UsagePlan>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUsagePlanError::from_response(response))),
)
}
})
}
fn get_usage_plan_key(
&self,
input: GetUsagePlanKeyRequest,
) -> RusotoFuture<UsagePlanKey, GetUsagePlanKeyError> {
let request_uri = format!(
"/usageplans/{usageplan_id}/keys/{key_id}",
key_id = input.key_id,
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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::<UsagePlanKey>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUsagePlanKeyError::from_response(response))),
)
}
})
}
fn get_usage_plan_keys(
&self,
input: GetUsagePlanKeysRequest,
) -> RusotoFuture<UsagePlanKeys, GetUsagePlanKeysError> {
let request_uri = format!(
"/usageplans/{usageplan_id}/keys",
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.name_query {
params.put("name", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<UsagePlanKeys>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUsagePlanKeysError::from_response(response))),
)
}
})
}
fn get_usage_plans(
&self,
input: GetUsagePlansRequest,
) -> RusotoFuture<UsagePlans, GetUsagePlansError> {
let request_uri = "/usageplans";
let mut request = SignedRequest::new("GET", "apigateway", &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.key_id {
params.put("keyId", x);
}
if let Some(ref x) = input.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<UsagePlans>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUsagePlansError::from_response(response))),
)
}
})
}
fn get_vpc_link(&self, input: GetVpcLinkRequest) -> RusotoFuture<VpcLink, GetVpcLinkError> {
let request_uri = format!("/vpclinks/{vpclink_id}", vpclink_id = input.vpc_link_id);
let mut request = SignedRequest::new("GET", "apigateway", &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.is_success() {
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::<VpcLink>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetVpcLinkError::from_response(response))),
)
}
})
}
fn get_vpc_links(&self, input: GetVpcLinksRequest) -> RusotoFuture<VpcLinks, GetVpcLinksError> {
let request_uri = "/vpclinks";
let mut request = SignedRequest::new("GET", "apigateway", &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.limit {
params.put("limit", x);
}
if let Some(ref x) = input.position {
params.put("position", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<VpcLinks>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetVpcLinksError::from_response(response))),
)
}
})
}
fn import_api_keys(
&self,
input: ImportApiKeysRequest,
) -> RusotoFuture<ApiKeyIds, ImportApiKeysError> {
let request_uri = "/apikeys";
let mut request = SignedRequest::new("POST", "apigateway", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(input.body.to_owned());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.fail_on_warnings {
params.put("failonwarnings", x);
}
params.put("format", &input.format);
params.put("mode", "import");
request.set_params(params);
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::<ApiKeyIds>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ImportApiKeysError::from_response(response))),
)
}
})
}
fn import_documentation_parts(
&self,
input: ImportDocumentationPartsRequest,
) -> RusotoFuture<DocumentationPartIds, ImportDocumentationPartsError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/parts",
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PUT", "apigateway", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(input.body.to_owned());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.fail_on_warnings {
params.put("failonwarnings", x);
}
if let Some(ref x) = input.mode {
params.put("mode", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<DocumentationPartIds>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ImportDocumentationPartsError::from_response(response))
}))
}
})
}
fn import_rest_api(
&self,
input: ImportRestApiRequest,
) -> RusotoFuture<RestApi, ImportRestApiError> {
let request_uri = "/restapis";
let mut request = SignedRequest::new("POST", "apigateway", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(input.body.to_owned());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.fail_on_warnings {
params.put("failonwarnings", x);
}
if let Some(ref x) = input.parameters {
for (key, val) in x.iter() {
params.put(key, val);
}
}
params.put("mode", "import");
request.set_params(params);
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::<RestApi>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ImportRestApiError::from_response(response))),
)
}
})
}
fn put_gateway_response(
&self,
input: PutGatewayResponseRequest,
) -> RusotoFuture<GatewayResponse, PutGatewayResponseError> {
let request_uri = format!(
"/restapis/{restapi_id}/gatewayresponses/{response_type}",
response_type = input.response_type,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PUT", "apigateway", &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::<GatewayResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutGatewayResponseError::from_response(response))),
)
}
})
}
fn put_integration(
&self,
input: PutIntegrationRequest,
) -> RusotoFuture<Integration, PutIntegrationError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PUT", "apigateway", &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::<Integration>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutIntegrationError::from_response(response))),
)
}
})
}
fn put_integration_response(
&self,
input: PutIntegrationResponseRequest,
) -> RusotoFuture<IntegrationResponse, PutIntegrationResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("PUT", "apigateway", &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::<IntegrationResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(PutIntegrationResponseError::from_response(response))
}),
)
}
})
}
fn put_method(&self, input: PutMethodRequest) -> RusotoFuture<Method, PutMethodError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PUT", "apigateway", &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::<Method>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutMethodError::from_response(response))),
)
}
})
}
fn put_method_response(
&self,
input: PutMethodResponseRequest,
) -> RusotoFuture<MethodResponse, PutMethodResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("PUT", "apigateway", &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::<MethodResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutMethodResponseError::from_response(response))),
)
}
})
}
fn put_rest_api(&self, input: PutRestApiRequest) -> RusotoFuture<RestApi, PutRestApiError> {
let request_uri = format!("/restapis/{restapi_id}", restapi_id = input.rest_api_id);
let mut request = SignedRequest::new("PUT", "apigateway", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(input.body.to_owned());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.fail_on_warnings {
params.put("failonwarnings", x);
}
if let Some(ref x) = input.mode {
params.put("mode", x);
}
if let Some(ref x) = input.parameters {
for (key, val) in x.iter() {
params.put(key, val);
}
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
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::<RestApi>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutRestApiError::from_response(response))),
)
}
})
}
fn tag_resource(&self, input: TagResourceRequest) -> RusotoFuture<(), TagResourceError> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("PUT", "apigateway", &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() == 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(TagResourceError::from_response(response))),
)
}
})
}
fn test_invoke_authorizer(
&self,
input: TestInvokeAuthorizerRequest,
) -> RusotoFuture<TestInvokeAuthorizerResponse, TestInvokeAuthorizerError> {
let request_uri = format!(
"/restapis/{restapi_id}/authorizers/{authorizer_id}",
authorizer_id = input.authorizer_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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.is_success() {
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::<TestInvokeAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(TestInvokeAuthorizerError::from_response(response))
}),
)
}
})
}
fn test_invoke_method(
&self,
input: TestInvokeMethodRequest,
) -> RusotoFuture<TestInvokeMethodResponse, TestInvokeMethodError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("POST", "apigateway", &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.is_success() {
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::<TestInvokeMethodResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TestInvokeMethodError::from_response(response))),
)
}
})
}
fn untag_resource(&self, input: UntagResourceRequest) -> RusotoFuture<(), UntagResourceError> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("DELETE", "apigateway", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
for item in input.tag_keys.iter() {
params.put("tagKeys", item);
}
request.set_params(params);
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(UntagResourceError::from_response(response))),
)
}
})
}
fn update_account(
&self,
input: UpdateAccountRequest,
) -> RusotoFuture<Account, UpdateAccountError> {
let request_uri = "/account";
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Account>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateAccountError::from_response(response))),
)
}
})
}
fn update_api_key(
&self,
input: UpdateApiKeyRequest,
) -> RusotoFuture<ApiKey, UpdateApiKeyError> {
let request_uri = format!("/apikeys/{api_key}", api_key = input.api_key);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<ApiKey>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateApiKeyError::from_response(response))),
)
}
})
}
fn update_authorizer(
&self,
input: UpdateAuthorizerRequest,
) -> RusotoFuture<Authorizer, UpdateAuthorizerError> {
let request_uri = format!(
"/restapis/{restapi_id}/authorizers/{authorizer_id}",
authorizer_id = input.authorizer_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Authorizer>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateAuthorizerError::from_response(response))),
)
}
})
}
fn update_base_path_mapping(
&self,
input: UpdateBasePathMappingRequest,
) -> RusotoFuture<BasePathMapping, UpdateBasePathMappingError> {
let request_uri = format!(
"/domainnames/{domain_name}/basepathmappings/{base_path}",
base_path = input.base_path,
domain_name = input.domain_name
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<BasePathMapping>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateBasePathMappingError::from_response(response))
}),
)
}
})
}
fn update_client_certificate(
&self,
input: UpdateClientCertificateRequest,
) -> RusotoFuture<ClientCertificate, UpdateClientCertificateError> {
let request_uri = format!(
"/clientcertificates/{clientcertificate_id}",
clientcertificate_id = input.client_certificate_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<ClientCertificate>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateClientCertificateError::from_response(response))
}))
}
})
}
fn update_deployment(
&self,
input: UpdateDeploymentRequest,
) -> RusotoFuture<Deployment, UpdateDeploymentError> {
let request_uri = format!(
"/restapis/{restapi_id}/deployments/{deployment_id}",
deployment_id = input.deployment_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Deployment>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDeploymentError::from_response(response))),
)
}
})
}
fn update_documentation_part(
&self,
input: UpdateDocumentationPartRequest,
) -> RusotoFuture<DocumentationPart, UpdateDocumentationPartError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/parts/{part_id}",
part_id = input.documentation_part_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<DocumentationPart>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateDocumentationPartError::from_response(response))
}))
}
})
}
fn update_documentation_version(
&self,
input: UpdateDocumentationVersionRequest,
) -> RusotoFuture<DocumentationVersion, UpdateDocumentationVersionError> {
let request_uri = format!(
"/restapis/{restapi_id}/documentation/versions/{doc_version}",
doc_version = input.documentation_version,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<DocumentationVersion>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateDocumentationVersionError::from_response(response))
}))
}
})
}
fn update_domain_name(
&self,
input: UpdateDomainNameRequest,
) -> RusotoFuture<DomainName, UpdateDomainNameError> {
let request_uri = format!(
"/domainnames/{domain_name}",
domain_name = input.domain_name
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<DomainName>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDomainNameError::from_response(response))),
)
}
})
}
fn update_gateway_response(
&self,
input: UpdateGatewayResponseRequest,
) -> RusotoFuture<GatewayResponse, UpdateGatewayResponseError> {
let request_uri = format!(
"/restapis/{restapi_id}/gatewayresponses/{response_type}",
response_type = input.response_type,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<GatewayResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateGatewayResponseError::from_response(response))
}),
)
}
})
}
fn update_integration(
&self,
input: UpdateIntegrationRequest,
) -> RusotoFuture<Integration, UpdateIntegrationError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Integration>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateIntegrationError::from_response(response))),
)
}
})
}
fn update_integration_response(
&self,
input: UpdateIntegrationResponseRequest,
) -> RusotoFuture<IntegrationResponse, UpdateIntegrationResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<IntegrationResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateIntegrationResponseError::from_response(response))
}))
}
})
}
fn update_method(&self, input: UpdateMethodRequest) -> RusotoFuture<Method, UpdateMethodError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}",
http_method = input.http_method,
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Method>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateMethodError::from_response(response))),
)
}
})
}
fn update_method_response(
&self,
input: UpdateMethodResponseRequest,
) -> RusotoFuture<MethodResponse, UpdateMethodResponseError> {
let request_uri = format!("/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}", http_method = input.http_method, resource_id = input.resource_id, restapi_id = input.rest_api_id, status_code = input.status_code);
let mut request = SignedRequest::new("PATCH", "apigateway", &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::<MethodResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateMethodResponseError::from_response(response))
}),
)
}
})
}
fn update_model(&self, input: UpdateModelRequest) -> RusotoFuture<Model, UpdateModelError> {
let request_uri = format!(
"/restapis/{restapi_id}/models/{model_name}",
model_name = input.model_name,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Model>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateModelError::from_response(response))),
)
}
})
}
fn update_request_validator(
&self,
input: UpdateRequestValidatorRequest,
) -> RusotoFuture<RequestValidator, UpdateRequestValidatorError> {
let request_uri = format!(
"/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}",
requestvalidator_id = input.request_validator_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<RequestValidator>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateRequestValidatorError::from_response(response))
}),
)
}
})
}
fn update_resource(
&self,
input: UpdateResourceRequest,
) -> RusotoFuture<Resource, UpdateResourceError> {
let request_uri = format!(
"/restapis/{restapi_id}/resources/{resource_id}",
resource_id = input.resource_id,
restapi_id = input.rest_api_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Resource>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateResourceError::from_response(response))),
)
}
})
}
fn update_rest_api(
&self,
input: UpdateRestApiRequest,
) -> RusotoFuture<RestApi, UpdateRestApiError> {
let request_uri = format!("/restapis/{restapi_id}", restapi_id = input.rest_api_id);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<RestApi>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateRestApiError::from_response(response))),
)
}
})
}
fn update_stage(&self, input: UpdateStageRequest) -> RusotoFuture<Stage, UpdateStageError> {
let request_uri = format!(
"/restapis/{restapi_id}/stages/{stage_name}",
restapi_id = input.rest_api_id,
stage_name = input.stage_name
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Stage>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateStageError::from_response(response))),
)
}
})
}
fn update_usage(&self, input: UpdateUsageRequest) -> RusotoFuture<Usage, UpdateUsageError> {
let request_uri = format!(
"/usageplans/{usageplan_id}/keys/{key_id}/usage",
key_id = input.key_id,
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<Usage>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateUsageError::from_response(response))),
)
}
})
}
fn update_usage_plan(
&self,
input: UpdateUsagePlanRequest,
) -> RusotoFuture<UsagePlan, UpdateUsagePlanError> {
let request_uri = format!(
"/usageplans/{usageplan_id}",
usageplan_id = input.usage_plan_id
);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<UsagePlan>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateUsagePlanError::from_response(response))),
)
}
})
}
fn update_vpc_link(
&self,
input: UpdateVpcLinkRequest,
) -> RusotoFuture<VpcLink, UpdateVpcLinkError> {
let request_uri = format!("/vpclinks/{vpclink_id}", vpclink_id = input.vpc_link_id);
let mut request = SignedRequest::new("PATCH", "apigateway", &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.is_success() {
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::<VpcLink>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateVpcLinkError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}