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::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AllocateConnectionOnInterconnectRequest {
#[serde(rename = "bandwidth")]
pub bandwidth: String,
#[serde(rename = "connectionName")]
pub connection_name: String,
#[serde(rename = "interconnectId")]
pub interconnect_id: String,
#[serde(rename = "ownerAccount")]
pub owner_account: String,
#[serde(rename = "vlan")]
pub vlan: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AllocateHostedConnectionRequest {
#[serde(rename = "bandwidth")]
pub bandwidth: String,
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "connectionName")]
pub connection_name: String,
#[serde(rename = "ownerAccount")]
pub owner_account: String,
#[serde(rename = "vlan")]
pub vlan: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AllocatePrivateVirtualInterfaceRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "newPrivateVirtualInterfaceAllocation")]
pub new_private_virtual_interface_allocation: NewPrivateVirtualInterfaceAllocation,
#[serde(rename = "ownerAccount")]
pub owner_account: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AllocatePublicVirtualInterfaceRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "newPublicVirtualInterfaceAllocation")]
pub new_public_virtual_interface_allocation: NewPublicVirtualInterfaceAllocation,
#[serde(rename = "ownerAccount")]
pub owner_account: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateConnectionWithLagRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "lagId")]
pub lag_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateHostedConnectionRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "parentConnectionId")]
pub parent_connection_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateVirtualInterfaceRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "virtualInterfaceId")]
pub virtual_interface_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BGPPeer {
#[serde(rename = "addressFamily")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_family: Option<String>,
#[serde(rename = "amazonAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_address: Option<String>,
#[serde(rename = "asn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub asn: Option<i64>,
#[serde(rename = "authKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_key: Option<String>,
#[serde(rename = "awsDeviceV2")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device_v2: Option<String>,
#[serde(rename = "bgpPeerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bgp_peer_id: Option<String>,
#[serde(rename = "bgpPeerState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bgp_peer_state: Option<String>,
#[serde(rename = "bgpStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bgp_status: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ConfirmConnectionRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ConfirmConnectionResponse {
#[serde(rename = "connectionState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ConfirmPrivateVirtualInterfaceRequest {
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "virtualGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_id: Option<String>,
#[serde(rename = "virtualInterfaceId")]
pub virtual_interface_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ConfirmPrivateVirtualInterfaceResponse {
#[serde(rename = "virtualInterfaceState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ConfirmPublicVirtualInterfaceRequest {
#[serde(rename = "virtualInterfaceId")]
pub virtual_interface_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ConfirmPublicVirtualInterfaceResponse {
#[serde(rename = "virtualInterfaceState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Connection {
#[serde(rename = "awsDevice")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device: Option<String>,
#[serde(rename = "awsDeviceV2")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device_v2: Option<String>,
#[serde(rename = "bandwidth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bandwidth: Option<String>,
#[serde(rename = "connectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_id: Option<String>,
#[serde(rename = "connectionName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_name: Option<String>,
#[serde(rename = "connectionState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_state: Option<String>,
#[serde(rename = "hasLogicalRedundancy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub has_logical_redundancy: Option<String>,
#[serde(rename = "jumboFrameCapable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub jumbo_frame_capable: Option<bool>,
#[serde(rename = "lagId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_id: Option<String>,
#[serde(rename = "loaIssueTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa_issue_time: Option<f64>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "ownerAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_account: Option<String>,
#[serde(rename = "partnerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub partner_name: Option<String>,
#[serde(rename = "region")]
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
#[serde(rename = "vlan")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vlan: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Connections {
#[serde(rename = "connections")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connections: Option<Vec<Connection>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateBGPPeerRequest {
#[serde(rename = "newBGPPeer")]
#[serde(skip_serializing_if = "Option::is_none")]
pub new_bgp_peer: Option<NewBGPPeer>,
#[serde(rename = "virtualInterfaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateBGPPeerResponse {
#[serde(rename = "virtualInterface")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface: Option<VirtualInterface>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateConnectionRequest {
#[serde(rename = "bandwidth")]
pub bandwidth: String,
#[serde(rename = "connectionName")]
pub connection_name: String,
#[serde(rename = "lagId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_id: Option<String>,
#[serde(rename = "location")]
pub location: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDirectConnectGatewayAssociationRequest {
#[serde(rename = "directConnectGatewayId")]
pub direct_connect_gateway_id: String,
#[serde(rename = "virtualGatewayId")]
pub virtual_gateway_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDirectConnectGatewayAssociationResult {
#[serde(rename = "directConnectGatewayAssociation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_association: Option<DirectConnectGatewayAssociation>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDirectConnectGatewayRequest {
#[serde(rename = "amazonSideAsn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_side_asn: Option<i64>,
#[serde(rename = "directConnectGatewayName")]
pub direct_connect_gateway_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDirectConnectGatewayResult {
#[serde(rename = "directConnectGateway")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway: Option<DirectConnectGateway>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateInterconnectRequest {
#[serde(rename = "bandwidth")]
pub bandwidth: String,
#[serde(rename = "interconnectName")]
pub interconnect_name: String,
#[serde(rename = "lagId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_id: Option<String>,
#[serde(rename = "location")]
pub location: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateLagRequest {
#[serde(rename = "connectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_id: Option<String>,
#[serde(rename = "connectionsBandwidth")]
pub connections_bandwidth: String,
#[serde(rename = "lagName")]
pub lag_name: String,
#[serde(rename = "location")]
pub location: String,
#[serde(rename = "numberOfConnections")]
pub number_of_connections: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePrivateVirtualInterfaceRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "newPrivateVirtualInterface")]
pub new_private_virtual_interface: NewPrivateVirtualInterface,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePublicVirtualInterfaceRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "newPublicVirtualInterface")]
pub new_public_virtual_interface: NewPublicVirtualInterface,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBGPPeerRequest {
#[serde(rename = "asn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub asn: Option<i64>,
#[serde(rename = "bgpPeerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bgp_peer_id: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
#[serde(rename = "virtualInterfaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteBGPPeerResponse {
#[serde(rename = "virtualInterface")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface: Option<VirtualInterface>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteConnectionRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDirectConnectGatewayAssociationRequest {
#[serde(rename = "directConnectGatewayId")]
pub direct_connect_gateway_id: String,
#[serde(rename = "virtualGatewayId")]
pub virtual_gateway_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteDirectConnectGatewayAssociationResult {
#[serde(rename = "directConnectGatewayAssociation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_association: Option<DirectConnectGatewayAssociation>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDirectConnectGatewayRequest {
#[serde(rename = "directConnectGatewayId")]
pub direct_connect_gateway_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteDirectConnectGatewayResult {
#[serde(rename = "directConnectGateway")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway: Option<DirectConnectGateway>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteInterconnectRequest {
#[serde(rename = "interconnectId")]
pub interconnect_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteInterconnectResponse {
#[serde(rename = "interconnectState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub interconnect_state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteLagRequest {
#[serde(rename = "lagId")]
pub lag_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteVirtualInterfaceRequest {
#[serde(rename = "virtualInterfaceId")]
pub virtual_interface_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteVirtualInterfaceResponse {
#[serde(rename = "virtualInterfaceState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeConnectionLoaRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "loaContentType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa_content_type: Option<String>,
#[serde(rename = "providerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeConnectionLoaResponse {
#[serde(rename = "loa")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa: Option<Loa>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeConnectionsOnInterconnectRequest {
#[serde(rename = "interconnectId")]
pub interconnect_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeConnectionsRequest {
#[serde(rename = "connectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDirectConnectGatewayAssociationsRequest {
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "virtualGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeDirectConnectGatewayAssociationsResult {
#[serde(rename = "directConnectGatewayAssociations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_associations: Option<Vec<DirectConnectGatewayAssociation>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDirectConnectGatewayAttachmentsRequest {
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "virtualInterfaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeDirectConnectGatewayAttachmentsResult {
#[serde(rename = "directConnectGatewayAttachments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_attachments: Option<Vec<DirectConnectGatewayAttachment>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDirectConnectGatewaysRequest {
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeDirectConnectGatewaysResult {
#[serde(rename = "directConnectGateways")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateways: Option<Vec<DirectConnectGateway>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeHostedConnectionsRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeInterconnectLoaRequest {
#[serde(rename = "interconnectId")]
pub interconnect_id: String,
#[serde(rename = "loaContentType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa_content_type: Option<String>,
#[serde(rename = "providerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeInterconnectLoaResponse {
#[serde(rename = "loa")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa: Option<Loa>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeInterconnectsRequest {
#[serde(rename = "interconnectId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub interconnect_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeLagsRequest {
#[serde(rename = "lagId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeLoaRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "loaContentType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa_content_type: Option<String>,
#[serde(rename = "providerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeTagsRequest {
#[serde(rename = "resourceArns")]
pub resource_arns: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeTagsResponse {
#[serde(rename = "resourceTags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_tags: Option<Vec<ResourceTag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeVirtualInterfacesRequest {
#[serde(rename = "connectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_id: Option<String>,
#[serde(rename = "virtualInterfaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DirectConnectGateway {
#[serde(rename = "amazonSideAsn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_side_asn: Option<i64>,
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "directConnectGatewayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_name: Option<String>,
#[serde(rename = "directConnectGatewayState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_state: Option<String>,
#[serde(rename = "ownerAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_account: Option<String>,
#[serde(rename = "stateChangeError")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state_change_error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DirectConnectGatewayAssociation {
#[serde(rename = "associationState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub association_state: Option<String>,
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "stateChangeError")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state_change_error: Option<String>,
#[serde(rename = "virtualGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_id: Option<String>,
#[serde(rename = "virtualGatewayOwnerAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_owner_account: Option<String>,
#[serde(rename = "virtualGatewayRegion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_region: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DirectConnectGatewayAttachment {
#[serde(rename = "attachmentState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment_state: Option<String>,
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "stateChangeError")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state_change_error: Option<String>,
#[serde(rename = "virtualInterfaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_id: Option<String>,
#[serde(rename = "virtualInterfaceOwnerAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_owner_account: Option<String>,
#[serde(rename = "virtualInterfaceRegion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_region: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateConnectionFromLagRequest {
#[serde(rename = "connectionId")]
pub connection_id: String,
#[serde(rename = "lagId")]
pub lag_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Interconnect {
#[serde(rename = "awsDevice")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device: Option<String>,
#[serde(rename = "awsDeviceV2")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device_v2: Option<String>,
#[serde(rename = "bandwidth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bandwidth: Option<String>,
#[serde(rename = "hasLogicalRedundancy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub has_logical_redundancy: Option<String>,
#[serde(rename = "interconnectId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub interconnect_id: Option<String>,
#[serde(rename = "interconnectName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub interconnect_name: Option<String>,
#[serde(rename = "interconnectState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub interconnect_state: Option<String>,
#[serde(rename = "jumboFrameCapable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub jumbo_frame_capable: Option<bool>,
#[serde(rename = "lagId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_id: Option<String>,
#[serde(rename = "loaIssueTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa_issue_time: Option<f64>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "region")]
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Interconnects {
#[serde(rename = "interconnects")]
#[serde(skip_serializing_if = "Option::is_none")]
pub interconnects: Option<Vec<Interconnect>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Lag {
#[serde(rename = "allowsHostedConnections")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allows_hosted_connections: Option<bool>,
#[serde(rename = "awsDevice")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device: Option<String>,
#[serde(rename = "awsDeviceV2")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device_v2: Option<String>,
#[serde(rename = "connections")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connections: Option<Vec<Connection>>,
#[serde(rename = "connectionsBandwidth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connections_bandwidth: Option<String>,
#[serde(rename = "hasLogicalRedundancy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub has_logical_redundancy: Option<String>,
#[serde(rename = "jumboFrameCapable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub jumbo_frame_capable: Option<bool>,
#[serde(rename = "lagId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_id: Option<String>,
#[serde(rename = "lagName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_name: Option<String>,
#[serde(rename = "lagState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_state: Option<String>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "minimumLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_links: Option<i64>,
#[serde(rename = "numberOfConnections")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_connections: Option<i64>,
#[serde(rename = "ownerAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_account: Option<String>,
#[serde(rename = "region")]
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Lags {
#[serde(rename = "lags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lags: Option<Vec<Lag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Loa {
#[serde(rename = "loaContent")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa_content: Option<Vec<u8>>,
#[serde(rename = "loaContentType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub loa_content_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Location {
#[serde(rename = "locationCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location_code: Option<String>,
#[serde(rename = "locationName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location_name: Option<String>,
#[serde(rename = "region")]
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Locations {
#[serde(rename = "locations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locations: Option<Vec<Location>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NewBGPPeer {
#[serde(rename = "addressFamily")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_family: Option<String>,
#[serde(rename = "amazonAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_address: Option<String>,
#[serde(rename = "asn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub asn: Option<i64>,
#[serde(rename = "authKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_key: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NewPrivateVirtualInterface {
#[serde(rename = "addressFamily")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_family: Option<String>,
#[serde(rename = "amazonAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_address: Option<String>,
#[serde(rename = "asn")]
pub asn: i64,
#[serde(rename = "authKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_key: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "mtu")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mtu: Option<i64>,
#[serde(rename = "virtualGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_id: Option<String>,
#[serde(rename = "virtualInterfaceName")]
pub virtual_interface_name: String,
#[serde(rename = "vlan")]
pub vlan: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NewPrivateVirtualInterfaceAllocation {
#[serde(rename = "addressFamily")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_family: Option<String>,
#[serde(rename = "amazonAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_address: Option<String>,
#[serde(rename = "asn")]
pub asn: i64,
#[serde(rename = "authKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_key: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
#[serde(rename = "mtu")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mtu: Option<i64>,
#[serde(rename = "virtualInterfaceName")]
pub virtual_interface_name: String,
#[serde(rename = "vlan")]
pub vlan: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NewPublicVirtualInterface {
#[serde(rename = "addressFamily")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_family: Option<String>,
#[serde(rename = "amazonAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_address: Option<String>,
#[serde(rename = "asn")]
pub asn: i64,
#[serde(rename = "authKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_key: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
#[serde(rename = "routeFilterPrefixes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_filter_prefixes: Option<Vec<RouteFilterPrefix>>,
#[serde(rename = "virtualInterfaceName")]
pub virtual_interface_name: String,
#[serde(rename = "vlan")]
pub vlan: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NewPublicVirtualInterfaceAllocation {
#[serde(rename = "addressFamily")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_family: Option<String>,
#[serde(rename = "amazonAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_address: Option<String>,
#[serde(rename = "asn")]
pub asn: i64,
#[serde(rename = "authKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_key: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
#[serde(rename = "routeFilterPrefixes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_filter_prefixes: Option<Vec<RouteFilterPrefix>>,
#[serde(rename = "virtualInterfaceName")]
pub virtual_interface_name: String,
#[serde(rename = "vlan")]
pub vlan: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ResourceTag {
#[serde(rename = "resourceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arn: Option<String>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RouteFilterPrefix {
#[serde(rename = "cidr")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cidr: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "key")]
pub key: String,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tags")]
pub tags: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateLagRequest {
#[serde(rename = "lagId")]
pub lag_id: String,
#[serde(rename = "lagName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lag_name: Option<String>,
#[serde(rename = "minimumLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_links: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateVirtualInterfaceAttributesRequest {
#[serde(rename = "mtu")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mtu: Option<i64>,
#[serde(rename = "virtualInterfaceId")]
pub virtual_interface_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VirtualGateway {
#[serde(rename = "virtualGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_id: Option<String>,
#[serde(rename = "virtualGatewayState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VirtualGateways {
#[serde(rename = "virtualGateways")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateways: Option<Vec<VirtualGateway>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VirtualInterface {
#[serde(rename = "addressFamily")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_family: Option<String>,
#[serde(rename = "amazonAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_address: Option<String>,
#[serde(rename = "amazonSideAsn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_side_asn: Option<i64>,
#[serde(rename = "asn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub asn: Option<i64>,
#[serde(rename = "authKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_key: Option<String>,
#[serde(rename = "awsDeviceV2")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_device_v2: Option<String>,
#[serde(rename = "bgpPeers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bgp_peers: Option<Vec<BGPPeer>>,
#[serde(rename = "connectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_id: Option<String>,
#[serde(rename = "customerAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_address: Option<String>,
#[serde(rename = "customerRouterConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_router_config: Option<String>,
#[serde(rename = "directConnectGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub direct_connect_gateway_id: Option<String>,
#[serde(rename = "jumboFrameCapable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub jumbo_frame_capable: Option<bool>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "mtu")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mtu: Option<i64>,
#[serde(rename = "ownerAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_account: Option<String>,
#[serde(rename = "region")]
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
#[serde(rename = "routeFilterPrefixes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub route_filter_prefixes: Option<Vec<RouteFilterPrefix>>,
#[serde(rename = "virtualGatewayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_gateway_id: Option<String>,
#[serde(rename = "virtualInterfaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_id: Option<String>,
#[serde(rename = "virtualInterfaceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_name: Option<String>,
#[serde(rename = "virtualInterfaceState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_state: Option<String>,
#[serde(rename = "virtualInterfaceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interface_type: Option<String>,
#[serde(rename = "vlan")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vlan: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VirtualInterfaces {
#[serde(rename = "virtualInterfaces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub virtual_interfaces: Option<Vec<VirtualInterface>>,
}
#[derive(Debug, PartialEq)]
pub enum AllocateConnectionOnInterconnectError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AllocateConnectionOnInterconnectError {
pub fn from_response(res: BufferedHttpResponse) -> AllocateConnectionOnInterconnectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return AllocateConnectionOnInterconnectError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return AllocateConnectionOnInterconnectError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return AllocateConnectionOnInterconnectError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return AllocateConnectionOnInterconnectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AllocateConnectionOnInterconnectError {
fn from(err: serde_json::error::Error) -> AllocateConnectionOnInterconnectError {
AllocateConnectionOnInterconnectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AllocateConnectionOnInterconnectError {
fn from(err: CredentialsError) -> AllocateConnectionOnInterconnectError {
AllocateConnectionOnInterconnectError::Credentials(err)
}
}
impl From<HttpDispatchError> for AllocateConnectionOnInterconnectError {
fn from(err: HttpDispatchError) -> AllocateConnectionOnInterconnectError {
AllocateConnectionOnInterconnectError::HttpDispatch(err)
}
}
impl From<io::Error> for AllocateConnectionOnInterconnectError {
fn from(err: io::Error) -> AllocateConnectionOnInterconnectError {
AllocateConnectionOnInterconnectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AllocateConnectionOnInterconnectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AllocateConnectionOnInterconnectError {
fn description(&self) -> &str {
match *self {
AllocateConnectionOnInterconnectError::DirectConnectClient(ref cause) => cause,
AllocateConnectionOnInterconnectError::DirectConnectServer(ref cause) => cause,
AllocateConnectionOnInterconnectError::Validation(ref cause) => cause,
AllocateConnectionOnInterconnectError::Credentials(ref err) => err.description(),
AllocateConnectionOnInterconnectError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AllocateConnectionOnInterconnectError::ParseError(ref cause) => cause,
AllocateConnectionOnInterconnectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AllocateHostedConnectionError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AllocateHostedConnectionError {
pub fn from_response(res: BufferedHttpResponse) -> AllocateHostedConnectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return AllocateHostedConnectionError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return AllocateHostedConnectionError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return AllocateHostedConnectionError::Validation(error_message.to_string());
}
_ => {}
}
}
return AllocateHostedConnectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AllocateHostedConnectionError {
fn from(err: serde_json::error::Error) -> AllocateHostedConnectionError {
AllocateHostedConnectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AllocateHostedConnectionError {
fn from(err: CredentialsError) -> AllocateHostedConnectionError {
AllocateHostedConnectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for AllocateHostedConnectionError {
fn from(err: HttpDispatchError) -> AllocateHostedConnectionError {
AllocateHostedConnectionError::HttpDispatch(err)
}
}
impl From<io::Error> for AllocateHostedConnectionError {
fn from(err: io::Error) -> AllocateHostedConnectionError {
AllocateHostedConnectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AllocateHostedConnectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AllocateHostedConnectionError {
fn description(&self) -> &str {
match *self {
AllocateHostedConnectionError::DirectConnectClient(ref cause) => cause,
AllocateHostedConnectionError::DirectConnectServer(ref cause) => cause,
AllocateHostedConnectionError::Validation(ref cause) => cause,
AllocateHostedConnectionError::Credentials(ref err) => err.description(),
AllocateHostedConnectionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AllocateHostedConnectionError::ParseError(ref cause) => cause,
AllocateHostedConnectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AllocatePrivateVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AllocatePrivateVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> AllocatePrivateVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return AllocatePrivateVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return AllocatePrivateVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return AllocatePrivateVirtualInterfaceError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return AllocatePrivateVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AllocatePrivateVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> AllocatePrivateVirtualInterfaceError {
AllocatePrivateVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AllocatePrivateVirtualInterfaceError {
fn from(err: CredentialsError) -> AllocatePrivateVirtualInterfaceError {
AllocatePrivateVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AllocatePrivateVirtualInterfaceError {
fn from(err: HttpDispatchError) -> AllocatePrivateVirtualInterfaceError {
AllocatePrivateVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for AllocatePrivateVirtualInterfaceError {
fn from(err: io::Error) -> AllocatePrivateVirtualInterfaceError {
AllocatePrivateVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AllocatePrivateVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AllocatePrivateVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
AllocatePrivateVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
AllocatePrivateVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
AllocatePrivateVirtualInterfaceError::Validation(ref cause) => cause,
AllocatePrivateVirtualInterfaceError::Credentials(ref err) => err.description(),
AllocatePrivateVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AllocatePrivateVirtualInterfaceError::ParseError(ref cause) => cause,
AllocatePrivateVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AllocatePublicVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AllocatePublicVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> AllocatePublicVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return AllocatePublicVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return AllocatePublicVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return AllocatePublicVirtualInterfaceError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return AllocatePublicVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AllocatePublicVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> AllocatePublicVirtualInterfaceError {
AllocatePublicVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AllocatePublicVirtualInterfaceError {
fn from(err: CredentialsError) -> AllocatePublicVirtualInterfaceError {
AllocatePublicVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AllocatePublicVirtualInterfaceError {
fn from(err: HttpDispatchError) -> AllocatePublicVirtualInterfaceError {
AllocatePublicVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for AllocatePublicVirtualInterfaceError {
fn from(err: io::Error) -> AllocatePublicVirtualInterfaceError {
AllocatePublicVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AllocatePublicVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AllocatePublicVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
AllocatePublicVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
AllocatePublicVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
AllocatePublicVirtualInterfaceError::Validation(ref cause) => cause,
AllocatePublicVirtualInterfaceError::Credentials(ref err) => err.description(),
AllocatePublicVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AllocatePublicVirtualInterfaceError::ParseError(ref cause) => cause,
AllocatePublicVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateConnectionWithLagError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateConnectionWithLagError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateConnectionWithLagError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return AssociateConnectionWithLagError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return AssociateConnectionWithLagError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return AssociateConnectionWithLagError::Validation(error_message.to_string());
}
_ => {}
}
}
return AssociateConnectionWithLagError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateConnectionWithLagError {
fn from(err: serde_json::error::Error) -> AssociateConnectionWithLagError {
AssociateConnectionWithLagError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateConnectionWithLagError {
fn from(err: CredentialsError) -> AssociateConnectionWithLagError {
AssociateConnectionWithLagError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateConnectionWithLagError {
fn from(err: HttpDispatchError) -> AssociateConnectionWithLagError {
AssociateConnectionWithLagError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateConnectionWithLagError {
fn from(err: io::Error) -> AssociateConnectionWithLagError {
AssociateConnectionWithLagError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateConnectionWithLagError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateConnectionWithLagError {
fn description(&self) -> &str {
match *self {
AssociateConnectionWithLagError::DirectConnectClient(ref cause) => cause,
AssociateConnectionWithLagError::DirectConnectServer(ref cause) => cause,
AssociateConnectionWithLagError::Validation(ref cause) => cause,
AssociateConnectionWithLagError::Credentials(ref err) => err.description(),
AssociateConnectionWithLagError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateConnectionWithLagError::ParseError(ref cause) => cause,
AssociateConnectionWithLagError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateHostedConnectionError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateHostedConnectionError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateHostedConnectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return AssociateHostedConnectionError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return AssociateHostedConnectionError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return AssociateHostedConnectionError::Validation(error_message.to_string());
}
_ => {}
}
}
return AssociateHostedConnectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateHostedConnectionError {
fn from(err: serde_json::error::Error) -> AssociateHostedConnectionError {
AssociateHostedConnectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateHostedConnectionError {
fn from(err: CredentialsError) -> AssociateHostedConnectionError {
AssociateHostedConnectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateHostedConnectionError {
fn from(err: HttpDispatchError) -> AssociateHostedConnectionError {
AssociateHostedConnectionError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateHostedConnectionError {
fn from(err: io::Error) -> AssociateHostedConnectionError {
AssociateHostedConnectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateHostedConnectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateHostedConnectionError {
fn description(&self) -> &str {
match *self {
AssociateHostedConnectionError::DirectConnectClient(ref cause) => cause,
AssociateHostedConnectionError::DirectConnectServer(ref cause) => cause,
AssociateHostedConnectionError::Validation(ref cause) => cause,
AssociateHostedConnectionError::Credentials(ref err) => err.description(),
AssociateHostedConnectionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateHostedConnectionError::ParseError(ref cause) => cause,
AssociateHostedConnectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return AssociateVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return AssociateVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return AssociateVirtualInterfaceError::Validation(error_message.to_string());
}
_ => {}
}
}
return AssociateVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> AssociateVirtualInterfaceError {
AssociateVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateVirtualInterfaceError {
fn from(err: CredentialsError) -> AssociateVirtualInterfaceError {
AssociateVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateVirtualInterfaceError {
fn from(err: HttpDispatchError) -> AssociateVirtualInterfaceError {
AssociateVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateVirtualInterfaceError {
fn from(err: io::Error) -> AssociateVirtualInterfaceError {
AssociateVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
AssociateVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
AssociateVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
AssociateVirtualInterfaceError::Validation(ref cause) => cause,
AssociateVirtualInterfaceError::Credentials(ref err) => err.description(),
AssociateVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateVirtualInterfaceError::ParseError(ref cause) => cause,
AssociateVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmConnectionError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConfirmConnectionError {
pub fn from_response(res: BufferedHttpResponse) -> ConfirmConnectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return ConfirmConnectionError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return ConfirmConnectionError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return ConfirmConnectionError::Validation(error_message.to_string());
}
_ => {}
}
}
return ConfirmConnectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ConfirmConnectionError {
fn from(err: serde_json::error::Error) -> ConfirmConnectionError {
ConfirmConnectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ConfirmConnectionError {
fn from(err: CredentialsError) -> ConfirmConnectionError {
ConfirmConnectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConfirmConnectionError {
fn from(err: HttpDispatchError) -> ConfirmConnectionError {
ConfirmConnectionError::HttpDispatch(err)
}
}
impl From<io::Error> for ConfirmConnectionError {
fn from(err: io::Error) -> ConfirmConnectionError {
ConfirmConnectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConfirmConnectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConfirmConnectionError {
fn description(&self) -> &str {
match *self {
ConfirmConnectionError::DirectConnectClient(ref cause) => cause,
ConfirmConnectionError::DirectConnectServer(ref cause) => cause,
ConfirmConnectionError::Validation(ref cause) => cause,
ConfirmConnectionError::Credentials(ref err) => err.description(),
ConfirmConnectionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ConfirmConnectionError::ParseError(ref cause) => cause,
ConfirmConnectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmPrivateVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConfirmPrivateVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> ConfirmPrivateVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return ConfirmPrivateVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return ConfirmPrivateVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return ConfirmPrivateVirtualInterfaceError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return ConfirmPrivateVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ConfirmPrivateVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> ConfirmPrivateVirtualInterfaceError {
ConfirmPrivateVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ConfirmPrivateVirtualInterfaceError {
fn from(err: CredentialsError) -> ConfirmPrivateVirtualInterfaceError {
ConfirmPrivateVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConfirmPrivateVirtualInterfaceError {
fn from(err: HttpDispatchError) -> ConfirmPrivateVirtualInterfaceError {
ConfirmPrivateVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for ConfirmPrivateVirtualInterfaceError {
fn from(err: io::Error) -> ConfirmPrivateVirtualInterfaceError {
ConfirmPrivateVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConfirmPrivateVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConfirmPrivateVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
ConfirmPrivateVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
ConfirmPrivateVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
ConfirmPrivateVirtualInterfaceError::Validation(ref cause) => cause,
ConfirmPrivateVirtualInterfaceError::Credentials(ref err) => err.description(),
ConfirmPrivateVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ConfirmPrivateVirtualInterfaceError::ParseError(ref cause) => cause,
ConfirmPrivateVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmPublicVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConfirmPublicVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> ConfirmPublicVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return ConfirmPublicVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return ConfirmPublicVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return ConfirmPublicVirtualInterfaceError::Validation(error_message.to_string());
}
_ => {}
}
}
return ConfirmPublicVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ConfirmPublicVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> ConfirmPublicVirtualInterfaceError {
ConfirmPublicVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ConfirmPublicVirtualInterfaceError {
fn from(err: CredentialsError) -> ConfirmPublicVirtualInterfaceError {
ConfirmPublicVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConfirmPublicVirtualInterfaceError {
fn from(err: HttpDispatchError) -> ConfirmPublicVirtualInterfaceError {
ConfirmPublicVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for ConfirmPublicVirtualInterfaceError {
fn from(err: io::Error) -> ConfirmPublicVirtualInterfaceError {
ConfirmPublicVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConfirmPublicVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConfirmPublicVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
ConfirmPublicVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
ConfirmPublicVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
ConfirmPublicVirtualInterfaceError::Validation(ref cause) => cause,
ConfirmPublicVirtualInterfaceError::Credentials(ref err) => err.description(),
ConfirmPublicVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ConfirmPublicVirtualInterfaceError::ParseError(ref cause) => cause,
ConfirmPublicVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateBGPPeerError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateBGPPeerError {
pub fn from_response(res: BufferedHttpResponse) -> CreateBGPPeerError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreateBGPPeerError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return CreateBGPPeerError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return CreateBGPPeerError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateBGPPeerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateBGPPeerError {
fn from(err: serde_json::error::Error) -> CreateBGPPeerError {
CreateBGPPeerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateBGPPeerError {
fn from(err: CredentialsError) -> CreateBGPPeerError {
CreateBGPPeerError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateBGPPeerError {
fn from(err: HttpDispatchError) -> CreateBGPPeerError {
CreateBGPPeerError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateBGPPeerError {
fn from(err: io::Error) -> CreateBGPPeerError {
CreateBGPPeerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateBGPPeerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateBGPPeerError {
fn description(&self) -> &str {
match *self {
CreateBGPPeerError::DirectConnectClient(ref cause) => cause,
CreateBGPPeerError::DirectConnectServer(ref cause) => cause,
CreateBGPPeerError::Validation(ref cause) => cause,
CreateBGPPeerError::Credentials(ref err) => err.description(),
CreateBGPPeerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateBGPPeerError::ParseError(ref cause) => cause,
CreateBGPPeerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateConnectionError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateConnectionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateConnectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreateConnectionError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return CreateConnectionError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return CreateConnectionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateConnectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateConnectionError {
fn from(err: serde_json::error::Error) -> CreateConnectionError {
CreateConnectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateConnectionError {
fn from(err: CredentialsError) -> CreateConnectionError {
CreateConnectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateConnectionError {
fn from(err: HttpDispatchError) -> CreateConnectionError {
CreateConnectionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateConnectionError {
fn from(err: io::Error) -> CreateConnectionError {
CreateConnectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateConnectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateConnectionError {
fn description(&self) -> &str {
match *self {
CreateConnectionError::DirectConnectClient(ref cause) => cause,
CreateConnectionError::DirectConnectServer(ref cause) => cause,
CreateConnectionError::Validation(ref cause) => cause,
CreateConnectionError::Credentials(ref err) => err.description(),
CreateConnectionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateConnectionError::ParseError(ref cause) => cause,
CreateConnectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDirectConnectGatewayError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDirectConnectGatewayError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDirectConnectGatewayError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreateDirectConnectGatewayError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return CreateDirectConnectGatewayError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return CreateDirectConnectGatewayError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDirectConnectGatewayError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDirectConnectGatewayError {
fn from(err: serde_json::error::Error) -> CreateDirectConnectGatewayError {
CreateDirectConnectGatewayError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDirectConnectGatewayError {
fn from(err: CredentialsError) -> CreateDirectConnectGatewayError {
CreateDirectConnectGatewayError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDirectConnectGatewayError {
fn from(err: HttpDispatchError) -> CreateDirectConnectGatewayError {
CreateDirectConnectGatewayError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDirectConnectGatewayError {
fn from(err: io::Error) -> CreateDirectConnectGatewayError {
CreateDirectConnectGatewayError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDirectConnectGatewayError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDirectConnectGatewayError {
fn description(&self) -> &str {
match *self {
CreateDirectConnectGatewayError::DirectConnectClient(ref cause) => cause,
CreateDirectConnectGatewayError::DirectConnectServer(ref cause) => cause,
CreateDirectConnectGatewayError::Validation(ref cause) => cause,
CreateDirectConnectGatewayError::Credentials(ref err) => err.description(),
CreateDirectConnectGatewayError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateDirectConnectGatewayError::ParseError(ref cause) => cause,
CreateDirectConnectGatewayError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDirectConnectGatewayAssociationError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDirectConnectGatewayAssociationError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDirectConnectGatewayAssociationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreateDirectConnectGatewayAssociationError::DirectConnectClient(
String::from(error_message),
);
}
"DirectConnectServerException" => {
return CreateDirectConnectGatewayAssociationError::DirectConnectServer(
String::from(error_message),
);
}
"ValidationException" => {
return CreateDirectConnectGatewayAssociationError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return CreateDirectConnectGatewayAssociationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDirectConnectGatewayAssociationError {
fn from(err: serde_json::error::Error) -> CreateDirectConnectGatewayAssociationError {
CreateDirectConnectGatewayAssociationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDirectConnectGatewayAssociationError {
fn from(err: CredentialsError) -> CreateDirectConnectGatewayAssociationError {
CreateDirectConnectGatewayAssociationError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDirectConnectGatewayAssociationError {
fn from(err: HttpDispatchError) -> CreateDirectConnectGatewayAssociationError {
CreateDirectConnectGatewayAssociationError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDirectConnectGatewayAssociationError {
fn from(err: io::Error) -> CreateDirectConnectGatewayAssociationError {
CreateDirectConnectGatewayAssociationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDirectConnectGatewayAssociationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDirectConnectGatewayAssociationError {
fn description(&self) -> &str {
match *self {
CreateDirectConnectGatewayAssociationError::DirectConnectClient(ref cause) => cause,
CreateDirectConnectGatewayAssociationError::DirectConnectServer(ref cause) => cause,
CreateDirectConnectGatewayAssociationError::Validation(ref cause) => cause,
CreateDirectConnectGatewayAssociationError::Credentials(ref err) => err.description(),
CreateDirectConnectGatewayAssociationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateDirectConnectGatewayAssociationError::ParseError(ref cause) => cause,
CreateDirectConnectGatewayAssociationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateInterconnectError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateInterconnectError {
pub fn from_response(res: BufferedHttpResponse) -> CreateInterconnectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreateInterconnectError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return CreateInterconnectError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return CreateInterconnectError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateInterconnectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateInterconnectError {
fn from(err: serde_json::error::Error) -> CreateInterconnectError {
CreateInterconnectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateInterconnectError {
fn from(err: CredentialsError) -> CreateInterconnectError {
CreateInterconnectError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateInterconnectError {
fn from(err: HttpDispatchError) -> CreateInterconnectError {
CreateInterconnectError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateInterconnectError {
fn from(err: io::Error) -> CreateInterconnectError {
CreateInterconnectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateInterconnectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateInterconnectError {
fn description(&self) -> &str {
match *self {
CreateInterconnectError::DirectConnectClient(ref cause) => cause,
CreateInterconnectError::DirectConnectServer(ref cause) => cause,
CreateInterconnectError::Validation(ref cause) => cause,
CreateInterconnectError::Credentials(ref err) => err.description(),
CreateInterconnectError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateInterconnectError::ParseError(ref cause) => cause,
CreateInterconnectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateLagError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateLagError {
pub fn from_response(res: BufferedHttpResponse) -> CreateLagError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreateLagError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return CreateLagError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return CreateLagError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateLagError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateLagError {
fn from(err: serde_json::error::Error) -> CreateLagError {
CreateLagError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateLagError {
fn from(err: CredentialsError) -> CreateLagError {
CreateLagError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateLagError {
fn from(err: HttpDispatchError) -> CreateLagError {
CreateLagError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateLagError {
fn from(err: io::Error) -> CreateLagError {
CreateLagError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateLagError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateLagError {
fn description(&self) -> &str {
match *self {
CreateLagError::DirectConnectClient(ref cause) => cause,
CreateLagError::DirectConnectServer(ref cause) => cause,
CreateLagError::Validation(ref cause) => cause,
CreateLagError::Credentials(ref err) => err.description(),
CreateLagError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateLagError::ParseError(ref cause) => cause,
CreateLagError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePrivateVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePrivateVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePrivateVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreatePrivateVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return CreatePrivateVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return CreatePrivateVirtualInterfaceError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreatePrivateVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreatePrivateVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> CreatePrivateVirtualInterfaceError {
CreatePrivateVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreatePrivateVirtualInterfaceError {
fn from(err: CredentialsError) -> CreatePrivateVirtualInterfaceError {
CreatePrivateVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePrivateVirtualInterfaceError {
fn from(err: HttpDispatchError) -> CreatePrivateVirtualInterfaceError {
CreatePrivateVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePrivateVirtualInterfaceError {
fn from(err: io::Error) -> CreatePrivateVirtualInterfaceError {
CreatePrivateVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePrivateVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePrivateVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
CreatePrivateVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
CreatePrivateVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
CreatePrivateVirtualInterfaceError::Validation(ref cause) => cause,
CreatePrivateVirtualInterfaceError::Credentials(ref err) => err.description(),
CreatePrivateVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreatePrivateVirtualInterfaceError::ParseError(ref cause) => cause,
CreatePrivateVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePublicVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePublicVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePublicVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return CreatePublicVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return CreatePublicVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return CreatePublicVirtualInterfaceError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreatePublicVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreatePublicVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> CreatePublicVirtualInterfaceError {
CreatePublicVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreatePublicVirtualInterfaceError {
fn from(err: CredentialsError) -> CreatePublicVirtualInterfaceError {
CreatePublicVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePublicVirtualInterfaceError {
fn from(err: HttpDispatchError) -> CreatePublicVirtualInterfaceError {
CreatePublicVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePublicVirtualInterfaceError {
fn from(err: io::Error) -> CreatePublicVirtualInterfaceError {
CreatePublicVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePublicVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePublicVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
CreatePublicVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
CreatePublicVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
CreatePublicVirtualInterfaceError::Validation(ref cause) => cause,
CreatePublicVirtualInterfaceError::Credentials(ref err) => err.description(),
CreatePublicVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreatePublicVirtualInterfaceError::ParseError(ref cause) => cause,
CreatePublicVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBGPPeerError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteBGPPeerError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteBGPPeerError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DeleteBGPPeerError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DeleteBGPPeerError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DeleteBGPPeerError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteBGPPeerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteBGPPeerError {
fn from(err: serde_json::error::Error) -> DeleteBGPPeerError {
DeleteBGPPeerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteBGPPeerError {
fn from(err: CredentialsError) -> DeleteBGPPeerError {
DeleteBGPPeerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteBGPPeerError {
fn from(err: HttpDispatchError) -> DeleteBGPPeerError {
DeleteBGPPeerError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteBGPPeerError {
fn from(err: io::Error) -> DeleteBGPPeerError {
DeleteBGPPeerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteBGPPeerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBGPPeerError {
fn description(&self) -> &str {
match *self {
DeleteBGPPeerError::DirectConnectClient(ref cause) => cause,
DeleteBGPPeerError::DirectConnectServer(ref cause) => cause,
DeleteBGPPeerError::Validation(ref cause) => cause,
DeleteBGPPeerError::Credentials(ref err) => err.description(),
DeleteBGPPeerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteBGPPeerError::ParseError(ref cause) => cause,
DeleteBGPPeerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteConnectionError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteConnectionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteConnectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DeleteConnectionError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DeleteConnectionError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DeleteConnectionError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteConnectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteConnectionError {
fn from(err: serde_json::error::Error) -> DeleteConnectionError {
DeleteConnectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteConnectionError {
fn from(err: CredentialsError) -> DeleteConnectionError {
DeleteConnectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteConnectionError {
fn from(err: HttpDispatchError) -> DeleteConnectionError {
DeleteConnectionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteConnectionError {
fn from(err: io::Error) -> DeleteConnectionError {
DeleteConnectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteConnectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteConnectionError {
fn description(&self) -> &str {
match *self {
DeleteConnectionError::DirectConnectClient(ref cause) => cause,
DeleteConnectionError::DirectConnectServer(ref cause) => cause,
DeleteConnectionError::Validation(ref cause) => cause,
DeleteConnectionError::Credentials(ref err) => err.description(),
DeleteConnectionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteConnectionError::ParseError(ref cause) => cause,
DeleteConnectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDirectConnectGatewayError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDirectConnectGatewayError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDirectConnectGatewayError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DeleteDirectConnectGatewayError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DeleteDirectConnectGatewayError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteDirectConnectGatewayError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDirectConnectGatewayError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDirectConnectGatewayError {
fn from(err: serde_json::error::Error) -> DeleteDirectConnectGatewayError {
DeleteDirectConnectGatewayError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDirectConnectGatewayError {
fn from(err: CredentialsError) -> DeleteDirectConnectGatewayError {
DeleteDirectConnectGatewayError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDirectConnectGatewayError {
fn from(err: HttpDispatchError) -> DeleteDirectConnectGatewayError {
DeleteDirectConnectGatewayError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDirectConnectGatewayError {
fn from(err: io::Error) -> DeleteDirectConnectGatewayError {
DeleteDirectConnectGatewayError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDirectConnectGatewayError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDirectConnectGatewayError {
fn description(&self) -> &str {
match *self {
DeleteDirectConnectGatewayError::DirectConnectClient(ref cause) => cause,
DeleteDirectConnectGatewayError::DirectConnectServer(ref cause) => cause,
DeleteDirectConnectGatewayError::Validation(ref cause) => cause,
DeleteDirectConnectGatewayError::Credentials(ref err) => err.description(),
DeleteDirectConnectGatewayError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteDirectConnectGatewayError::ParseError(ref cause) => cause,
DeleteDirectConnectGatewayError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDirectConnectGatewayAssociationError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDirectConnectGatewayAssociationError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDirectConnectGatewayAssociationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DeleteDirectConnectGatewayAssociationError::DirectConnectClient(
String::from(error_message),
);
}
"DirectConnectServerException" => {
return DeleteDirectConnectGatewayAssociationError::DirectConnectServer(
String::from(error_message),
);
}
"ValidationException" => {
return DeleteDirectConnectGatewayAssociationError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return DeleteDirectConnectGatewayAssociationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDirectConnectGatewayAssociationError {
fn from(err: serde_json::error::Error) -> DeleteDirectConnectGatewayAssociationError {
DeleteDirectConnectGatewayAssociationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDirectConnectGatewayAssociationError {
fn from(err: CredentialsError) -> DeleteDirectConnectGatewayAssociationError {
DeleteDirectConnectGatewayAssociationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDirectConnectGatewayAssociationError {
fn from(err: HttpDispatchError) -> DeleteDirectConnectGatewayAssociationError {
DeleteDirectConnectGatewayAssociationError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDirectConnectGatewayAssociationError {
fn from(err: io::Error) -> DeleteDirectConnectGatewayAssociationError {
DeleteDirectConnectGatewayAssociationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDirectConnectGatewayAssociationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDirectConnectGatewayAssociationError {
fn description(&self) -> &str {
match *self {
DeleteDirectConnectGatewayAssociationError::DirectConnectClient(ref cause) => cause,
DeleteDirectConnectGatewayAssociationError::DirectConnectServer(ref cause) => cause,
DeleteDirectConnectGatewayAssociationError::Validation(ref cause) => cause,
DeleteDirectConnectGatewayAssociationError::Credentials(ref err) => err.description(),
DeleteDirectConnectGatewayAssociationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteDirectConnectGatewayAssociationError::ParseError(ref cause) => cause,
DeleteDirectConnectGatewayAssociationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteInterconnectError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteInterconnectError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteInterconnectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DeleteInterconnectError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DeleteInterconnectError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DeleteInterconnectError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteInterconnectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteInterconnectError {
fn from(err: serde_json::error::Error) -> DeleteInterconnectError {
DeleteInterconnectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteInterconnectError {
fn from(err: CredentialsError) -> DeleteInterconnectError {
DeleteInterconnectError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteInterconnectError {
fn from(err: HttpDispatchError) -> DeleteInterconnectError {
DeleteInterconnectError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteInterconnectError {
fn from(err: io::Error) -> DeleteInterconnectError {
DeleteInterconnectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteInterconnectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteInterconnectError {
fn description(&self) -> &str {
match *self {
DeleteInterconnectError::DirectConnectClient(ref cause) => cause,
DeleteInterconnectError::DirectConnectServer(ref cause) => cause,
DeleteInterconnectError::Validation(ref cause) => cause,
DeleteInterconnectError::Credentials(ref err) => err.description(),
DeleteInterconnectError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteInterconnectError::ParseError(ref cause) => cause,
DeleteInterconnectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteLagError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteLagError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteLagError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DeleteLagError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DeleteLagError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DeleteLagError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteLagError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteLagError {
fn from(err: serde_json::error::Error) -> DeleteLagError {
DeleteLagError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteLagError {
fn from(err: CredentialsError) -> DeleteLagError {
DeleteLagError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteLagError {
fn from(err: HttpDispatchError) -> DeleteLagError {
DeleteLagError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteLagError {
fn from(err: io::Error) -> DeleteLagError {
DeleteLagError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteLagError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteLagError {
fn description(&self) -> &str {
match *self {
DeleteLagError::DirectConnectClient(ref cause) => cause,
DeleteLagError::DirectConnectServer(ref cause) => cause,
DeleteLagError::Validation(ref cause) => cause,
DeleteLagError::Credentials(ref err) => err.description(),
DeleteLagError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteLagError::ParseError(ref cause) => cause,
DeleteLagError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteVirtualInterfaceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteVirtualInterfaceError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteVirtualInterfaceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DeleteVirtualInterfaceError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DeleteVirtualInterfaceError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteVirtualInterfaceError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteVirtualInterfaceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteVirtualInterfaceError {
fn from(err: serde_json::error::Error) -> DeleteVirtualInterfaceError {
DeleteVirtualInterfaceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteVirtualInterfaceError {
fn from(err: CredentialsError) -> DeleteVirtualInterfaceError {
DeleteVirtualInterfaceError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteVirtualInterfaceError {
fn from(err: HttpDispatchError) -> DeleteVirtualInterfaceError {
DeleteVirtualInterfaceError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteVirtualInterfaceError {
fn from(err: io::Error) -> DeleteVirtualInterfaceError {
DeleteVirtualInterfaceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteVirtualInterfaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteVirtualInterfaceError {
fn description(&self) -> &str {
match *self {
DeleteVirtualInterfaceError::DirectConnectClient(ref cause) => cause,
DeleteVirtualInterfaceError::DirectConnectServer(ref cause) => cause,
DeleteVirtualInterfaceError::Validation(ref cause) => cause,
DeleteVirtualInterfaceError::Credentials(ref err) => err.description(),
DeleteVirtualInterfaceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteVirtualInterfaceError::ParseError(ref cause) => cause,
DeleteVirtualInterfaceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeConnectionLoaError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeConnectionLoaError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeConnectionLoaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeConnectionLoaError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeConnectionLoaError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeConnectionLoaError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeConnectionLoaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeConnectionLoaError {
fn from(err: serde_json::error::Error) -> DescribeConnectionLoaError {
DescribeConnectionLoaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeConnectionLoaError {
fn from(err: CredentialsError) -> DescribeConnectionLoaError {
DescribeConnectionLoaError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeConnectionLoaError {
fn from(err: HttpDispatchError) -> DescribeConnectionLoaError {
DescribeConnectionLoaError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeConnectionLoaError {
fn from(err: io::Error) -> DescribeConnectionLoaError {
DescribeConnectionLoaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeConnectionLoaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeConnectionLoaError {
fn description(&self) -> &str {
match *self {
DescribeConnectionLoaError::DirectConnectClient(ref cause) => cause,
DescribeConnectionLoaError::DirectConnectServer(ref cause) => cause,
DescribeConnectionLoaError::Validation(ref cause) => cause,
DescribeConnectionLoaError::Credentials(ref err) => err.description(),
DescribeConnectionLoaError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeConnectionLoaError::ParseError(ref cause) => cause,
DescribeConnectionLoaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeConnectionsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeConnectionsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeConnectionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeConnectionsError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeConnectionsError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeConnectionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeConnectionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeConnectionsError {
fn from(err: serde_json::error::Error) -> DescribeConnectionsError {
DescribeConnectionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeConnectionsError {
fn from(err: CredentialsError) -> DescribeConnectionsError {
DescribeConnectionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeConnectionsError {
fn from(err: HttpDispatchError) -> DescribeConnectionsError {
DescribeConnectionsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeConnectionsError {
fn from(err: io::Error) -> DescribeConnectionsError {
DescribeConnectionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeConnectionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeConnectionsError {
fn description(&self) -> &str {
match *self {
DescribeConnectionsError::DirectConnectClient(ref cause) => cause,
DescribeConnectionsError::DirectConnectServer(ref cause) => cause,
DescribeConnectionsError::Validation(ref cause) => cause,
DescribeConnectionsError::Credentials(ref err) => err.description(),
DescribeConnectionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeConnectionsError::ParseError(ref cause) => cause,
DescribeConnectionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeConnectionsOnInterconnectError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeConnectionsOnInterconnectError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeConnectionsOnInterconnectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeConnectionsOnInterconnectError::DirectConnectClient(
String::from(error_message),
);
}
"DirectConnectServerException" => {
return DescribeConnectionsOnInterconnectError::DirectConnectServer(
String::from(error_message),
);
}
"ValidationException" => {
return DescribeConnectionsOnInterconnectError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return DescribeConnectionsOnInterconnectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeConnectionsOnInterconnectError {
fn from(err: serde_json::error::Error) -> DescribeConnectionsOnInterconnectError {
DescribeConnectionsOnInterconnectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeConnectionsOnInterconnectError {
fn from(err: CredentialsError) -> DescribeConnectionsOnInterconnectError {
DescribeConnectionsOnInterconnectError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeConnectionsOnInterconnectError {
fn from(err: HttpDispatchError) -> DescribeConnectionsOnInterconnectError {
DescribeConnectionsOnInterconnectError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeConnectionsOnInterconnectError {
fn from(err: io::Error) -> DescribeConnectionsOnInterconnectError {
DescribeConnectionsOnInterconnectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeConnectionsOnInterconnectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeConnectionsOnInterconnectError {
fn description(&self) -> &str {
match *self {
DescribeConnectionsOnInterconnectError::DirectConnectClient(ref cause) => cause,
DescribeConnectionsOnInterconnectError::DirectConnectServer(ref cause) => cause,
DescribeConnectionsOnInterconnectError::Validation(ref cause) => cause,
DescribeConnectionsOnInterconnectError::Credentials(ref err) => err.description(),
DescribeConnectionsOnInterconnectError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeConnectionsOnInterconnectError::ParseError(ref cause) => cause,
DescribeConnectionsOnInterconnectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDirectConnectGatewayAssociationsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDirectConnectGatewayAssociationsError {
pub fn from_response(
res: BufferedHttpResponse,
) -> DescribeDirectConnectGatewayAssociationsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeDirectConnectGatewayAssociationsError::DirectConnectClient(
String::from(error_message),
);
}
"DirectConnectServerException" => {
return DescribeDirectConnectGatewayAssociationsError::DirectConnectServer(
String::from(error_message),
);
}
"ValidationException" => {
return DescribeDirectConnectGatewayAssociationsError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return DescribeDirectConnectGatewayAssociationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDirectConnectGatewayAssociationsError {
fn from(err: serde_json::error::Error) -> DescribeDirectConnectGatewayAssociationsError {
DescribeDirectConnectGatewayAssociationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDirectConnectGatewayAssociationsError {
fn from(err: CredentialsError) -> DescribeDirectConnectGatewayAssociationsError {
DescribeDirectConnectGatewayAssociationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDirectConnectGatewayAssociationsError {
fn from(err: HttpDispatchError) -> DescribeDirectConnectGatewayAssociationsError {
DescribeDirectConnectGatewayAssociationsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDirectConnectGatewayAssociationsError {
fn from(err: io::Error) -> DescribeDirectConnectGatewayAssociationsError {
DescribeDirectConnectGatewayAssociationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDirectConnectGatewayAssociationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDirectConnectGatewayAssociationsError {
fn description(&self) -> &str {
match *self {
DescribeDirectConnectGatewayAssociationsError::DirectConnectClient(ref cause) => cause,
DescribeDirectConnectGatewayAssociationsError::DirectConnectServer(ref cause) => cause,
DescribeDirectConnectGatewayAssociationsError::Validation(ref cause) => cause,
DescribeDirectConnectGatewayAssociationsError::Credentials(ref err) => {
err.description()
}
DescribeDirectConnectGatewayAssociationsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDirectConnectGatewayAssociationsError::ParseError(ref cause) => cause,
DescribeDirectConnectGatewayAssociationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDirectConnectGatewayAttachmentsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDirectConnectGatewayAttachmentsError {
pub fn from_response(
res: BufferedHttpResponse,
) -> DescribeDirectConnectGatewayAttachmentsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeDirectConnectGatewayAttachmentsError::DirectConnectClient(
String::from(error_message),
);
}
"DirectConnectServerException" => {
return DescribeDirectConnectGatewayAttachmentsError::DirectConnectServer(
String::from(error_message),
);
}
"ValidationException" => {
return DescribeDirectConnectGatewayAttachmentsError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return DescribeDirectConnectGatewayAttachmentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDirectConnectGatewayAttachmentsError {
fn from(err: serde_json::error::Error) -> DescribeDirectConnectGatewayAttachmentsError {
DescribeDirectConnectGatewayAttachmentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDirectConnectGatewayAttachmentsError {
fn from(err: CredentialsError) -> DescribeDirectConnectGatewayAttachmentsError {
DescribeDirectConnectGatewayAttachmentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDirectConnectGatewayAttachmentsError {
fn from(err: HttpDispatchError) -> DescribeDirectConnectGatewayAttachmentsError {
DescribeDirectConnectGatewayAttachmentsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDirectConnectGatewayAttachmentsError {
fn from(err: io::Error) -> DescribeDirectConnectGatewayAttachmentsError {
DescribeDirectConnectGatewayAttachmentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDirectConnectGatewayAttachmentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDirectConnectGatewayAttachmentsError {
fn description(&self) -> &str {
match *self {
DescribeDirectConnectGatewayAttachmentsError::DirectConnectClient(ref cause) => cause,
DescribeDirectConnectGatewayAttachmentsError::DirectConnectServer(ref cause) => cause,
DescribeDirectConnectGatewayAttachmentsError::Validation(ref cause) => cause,
DescribeDirectConnectGatewayAttachmentsError::Credentials(ref err) => err.description(),
DescribeDirectConnectGatewayAttachmentsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDirectConnectGatewayAttachmentsError::ParseError(ref cause) => cause,
DescribeDirectConnectGatewayAttachmentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDirectConnectGatewaysError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDirectConnectGatewaysError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeDirectConnectGatewaysError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeDirectConnectGatewaysError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeDirectConnectGatewaysError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeDirectConnectGatewaysError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeDirectConnectGatewaysError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDirectConnectGatewaysError {
fn from(err: serde_json::error::Error) -> DescribeDirectConnectGatewaysError {
DescribeDirectConnectGatewaysError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDirectConnectGatewaysError {
fn from(err: CredentialsError) -> DescribeDirectConnectGatewaysError {
DescribeDirectConnectGatewaysError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDirectConnectGatewaysError {
fn from(err: HttpDispatchError) -> DescribeDirectConnectGatewaysError {
DescribeDirectConnectGatewaysError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDirectConnectGatewaysError {
fn from(err: io::Error) -> DescribeDirectConnectGatewaysError {
DescribeDirectConnectGatewaysError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDirectConnectGatewaysError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDirectConnectGatewaysError {
fn description(&self) -> &str {
match *self {
DescribeDirectConnectGatewaysError::DirectConnectClient(ref cause) => cause,
DescribeDirectConnectGatewaysError::DirectConnectServer(ref cause) => cause,
DescribeDirectConnectGatewaysError::Validation(ref cause) => cause,
DescribeDirectConnectGatewaysError::Credentials(ref err) => err.description(),
DescribeDirectConnectGatewaysError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDirectConnectGatewaysError::ParseError(ref cause) => cause,
DescribeDirectConnectGatewaysError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeHostedConnectionsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeHostedConnectionsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeHostedConnectionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeHostedConnectionsError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeHostedConnectionsError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeHostedConnectionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeHostedConnectionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeHostedConnectionsError {
fn from(err: serde_json::error::Error) -> DescribeHostedConnectionsError {
DescribeHostedConnectionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeHostedConnectionsError {
fn from(err: CredentialsError) -> DescribeHostedConnectionsError {
DescribeHostedConnectionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeHostedConnectionsError {
fn from(err: HttpDispatchError) -> DescribeHostedConnectionsError {
DescribeHostedConnectionsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeHostedConnectionsError {
fn from(err: io::Error) -> DescribeHostedConnectionsError {
DescribeHostedConnectionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeHostedConnectionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeHostedConnectionsError {
fn description(&self) -> &str {
match *self {
DescribeHostedConnectionsError::DirectConnectClient(ref cause) => cause,
DescribeHostedConnectionsError::DirectConnectServer(ref cause) => cause,
DescribeHostedConnectionsError::Validation(ref cause) => cause,
DescribeHostedConnectionsError::Credentials(ref err) => err.description(),
DescribeHostedConnectionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeHostedConnectionsError::ParseError(ref cause) => cause,
DescribeHostedConnectionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeInterconnectLoaError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeInterconnectLoaError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeInterconnectLoaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeInterconnectLoaError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeInterconnectLoaError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeInterconnectLoaError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeInterconnectLoaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeInterconnectLoaError {
fn from(err: serde_json::error::Error) -> DescribeInterconnectLoaError {
DescribeInterconnectLoaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeInterconnectLoaError {
fn from(err: CredentialsError) -> DescribeInterconnectLoaError {
DescribeInterconnectLoaError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeInterconnectLoaError {
fn from(err: HttpDispatchError) -> DescribeInterconnectLoaError {
DescribeInterconnectLoaError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeInterconnectLoaError {
fn from(err: io::Error) -> DescribeInterconnectLoaError {
DescribeInterconnectLoaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeInterconnectLoaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeInterconnectLoaError {
fn description(&self) -> &str {
match *self {
DescribeInterconnectLoaError::DirectConnectClient(ref cause) => cause,
DescribeInterconnectLoaError::DirectConnectServer(ref cause) => cause,
DescribeInterconnectLoaError::Validation(ref cause) => cause,
DescribeInterconnectLoaError::Credentials(ref err) => err.description(),
DescribeInterconnectLoaError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeInterconnectLoaError::ParseError(ref cause) => cause,
DescribeInterconnectLoaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeInterconnectsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeInterconnectsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeInterconnectsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeInterconnectsError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeInterconnectsError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeInterconnectsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeInterconnectsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeInterconnectsError {
fn from(err: serde_json::error::Error) -> DescribeInterconnectsError {
DescribeInterconnectsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeInterconnectsError {
fn from(err: CredentialsError) -> DescribeInterconnectsError {
DescribeInterconnectsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeInterconnectsError {
fn from(err: HttpDispatchError) -> DescribeInterconnectsError {
DescribeInterconnectsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeInterconnectsError {
fn from(err: io::Error) -> DescribeInterconnectsError {
DescribeInterconnectsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeInterconnectsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeInterconnectsError {
fn description(&self) -> &str {
match *self {
DescribeInterconnectsError::DirectConnectClient(ref cause) => cause,
DescribeInterconnectsError::DirectConnectServer(ref cause) => cause,
DescribeInterconnectsError::Validation(ref cause) => cause,
DescribeInterconnectsError::Credentials(ref err) => err.description(),
DescribeInterconnectsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeInterconnectsError::ParseError(ref cause) => cause,
DescribeInterconnectsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeLagsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeLagsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeLagsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeLagsError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DescribeLagsError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DescribeLagsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeLagsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeLagsError {
fn from(err: serde_json::error::Error) -> DescribeLagsError {
DescribeLagsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeLagsError {
fn from(err: CredentialsError) -> DescribeLagsError {
DescribeLagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeLagsError {
fn from(err: HttpDispatchError) -> DescribeLagsError {
DescribeLagsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeLagsError {
fn from(err: io::Error) -> DescribeLagsError {
DescribeLagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeLagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeLagsError {
fn description(&self) -> &str {
match *self {
DescribeLagsError::DirectConnectClient(ref cause) => cause,
DescribeLagsError::DirectConnectServer(ref cause) => cause,
DescribeLagsError::Validation(ref cause) => cause,
DescribeLagsError::Credentials(ref err) => err.description(),
DescribeLagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeLagsError::ParseError(ref cause) => cause,
DescribeLagsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeLoaError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeLoaError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeLoaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeLoaError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DescribeLoaError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DescribeLoaError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeLoaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeLoaError {
fn from(err: serde_json::error::Error) -> DescribeLoaError {
DescribeLoaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeLoaError {
fn from(err: CredentialsError) -> DescribeLoaError {
DescribeLoaError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeLoaError {
fn from(err: HttpDispatchError) -> DescribeLoaError {
DescribeLoaError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeLoaError {
fn from(err: io::Error) -> DescribeLoaError {
DescribeLoaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeLoaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeLoaError {
fn description(&self) -> &str {
match *self {
DescribeLoaError::DirectConnectClient(ref cause) => cause,
DescribeLoaError::DirectConnectServer(ref cause) => cause,
DescribeLoaError::Validation(ref cause) => cause,
DescribeLoaError::Credentials(ref err) => err.description(),
DescribeLoaError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeLoaError::ParseError(ref cause) => cause,
DescribeLoaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeLocationsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeLocationsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeLocationsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeLocationsError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DescribeLocationsError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DescribeLocationsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeLocationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeLocationsError {
fn from(err: serde_json::error::Error) -> DescribeLocationsError {
DescribeLocationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeLocationsError {
fn from(err: CredentialsError) -> DescribeLocationsError {
DescribeLocationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeLocationsError {
fn from(err: HttpDispatchError) -> DescribeLocationsError {
DescribeLocationsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeLocationsError {
fn from(err: io::Error) -> DescribeLocationsError {
DescribeLocationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeLocationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeLocationsError {
fn description(&self) -> &str {
match *self {
DescribeLocationsError::DirectConnectClient(ref cause) => cause,
DescribeLocationsError::DirectConnectServer(ref cause) => cause,
DescribeLocationsError::Validation(ref cause) => cause,
DescribeLocationsError::Credentials(ref err) => err.description(),
DescribeLocationsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeLocationsError::ParseError(ref cause) => cause,
DescribeLocationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeTagsError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeTagsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeTagsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeTagsError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return DescribeTagsError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return DescribeTagsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeTagsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeTagsError {
fn from(err: serde_json::error::Error) -> DescribeTagsError {
DescribeTagsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeTagsError {
fn from(err: CredentialsError) -> DescribeTagsError {
DescribeTagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeTagsError {
fn from(err: HttpDispatchError) -> DescribeTagsError {
DescribeTagsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeTagsError {
fn from(err: io::Error) -> DescribeTagsError {
DescribeTagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeTagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeTagsError {
fn description(&self) -> &str {
match *self {
DescribeTagsError::DirectConnectClient(ref cause) => cause,
DescribeTagsError::DirectConnectServer(ref cause) => cause,
DescribeTagsError::Validation(ref cause) => cause,
DescribeTagsError::Credentials(ref err) => err.description(),
DescribeTagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeTagsError::ParseError(ref cause) => cause,
DescribeTagsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeVirtualGatewaysError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeVirtualGatewaysError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeVirtualGatewaysError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeVirtualGatewaysError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeVirtualGatewaysError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeVirtualGatewaysError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeVirtualGatewaysError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeVirtualGatewaysError {
fn from(err: serde_json::error::Error) -> DescribeVirtualGatewaysError {
DescribeVirtualGatewaysError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeVirtualGatewaysError {
fn from(err: CredentialsError) -> DescribeVirtualGatewaysError {
DescribeVirtualGatewaysError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeVirtualGatewaysError {
fn from(err: HttpDispatchError) -> DescribeVirtualGatewaysError {
DescribeVirtualGatewaysError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeVirtualGatewaysError {
fn from(err: io::Error) -> DescribeVirtualGatewaysError {
DescribeVirtualGatewaysError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeVirtualGatewaysError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeVirtualGatewaysError {
fn description(&self) -> &str {
match *self {
DescribeVirtualGatewaysError::DirectConnectClient(ref cause) => cause,
DescribeVirtualGatewaysError::DirectConnectServer(ref cause) => cause,
DescribeVirtualGatewaysError::Validation(ref cause) => cause,
DescribeVirtualGatewaysError::Credentials(ref err) => err.description(),
DescribeVirtualGatewaysError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeVirtualGatewaysError::ParseError(ref cause) => cause,
DescribeVirtualGatewaysError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeVirtualInterfacesError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeVirtualInterfacesError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeVirtualInterfacesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DescribeVirtualInterfacesError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DescribeVirtualInterfacesError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeVirtualInterfacesError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeVirtualInterfacesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeVirtualInterfacesError {
fn from(err: serde_json::error::Error) -> DescribeVirtualInterfacesError {
DescribeVirtualInterfacesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeVirtualInterfacesError {
fn from(err: CredentialsError) -> DescribeVirtualInterfacesError {
DescribeVirtualInterfacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeVirtualInterfacesError {
fn from(err: HttpDispatchError) -> DescribeVirtualInterfacesError {
DescribeVirtualInterfacesError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeVirtualInterfacesError {
fn from(err: io::Error) -> DescribeVirtualInterfacesError {
DescribeVirtualInterfacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeVirtualInterfacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeVirtualInterfacesError {
fn description(&self) -> &str {
match *self {
DescribeVirtualInterfacesError::DirectConnectClient(ref cause) => cause,
DescribeVirtualInterfacesError::DirectConnectServer(ref cause) => cause,
DescribeVirtualInterfacesError::Validation(ref cause) => cause,
DescribeVirtualInterfacesError::Credentials(ref err) => err.description(),
DescribeVirtualInterfacesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeVirtualInterfacesError::ParseError(ref cause) => cause,
DescribeVirtualInterfacesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateConnectionFromLagError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisassociateConnectionFromLagError {
pub fn from_response(res: BufferedHttpResponse) -> DisassociateConnectionFromLagError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return DisassociateConnectionFromLagError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return DisassociateConnectionFromLagError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return DisassociateConnectionFromLagError::Validation(error_message.to_string());
}
_ => {}
}
}
return DisassociateConnectionFromLagError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisassociateConnectionFromLagError {
fn from(err: serde_json::error::Error) -> DisassociateConnectionFromLagError {
DisassociateConnectionFromLagError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisassociateConnectionFromLagError {
fn from(err: CredentialsError) -> DisassociateConnectionFromLagError {
DisassociateConnectionFromLagError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisassociateConnectionFromLagError {
fn from(err: HttpDispatchError) -> DisassociateConnectionFromLagError {
DisassociateConnectionFromLagError::HttpDispatch(err)
}
}
impl From<io::Error> for DisassociateConnectionFromLagError {
fn from(err: io::Error) -> DisassociateConnectionFromLagError {
DisassociateConnectionFromLagError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisassociateConnectionFromLagError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateConnectionFromLagError {
fn description(&self) -> &str {
match *self {
DisassociateConnectionFromLagError::DirectConnectClient(ref cause) => cause,
DisassociateConnectionFromLagError::DirectConnectServer(ref cause) => cause,
DisassociateConnectionFromLagError::Validation(ref cause) => cause,
DisassociateConnectionFromLagError::Credentials(ref err) => err.description(),
DisassociateConnectionFromLagError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DisassociateConnectionFromLagError::ParseError(ref cause) => cause,
DisassociateConnectionFromLagError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
DirectConnectClient(String),
DirectConnectServer(String),
DuplicateTagKeys(String),
TooManyTags(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> TagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return TagResourceError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return TagResourceError::DirectConnectServer(String::from(error_message));
}
"DuplicateTagKeysException" => {
return TagResourceError::DuplicateTagKeys(String::from(error_message));
}
"TooManyTagsException" => {
return TagResourceError::TooManyTags(String::from(error_message));
}
"ValidationException" => {
return TagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return TagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TagResourceError {
fn from(err: serde_json::error::Error) -> TagResourceError {
TagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TagResourceError {
fn from(err: CredentialsError) -> TagResourceError {
TagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for TagResourceError {
fn from(err: HttpDispatchError) -> TagResourceError {
TagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for TagResourceError {
fn from(err: io::Error) -> TagResourceError {
TagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::DirectConnectClient(ref cause) => cause,
TagResourceError::DirectConnectServer(ref cause) => cause,
TagResourceError::DuplicateTagKeys(ref cause) => cause,
TagResourceError::TooManyTags(ref cause) => cause,
TagResourceError::Validation(ref cause) => cause,
TagResourceError::Credentials(ref err) => err.description(),
TagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TagResourceError::ParseError(ref cause) => cause,
TagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> UntagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return UntagResourceError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return UntagResourceError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return UntagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return UntagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UntagResourceError {
fn from(err: serde_json::error::Error) -> UntagResourceError {
UntagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UntagResourceError {
fn from(err: CredentialsError) -> UntagResourceError {
UntagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UntagResourceError {
fn from(err: HttpDispatchError) -> UntagResourceError {
UntagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for UntagResourceError {
fn from(err: io::Error) -> UntagResourceError {
UntagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::DirectConnectClient(ref cause) => cause,
UntagResourceError::DirectConnectServer(ref cause) => cause,
UntagResourceError::Validation(ref cause) => cause,
UntagResourceError::Credentials(ref err) => err.description(),
UntagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UntagResourceError::ParseError(ref cause) => cause,
UntagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateLagError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateLagError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateLagError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return UpdateLagError::DirectConnectClient(String::from(error_message));
}
"DirectConnectServerException" => {
return UpdateLagError::DirectConnectServer(String::from(error_message));
}
"ValidationException" => {
return UpdateLagError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateLagError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateLagError {
fn from(err: serde_json::error::Error) -> UpdateLagError {
UpdateLagError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateLagError {
fn from(err: CredentialsError) -> UpdateLagError {
UpdateLagError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateLagError {
fn from(err: HttpDispatchError) -> UpdateLagError {
UpdateLagError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateLagError {
fn from(err: io::Error) -> UpdateLagError {
UpdateLagError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateLagError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateLagError {
fn description(&self) -> &str {
match *self {
UpdateLagError::DirectConnectClient(ref cause) => cause,
UpdateLagError::DirectConnectServer(ref cause) => cause,
UpdateLagError::Validation(ref cause) => cause,
UpdateLagError::Credentials(ref err) => err.description(),
UpdateLagError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateLagError::ParseError(ref cause) => cause,
UpdateLagError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateVirtualInterfaceAttributesError {
DirectConnectClient(String),
DirectConnectServer(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateVirtualInterfaceAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateVirtualInterfaceAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DirectConnectClientException" => {
return UpdateVirtualInterfaceAttributesError::DirectConnectClient(String::from(
error_message,
));
}
"DirectConnectServerException" => {
return UpdateVirtualInterfaceAttributesError::DirectConnectServer(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateVirtualInterfaceAttributesError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return UpdateVirtualInterfaceAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateVirtualInterfaceAttributesError {
fn from(err: serde_json::error::Error) -> UpdateVirtualInterfaceAttributesError {
UpdateVirtualInterfaceAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateVirtualInterfaceAttributesError {
fn from(err: CredentialsError) -> UpdateVirtualInterfaceAttributesError {
UpdateVirtualInterfaceAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateVirtualInterfaceAttributesError {
fn from(err: HttpDispatchError) -> UpdateVirtualInterfaceAttributesError {
UpdateVirtualInterfaceAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateVirtualInterfaceAttributesError {
fn from(err: io::Error) -> UpdateVirtualInterfaceAttributesError {
UpdateVirtualInterfaceAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateVirtualInterfaceAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateVirtualInterfaceAttributesError {
fn description(&self) -> &str {
match *self {
UpdateVirtualInterfaceAttributesError::DirectConnectClient(ref cause) => cause,
UpdateVirtualInterfaceAttributesError::DirectConnectServer(ref cause) => cause,
UpdateVirtualInterfaceAttributesError::Validation(ref cause) => cause,
UpdateVirtualInterfaceAttributesError::Credentials(ref err) => err.description(),
UpdateVirtualInterfaceAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateVirtualInterfaceAttributesError::ParseError(ref cause) => cause,
UpdateVirtualInterfaceAttributesError::Unknown(_) => "unknown error",
}
}
}
pub trait DirectConnect {
fn allocate_connection_on_interconnect(
&self,
input: AllocateConnectionOnInterconnectRequest,
) -> RusotoFuture<Connection, AllocateConnectionOnInterconnectError>;
fn allocate_hosted_connection(
&self,
input: AllocateHostedConnectionRequest,
) -> RusotoFuture<Connection, AllocateHostedConnectionError>;
fn allocate_private_virtual_interface(
&self,
input: AllocatePrivateVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, AllocatePrivateVirtualInterfaceError>;
fn allocate_public_virtual_interface(
&self,
input: AllocatePublicVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, AllocatePublicVirtualInterfaceError>;
fn associate_connection_with_lag(
&self,
input: AssociateConnectionWithLagRequest,
) -> RusotoFuture<Connection, AssociateConnectionWithLagError>;
fn associate_hosted_connection(
&self,
input: AssociateHostedConnectionRequest,
) -> RusotoFuture<Connection, AssociateHostedConnectionError>;
fn associate_virtual_interface(
&self,
input: AssociateVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, AssociateVirtualInterfaceError>;
fn confirm_connection(
&self,
input: ConfirmConnectionRequest,
) -> RusotoFuture<ConfirmConnectionResponse, ConfirmConnectionError>;
fn confirm_private_virtual_interface(
&self,
input: ConfirmPrivateVirtualInterfaceRequest,
) -> RusotoFuture<ConfirmPrivateVirtualInterfaceResponse, ConfirmPrivateVirtualInterfaceError>;
fn confirm_public_virtual_interface(
&self,
input: ConfirmPublicVirtualInterfaceRequest,
) -> RusotoFuture<ConfirmPublicVirtualInterfaceResponse, ConfirmPublicVirtualInterfaceError>;
fn create_bgp_peer(
&self,
input: CreateBGPPeerRequest,
) -> RusotoFuture<CreateBGPPeerResponse, CreateBGPPeerError>;
fn create_connection(
&self,
input: CreateConnectionRequest,
) -> RusotoFuture<Connection, CreateConnectionError>;
fn create_direct_connect_gateway(
&self,
input: CreateDirectConnectGatewayRequest,
) -> RusotoFuture<CreateDirectConnectGatewayResult, CreateDirectConnectGatewayError>;
fn create_direct_connect_gateway_association(
&self,
input: CreateDirectConnectGatewayAssociationRequest,
) -> RusotoFuture<
CreateDirectConnectGatewayAssociationResult,
CreateDirectConnectGatewayAssociationError,
>;
fn create_interconnect(
&self,
input: CreateInterconnectRequest,
) -> RusotoFuture<Interconnect, CreateInterconnectError>;
fn create_lag(&self, input: CreateLagRequest) -> RusotoFuture<Lag, CreateLagError>;
fn create_private_virtual_interface(
&self,
input: CreatePrivateVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, CreatePrivateVirtualInterfaceError>;
fn create_public_virtual_interface(
&self,
input: CreatePublicVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, CreatePublicVirtualInterfaceError>;
fn delete_bgp_peer(
&self,
input: DeleteBGPPeerRequest,
) -> RusotoFuture<DeleteBGPPeerResponse, DeleteBGPPeerError>;
fn delete_connection(
&self,
input: DeleteConnectionRequest,
) -> RusotoFuture<Connection, DeleteConnectionError>;
fn delete_direct_connect_gateway(
&self,
input: DeleteDirectConnectGatewayRequest,
) -> RusotoFuture<DeleteDirectConnectGatewayResult, DeleteDirectConnectGatewayError>;
fn delete_direct_connect_gateway_association(
&self,
input: DeleteDirectConnectGatewayAssociationRequest,
) -> RusotoFuture<
DeleteDirectConnectGatewayAssociationResult,
DeleteDirectConnectGatewayAssociationError,
>;
fn delete_interconnect(
&self,
input: DeleteInterconnectRequest,
) -> RusotoFuture<DeleteInterconnectResponse, DeleteInterconnectError>;
fn delete_lag(&self, input: DeleteLagRequest) -> RusotoFuture<Lag, DeleteLagError>;
fn delete_virtual_interface(
&self,
input: DeleteVirtualInterfaceRequest,
) -> RusotoFuture<DeleteVirtualInterfaceResponse, DeleteVirtualInterfaceError>;
fn describe_connection_loa(
&self,
input: DescribeConnectionLoaRequest,
) -> RusotoFuture<DescribeConnectionLoaResponse, DescribeConnectionLoaError>;
fn describe_connections(
&self,
input: DescribeConnectionsRequest,
) -> RusotoFuture<Connections, DescribeConnectionsError>;
fn describe_connections_on_interconnect(
&self,
input: DescribeConnectionsOnInterconnectRequest,
) -> RusotoFuture<Connections, DescribeConnectionsOnInterconnectError>;
fn describe_direct_connect_gateway_associations(
&self,
input: DescribeDirectConnectGatewayAssociationsRequest,
) -> RusotoFuture<
DescribeDirectConnectGatewayAssociationsResult,
DescribeDirectConnectGatewayAssociationsError,
>;
fn describe_direct_connect_gateway_attachments(
&self,
input: DescribeDirectConnectGatewayAttachmentsRequest,
) -> RusotoFuture<
DescribeDirectConnectGatewayAttachmentsResult,
DescribeDirectConnectGatewayAttachmentsError,
>;
fn describe_direct_connect_gateways(
&self,
input: DescribeDirectConnectGatewaysRequest,
) -> RusotoFuture<DescribeDirectConnectGatewaysResult, DescribeDirectConnectGatewaysError>;
fn describe_hosted_connections(
&self,
input: DescribeHostedConnectionsRequest,
) -> RusotoFuture<Connections, DescribeHostedConnectionsError>;
fn describe_interconnect_loa(
&self,
input: DescribeInterconnectLoaRequest,
) -> RusotoFuture<DescribeInterconnectLoaResponse, DescribeInterconnectLoaError>;
fn describe_interconnects(
&self,
input: DescribeInterconnectsRequest,
) -> RusotoFuture<Interconnects, DescribeInterconnectsError>;
fn describe_lags(&self, input: DescribeLagsRequest) -> RusotoFuture<Lags, DescribeLagsError>;
fn describe_loa(&self, input: DescribeLoaRequest) -> RusotoFuture<Loa, DescribeLoaError>;
fn describe_locations(&self) -> RusotoFuture<Locations, DescribeLocationsError>;
fn describe_tags(
&self,
input: DescribeTagsRequest,
) -> RusotoFuture<DescribeTagsResponse, DescribeTagsError>;
fn describe_virtual_gateways(
&self,
) -> RusotoFuture<VirtualGateways, DescribeVirtualGatewaysError>;
fn describe_virtual_interfaces(
&self,
input: DescribeVirtualInterfacesRequest,
) -> RusotoFuture<VirtualInterfaces, DescribeVirtualInterfacesError>;
fn disassociate_connection_from_lag(
&self,
input: DisassociateConnectionFromLagRequest,
) -> RusotoFuture<Connection, DisassociateConnectionFromLagError>;
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError>;
fn update_lag(&self, input: UpdateLagRequest) -> RusotoFuture<Lag, UpdateLagError>;
fn update_virtual_interface_attributes(
&self,
input: UpdateVirtualInterfaceAttributesRequest,
) -> RusotoFuture<VirtualInterface, UpdateVirtualInterfaceAttributesError>;
}
#[derive(Clone)]
pub struct DirectConnectClient {
client: Client,
region: region::Region,
}
impl DirectConnectClient {
pub fn new(region: region::Region) -> DirectConnectClient {
DirectConnectClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> DirectConnectClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
DirectConnectClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl DirectConnect for DirectConnectClient {
fn allocate_connection_on_interconnect(
&self,
input: AllocateConnectionOnInterconnectRequest,
) -> RusotoFuture<Connection, AllocateConnectionOnInterconnectError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.AllocateConnectionOnInterconnect",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connection>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AllocateConnectionOnInterconnectError::from_response(
response,
))
}))
}
})
}
fn allocate_hosted_connection(
&self,
input: AllocateHostedConnectionRequest,
) -> RusotoFuture<Connection, AllocateHostedConnectionError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.AllocateHostedConnection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connection>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AllocateHostedConnectionError::from_response(response))
}))
}
})
}
fn allocate_private_virtual_interface(
&self,
input: AllocatePrivateVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, AllocatePrivateVirtualInterfaceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.AllocatePrivateVirtualInterface",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualInterface>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AllocatePrivateVirtualInterfaceError::from_response(
response,
))
}))
}
})
}
fn allocate_public_virtual_interface(
&self,
input: AllocatePublicVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, AllocatePublicVirtualInterfaceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.AllocatePublicVirtualInterface",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualInterface>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AllocatePublicVirtualInterfaceError::from_response(response))
}))
}
})
}
fn associate_connection_with_lag(
&self,
input: AssociateConnectionWithLagRequest,
) -> RusotoFuture<Connection, AssociateConnectionWithLagError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.AssociateConnectionWithLag");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connection>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateConnectionWithLagError::from_response(response))
}))
}
})
}
fn associate_hosted_connection(
&self,
input: AssociateHostedConnectionRequest,
) -> RusotoFuture<Connection, AssociateHostedConnectionError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.AssociateHostedConnection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connection>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateHostedConnectionError::from_response(response))
}))
}
})
}
fn associate_virtual_interface(
&self,
input: AssociateVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, AssociateVirtualInterfaceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.AssociateVirtualInterface");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualInterface>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateVirtualInterfaceError::from_response(response))
}))
}
})
}
fn confirm_connection(
&self,
input: ConfirmConnectionRequest,
) -> RusotoFuture<ConfirmConnectionResponse, ConfirmConnectionError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.ConfirmConnection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ConfirmConnectionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ConfirmConnectionError::from_response(response))),
)
}
})
}
fn confirm_private_virtual_interface(
&self,
input: ConfirmPrivateVirtualInterfaceRequest,
) -> RusotoFuture<ConfirmPrivateVirtualInterfaceResponse, ConfirmPrivateVirtualInterfaceError>
{
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.ConfirmPrivateVirtualInterface",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ConfirmPrivateVirtualInterfaceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ConfirmPrivateVirtualInterfaceError::from_response(response))
}))
}
})
}
fn confirm_public_virtual_interface(
&self,
input: ConfirmPublicVirtualInterfaceRequest,
) -> RusotoFuture<ConfirmPublicVirtualInterfaceResponse, ConfirmPublicVirtualInterfaceError>
{
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.ConfirmPublicVirtualInterface",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ConfirmPublicVirtualInterfaceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ConfirmPublicVirtualInterfaceError::from_response(response))
}))
}
})
}
fn create_bgp_peer(
&self,
input: CreateBGPPeerRequest,
) -> RusotoFuture<CreateBGPPeerResponse, CreateBGPPeerError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.CreateBGPPeer");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateBGPPeerResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateBGPPeerError::from_response(response))),
)
}
})
}
fn create_connection(
&self,
input: CreateConnectionRequest,
) -> RusotoFuture<Connection, CreateConnectionError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.CreateConnection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connection>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateConnectionError::from_response(response))),
)
}
})
}
fn create_direct_connect_gateway(
&self,
input: CreateDirectConnectGatewayRequest,
) -> RusotoFuture<CreateDirectConnectGatewayResult, CreateDirectConnectGatewayError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.CreateDirectConnectGateway");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateDirectConnectGatewayResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateDirectConnectGatewayError::from_response(response))
}))
}
})
}
fn create_direct_connect_gateway_association(
&self,
input: CreateDirectConnectGatewayAssociationRequest,
) -> RusotoFuture<
CreateDirectConnectGatewayAssociationResult,
CreateDirectConnectGatewayAssociationError,
> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.CreateDirectConnectGatewayAssociation",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateDirectConnectGatewayAssociationResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateDirectConnectGatewayAssociationError::from_response(
response,
))
}))
}
})
}
fn create_interconnect(
&self,
input: CreateInterconnectRequest,
) -> RusotoFuture<Interconnect, CreateInterconnectError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.CreateInterconnect");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Interconnect>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateInterconnectError::from_response(response))),
)
}
})
}
fn create_lag(&self, input: CreateLagRequest) -> RusotoFuture<Lag, CreateLagError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.CreateLag");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Lag>(String::from_utf8_lossy(body.as_ref()).as_ref())
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateLagError::from_response(response))),
)
}
})
}
fn create_private_virtual_interface(
&self,
input: CreatePrivateVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, CreatePrivateVirtualInterfaceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.CreatePrivateVirtualInterface",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualInterface>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreatePrivateVirtualInterfaceError::from_response(response))
}))
}
})
}
fn create_public_virtual_interface(
&self,
input: CreatePublicVirtualInterfaceRequest,
) -> RusotoFuture<VirtualInterface, CreatePublicVirtualInterfaceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.CreatePublicVirtualInterface",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualInterface>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreatePublicVirtualInterfaceError::from_response(response))
}))
}
})
}
fn delete_bgp_peer(
&self,
input: DeleteBGPPeerRequest,
) -> RusotoFuture<DeleteBGPPeerResponse, DeleteBGPPeerError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DeleteBGPPeer");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteBGPPeerResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteBGPPeerError::from_response(response))),
)
}
})
}
fn delete_connection(
&self,
input: DeleteConnectionRequest,
) -> RusotoFuture<Connection, DeleteConnectionError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DeleteConnection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connection>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteConnectionError::from_response(response))),
)
}
})
}
fn delete_direct_connect_gateway(
&self,
input: DeleteDirectConnectGatewayRequest,
) -> RusotoFuture<DeleteDirectConnectGatewayResult, DeleteDirectConnectGatewayError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DeleteDirectConnectGateway");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteDirectConnectGatewayResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteDirectConnectGatewayError::from_response(response))
}))
}
})
}
fn delete_direct_connect_gateway_association(
&self,
input: DeleteDirectConnectGatewayAssociationRequest,
) -> RusotoFuture<
DeleteDirectConnectGatewayAssociationResult,
DeleteDirectConnectGatewayAssociationError,
> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.DeleteDirectConnectGatewayAssociation",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteDirectConnectGatewayAssociationResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteDirectConnectGatewayAssociationError::from_response(
response,
))
}))
}
})
}
fn delete_interconnect(
&self,
input: DeleteInterconnectRequest,
) -> RusotoFuture<DeleteInterconnectResponse, DeleteInterconnectError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DeleteInterconnect");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteInterconnectResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteInterconnectError::from_response(response))),
)
}
})
}
fn delete_lag(&self, input: DeleteLagRequest) -> RusotoFuture<Lag, DeleteLagError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DeleteLag");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Lag>(String::from_utf8_lossy(body.as_ref()).as_ref())
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteLagError::from_response(response))),
)
}
})
}
fn delete_virtual_interface(
&self,
input: DeleteVirtualInterfaceRequest,
) -> RusotoFuture<DeleteVirtualInterfaceResponse, DeleteVirtualInterfaceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DeleteVirtualInterface");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteVirtualInterfaceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteVirtualInterfaceError::from_response(response))
}),
)
}
})
}
fn describe_connection_loa(
&self,
input: DescribeConnectionLoaRequest,
) -> RusotoFuture<DescribeConnectionLoaResponse, DescribeConnectionLoaError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeConnectionLoa");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DescribeConnectionLoaResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeConnectionLoaError::from_response(response))
}),
)
}
})
}
fn describe_connections(
&self,
input: DescribeConnectionsRequest,
) -> RusotoFuture<Connections, DescribeConnectionsError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeConnections");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connections>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeConnectionsError::from_response(response))
}),
)
}
})
}
fn describe_connections_on_interconnect(
&self,
input: DescribeConnectionsOnInterconnectRequest,
) -> RusotoFuture<Connections, DescribeConnectionsOnInterconnectError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.DescribeConnectionsOnInterconnect",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connections>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeConnectionsOnInterconnectError::from_response(
response,
))
}))
}
})
}
fn describe_direct_connect_gateway_associations(
&self,
input: DescribeDirectConnectGatewayAssociationsRequest,
) -> RusotoFuture<
DescribeDirectConnectGatewayAssociationsResult,
DescribeDirectConnectGatewayAssociationsError,
> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.DescribeDirectConnectGatewayAssociations",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DescribeDirectConnectGatewayAssociationsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeDirectConnectGatewayAssociationsError::from_response(response))
}))
}
})
}
fn describe_direct_connect_gateway_attachments(
&self,
input: DescribeDirectConnectGatewayAttachmentsRequest,
) -> RusotoFuture<
DescribeDirectConnectGatewayAttachmentsResult,
DescribeDirectConnectGatewayAttachmentsError,
> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.DescribeDirectConnectGatewayAttachments",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DescribeDirectConnectGatewayAttachmentsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeDirectConnectGatewayAttachmentsError::from_response(
response,
))
}))
}
})
}
fn describe_direct_connect_gateways(
&self,
input: DescribeDirectConnectGatewaysRequest,
) -> RusotoFuture<DescribeDirectConnectGatewaysResult, DescribeDirectConnectGatewaysError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.DescribeDirectConnectGateways",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DescribeDirectConnectGatewaysResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeDirectConnectGatewaysError::from_response(response))
}))
}
})
}
fn describe_hosted_connections(
&self,
input: DescribeHostedConnectionsRequest,
) -> RusotoFuture<Connections, DescribeHostedConnectionsError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeHostedConnections");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connections>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeHostedConnectionsError::from_response(response))
}))
}
})
}
fn describe_interconnect_loa(
&self,
input: DescribeInterconnectLoaRequest,
) -> RusotoFuture<DescribeInterconnectLoaResponse, DescribeInterconnectLoaError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeInterconnectLoa");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DescribeInterconnectLoaResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeInterconnectLoaError::from_response(response))
}))
}
})
}
fn describe_interconnects(
&self,
input: DescribeInterconnectsRequest,
) -> RusotoFuture<Interconnects, DescribeInterconnectsError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeInterconnects");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Interconnects>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeInterconnectsError::from_response(response))
}),
)
}
})
}
fn describe_lags(&self, input: DescribeLagsRequest) -> RusotoFuture<Lags, DescribeLagsError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeLags");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Lags>(String::from_utf8_lossy(body.as_ref()).as_ref())
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeLagsError::from_response(response))),
)
}
})
}
fn describe_loa(&self, input: DescribeLoaRequest) -> RusotoFuture<Loa, DescribeLoaError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeLoa");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Loa>(String::from_utf8_lossy(body.as_ref()).as_ref())
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeLoaError::from_response(response))),
)
}
})
}
fn describe_locations(&self) -> RusotoFuture<Locations, DescribeLocationsError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeLocations");
request.set_payload(Some(b"{}".to_vec()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Locations>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeLocationsError::from_response(response))),
)
}
})
}
fn describe_tags(
&self,
input: DescribeTagsRequest,
) -> RusotoFuture<DescribeTagsResponse, DescribeTagsError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeTags");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DescribeTagsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeTagsError::from_response(response))),
)
}
})
}
fn describe_virtual_gateways(
&self,
) -> RusotoFuture<VirtualGateways, DescribeVirtualGatewaysError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeVirtualGateways");
request.set_payload(Some(b"{}".to_vec()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualGateways>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeVirtualGatewaysError::from_response(response))
}))
}
})
}
fn describe_virtual_interfaces(
&self,
input: DescribeVirtualInterfacesRequest,
) -> RusotoFuture<VirtualInterfaces, DescribeVirtualInterfacesError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.DescribeVirtualInterfaces");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualInterfaces>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeVirtualInterfacesError::from_response(response))
}))
}
})
}
fn disassociate_connection_from_lag(
&self,
input: DisassociateConnectionFromLagRequest,
) -> RusotoFuture<Connection, DisassociateConnectionFromLagError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.DisassociateConnectionFromLag",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Connection>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DisassociateConnectionFromLagError::from_response(response))
}))
}
})
}
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.TagResource");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<TagResourceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
)
}
})
}
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.UntagResource");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UntagResourceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
)
}
})
}
fn update_lag(&self, input: UpdateLagRequest) -> RusotoFuture<Lag, UpdateLagError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "OvertureService.UpdateLag");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<Lag>(String::from_utf8_lossy(body.as_ref()).as_ref())
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateLagError::from_response(response))),
)
}
})
}
fn update_virtual_interface_attributes(
&self,
input: UpdateVirtualInterfaceAttributesRequest,
) -> RusotoFuture<VirtualInterface, UpdateVirtualInterfaceAttributesError> {
let mut request = SignedRequest::new("POST", "directconnect", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"OvertureService.UpdateVirtualInterfaceAttributes",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<VirtualInterface>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateVirtualInterfaceAttributesError::from_response(
response,
))
}))
}
})
}
}
#[cfg(test)]
mod protocol_tests {}