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, Serialize, Deserialize)]
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 Api {
#[serde(rename = "ApiEndpoint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_endpoint: Option<String>,
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiKeySelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_selection_expression: 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 = "DisableSchemaValidation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_schema_validation: Option<bool>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "ProtocolType")]
pub protocol_type: String,
#[serde(rename = "RouteSelectionExpression")]
pub route_selection_expression: 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)]
pub struct ApiMapping {
pub api_id: String,
pub api_mapping_id: Option<String>,
pub api_mapping_key: Option<String>,
pub stage: String,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Apis {
pub items: Option<Vec<Api>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Authorizer {
#[serde(rename = "AuthorizerCredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials_arn: Option<String>,
#[serde(rename = "AuthorizerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_id: Option<String>,
#[serde(rename = "AuthorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "AuthorizerType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_type: Option<String>,
#[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<Vec<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_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Authorizers {
pub items: Option<Vec<Authorizer>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateApiInput {
pub api_key_selection_expression: Option<String>,
pub description: Option<String>,
pub disable_schema_validation: Option<bool>,
pub name: String,
pub protocol_type: String,
pub route_selection_expression: String,
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateApiMappingInput {
pub api_id: String,
pub api_mapping_key: Option<String>,
pub stage: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateApiMappingRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ApiMappingKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_key: Option<String>,
#[serde(rename = "DomainName")]
pub domain_name: String,
#[serde(rename = "Stage")]
pub stage: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateApiMappingResponse {
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiMappingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_id: Option<String>,
#[serde(rename = "ApiMappingKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_key: Option<String>,
#[serde(rename = "Stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateApiRequest {
#[serde(rename = "ApiKeySelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_selection_expression: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "DisableSchemaValidation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_schema_validation: Option<bool>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "ProtocolType")]
pub protocol_type: String,
#[serde(rename = "RouteSelectionExpression")]
pub route_selection_expression: 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 CreateApiResponse {
#[serde(rename = "ApiEndpoint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_endpoint: Option<String>,
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiKeySelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_selection_expression: 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 = "DisableSchemaValidation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_schema_validation: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ProtocolType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub protocol_type: Option<String>,
#[serde(rename = "RouteSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_selection_expression: 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)]
pub struct CreateAuthorizerInput {
pub authorizer_credentials_arn: Option<String>,
pub authorizer_result_ttl_in_seconds: Option<i64>,
pub authorizer_type: String,
pub authorizer_uri: String,
pub identity_source: Vec<String>,
pub identity_validation_expression: Option<String>,
pub name: String,
pub provider_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateAuthorizerRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "AuthorizerCredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials_arn: Option<String>,
#[serde(rename = "AuthorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "AuthorizerType")]
pub authorizer_type: String,
#[serde(rename = "AuthorizerUri")]
pub authorizer_uri: String,
#[serde(rename = "IdentitySource")]
pub identity_source: Vec<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_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateAuthorizerResponse {
#[serde(rename = "AuthorizerCredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials_arn: Option<String>,
#[serde(rename = "AuthorizerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_id: Option<String>,
#[serde(rename = "AuthorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "AuthorizerType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_type: Option<String>,
#[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<Vec<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_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateDeploymentInput {
pub description: Option<String>,
pub stage_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDeploymentRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: 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 CreateDeploymentResponse {
#[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 = "DeploymentStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status: Option<String>,
#[serde(rename = "DeploymentStatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status_message: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateDomainNameInput {
pub domain_name: String,
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDomainNameRequest {
#[serde(rename = "DomainName")]
pub domain_name: String,
#[serde(rename = "DomainNameConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDomainNameResponse {
#[serde(rename = "ApiMappingSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_selection_expression: Option<String>,
#[serde(rename = "DomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name: Option<String>,
#[serde(rename = "DomainNameConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateIntegrationInput {
pub connection_id: Option<String>,
pub connection_type: Option<String>,
pub content_handling_strategy: Option<String>,
pub credentials_arn: Option<String>,
pub description: Option<String>,
pub integration_method: Option<String>,
pub integration_type: Option<String>,
pub integration_uri: Option<String>,
pub passthrough_behavior: Option<String>,
pub request_parameters: Option<::std::collections::HashMap<String, String>>,
pub request_templates: Option<::std::collections::HashMap<String, String>>,
pub template_selection_expression: Option<String>,
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateIntegrationRequest {
#[serde(rename = "ApiId")]
pub api_id: 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 = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "CredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IntegrationMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_method: Option<String>,
#[serde(rename = "IntegrationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_type: Option<String>,
#[serde(rename = "IntegrationUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_uri: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
#[serde(rename = "TimeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateIntegrationResponseInput {
pub content_handling_strategy: Option<String>,
pub integration_response_key: String,
pub response_parameters: Option<::std::collections::HashMap<String, String>>,
pub response_templates: Option<::std::collections::HashMap<String, String>>,
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateIntegrationResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
#[serde(rename = "IntegrationResponseKey")]
pub integration_response_key: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateIntegrationResponseResponse {
#[serde(rename = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "IntegrationResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_id: Option<String>,
#[serde(rename = "IntegrationResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_key: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateIntegrationResult {
#[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 = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "CredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IntegrationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_id: Option<String>,
#[serde(rename = "IntegrationMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_method: Option<String>,
#[serde(rename = "IntegrationResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_selection_expression: Option<String>,
#[serde(rename = "IntegrationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_type: Option<String>,
#[serde(rename = "IntegrationUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_uri: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
#[serde(rename = "TimeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateModelInput {
pub content_type: Option<String>,
pub description: Option<String>,
pub name: String,
pub schema: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateModelRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[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 = "Name")]
pub name: 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 CreateModelResponse {
#[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 = "ModelId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_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)]
pub struct CreateRouteInput {
pub api_key_required: Option<bool>,
pub authorization_scopes: Option<Vec<String>>,
pub authorization_type: Option<String>,
pub authorizer_id: Option<String>,
pub model_selection_expression: Option<String>,
pub operation_name: Option<String>,
pub request_models: Option<::std::collections::HashMap<String, String>>,
pub request_parameters: Option<::std::collections::HashMap<String, ParameterConstraints>>,
pub route_key: String,
pub route_response_selection_expression: Option<String>,
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateRouteRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[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 = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteKey")]
pub route_key: String,
#[serde(rename = "RouteResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_selection_expression: Option<String>,
#[serde(rename = "Target")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateRouteResponseInput {
pub model_selection_expression: Option<String>,
pub response_models: Option<::std::collections::HashMap<String, String>>,
pub response_parameters: Option<::std::collections::HashMap<String, ParameterConstraints>>,
pub route_response_key: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateRouteResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteId")]
pub route_id: String,
#[serde(rename = "RouteResponseKey")]
pub route_response_key: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateRouteResponseResponse {
#[serde(rename = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_id: Option<String>,
#[serde(rename = "RouteResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_key: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateRouteResult {
#[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 = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_id: Option<String>,
#[serde(rename = "RouteKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_key: Option<String>,
#[serde(rename = "RouteResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_selection_expression: Option<String>,
#[serde(rename = "Target")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateStageInput {
pub access_log_settings: Option<AccessLogSettings>,
pub client_certificate_id: Option<String>,
pub default_route_settings: Option<RouteSettings>,
pub deployment_id: Option<String>,
pub description: Option<String>,
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
pub stage_name: String,
pub stage_variables: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateStageRequest {
#[serde(rename = "AccessLogSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_log_settings: Option<AccessLogSettings>,
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ClientCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_certificate_id: Option<String>,
#[serde(rename = "DefaultRouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_route_settings: Option<RouteSettings>,
#[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 = "RouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
#[serde(rename = "StageName")]
pub stage_name: 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 CreateStageResponse {
#[serde(rename = "AccessLogSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_log_settings: Option<AccessLogSettings>,
#[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 = "DefaultRouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_route_settings: Option<RouteSettings>,
#[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 = "LastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "RouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
#[serde(rename = "StageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<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, Serialize)]
pub struct DeleteApiMappingRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ApiMappingId")]
pub api_mapping_id: String,
#[serde(rename = "DomainName")]
pub domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteApiRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteAuthorizerRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "AuthorizerId")]
pub authorizer_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDeploymentRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "DeploymentId")]
pub deployment_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 DeleteIntegrationRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteIntegrationResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
#[serde(rename = "IntegrationResponseId")]
pub integration_response_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteModelRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ModelId")]
pub model_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRouteRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "RouteId")]
pub route_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRouteResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "RouteId")]
pub route_id: String,
#[serde(rename = "RouteResponseId")]
pub route_response_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteStageRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "StageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Deployment {
#[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 = "DeploymentStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status: Option<String>,
#[serde(rename = "DeploymentStatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status_message: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Deployments {
pub items: Option<Vec<Deployment>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DomainName {
#[serde(rename = "ApiMappingSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_selection_expression: Option<String>,
#[serde(rename = "DomainName")]
pub domain_name: String,
#[serde(rename = "DomainNameConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DomainNameConfiguration {
#[serde(rename = "ApiGatewayDomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_gateway_domain_name: Option<String>,
#[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 = "EndpointType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint_type: Option<String>,
#[serde(rename = "HostedZoneId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hosted_zone_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DomainNames {
pub items: Option<Vec<DomainName>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetApiMappingRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ApiMappingId")]
pub api_mapping_id: String,
#[serde(rename = "DomainName")]
pub domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetApiMappingResponse {
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiMappingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_id: Option<String>,
#[serde(rename = "ApiMappingKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_key: Option<String>,
#[serde(rename = "Stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetApiMappingsRequest {
#[serde(rename = "DomainName")]
pub domain_name: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetApiMappingsResponse {
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiMappingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_id: Option<String>,
#[serde(rename = "ApiMappingKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_key: Option<String>,
#[serde(rename = "Stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetApiRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetApiResponse {
#[serde(rename = "ApiEndpoint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_endpoint: Option<String>,
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiKeySelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_selection_expression: 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 = "DisableSchemaValidation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_schema_validation: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ProtocolType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub protocol_type: Option<String>,
#[serde(rename = "RouteSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_selection_expression: 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, Serialize)]
pub struct GetApisRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetApisResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Api>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAuthorizerRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "AuthorizerId")]
pub authorizer_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetAuthorizerResponse {
#[serde(rename = "AuthorizerCredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials_arn: Option<String>,
#[serde(rename = "AuthorizerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_id: Option<String>,
#[serde(rename = "AuthorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "AuthorizerType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_type: Option<String>,
#[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<Vec<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_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAuthorizersRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetAuthorizersResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Authorizer>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDeploymentRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "DeploymentId")]
pub deployment_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDeploymentResponse {
#[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 = "DeploymentStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status: Option<String>,
#[serde(rename = "DeploymentStatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status_message: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDeploymentsRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDeploymentsResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Deployment>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDomainNameRequest {
#[serde(rename = "DomainName")]
pub domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDomainNameResponse {
#[serde(rename = "ApiMappingSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_selection_expression: Option<String>,
#[serde(rename = "DomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name: Option<String>,
#[serde(rename = "DomainNameConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDomainNamesRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDomainNamesResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<DomainName>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntegrationRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntegrationResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
#[serde(rename = "IntegrationResponseId")]
pub integration_response_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIntegrationResponseResponse {
#[serde(rename = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "IntegrationResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_id: Option<String>,
#[serde(rename = "IntegrationResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_key: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntegrationResponsesRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIntegrationResponsesResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<IntegrationResponse>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIntegrationResult {
#[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 = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "CredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IntegrationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_id: Option<String>,
#[serde(rename = "IntegrationMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_method: Option<String>,
#[serde(rename = "IntegrationResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_selection_expression: Option<String>,
#[serde(rename = "IntegrationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_type: Option<String>,
#[serde(rename = "IntegrationUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_uri: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
#[serde(rename = "TimeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntegrationsRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIntegrationsResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Integration>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetModelRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ModelId")]
pub model_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetModelResponse {
#[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 = "ModelId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_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, Serialize)]
pub struct GetModelTemplateRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ModelId")]
pub model_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetModelTemplateResponse {
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetModelsRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetModelsResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Model>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRouteRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "RouteId")]
pub route_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRouteResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "RouteId")]
pub route_id: String,
#[serde(rename = "RouteResponseId")]
pub route_response_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRouteResponseResponse {
#[serde(rename = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_id: Option<String>,
#[serde(rename = "RouteResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_key: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRouteResponsesRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "RouteId")]
pub route_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRouteResponsesResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<RouteResponse>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRouteResult {
#[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 = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_id: Option<String>,
#[serde(rename = "RouteKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_key: Option<String>,
#[serde(rename = "RouteResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_selection_expression: Option<String>,
#[serde(rename = "Target")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRoutesRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRoutesResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Route>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetStageRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "StageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetStageResponse {
#[serde(rename = "AccessLogSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_log_settings: Option<AccessLogSettings>,
#[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 = "DefaultRouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_route_settings: Option<RouteSettings>,
#[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 = "LastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "RouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
#[serde(rename = "StageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<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, Serialize)]
pub struct GetStagesRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetStagesResponse {
#[serde(rename = "Items")]
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<Stage>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Integration {
#[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 = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "CredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IntegrationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_id: Option<String>,
#[serde(rename = "IntegrationMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_method: Option<String>,
#[serde(rename = "IntegrationResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_selection_expression: Option<String>,
#[serde(rename = "IntegrationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_type: Option<String>,
#[serde(rename = "IntegrationUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_uri: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
#[serde(rename = "TimeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IntegrationResponse {
#[serde(rename = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "IntegrationResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_id: Option<String>,
#[serde(rename = "IntegrationResponseKey")]
pub integration_response_key: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct IntegrationResponses {
pub items: Option<Vec<IntegrationResponse>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Integrations {
pub items: Option<Vec<Integration>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct LimitExceededException {
pub limit_type: Option<String>,
pub message: 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 = "ModelId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_id: Option<String>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Schema")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Models {
pub items: Option<Vec<Model>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ParameterConstraints {
#[serde(rename = "Required")]
#[serde(skip_serializing_if = "Option::is_none")]
pub required: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Route {
#[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 = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_id: Option<String>,
#[serde(rename = "RouteKey")]
pub route_key: String,
#[serde(rename = "RouteResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_selection_expression: Option<String>,
#[serde(rename = "Target")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RouteResponse {
#[serde(rename = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_id: Option<String>,
#[serde(rename = "RouteResponseKey")]
pub route_response_key: String,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct RouteResponses {
pub items: Option<Vec<RouteResponse>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RouteSettings {
#[serde(rename = "DataTraceEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_trace_enabled: Option<bool>,
#[serde(rename = "DetailedMetricsEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detailed_metrics_enabled: Option<bool>,
#[serde(rename = "LoggingLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logging_level: Option<String>,
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Routes {
pub items: Option<Vec<Route>>,
pub next_token: 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 = "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 = "DefaultRouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_route_settings: Option<RouteSettings>,
#[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 = "LastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "RouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
#[serde(rename = "StageName")]
pub stage_name: 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)]
pub struct Stages {
pub items: Option<Vec<Stage>>,
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Template {
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateApiInput {
pub api_key_selection_expression: Option<String>,
pub description: Option<String>,
pub disable_schema_validation: Option<bool>,
pub name: Option<String>,
pub route_selection_expression: Option<String>,
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateApiMappingInput {
pub api_id: Option<String>,
pub api_mapping_key: Option<String>,
pub stage: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateApiMappingRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ApiMappingId")]
pub api_mapping_id: String,
#[serde(rename = "ApiMappingKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_key: Option<String>,
#[serde(rename = "DomainName")]
pub domain_name: 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 UpdateApiMappingResponse {
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiMappingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_id: Option<String>,
#[serde(rename = "ApiMappingKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_key: Option<String>,
#[serde(rename = "Stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateApiRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ApiKeySelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_selection_expression: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "DisableSchemaValidation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_schema_validation: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "RouteSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_selection_expression: 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 UpdateApiResponse {
#[serde(rename = "ApiEndpoint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_endpoint: Option<String>,
#[serde(rename = "ApiId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_id: Option<String>,
#[serde(rename = "ApiKeySelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_key_selection_expression: 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 = "DisableSchemaValidation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_schema_validation: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ProtocolType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub protocol_type: Option<String>,
#[serde(rename = "RouteSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_selection_expression: 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)]
pub struct UpdateAuthorizerInput {
pub authorizer_credentials_arn: Option<String>,
pub authorizer_result_ttl_in_seconds: Option<i64>,
pub authorizer_type: Option<String>,
pub authorizer_uri: Option<String>,
pub identity_source: Option<Vec<String>>,
pub identity_validation_expression: Option<String>,
pub name: Option<String>,
pub provider_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateAuthorizerRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "AuthorizerCredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials_arn: Option<String>,
#[serde(rename = "AuthorizerId")]
pub authorizer_id: String,
#[serde(rename = "AuthorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "AuthorizerType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_type: Option<String>,
#[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<Vec<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_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateAuthorizerResponse {
#[serde(rename = "AuthorizerCredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_credentials_arn: Option<String>,
#[serde(rename = "AuthorizerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_id: Option<String>,
#[serde(rename = "AuthorizerResultTtlInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_result_ttl_in_seconds: Option<i64>,
#[serde(rename = "AuthorizerType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_type: Option<String>,
#[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<Vec<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_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateDeploymentInput {
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDeploymentRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "DeploymentId")]
pub deployment_id: String,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateDeploymentResponse {
#[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 = "DeploymentStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status: Option<String>,
#[serde(rename = "DeploymentStatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deployment_status_message: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateDomainNameInput {
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDomainNameRequest {
#[serde(rename = "DomainName")]
pub domain_name: String,
#[serde(rename = "DomainNameConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateDomainNameResponse {
#[serde(rename = "ApiMappingSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api_mapping_selection_expression: Option<String>,
#[serde(rename = "DomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name: Option<String>,
#[serde(rename = "DomainNameConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_name_configurations: Option<Vec<DomainNameConfiguration>>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateIntegrationInput {
pub connection_id: Option<String>,
pub connection_type: Option<String>,
pub content_handling_strategy: Option<String>,
pub credentials_arn: Option<String>,
pub description: Option<String>,
pub integration_method: Option<String>,
pub integration_type: Option<String>,
pub integration_uri: Option<String>,
pub passthrough_behavior: Option<String>,
pub request_parameters: Option<::std::collections::HashMap<String, String>>,
pub request_templates: Option<::std::collections::HashMap<String, String>>,
pub template_selection_expression: Option<String>,
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateIntegrationRequest {
#[serde(rename = "ApiId")]
pub api_id: 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 = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "CredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
#[serde(rename = "IntegrationMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_method: Option<String>,
#[serde(rename = "IntegrationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_type: Option<String>,
#[serde(rename = "IntegrationUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_uri: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
#[serde(rename = "TimeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateIntegrationResponseInput {
pub content_handling_strategy: Option<String>,
pub integration_response_key: Option<String>,
pub response_parameters: Option<::std::collections::HashMap<String, String>>,
pub response_templates: Option<::std::collections::HashMap<String, String>>,
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateIntegrationResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "IntegrationId")]
pub integration_id: String,
#[serde(rename = "IntegrationResponseId")]
pub integration_response_id: String,
#[serde(rename = "IntegrationResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_key: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateIntegrationResponseResponse {
#[serde(rename = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "IntegrationResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_id: Option<String>,
#[serde(rename = "IntegrationResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_key: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateIntegrationResult {
#[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 = "ContentHandlingStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_handling_strategy: Option<String>,
#[serde(rename = "CredentialsArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credentials_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IntegrationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_id: Option<String>,
#[serde(rename = "IntegrationMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_method: Option<String>,
#[serde(rename = "IntegrationResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_response_selection_expression: Option<String>,
#[serde(rename = "IntegrationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_type: Option<String>,
#[serde(rename = "IntegrationUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integration_uri: 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 = "TemplateSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_selection_expression: Option<String>,
#[serde(rename = "TimeoutInMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_millis: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateModelInput {
pub content_type: Option<String>,
pub description: Option<String>,
pub name: Option<String>,
pub schema: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateModelRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[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 = "ModelId")]
pub model_id: 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 UpdateModelResponse {
#[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 = "ModelId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_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)]
pub struct UpdateRouteInput {
pub api_key_required: Option<bool>,
pub authorization_scopes: Option<Vec<String>>,
pub authorization_type: Option<String>,
pub authorizer_id: Option<String>,
pub model_selection_expression: Option<String>,
pub operation_name: Option<String>,
pub request_models: Option<::std::collections::HashMap<String, String>>,
pub request_parameters: Option<::std::collections::HashMap<String, ParameterConstraints>>,
pub route_key: Option<String>,
pub route_response_selection_expression: Option<String>,
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRouteRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[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 = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteId")]
pub route_id: String,
#[serde(rename = "RouteKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_key: Option<String>,
#[serde(rename = "RouteResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_selection_expression: Option<String>,
#[serde(rename = "Target")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateRouteResponseInput {
pub model_selection_expression: Option<String>,
pub response_models: Option<::std::collections::HashMap<String, String>>,
pub response_parameters: Option<::std::collections::HashMap<String, ParameterConstraints>>,
pub route_response_key: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRouteResponseRequest {
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteId")]
pub route_id: String,
#[serde(rename = "RouteResponseId")]
pub route_response_id: String,
#[serde(rename = "RouteResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_key: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateRouteResponseResponse {
#[serde(rename = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteResponseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_id: Option<String>,
#[serde(rename = "RouteResponseKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_key: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateRouteResult {
#[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 = "ModelSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub model_selection_expression: Option<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, ParameterConstraints>>,
#[serde(rename = "RouteId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_id: Option<String>,
#[serde(rename = "RouteKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_key: Option<String>,
#[serde(rename = "RouteResponseSelectionExpression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_response_selection_expression: Option<String>,
#[serde(rename = "Target")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UpdateStageInput {
pub access_log_settings: Option<AccessLogSettings>,
pub client_certificate_id: Option<String>,
pub default_route_settings: Option<RouteSettings>,
pub deployment_id: Option<String>,
pub description: Option<String>,
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
pub stage_variables: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateStageRequest {
#[serde(rename = "AccessLogSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_log_settings: Option<AccessLogSettings>,
#[serde(rename = "ApiId")]
pub api_id: String,
#[serde(rename = "ClientCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_certificate_id: Option<String>,
#[serde(rename = "DefaultRouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_route_settings: Option<RouteSettings>,
#[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 = "RouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
#[serde(rename = "StageName")]
pub stage_name: 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 UpdateStageResponse {
#[serde(rename = "AccessLogSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_log_settings: Option<AccessLogSettings>,
#[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 = "DefaultRouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_route_settings: Option<RouteSettings>,
#[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 = "LastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "RouteSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_settings: Option<::std::collections::HashMap<String, RouteSettings>>,
#[serde(rename = "StageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<String>,
#[serde(rename = "StageVariables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_variables: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Debug, PartialEq)]
pub enum CreateApiError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateApiError {
pub fn from_response(res: BufferedHttpResponse) -> CreateApiError {
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 CreateApiError::BadRequest(String::from(error_message));
}
"ConflictException" => return CreateApiError::Conflict(String::from(error_message)),
"NotFoundException" => return CreateApiError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return CreateApiError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateApiError {
fn from(err: serde_json::error::Error) -> CreateApiError {
CreateApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateApiError {
fn from(err: CredentialsError) -> CreateApiError {
CreateApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateApiError {
fn from(err: HttpDispatchError) -> CreateApiError {
CreateApiError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateApiError {
fn from(err: io::Error) -> CreateApiError {
CreateApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateApiError {
fn description(&self) -> &str {
match *self {
CreateApiError::BadRequest(ref cause) => cause,
CreateApiError::Conflict(ref cause) => cause,
CreateApiError::NotFound(ref cause) => cause,
CreateApiError::TooManyRequests(ref cause) => cause,
CreateApiError::Validation(ref cause) => cause,
CreateApiError::Credentials(ref err) => err.description(),
CreateApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateApiError::ParseError(ref cause) => cause,
CreateApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateApiMappingError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateApiMappingError {
pub fn from_response(res: BufferedHttpResponse) -> CreateApiMappingError {
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 CreateApiMappingError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateApiMappingError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateApiMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateApiMappingError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateApiMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateApiMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateApiMappingError {
fn from(err: serde_json::error::Error) -> CreateApiMappingError {
CreateApiMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateApiMappingError {
fn from(err: CredentialsError) -> CreateApiMappingError {
CreateApiMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateApiMappingError {
fn from(err: HttpDispatchError) -> CreateApiMappingError {
CreateApiMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateApiMappingError {
fn from(err: io::Error) -> CreateApiMappingError {
CreateApiMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateApiMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateApiMappingError {
fn description(&self) -> &str {
match *self {
CreateApiMappingError::BadRequest(ref cause) => cause,
CreateApiMappingError::Conflict(ref cause) => cause,
CreateApiMappingError::NotFound(ref cause) => cause,
CreateApiMappingError::TooManyRequests(ref cause) => cause,
CreateApiMappingError::Validation(ref cause) => cause,
CreateApiMappingError::Credentials(ref err) => err.description(),
CreateApiMappingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateApiMappingError::ParseError(ref cause) => cause,
CreateApiMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateAuthorizerError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"ConflictException" => {
return CreateAuthorizerError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateAuthorizerError::TooManyRequests(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::Conflict(ref cause) => cause,
CreateAuthorizerError::NotFound(ref cause) => cause,
CreateAuthorizerError::TooManyRequests(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 CreateDeploymentError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"NotFoundException" => {
return CreateDeploymentError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateDeploymentError::TooManyRequests(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::NotFound(ref cause) => cause,
CreateDeploymentError::TooManyRequests(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 CreateDomainNameError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"NotFoundException" => {
return CreateDomainNameError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateDomainNameError::TooManyRequests(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::NotFound(ref cause) => cause,
CreateDomainNameError::TooManyRequests(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 CreateIntegrationError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateIntegrationError {
pub fn from_response(res: BufferedHttpResponse) -> CreateIntegrationError {
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 CreateIntegrationError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateIntegrationError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateIntegrationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateIntegrationError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateIntegrationError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateIntegrationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateIntegrationError {
fn from(err: serde_json::error::Error) -> CreateIntegrationError {
CreateIntegrationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateIntegrationError {
fn from(err: CredentialsError) -> CreateIntegrationError {
CreateIntegrationError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateIntegrationError {
fn from(err: HttpDispatchError) -> CreateIntegrationError {
CreateIntegrationError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateIntegrationError {
fn from(err: io::Error) -> CreateIntegrationError {
CreateIntegrationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateIntegrationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateIntegrationError {
fn description(&self) -> &str {
match *self {
CreateIntegrationError::BadRequest(ref cause) => cause,
CreateIntegrationError::Conflict(ref cause) => cause,
CreateIntegrationError::NotFound(ref cause) => cause,
CreateIntegrationError::TooManyRequests(ref cause) => cause,
CreateIntegrationError::Validation(ref cause) => cause,
CreateIntegrationError::Credentials(ref err) => err.description(),
CreateIntegrationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateIntegrationError::ParseError(ref cause) => cause,
CreateIntegrationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateIntegrationResponseError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateIntegrationResponseError {
pub fn from_response(res: BufferedHttpResponse) -> CreateIntegrationResponseError {
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 CreateIntegrationResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateIntegrationResponseError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateIntegrationResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateIntegrationResponseError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return CreateIntegrationResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateIntegrationResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateIntegrationResponseError {
fn from(err: serde_json::error::Error) -> CreateIntegrationResponseError {
CreateIntegrationResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateIntegrationResponseError {
fn from(err: CredentialsError) -> CreateIntegrationResponseError {
CreateIntegrationResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateIntegrationResponseError {
fn from(err: HttpDispatchError) -> CreateIntegrationResponseError {
CreateIntegrationResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateIntegrationResponseError {
fn from(err: io::Error) -> CreateIntegrationResponseError {
CreateIntegrationResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateIntegrationResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateIntegrationResponseError {
fn description(&self) -> &str {
match *self {
CreateIntegrationResponseError::BadRequest(ref cause) => cause,
CreateIntegrationResponseError::Conflict(ref cause) => cause,
CreateIntegrationResponseError::NotFound(ref cause) => cause,
CreateIntegrationResponseError::TooManyRequests(ref cause) => cause,
CreateIntegrationResponseError::Validation(ref cause) => cause,
CreateIntegrationResponseError::Credentials(ref err) => err.description(),
CreateIntegrationResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateIntegrationResponseError::ParseError(ref cause) => cause,
CreateIntegrationResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateModelError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"NotFoundException" => {
return CreateModelError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateModelError::TooManyRequests(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::NotFound(ref cause) => cause,
CreateModelError::TooManyRequests(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 CreateRouteError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateRouteError {
pub fn from_response(res: BufferedHttpResponse) -> CreateRouteError {
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 CreateRouteError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateRouteError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateRouteError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateRouteError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateRouteError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateRouteError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateRouteError {
fn from(err: serde_json::error::Error) -> CreateRouteError {
CreateRouteError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateRouteError {
fn from(err: CredentialsError) -> CreateRouteError {
CreateRouteError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateRouteError {
fn from(err: HttpDispatchError) -> CreateRouteError {
CreateRouteError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateRouteError {
fn from(err: io::Error) -> CreateRouteError {
CreateRouteError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateRouteError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateRouteError {
fn description(&self) -> &str {
match *self {
CreateRouteError::BadRequest(ref cause) => cause,
CreateRouteError::Conflict(ref cause) => cause,
CreateRouteError::NotFound(ref cause) => cause,
CreateRouteError::TooManyRequests(ref cause) => cause,
CreateRouteError::Validation(ref cause) => cause,
CreateRouteError::Credentials(ref err) => err.description(),
CreateRouteError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateRouteError::ParseError(ref cause) => cause,
CreateRouteError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateRouteResponseError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateRouteResponseError {
pub fn from_response(res: BufferedHttpResponse) -> CreateRouteResponseError {
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 CreateRouteResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateRouteResponseError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return CreateRouteResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateRouteResponseError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateRouteResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateRouteResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateRouteResponseError {
fn from(err: serde_json::error::Error) -> CreateRouteResponseError {
CreateRouteResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateRouteResponseError {
fn from(err: CredentialsError) -> CreateRouteResponseError {
CreateRouteResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateRouteResponseError {
fn from(err: HttpDispatchError) -> CreateRouteResponseError {
CreateRouteResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateRouteResponseError {
fn from(err: io::Error) -> CreateRouteResponseError {
CreateRouteResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateRouteResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateRouteResponseError {
fn description(&self) -> &str {
match *self {
CreateRouteResponseError::BadRequest(ref cause) => cause,
CreateRouteResponseError::Conflict(ref cause) => cause,
CreateRouteResponseError::NotFound(ref cause) => cause,
CreateRouteResponseError::TooManyRequests(ref cause) => cause,
CreateRouteResponseError::Validation(ref cause) => cause,
CreateRouteResponseError::Credentials(ref err) => err.description(),
CreateRouteResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateRouteResponseError::ParseError(ref cause) => cause,
CreateRouteResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateStageError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"NotFoundException" => {
return CreateStageError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateStageError::TooManyRequests(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::NotFound(ref cause) => cause,
CreateStageError::TooManyRequests(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 DeleteApiError {
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteApiError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteApiError {
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 DeleteApiError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return DeleteApiError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteApiError {
fn from(err: serde_json::error::Error) -> DeleteApiError {
DeleteApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteApiError {
fn from(err: CredentialsError) -> DeleteApiError {
DeleteApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteApiError {
fn from(err: HttpDispatchError) -> DeleteApiError {
DeleteApiError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteApiError {
fn from(err: io::Error) -> DeleteApiError {
DeleteApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteApiError {
fn description(&self) -> &str {
match *self {
DeleteApiError::NotFound(ref cause) => cause,
DeleteApiError::TooManyRequests(ref cause) => cause,
DeleteApiError::Validation(ref cause) => cause,
DeleteApiError::Credentials(ref err) => err.description(),
DeleteApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteApiError::ParseError(ref cause) => cause,
DeleteApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteApiMappingError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteApiMappingError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteApiMappingError {
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 DeleteApiMappingError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return DeleteApiMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteApiMappingError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteApiMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteApiMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteApiMappingError {
fn from(err: serde_json::error::Error) -> DeleteApiMappingError {
DeleteApiMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteApiMappingError {
fn from(err: CredentialsError) -> DeleteApiMappingError {
DeleteApiMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteApiMappingError {
fn from(err: HttpDispatchError) -> DeleteApiMappingError {
DeleteApiMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteApiMappingError {
fn from(err: io::Error) -> DeleteApiMappingError {
DeleteApiMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteApiMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteApiMappingError {
fn description(&self) -> &str {
match *self {
DeleteApiMappingError::BadRequest(ref cause) => cause,
DeleteApiMappingError::NotFound(ref cause) => cause,
DeleteApiMappingError::TooManyRequests(ref cause) => cause,
DeleteApiMappingError::Validation(ref cause) => cause,
DeleteApiMappingError::Credentials(ref err) => err.description(),
DeleteApiMappingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteApiMappingError::ParseError(ref cause) => cause,
DeleteApiMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteAuthorizerError {
NotFound(String),
TooManyRequests(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 {
"NotFoundException" => {
return DeleteAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteAuthorizerError::TooManyRequests(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::NotFound(ref cause) => cause,
DeleteAuthorizerError::TooManyRequests(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 DeleteDeploymentError {
NotFound(String),
TooManyRequests(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 {
"NotFoundException" => {
return DeleteDeploymentError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteDeploymentError::TooManyRequests(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::NotFound(ref cause) => cause,
DeleteDeploymentError::TooManyRequests(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 DeleteDomainNameError {
NotFound(String),
TooManyRequests(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));
}
"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::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 DeleteIntegrationError {
NotFound(String),
TooManyRequests(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 {
"NotFoundException" => {
return DeleteIntegrationError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteIntegrationError::TooManyRequests(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::NotFound(ref cause) => cause,
DeleteIntegrationError::TooManyRequests(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 {
NotFound(String),
TooManyRequests(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 {
"NotFoundException" => {
return DeleteIntegrationResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteIntegrationResponseError::TooManyRequests(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::NotFound(ref cause) => cause,
DeleteIntegrationResponseError::TooManyRequests(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 DeleteModelError {
NotFound(String),
TooManyRequests(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 {
"NotFoundException" => {
return DeleteModelError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteModelError::TooManyRequests(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::NotFound(ref cause) => cause,
DeleteModelError::TooManyRequests(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 DeleteRouteError {
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRouteError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRouteError {
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 DeleteRouteError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteRouteError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteRouteError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteRouteError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRouteError {
fn from(err: serde_json::error::Error) -> DeleteRouteError {
DeleteRouteError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRouteError {
fn from(err: CredentialsError) -> DeleteRouteError {
DeleteRouteError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRouteError {
fn from(err: HttpDispatchError) -> DeleteRouteError {
DeleteRouteError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRouteError {
fn from(err: io::Error) -> DeleteRouteError {
DeleteRouteError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRouteError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRouteError {
fn description(&self) -> &str {
match *self {
DeleteRouteError::NotFound(ref cause) => cause,
DeleteRouteError::TooManyRequests(ref cause) => cause,
DeleteRouteError::Validation(ref cause) => cause,
DeleteRouteError::Credentials(ref err) => err.description(),
DeleteRouteError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteRouteError::ParseError(ref cause) => cause,
DeleteRouteError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRouteResponseError {
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRouteResponseError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRouteResponseError {
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 DeleteRouteResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteRouteResponseError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteRouteResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteRouteResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRouteResponseError {
fn from(err: serde_json::error::Error) -> DeleteRouteResponseError {
DeleteRouteResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRouteResponseError {
fn from(err: CredentialsError) -> DeleteRouteResponseError {
DeleteRouteResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRouteResponseError {
fn from(err: HttpDispatchError) -> DeleteRouteResponseError {
DeleteRouteResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRouteResponseError {
fn from(err: io::Error) -> DeleteRouteResponseError {
DeleteRouteResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRouteResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRouteResponseError {
fn description(&self) -> &str {
match *self {
DeleteRouteResponseError::NotFound(ref cause) => cause,
DeleteRouteResponseError::TooManyRequests(ref cause) => cause,
DeleteRouteResponseError::Validation(ref cause) => cause,
DeleteRouteResponseError::Credentials(ref err) => err.description(),
DeleteRouteResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteRouteResponseError::ParseError(ref cause) => cause,
DeleteRouteResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteStageError {
NotFound(String),
TooManyRequests(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 {
"NotFoundException" => {
return DeleteStageError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteStageError::TooManyRequests(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::NotFound(ref cause) => cause,
DeleteStageError::TooManyRequests(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 GetApiError {
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApiError {
pub fn from_response(res: BufferedHttpResponse) -> GetApiError {
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 GetApiError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetApiError::TooManyRequests(String::from(error_message));
}
"ValidationException" => return GetApiError::Validation(error_message.to_string()),
_ => {}
}
}
return GetApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApiError {
fn from(err: serde_json::error::Error) -> GetApiError {
GetApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApiError {
fn from(err: CredentialsError) -> GetApiError {
GetApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApiError {
fn from(err: HttpDispatchError) -> GetApiError {
GetApiError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApiError {
fn from(err: io::Error) -> GetApiError {
GetApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApiError {
fn description(&self) -> &str {
match *self {
GetApiError::NotFound(ref cause) => cause,
GetApiError::TooManyRequests(ref cause) => cause,
GetApiError::Validation(ref cause) => cause,
GetApiError::Credentials(ref err) => err.description(),
GetApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetApiError::ParseError(ref cause) => cause,
GetApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetApiMappingError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApiMappingError {
pub fn from_response(res: BufferedHttpResponse) -> GetApiMappingError {
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 GetApiMappingError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetApiMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetApiMappingError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetApiMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetApiMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApiMappingError {
fn from(err: serde_json::error::Error) -> GetApiMappingError {
GetApiMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApiMappingError {
fn from(err: CredentialsError) -> GetApiMappingError {
GetApiMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApiMappingError {
fn from(err: HttpDispatchError) -> GetApiMappingError {
GetApiMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApiMappingError {
fn from(err: io::Error) -> GetApiMappingError {
GetApiMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApiMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApiMappingError {
fn description(&self) -> &str {
match *self {
GetApiMappingError::BadRequest(ref cause) => cause,
GetApiMappingError::NotFound(ref cause) => cause,
GetApiMappingError::TooManyRequests(ref cause) => cause,
GetApiMappingError::Validation(ref cause) => cause,
GetApiMappingError::Credentials(ref err) => err.description(),
GetApiMappingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetApiMappingError::ParseError(ref cause) => cause,
GetApiMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetApiMappingsError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApiMappingsError {
pub fn from_response(res: BufferedHttpResponse) -> GetApiMappingsError {
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 GetApiMappingsError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetApiMappingsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetApiMappingsError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetApiMappingsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetApiMappingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApiMappingsError {
fn from(err: serde_json::error::Error) -> GetApiMappingsError {
GetApiMappingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApiMappingsError {
fn from(err: CredentialsError) -> GetApiMappingsError {
GetApiMappingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApiMappingsError {
fn from(err: HttpDispatchError) -> GetApiMappingsError {
GetApiMappingsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApiMappingsError {
fn from(err: io::Error) -> GetApiMappingsError {
GetApiMappingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApiMappingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApiMappingsError {
fn description(&self) -> &str {
match *self {
GetApiMappingsError::BadRequest(ref cause) => cause,
GetApiMappingsError::NotFound(ref cause) => cause,
GetApiMappingsError::TooManyRequests(ref cause) => cause,
GetApiMappingsError::Validation(ref cause) => cause,
GetApiMappingsError::Credentials(ref err) => err.description(),
GetApiMappingsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetApiMappingsError::ParseError(ref cause) => cause,
GetApiMappingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetApisError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetApisError {
pub fn from_response(res: BufferedHttpResponse) -> GetApisError {
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 GetApisError::BadRequest(String::from(error_message));
}
"NotFoundException" => return GetApisError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetApisError::TooManyRequests(String::from(error_message));
}
"ValidationException" => return GetApisError::Validation(error_message.to_string()),
_ => {}
}
}
return GetApisError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetApisError {
fn from(err: serde_json::error::Error) -> GetApisError {
GetApisError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetApisError {
fn from(err: CredentialsError) -> GetApisError {
GetApisError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetApisError {
fn from(err: HttpDispatchError) -> GetApisError {
GetApisError::HttpDispatch(err)
}
}
impl From<io::Error> for GetApisError {
fn from(err: io::Error) -> GetApisError {
GetApisError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetApisError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetApisError {
fn description(&self) -> &str {
match *self {
GetApisError::BadRequest(ref cause) => cause,
GetApisError::NotFound(ref cause) => cause,
GetApisError::TooManyRequests(ref cause) => cause,
GetApisError::Validation(ref cause) => cause,
GetApisError::Credentials(ref err) => err.description(),
GetApisError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetApisError::ParseError(ref cause) => cause,
GetApisError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAuthorizerError {
NotFound(String),
TooManyRequests(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));
}
"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::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),
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));
}
"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::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 GetDeploymentError {
NotFound(String),
TooManyRequests(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));
}
"TooManyRequestsException" => {
return GetDeploymentError::TooManyRequests(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::TooManyRequests(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),
NotFound(String),
TooManyRequests(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));
}
"NotFoundException" => {
return GetDeploymentsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDeploymentsError::TooManyRequests(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::NotFound(ref cause) => cause,
GetDeploymentsError::TooManyRequests(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 GetDomainNameError {
NotFound(String),
TooManyRequests(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));
}
"TooManyRequestsException" => {
return GetDomainNameError::TooManyRequests(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::TooManyRequests(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),
NotFound(String),
TooManyRequests(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));
}
"NotFoundException" => {
return GetDomainNamesError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDomainNamesError::TooManyRequests(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::NotFound(ref cause) => cause,
GetDomainNamesError::TooManyRequests(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 GetIntegrationError {
NotFound(String),
TooManyRequests(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));
}
"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::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),
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));
}
"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::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 GetIntegrationResponsesError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIntegrationResponsesError {
pub fn from_response(res: BufferedHttpResponse) -> GetIntegrationResponsesError {
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 GetIntegrationResponsesError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetIntegrationResponsesError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetIntegrationResponsesError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return GetIntegrationResponsesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetIntegrationResponsesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIntegrationResponsesError {
fn from(err: serde_json::error::Error) -> GetIntegrationResponsesError {
GetIntegrationResponsesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIntegrationResponsesError {
fn from(err: CredentialsError) -> GetIntegrationResponsesError {
GetIntegrationResponsesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIntegrationResponsesError {
fn from(err: HttpDispatchError) -> GetIntegrationResponsesError {
GetIntegrationResponsesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIntegrationResponsesError {
fn from(err: io::Error) -> GetIntegrationResponsesError {
GetIntegrationResponsesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIntegrationResponsesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIntegrationResponsesError {
fn description(&self) -> &str {
match *self {
GetIntegrationResponsesError::BadRequest(ref cause) => cause,
GetIntegrationResponsesError::NotFound(ref cause) => cause,
GetIntegrationResponsesError::TooManyRequests(ref cause) => cause,
GetIntegrationResponsesError::Validation(ref cause) => cause,
GetIntegrationResponsesError::Credentials(ref err) => err.description(),
GetIntegrationResponsesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetIntegrationResponsesError::ParseError(ref cause) => cause,
GetIntegrationResponsesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIntegrationsError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIntegrationsError {
pub fn from_response(res: BufferedHttpResponse) -> GetIntegrationsError {
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 GetIntegrationsError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetIntegrationsError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetIntegrationsError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetIntegrationsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetIntegrationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIntegrationsError {
fn from(err: serde_json::error::Error) -> GetIntegrationsError {
GetIntegrationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIntegrationsError {
fn from(err: CredentialsError) -> GetIntegrationsError {
GetIntegrationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIntegrationsError {
fn from(err: HttpDispatchError) -> GetIntegrationsError {
GetIntegrationsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIntegrationsError {
fn from(err: io::Error) -> GetIntegrationsError {
GetIntegrationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIntegrationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIntegrationsError {
fn description(&self) -> &str {
match *self {
GetIntegrationsError::BadRequest(ref cause) => cause,
GetIntegrationsError::NotFound(ref cause) => cause,
GetIntegrationsError::TooManyRequests(ref cause) => cause,
GetIntegrationsError::Validation(ref cause) => cause,
GetIntegrationsError::Credentials(ref err) => err.description(),
GetIntegrationsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetIntegrationsError::ParseError(ref cause) => cause,
GetIntegrationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetModelError {
NotFound(String),
TooManyRequests(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));
}
"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::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 {
NotFound(String),
TooManyRequests(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 {
"NotFoundException" => {
return GetModelTemplateError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetModelTemplateError::TooManyRequests(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::NotFound(ref cause) => cause,
GetModelTemplateError::TooManyRequests(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),
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));
}
"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::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 GetRouteError {
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRouteError {
pub fn from_response(res: BufferedHttpResponse) -> GetRouteError {
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 GetRouteError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetRouteError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetRouteError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRouteError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRouteError {
fn from(err: serde_json::error::Error) -> GetRouteError {
GetRouteError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRouteError {
fn from(err: CredentialsError) -> GetRouteError {
GetRouteError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRouteError {
fn from(err: HttpDispatchError) -> GetRouteError {
GetRouteError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRouteError {
fn from(err: io::Error) -> GetRouteError {
GetRouteError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRouteError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRouteError {
fn description(&self) -> &str {
match *self {
GetRouteError::NotFound(ref cause) => cause,
GetRouteError::TooManyRequests(ref cause) => cause,
GetRouteError::Validation(ref cause) => cause,
GetRouteError::Credentials(ref err) => err.description(),
GetRouteError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetRouteError::ParseError(ref cause) => cause,
GetRouteError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRouteResponseError {
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRouteResponseError {
pub fn from_response(res: BufferedHttpResponse) -> GetRouteResponseError {
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 GetRouteResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetRouteResponseError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetRouteResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRouteResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRouteResponseError {
fn from(err: serde_json::error::Error) -> GetRouteResponseError {
GetRouteResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRouteResponseError {
fn from(err: CredentialsError) -> GetRouteResponseError {
GetRouteResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRouteResponseError {
fn from(err: HttpDispatchError) -> GetRouteResponseError {
GetRouteResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRouteResponseError {
fn from(err: io::Error) -> GetRouteResponseError {
GetRouteResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRouteResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRouteResponseError {
fn description(&self) -> &str {
match *self {
GetRouteResponseError::NotFound(ref cause) => cause,
GetRouteResponseError::TooManyRequests(ref cause) => cause,
GetRouteResponseError::Validation(ref cause) => cause,
GetRouteResponseError::Credentials(ref err) => err.description(),
GetRouteResponseError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetRouteResponseError::ParseError(ref cause) => cause,
GetRouteResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRouteResponsesError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRouteResponsesError {
pub fn from_response(res: BufferedHttpResponse) -> GetRouteResponsesError {
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 GetRouteResponsesError::BadRequest(String::from(error_message));
}
"NotFoundException" => {
return GetRouteResponsesError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetRouteResponsesError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetRouteResponsesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRouteResponsesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRouteResponsesError {
fn from(err: serde_json::error::Error) -> GetRouteResponsesError {
GetRouteResponsesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRouteResponsesError {
fn from(err: CredentialsError) -> GetRouteResponsesError {
GetRouteResponsesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRouteResponsesError {
fn from(err: HttpDispatchError) -> GetRouteResponsesError {
GetRouteResponsesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRouteResponsesError {
fn from(err: io::Error) -> GetRouteResponsesError {
GetRouteResponsesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRouteResponsesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRouteResponsesError {
fn description(&self) -> &str {
match *self {
GetRouteResponsesError::BadRequest(ref cause) => cause,
GetRouteResponsesError::NotFound(ref cause) => cause,
GetRouteResponsesError::TooManyRequests(ref cause) => cause,
GetRouteResponsesError::Validation(ref cause) => cause,
GetRouteResponsesError::Credentials(ref err) => err.description(),
GetRouteResponsesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetRouteResponsesError::ParseError(ref cause) => cause,
GetRouteResponsesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRoutesError {
BadRequest(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRoutesError {
pub fn from_response(res: BufferedHttpResponse) -> GetRoutesError {
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 GetRoutesError::BadRequest(String::from(error_message));
}
"NotFoundException" => return GetRoutesError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetRoutesError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetRoutesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRoutesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRoutesError {
fn from(err: serde_json::error::Error) -> GetRoutesError {
GetRoutesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRoutesError {
fn from(err: CredentialsError) -> GetRoutesError {
GetRoutesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRoutesError {
fn from(err: HttpDispatchError) -> GetRoutesError {
GetRoutesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRoutesError {
fn from(err: io::Error) -> GetRoutesError {
GetRoutesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRoutesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRoutesError {
fn description(&self) -> &str {
match *self {
GetRoutesError::BadRequest(ref cause) => cause,
GetRoutesError::NotFound(ref cause) => cause,
GetRoutesError::TooManyRequests(ref cause) => cause,
GetRoutesError::Validation(ref cause) => cause,
GetRoutesError::Credentials(ref err) => err.description(),
GetRoutesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetRoutesError::ParseError(ref cause) => cause,
GetRoutesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetStageError {
NotFound(String),
TooManyRequests(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));
}
"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::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 {
BadRequest(String),
NotFound(String),
TooManyRequests(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 {
"BadRequestException" => {
return GetStagesError::BadRequest(String::from(error_message));
}
"NotFoundException" => return GetStagesError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return GetStagesError::TooManyRequests(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::BadRequest(ref cause) => cause,
GetStagesError::NotFound(ref cause) => cause,
GetStagesError::TooManyRequests(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 UpdateApiError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateApiError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateApiError {
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 UpdateApiError::BadRequest(String::from(error_message));
}
"ConflictException" => return UpdateApiError::Conflict(String::from(error_message)),
"NotFoundException" => return UpdateApiError::NotFound(String::from(error_message)),
"TooManyRequestsException" => {
return UpdateApiError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateApiError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateApiError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateApiError {
fn from(err: serde_json::error::Error) -> UpdateApiError {
UpdateApiError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateApiError {
fn from(err: CredentialsError) -> UpdateApiError {
UpdateApiError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateApiError {
fn from(err: HttpDispatchError) -> UpdateApiError {
UpdateApiError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateApiError {
fn from(err: io::Error) -> UpdateApiError {
UpdateApiError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateApiError {
fn description(&self) -> &str {
match *self {
UpdateApiError::BadRequest(ref cause) => cause,
UpdateApiError::Conflict(ref cause) => cause,
UpdateApiError::NotFound(ref cause) => cause,
UpdateApiError::TooManyRequests(ref cause) => cause,
UpdateApiError::Validation(ref cause) => cause,
UpdateApiError::Credentials(ref err) => err.description(),
UpdateApiError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateApiError::ParseError(ref cause) => cause,
UpdateApiError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateApiMappingError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateApiMappingError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateApiMappingError {
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 UpdateApiMappingError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateApiMappingError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateApiMappingError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateApiMappingError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateApiMappingError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateApiMappingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateApiMappingError {
fn from(err: serde_json::error::Error) -> UpdateApiMappingError {
UpdateApiMappingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateApiMappingError {
fn from(err: CredentialsError) -> UpdateApiMappingError {
UpdateApiMappingError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateApiMappingError {
fn from(err: HttpDispatchError) -> UpdateApiMappingError {
UpdateApiMappingError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateApiMappingError {
fn from(err: io::Error) -> UpdateApiMappingError {
UpdateApiMappingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateApiMappingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateApiMappingError {
fn description(&self) -> &str {
match *self {
UpdateApiMappingError::BadRequest(ref cause) => cause,
UpdateApiMappingError::Conflict(ref cause) => cause,
UpdateApiMappingError::NotFound(ref cause) => cause,
UpdateApiMappingError::TooManyRequests(ref cause) => cause,
UpdateApiMappingError::Validation(ref cause) => cause,
UpdateApiMappingError::Credentials(ref err) => err.description(),
UpdateApiMappingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateApiMappingError::ParseError(ref cause) => cause,
UpdateApiMappingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateAuthorizerError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"ConflictException" => {
return UpdateAuthorizerError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateAuthorizerError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateAuthorizerError::TooManyRequests(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::Conflict(ref cause) => cause,
UpdateAuthorizerError::NotFound(ref cause) => cause,
UpdateAuthorizerError::TooManyRequests(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 UpdateDeploymentError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"ConflictException" => {
return UpdateDeploymentError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateDeploymentError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateDeploymentError::TooManyRequests(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::Conflict(ref cause) => cause,
UpdateDeploymentError::NotFound(ref cause) => cause,
UpdateDeploymentError::TooManyRequests(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 UpdateDomainNameError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"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::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 UpdateIntegrationError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"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::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),
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,
));
}
"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::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 UpdateModelError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"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::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 UpdateRouteError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRouteError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRouteError {
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 UpdateRouteError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateRouteError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateRouteError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateRouteError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateRouteError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateRouteError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRouteError {
fn from(err: serde_json::error::Error) -> UpdateRouteError {
UpdateRouteError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRouteError {
fn from(err: CredentialsError) -> UpdateRouteError {
UpdateRouteError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRouteError {
fn from(err: HttpDispatchError) -> UpdateRouteError {
UpdateRouteError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRouteError {
fn from(err: io::Error) -> UpdateRouteError {
UpdateRouteError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRouteError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRouteError {
fn description(&self) -> &str {
match *self {
UpdateRouteError::BadRequest(ref cause) => cause,
UpdateRouteError::Conflict(ref cause) => cause,
UpdateRouteError::NotFound(ref cause) => cause,
UpdateRouteError::TooManyRequests(ref cause) => cause,
UpdateRouteError::Validation(ref cause) => cause,
UpdateRouteError::Credentials(ref err) => err.description(),
UpdateRouteError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateRouteError::ParseError(ref cause) => cause,
UpdateRouteError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRouteResponseError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRouteResponseError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRouteResponseError {
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 UpdateRouteResponseError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return UpdateRouteResponseError::Conflict(String::from(error_message));
}
"NotFoundException" => {
return UpdateRouteResponseError::NotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateRouteResponseError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateRouteResponseError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateRouteResponseError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRouteResponseError {
fn from(err: serde_json::error::Error) -> UpdateRouteResponseError {
UpdateRouteResponseError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRouteResponseError {
fn from(err: CredentialsError) -> UpdateRouteResponseError {
UpdateRouteResponseError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRouteResponseError {
fn from(err: HttpDispatchError) -> UpdateRouteResponseError {
UpdateRouteResponseError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRouteResponseError {
fn from(err: io::Error) -> UpdateRouteResponseError {
UpdateRouteResponseError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRouteResponseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRouteResponseError {
fn description(&self) -> &str {
match *self {
UpdateRouteResponseError::BadRequest(ref cause) => cause,
UpdateRouteResponseError::Conflict(ref cause) => cause,
UpdateRouteResponseError::NotFound(ref cause) => cause,
UpdateRouteResponseError::TooManyRequests(ref cause) => cause,
UpdateRouteResponseError::Validation(ref cause) => cause,
UpdateRouteResponseError::Credentials(ref err) => err.description(),
UpdateRouteResponseError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateRouteResponseError::ParseError(ref cause) => cause,
UpdateRouteResponseError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateStageError {
BadRequest(String),
Conflict(String),
NotFound(String),
TooManyRequests(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));
}
"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::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",
}
}
}
pub trait ApiGatewayV2 {
fn create_api(
&self,
input: CreateApiRequest,
) -> RusotoFuture<CreateApiResponse, CreateApiError>;
fn create_api_mapping(
&self,
input: CreateApiMappingRequest,
) -> RusotoFuture<CreateApiMappingResponse, CreateApiMappingError>;
fn create_authorizer(
&self,
input: CreateAuthorizerRequest,
) -> RusotoFuture<CreateAuthorizerResponse, CreateAuthorizerError>;
fn create_deployment(
&self,
input: CreateDeploymentRequest,
) -> RusotoFuture<CreateDeploymentResponse, CreateDeploymentError>;
fn create_domain_name(
&self,
input: CreateDomainNameRequest,
) -> RusotoFuture<CreateDomainNameResponse, CreateDomainNameError>;
fn create_integration(
&self,
input: CreateIntegrationRequest,
) -> RusotoFuture<CreateIntegrationResult, CreateIntegrationError>;
fn create_integration_response(
&self,
input: CreateIntegrationResponseRequest,
) -> RusotoFuture<CreateIntegrationResponseResponse, CreateIntegrationResponseError>;
fn create_model(
&self,
input: CreateModelRequest,
) -> RusotoFuture<CreateModelResponse, CreateModelError>;
fn create_route(
&self,
input: CreateRouteRequest,
) -> RusotoFuture<CreateRouteResult, CreateRouteError>;
fn create_route_response(
&self,
input: CreateRouteResponseRequest,
) -> RusotoFuture<CreateRouteResponseResponse, CreateRouteResponseError>;
fn create_stage(
&self,
input: CreateStageRequest,
) -> RusotoFuture<CreateStageResponse, CreateStageError>;
fn delete_api(&self, input: DeleteApiRequest) -> RusotoFuture<(), DeleteApiError>;
fn delete_api_mapping(
&self,
input: DeleteApiMappingRequest,
) -> RusotoFuture<(), DeleteApiMappingError>;
fn delete_authorizer(
&self,
input: DeleteAuthorizerRequest,
) -> RusotoFuture<(), DeleteAuthorizerError>;
fn delete_deployment(
&self,
input: DeleteDeploymentRequest,
) -> RusotoFuture<(), DeleteDeploymentError>;
fn delete_domain_name(
&self,
input: DeleteDomainNameRequest,
) -> RusotoFuture<(), DeleteDomainNameError>;
fn delete_integration(
&self,
input: DeleteIntegrationRequest,
) -> RusotoFuture<(), DeleteIntegrationError>;
fn delete_integration_response(
&self,
input: DeleteIntegrationResponseRequest,
) -> RusotoFuture<(), DeleteIntegrationResponseError>;
fn delete_model(&self, input: DeleteModelRequest) -> RusotoFuture<(), DeleteModelError>;
fn delete_route(&self, input: DeleteRouteRequest) -> RusotoFuture<(), DeleteRouteError>;
fn delete_route_response(
&self,
input: DeleteRouteResponseRequest,
) -> RusotoFuture<(), DeleteRouteResponseError>;
fn delete_stage(&self, input: DeleteStageRequest) -> RusotoFuture<(), DeleteStageError>;
fn get_api(&self, input: GetApiRequest) -> RusotoFuture<GetApiResponse, GetApiError>;
fn get_api_mapping(
&self,
input: GetApiMappingRequest,
) -> RusotoFuture<GetApiMappingResponse, GetApiMappingError>;
fn get_api_mappings(
&self,
input: GetApiMappingsRequest,
) -> RusotoFuture<GetApiMappingsResponse, GetApiMappingsError>;
fn get_apis(&self, input: GetApisRequest) -> RusotoFuture<GetApisResponse, GetApisError>;
fn get_authorizer(
&self,
input: GetAuthorizerRequest,
) -> RusotoFuture<GetAuthorizerResponse, GetAuthorizerError>;
fn get_authorizers(
&self,
input: GetAuthorizersRequest,
) -> RusotoFuture<GetAuthorizersResponse, GetAuthorizersError>;
fn get_deployment(
&self,
input: GetDeploymentRequest,
) -> RusotoFuture<GetDeploymentResponse, GetDeploymentError>;
fn get_deployments(
&self,
input: GetDeploymentsRequest,
) -> RusotoFuture<GetDeploymentsResponse, GetDeploymentsError>;
fn get_domain_name(
&self,
input: GetDomainNameRequest,
) -> RusotoFuture<GetDomainNameResponse, GetDomainNameError>;
fn get_domain_names(
&self,
input: GetDomainNamesRequest,
) -> RusotoFuture<GetDomainNamesResponse, GetDomainNamesError>;
fn get_integration(
&self,
input: GetIntegrationRequest,
) -> RusotoFuture<GetIntegrationResult, GetIntegrationError>;
fn get_integration_response(
&self,
input: GetIntegrationResponseRequest,
) -> RusotoFuture<GetIntegrationResponseResponse, GetIntegrationResponseError>;
fn get_integration_responses(
&self,
input: GetIntegrationResponsesRequest,
) -> RusotoFuture<GetIntegrationResponsesResponse, GetIntegrationResponsesError>;
fn get_integrations(
&self,
input: GetIntegrationsRequest,
) -> RusotoFuture<GetIntegrationsResponse, GetIntegrationsError>;
fn get_model(&self, input: GetModelRequest) -> RusotoFuture<GetModelResponse, GetModelError>;
fn get_model_template(
&self,
input: GetModelTemplateRequest,
) -> RusotoFuture<GetModelTemplateResponse, GetModelTemplateError>;
fn get_models(
&self,
input: GetModelsRequest,
) -> RusotoFuture<GetModelsResponse, GetModelsError>;
fn get_route(&self, input: GetRouteRequest) -> RusotoFuture<GetRouteResult, GetRouteError>;
fn get_route_response(
&self,
input: GetRouteResponseRequest,
) -> RusotoFuture<GetRouteResponseResponse, GetRouteResponseError>;
fn get_route_responses(
&self,
input: GetRouteResponsesRequest,
) -> RusotoFuture<GetRouteResponsesResponse, GetRouteResponsesError>;
fn get_routes(
&self,
input: GetRoutesRequest,
) -> RusotoFuture<GetRoutesResponse, GetRoutesError>;
fn get_stage(&self, input: GetStageRequest) -> RusotoFuture<GetStageResponse, GetStageError>;
fn get_stages(
&self,
input: GetStagesRequest,
) -> RusotoFuture<GetStagesResponse, GetStagesError>;
fn update_api(
&self,
input: UpdateApiRequest,
) -> RusotoFuture<UpdateApiResponse, UpdateApiError>;
fn update_api_mapping(
&self,
input: UpdateApiMappingRequest,
) -> RusotoFuture<UpdateApiMappingResponse, UpdateApiMappingError>;
fn update_authorizer(
&self,
input: UpdateAuthorizerRequest,
) -> RusotoFuture<UpdateAuthorizerResponse, UpdateAuthorizerError>;
fn update_deployment(
&self,
input: UpdateDeploymentRequest,
) -> RusotoFuture<UpdateDeploymentResponse, UpdateDeploymentError>;
fn update_domain_name(
&self,
input: UpdateDomainNameRequest,
) -> RusotoFuture<UpdateDomainNameResponse, UpdateDomainNameError>;
fn update_integration(
&self,
input: UpdateIntegrationRequest,
) -> RusotoFuture<UpdateIntegrationResult, UpdateIntegrationError>;
fn update_integration_response(
&self,
input: UpdateIntegrationResponseRequest,
) -> RusotoFuture<UpdateIntegrationResponseResponse, UpdateIntegrationResponseError>;
fn update_model(
&self,
input: UpdateModelRequest,
) -> RusotoFuture<UpdateModelResponse, UpdateModelError>;
fn update_route(
&self,
input: UpdateRouteRequest,
) -> RusotoFuture<UpdateRouteResult, UpdateRouteError>;
fn update_route_response(
&self,
input: UpdateRouteResponseRequest,
) -> RusotoFuture<UpdateRouteResponseResponse, UpdateRouteResponseError>;
fn update_stage(
&self,
input: UpdateStageRequest,
) -> RusotoFuture<UpdateStageResponse, UpdateStageError>;
}
#[derive(Clone)]
pub struct ApiGatewayV2Client {
client: Client,
region: region::Region,
}
impl ApiGatewayV2Client {
pub fn new(region: region::Region) -> ApiGatewayV2Client {
ApiGatewayV2Client {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> ApiGatewayV2Client
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
ApiGatewayV2Client {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl ApiGatewayV2 for ApiGatewayV2Client {
fn create_api(
&self,
input: CreateApiRequest,
) -> RusotoFuture<CreateApiResponse, CreateApiError> {
let request_uri = "/v2/apis";
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::<CreateApiResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateApiError::from_response(response))),
)
}
})
}
fn create_api_mapping(
&self,
input: CreateApiMappingRequest,
) -> RusotoFuture<CreateApiMappingResponse, CreateApiMappingError> {
let request_uri = format!(
"/v2/domainnames/{domain_name}/apimappings",
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::<CreateApiMappingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateApiMappingError::from_response(response))),
)
}
})
}
fn create_authorizer(
&self,
input: CreateAuthorizerRequest,
) -> RusotoFuture<CreateAuthorizerResponse, CreateAuthorizerError> {
let request_uri = format!("/v2/apis/{api_id}/authorizers", api_id = input.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::<CreateAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateAuthorizerError::from_response(response))),
)
}
})
}
fn create_deployment(
&self,
input: CreateDeploymentRequest,
) -> RusotoFuture<CreateDeploymentResponse, CreateDeploymentError> {
let request_uri = format!("/v2/apis/{api_id}/deployments", api_id = input.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::<CreateDeploymentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDeploymentError::from_response(response))),
)
}
})
}
fn create_domain_name(
&self,
input: CreateDomainNameRequest,
) -> RusotoFuture<CreateDomainNameResponse, CreateDomainNameError> {
let request_uri = "/v2/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::<CreateDomainNameResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDomainNameError::from_response(response))),
)
}
})
}
fn create_integration(
&self,
input: CreateIntegrationRequest,
) -> RusotoFuture<CreateIntegrationResult, CreateIntegrationError> {
let request_uri = format!("/v2/apis/{api_id}/integrations", api_id = input.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::<CreateIntegrationResult>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateIntegrationError::from_response(response))),
)
}
})
}
fn create_integration_response(
&self,
input: CreateIntegrationResponseRequest,
) -> RusotoFuture<CreateIntegrationResponseResponse, CreateIntegrationResponseError> {
let request_uri = format!(
"/v2/apis/{api_id}/integrations/{integration_id}/integrationresponses",
api_id = input.api_id,
integration_id = input.integration_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::<CreateIntegrationResponseResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateIntegrationResponseError::from_response(response))
}))
}
})
}
fn create_model(
&self,
input: CreateModelRequest,
) -> RusotoFuture<CreateModelResponse, CreateModelError> {
let request_uri = format!("/v2/apis/{api_id}/models", api_id = input.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::<CreateModelResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateModelError::from_response(response))),
)
}
})
}
fn create_route(
&self,
input: CreateRouteRequest,
) -> RusotoFuture<CreateRouteResult, CreateRouteError> {
let request_uri = format!("/v2/apis/{api_id}/routes", api_id = input.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::<CreateRouteResult>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateRouteError::from_response(response))),
)
}
})
}
fn create_route_response(
&self,
input: CreateRouteResponseRequest,
) -> RusotoFuture<CreateRouteResponseResponse, CreateRouteResponseError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}/routeresponses",
api_id = input.api_id,
route_id = input.route_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::<CreateRouteResponseResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateRouteResponseError::from_response(response))
}),
)
}
})
}
fn create_stage(
&self,
input: CreateStageRequest,
) -> RusotoFuture<CreateStageResponse, CreateStageError> {
let request_uri = format!("/v2/apis/{api_id}/stages", api_id = input.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::<CreateStageResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateStageError::from_response(response))),
)
}
})
}
fn delete_api(&self, input: DeleteApiRequest) -> RusotoFuture<(), DeleteApiError> {
let request_uri = format!("/v2/apis/{api_id}", api_id = input.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(DeleteApiError::from_response(response))),
)
}
})
}
fn delete_api_mapping(
&self,
input: DeleteApiMappingRequest,
) -> RusotoFuture<(), DeleteApiMappingError> {
let request_uri = format!(
"/v2/domainnames/{domain_name}/apimappings/{api_mapping_id}",
api_mapping_id = input.api_mapping_id,
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());
let mut params = Params::new();
params.put("apiId", &input.api_id);
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(DeleteApiMappingError::from_response(response))),
)
}
})
}
fn delete_authorizer(
&self,
input: DeleteAuthorizerRequest,
) -> RusotoFuture<(), DeleteAuthorizerError> {
let request_uri = format!(
"/v2/apis/{api_id}/authorizers/{authorizer_id}",
api_id = input.api_id,
authorizer_id = input.authorizer_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(DeleteAuthorizerError::from_response(response))),
)
}
})
}
fn delete_deployment(
&self,
input: DeleteDeploymentRequest,
) -> RusotoFuture<(), DeleteDeploymentError> {
let request_uri = format!(
"/v2/apis/{api_id}/deployments/{deployment_id}",
api_id = input.api_id,
deployment_id = input.deployment_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(DeleteDeploymentError::from_response(response))),
)
}
})
}
fn delete_domain_name(
&self,
input: DeleteDomainNameRequest,
) -> RusotoFuture<(), DeleteDomainNameError> {
let request_uri = format!(
"/v2/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() == 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(DeleteDomainNameError::from_response(response))),
)
}
})
}
fn delete_integration(
&self,
input: DeleteIntegrationRequest,
) -> RusotoFuture<(), DeleteIntegrationError> {
let request_uri = format!(
"/v2/apis/{api_id}/integrations/{integration_id}",
api_id = input.api_id,
integration_id = input.integration_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!("/v2/apis/{api_id}/integrations/{integration_id}/integrationresponses/{integration_response_id}", api_id = input.api_id, integration_id = input.integration_id, integration_response_id = input.integration_response_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(DeleteIntegrationResponseError::from_response(response))
}))
}
})
}
fn delete_model(&self, input: DeleteModelRequest) -> RusotoFuture<(), DeleteModelError> {
let request_uri = format!(
"/v2/apis/{api_id}/models/{model_id}",
api_id = input.api_id,
model_id = input.model_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(DeleteModelError::from_response(response))),
)
}
})
}
fn delete_route(&self, input: DeleteRouteRequest) -> RusotoFuture<(), DeleteRouteError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}",
api_id = input.api_id,
route_id = input.route_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(DeleteRouteError::from_response(response))),
)
}
})
}
fn delete_route_response(
&self,
input: DeleteRouteResponseRequest,
) -> RusotoFuture<(), DeleteRouteResponseError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}/routeresponses/{route_response_id}",
api_id = input.api_id,
route_id = input.route_id,
route_response_id = input.route_response_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(DeleteRouteResponseError::from_response(response))
}),
)
}
})
}
fn delete_stage(&self, input: DeleteStageRequest) -> RusotoFuture<(), DeleteStageError> {
let request_uri = format!(
"/v2/apis/{api_id}/stages/{stage_name}",
api_id = input.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() == 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(DeleteStageError::from_response(response))),
)
}
})
}
fn get_api(&self, input: GetApiRequest) -> RusotoFuture<GetApiResponse, GetApiError> {
let request_uri = format!("/v2/apis/{api_id}", api_id = input.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.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::<GetApiResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetApiError::from_response(response))),
)
}
})
}
fn get_api_mapping(
&self,
input: GetApiMappingRequest,
) -> RusotoFuture<GetApiMappingResponse, GetApiMappingError> {
let request_uri = format!(
"/v2/domainnames/{domain_name}/apimappings/{api_mapping_id}",
api_mapping_id = input.api_mapping_id,
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();
params.put("apiId", &input.api_id);
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetApiMappingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetApiMappingError::from_response(response))),
)
}
})
}
fn get_api_mappings(
&self,
input: GetApiMappingsRequest,
) -> RusotoFuture<GetApiMappingsResponse, GetApiMappingsError> {
let request_uri = format!(
"/v2/domainnames/{domain_name}/apimappings",
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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetApiMappingsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetApiMappingsError::from_response(response))),
)
}
})
}
fn get_apis(&self, input: GetApisRequest) -> RusotoFuture<GetApisResponse, GetApisError> {
let request_uri = "/v2/apis";
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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetApisResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetApisError::from_response(response))),
)
}
})
}
fn get_authorizer(
&self,
input: GetAuthorizerRequest,
) -> RusotoFuture<GetAuthorizerResponse, GetAuthorizerError> {
let request_uri = format!(
"/v2/apis/{api_id}/authorizers/{authorizer_id}",
api_id = input.api_id,
authorizer_id = input.authorizer_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::<GetAuthorizerResponse>(&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<GetAuthorizersResponse, GetAuthorizersError> {
let request_uri = format!("/v2/apis/{api_id}/authorizers", api_id = input.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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetAuthorizersResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetAuthorizersError::from_response(response))),
)
}
})
}
fn get_deployment(
&self,
input: GetDeploymentRequest,
) -> RusotoFuture<GetDeploymentResponse, GetDeploymentError> {
let request_uri = format!(
"/v2/apis/{api_id}/deployments/{deployment_id}",
api_id = input.api_id,
deployment_id = input.deployment_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::<GetDeploymentResponse>(&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<GetDeploymentsResponse, GetDeploymentsError> {
let request_uri = format!("/v2/apis/{api_id}/deployments", api_id = input.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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetDeploymentsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDeploymentsError::from_response(response))),
)
}
})
}
fn get_domain_name(
&self,
input: GetDomainNameRequest,
) -> RusotoFuture<GetDomainNameResponse, GetDomainNameError> {
let request_uri = format!(
"/v2/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.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::<GetDomainNameResponse>(&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<GetDomainNamesResponse, GetDomainNamesError> {
let request_uri = "/v2/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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetDomainNamesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDomainNamesError::from_response(response))),
)
}
})
}
fn get_integration(
&self,
input: GetIntegrationRequest,
) -> RusotoFuture<GetIntegrationResult, GetIntegrationError> {
let request_uri = format!(
"/v2/apis/{api_id}/integrations/{integration_id}",
api_id = input.api_id,
integration_id = input.integration_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::<GetIntegrationResult>(&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<GetIntegrationResponseResponse, GetIntegrationResponseError> {
let request_uri = format!("/v2/apis/{api_id}/integrations/{integration_id}/integrationresponses/{integration_response_id}", api_id = input.api_id, integration_id = input.integration_id, integration_response_id = input.integration_response_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::<GetIntegrationResponseResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetIntegrationResponseError::from_response(response))
}),
)
}
})
}
fn get_integration_responses(
&self,
input: GetIntegrationResponsesRequest,
) -> RusotoFuture<GetIntegrationResponsesResponse, GetIntegrationResponsesError> {
let request_uri = format!(
"/v2/apis/{api_id}/integrations/{integration_id}/integrationresponses",
api_id = input.api_id,
integration_id = input.integration_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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetIntegrationResponsesResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetIntegrationResponsesError::from_response(response))
}))
}
})
}
fn get_integrations(
&self,
input: GetIntegrationsRequest,
) -> RusotoFuture<GetIntegrationsResponse, GetIntegrationsError> {
let request_uri = format!("/v2/apis/{api_id}/integrations", api_id = input.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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetIntegrationsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetIntegrationsError::from_response(response))),
)
}
})
}
fn get_model(&self, input: GetModelRequest) -> RusotoFuture<GetModelResponse, GetModelError> {
let request_uri = format!(
"/v2/apis/{api_id}/models/{model_id}",
api_id = input.api_id,
model_id = input.model_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::<GetModelResponse>(&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<GetModelTemplateResponse, GetModelTemplateError> {
let request_uri = format!(
"/v2/apis/{api_id}/models/{model_id}/template",
api_id = input.api_id,
model_id = input.model_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::<GetModelTemplateResponse>(&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<GetModelsResponse, GetModelsError> {
let request_uri = format!("/v2/apis/{api_id}/models", api_id = input.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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetModelsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetModelsError::from_response(response))),
)
}
})
}
fn get_route(&self, input: GetRouteRequest) -> RusotoFuture<GetRouteResult, GetRouteError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}",
api_id = input.api_id,
route_id = input.route_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::<GetRouteResult>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRouteError::from_response(response))),
)
}
})
}
fn get_route_response(
&self,
input: GetRouteResponseRequest,
) -> RusotoFuture<GetRouteResponseResponse, GetRouteResponseError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}/routeresponses/{route_response_id}",
api_id = input.api_id,
route_id = input.route_id,
route_response_id = input.route_response_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::<GetRouteResponseResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRouteResponseError::from_response(response))),
)
}
})
}
fn get_route_responses(
&self,
input: GetRouteResponsesRequest,
) -> RusotoFuture<GetRouteResponsesResponse, GetRouteResponsesError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}/routeresponses",
api_id = input.api_id,
route_id = input.route_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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetRouteResponsesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRouteResponsesError::from_response(response))),
)
}
})
}
fn get_routes(
&self,
input: GetRoutesRequest,
) -> RusotoFuture<GetRoutesResponse, GetRoutesError> {
let request_uri = format!("/v2/apis/{api_id}/routes", api_id = input.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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetRoutesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRoutesError::from_response(response))),
)
}
})
}
fn get_stage(&self, input: GetStageRequest) -> RusotoFuture<GetStageResponse, GetStageError> {
let request_uri = format!(
"/v2/apis/{api_id}/stages/{stage_name}",
api_id = input.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.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::<GetStageResponse>(&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<GetStagesResponse, GetStagesError> {
let request_uri = format!("/v2/apis/{api_id}/stages", api_id = input.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.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetStagesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetStagesError::from_response(response))),
)
}
})
}
fn update_api(
&self,
input: UpdateApiRequest,
) -> RusotoFuture<UpdateApiResponse, UpdateApiError> {
let request_uri = format!("/v2/apis/{api_id}", api_id = input.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.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::<UpdateApiResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateApiError::from_response(response))),
)
}
})
}
fn update_api_mapping(
&self,
input: UpdateApiMappingRequest,
) -> RusotoFuture<UpdateApiMappingResponse, UpdateApiMappingError> {
let request_uri = format!(
"/v2/domainnames/{domain_name}/apimappings/{api_mapping_id}",
api_mapping_id = input.api_mapping_id,
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.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::<UpdateApiMappingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateApiMappingError::from_response(response))),
)
}
})
}
fn update_authorizer(
&self,
input: UpdateAuthorizerRequest,
) -> RusotoFuture<UpdateAuthorizerResponse, UpdateAuthorizerError> {
let request_uri = format!(
"/v2/apis/{api_id}/authorizers/{authorizer_id}",
api_id = input.api_id,
authorizer_id = input.authorizer_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.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::<UpdateAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateAuthorizerError::from_response(response))),
)
}
})
}
fn update_deployment(
&self,
input: UpdateDeploymentRequest,
) -> RusotoFuture<UpdateDeploymentResponse, UpdateDeploymentError> {
let request_uri = format!(
"/v2/apis/{api_id}/deployments/{deployment_id}",
api_id = input.api_id,
deployment_id = input.deployment_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.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::<UpdateDeploymentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDeploymentError::from_response(response))),
)
}
})
}
fn update_domain_name(
&self,
input: UpdateDomainNameRequest,
) -> RusotoFuture<UpdateDomainNameResponse, UpdateDomainNameError> {
let request_uri = format!(
"/v2/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.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::<UpdateDomainNameResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDomainNameError::from_response(response))),
)
}
})
}
fn update_integration(
&self,
input: UpdateIntegrationRequest,
) -> RusotoFuture<UpdateIntegrationResult, UpdateIntegrationError> {
let request_uri = format!(
"/v2/apis/{api_id}/integrations/{integration_id}",
api_id = input.api_id,
integration_id = input.integration_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.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::<UpdateIntegrationResult>(&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<UpdateIntegrationResponseResponse, UpdateIntegrationResponseError> {
let request_uri = format!("/v2/apis/{api_id}/integrations/{integration_id}/integrationresponses/{integration_response_id}", api_id = input.api_id, integration_id = input.integration_id, integration_response_id = input.integration_response_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.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::<UpdateIntegrationResponseResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateIntegrationResponseError::from_response(response))
}))
}
})
}
fn update_model(
&self,
input: UpdateModelRequest,
) -> RusotoFuture<UpdateModelResponse, UpdateModelError> {
let request_uri = format!(
"/v2/apis/{api_id}/models/{model_id}",
api_id = input.api_id,
model_id = input.model_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.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::<UpdateModelResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateModelError::from_response(response))),
)
}
})
}
fn update_route(
&self,
input: UpdateRouteRequest,
) -> RusotoFuture<UpdateRouteResult, UpdateRouteError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}",
api_id = input.api_id,
route_id = input.route_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.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::<UpdateRouteResult>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateRouteError::from_response(response))),
)
}
})
}
fn update_route_response(
&self,
input: UpdateRouteResponseRequest,
) -> RusotoFuture<UpdateRouteResponseResponse, UpdateRouteResponseError> {
let request_uri = format!(
"/v2/apis/{api_id}/routes/{route_id}/routeresponses/{route_response_id}",
api_id = input.api_id,
route_id = input.route_id,
route_response_id = input.route_response_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.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::<UpdateRouteResponseResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateRouteResponseError::from_response(response))
}),
)
}
})
}
fn update_stage(
&self,
input: UpdateStageRequest,
) -> RusotoFuture<UpdateStageResponse, UpdateStageError> {
let request_uri = format!(
"/v2/apis/{api_id}/stages/{stage_name}",
api_id = input.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.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::<UpdateStageResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateStageError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}