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, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Cluster {
#[serde(rename = "ActiveNodes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub active_nodes: Option<i64>,
#[serde(rename = "ClusterArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster_arn: Option<String>,
#[serde(rename = "ClusterDiscoveryEndpoint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster_discovery_endpoint: Option<Endpoint>,
#[serde(rename = "ClusterName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster_name: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IamRoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub iam_role_arn: Option<String>,
#[serde(rename = "NodeIdsToRemove")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_ids_to_remove: Option<Vec<String>>,
#[serde(rename = "NodeType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_type: Option<String>,
#[serde(rename = "Nodes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub nodes: Option<Vec<Node>>,
#[serde(rename = "NotificationConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_configuration: Option<NotificationConfiguration>,
#[serde(rename = "ParameterGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group: Option<ParameterGroupStatus>,
#[serde(rename = "PreferredMaintenanceWindow")]
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_maintenance_window: Option<String>,
#[serde(rename = "SSEDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sse_description: Option<SSEDescription>,
#[serde(rename = "SecurityGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_groups: Option<Vec<SecurityGroupMembership>>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "SubnetGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_group: Option<String>,
#[serde(rename = "TotalNodes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_nodes: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateClusterRequest {
#[serde(rename = "AvailabilityZones")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zones: Option<Vec<String>>,
#[serde(rename = "ClusterName")]
pub cluster_name: String,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IamRoleArn")]
pub iam_role_arn: String,
#[serde(rename = "NodeType")]
pub node_type: String,
#[serde(rename = "NotificationTopicArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_topic_arn: Option<String>,
#[serde(rename = "ParameterGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group_name: Option<String>,
#[serde(rename = "PreferredMaintenanceWindow")]
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_maintenance_window: Option<String>,
#[serde(rename = "ReplicationFactor")]
pub replication_factor: i64,
#[serde(rename = "SSESpecification")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sse_specification: Option<SSESpecification>,
#[serde(rename = "SecurityGroupIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_group_ids: Option<Vec<String>>,
#[serde(rename = "SubnetGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_group_name: Option<String>,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateClusterResponse {
#[serde(rename = "Cluster")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster: Option<Cluster>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateParameterGroupRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "ParameterGroupName")]
pub parameter_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateParameterGroupResponse {
#[serde(rename = "ParameterGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group: Option<ParameterGroup>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSubnetGroupRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "SubnetGroupName")]
pub subnet_group_name: String,
#[serde(rename = "SubnetIds")]
pub subnet_ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSubnetGroupResponse {
#[serde(rename = "SubnetGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_group: Option<SubnetGroup>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DecreaseReplicationFactorRequest {
#[serde(rename = "AvailabilityZones")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zones: Option<Vec<String>>,
#[serde(rename = "ClusterName")]
pub cluster_name: String,
#[serde(rename = "NewReplicationFactor")]
pub new_replication_factor: i64,
#[serde(rename = "NodeIdsToRemove")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_ids_to_remove: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DecreaseReplicationFactorResponse {
#[serde(rename = "Cluster")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster: Option<Cluster>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteClusterRequest {
#[serde(rename = "ClusterName")]
pub cluster_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteClusterResponse {
#[serde(rename = "Cluster")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster: Option<Cluster>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteParameterGroupRequest {
#[serde(rename = "ParameterGroupName")]
pub parameter_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteParameterGroupResponse {
#[serde(rename = "DeletionMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deletion_message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSubnetGroupRequest {
#[serde(rename = "SubnetGroupName")]
pub subnet_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSubnetGroupResponse {
#[serde(rename = "DeletionMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deletion_message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeClustersRequest {
#[serde(rename = "ClusterNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster_names: Option<Vec<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 DescribeClustersResponse {
#[serde(rename = "Clusters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clusters: Option<Vec<Cluster>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDefaultParametersRequest {
#[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 DescribeDefaultParametersResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<Vec<Parameter>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeEventsRequest {
#[serde(rename = "Duration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[serde(rename = "EndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[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 = "SourceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_name: Option<String>,
#[serde(rename = "SourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_type: Option<String>,
#[serde(rename = "StartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeEventsResponse {
#[serde(rename = "Events")]
#[serde(skip_serializing_if = "Option::is_none")]
pub events: Option<Vec<Event>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeParameterGroupsRequest {
#[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 = "ParameterGroupNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group_names: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeParameterGroupsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ParameterGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_groups: Option<Vec<ParameterGroup>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeParametersRequest {
#[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 = "ParameterGroupName")]
pub parameter_group_name: String,
#[serde(rename = "Source")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeParametersResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<Vec<Parameter>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeSubnetGroupsRequest {
#[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 = "SubnetGroupNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_group_names: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeSubnetGroupsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SubnetGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_groups: Option<Vec<SubnetGroup>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Endpoint {
#[serde(rename = "Address")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(rename = "Port")]
#[serde(skip_serializing_if = "Option::is_none")]
pub port: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Event {
#[serde(rename = "Date")]
#[serde(skip_serializing_if = "Option::is_none")]
pub date: Option<f64>,
#[serde(rename = "Message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[serde(rename = "SourceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_name: Option<String>,
#[serde(rename = "SourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct IncreaseReplicationFactorRequest {
#[serde(rename = "AvailabilityZones")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zones: Option<Vec<String>>,
#[serde(rename = "ClusterName")]
pub cluster_name: String,
#[serde(rename = "NewReplicationFactor")]
pub new_replication_factor: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IncreaseReplicationFactorResponse {
#[serde(rename = "Cluster")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster: Option<Cluster>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsRequest {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ResourceName")]
pub resource_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Node {
#[serde(rename = "AvailabilityZone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zone: Option<String>,
#[serde(rename = "Endpoint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint: Option<Endpoint>,
#[serde(rename = "NodeCreateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_create_time: Option<f64>,
#[serde(rename = "NodeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_id: Option<String>,
#[serde(rename = "NodeStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_status: Option<String>,
#[serde(rename = "ParameterGroupStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct NodeTypeSpecificValue {
#[serde(rename = "NodeType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_type: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct NotificationConfiguration {
#[serde(rename = "TopicArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub topic_arn: Option<String>,
#[serde(rename = "TopicStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub topic_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Parameter {
#[serde(rename = "AllowedValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_values: Option<String>,
#[serde(rename = "ChangeType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub change_type: Option<String>,
#[serde(rename = "DataType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_type: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IsModifiable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_modifiable: Option<String>,
#[serde(rename = "NodeTypeSpecificValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_type_specific_values: Option<Vec<NodeTypeSpecificValue>>,
#[serde(rename = "ParameterName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_name: Option<String>,
#[serde(rename = "ParameterType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_type: Option<String>,
#[serde(rename = "ParameterValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_value: Option<String>,
#[serde(rename = "Source")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ParameterGroup {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "ParameterGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ParameterGroupStatus {
#[serde(rename = "NodeIdsToReboot")]
#[serde(skip_serializing_if = "Option::is_none")]
pub node_ids_to_reboot: Option<Vec<String>>,
#[serde(rename = "ParameterApplyStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_apply_status: Option<String>,
#[serde(rename = "ParameterGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ParameterNameValue {
#[serde(rename = "ParameterName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_name: Option<String>,
#[serde(rename = "ParameterValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RebootNodeRequest {
#[serde(rename = "ClusterName")]
pub cluster_name: String,
#[serde(rename = "NodeId")]
pub node_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RebootNodeResponse {
#[serde(rename = "Cluster")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster: Option<Cluster>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SSEDescription {
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SSESpecification {
#[serde(rename = "Enabled")]
pub enabled: bool,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SecurityGroupMembership {
#[serde(rename = "SecurityGroupIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_group_identifier: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Subnet {
#[serde(rename = "SubnetAvailabilityZone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_availability_zone: Option<String>,
#[serde(rename = "SubnetIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SubnetGroup {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "SubnetGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_group_name: Option<String>,
#[serde(rename = "Subnets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnets: Option<Vec<Subnet>>,
#[serde(rename = "VpcId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "Key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<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 = "ResourceName")]
pub resource_name: String,
#[serde(rename = "Tags")]
pub tags: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagResourceResponse {
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceRequest {
#[serde(rename = "ResourceName")]
pub resource_name: String,
#[serde(rename = "TagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagResourceResponse {
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateClusterRequest {
#[serde(rename = "ClusterName")]
pub cluster_name: String,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "NotificationTopicArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_topic_arn: Option<String>,
#[serde(rename = "NotificationTopicStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_topic_status: Option<String>,
#[serde(rename = "ParameterGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group_name: Option<String>,
#[serde(rename = "PreferredMaintenanceWindow")]
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_maintenance_window: Option<String>,
#[serde(rename = "SecurityGroupIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_group_ids: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateClusterResponse {
#[serde(rename = "Cluster")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster: Option<Cluster>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateParameterGroupRequest {
#[serde(rename = "ParameterGroupName")]
pub parameter_group_name: String,
#[serde(rename = "ParameterNameValues")]
pub parameter_name_values: Vec<ParameterNameValue>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateParameterGroupResponse {
#[serde(rename = "ParameterGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_group: Option<ParameterGroup>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateSubnetGroupRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "SubnetGroupName")]
pub subnet_group_name: String,
#[serde(rename = "SubnetIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_ids: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateSubnetGroupResponse {
#[serde(rename = "SubnetGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_group: Option<SubnetGroup>,
}
#[derive(Debug, PartialEq)]
pub enum CreateClusterError {
ClusterAlreadyExistsFault(String),
ClusterQuotaForCustomerExceededFault(String),
InsufficientClusterCapacityFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterGroupStateFault(String),
InvalidParameterValue(String),
InvalidVPCNetworkStateFault(String),
NodeQuotaForClusterExceededFault(String),
NodeQuotaForCustomerExceededFault(String),
ParameterGroupNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
SubnetGroupNotFoundFault(String),
TagQuotaPerResourceExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateClusterError {
pub fn from_response(res: BufferedHttpResponse) -> CreateClusterError {
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 {
"ClusterAlreadyExistsFault" => {
return CreateClusterError::ClusterAlreadyExistsFault(String::from(
error_message,
));
}
"ClusterQuotaForCustomerExceededFault" => {
return CreateClusterError::ClusterQuotaForCustomerExceededFault(String::from(
error_message,
));
}
"InsufficientClusterCapacityFault" => {
return CreateClusterError::InsufficientClusterCapacityFault(String::from(
error_message,
));
}
"InvalidClusterStateFault" => {
return CreateClusterError::InvalidClusterStateFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return CreateClusterError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterGroupStateFault" => {
return CreateClusterError::InvalidParameterGroupStateFault(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return CreateClusterError::InvalidParameterValue(String::from(error_message));
}
"InvalidVPCNetworkStateFault" => {
return CreateClusterError::InvalidVPCNetworkStateFault(String::from(
error_message,
));
}
"NodeQuotaForClusterExceededFault" => {
return CreateClusterError::NodeQuotaForClusterExceededFault(String::from(
error_message,
));
}
"NodeQuotaForCustomerExceededFault" => {
return CreateClusterError::NodeQuotaForCustomerExceededFault(String::from(
error_message,
));
}
"ParameterGroupNotFoundFault" => {
return CreateClusterError::ParameterGroupNotFoundFault(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return CreateClusterError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"SubnetGroupNotFoundFault" => {
return CreateClusterError::SubnetGroupNotFoundFault(String::from(error_message));
}
"TagQuotaPerResourceExceeded" => {
return CreateClusterError::TagQuotaPerResourceExceeded(String::from(
error_message,
));
}
"ValidationException" => {
return CreateClusterError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateClusterError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateClusterError {
fn from(err: serde_json::error::Error) -> CreateClusterError {
CreateClusterError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateClusterError {
fn from(err: CredentialsError) -> CreateClusterError {
CreateClusterError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateClusterError {
fn from(err: HttpDispatchError) -> CreateClusterError {
CreateClusterError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateClusterError {
fn from(err: io::Error) -> CreateClusterError {
CreateClusterError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateClusterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateClusterError {
fn description(&self) -> &str {
match *self {
CreateClusterError::ClusterAlreadyExistsFault(ref cause) => cause,
CreateClusterError::ClusterQuotaForCustomerExceededFault(ref cause) => cause,
CreateClusterError::InsufficientClusterCapacityFault(ref cause) => cause,
CreateClusterError::InvalidClusterStateFault(ref cause) => cause,
CreateClusterError::InvalidParameterCombination(ref cause) => cause,
CreateClusterError::InvalidParameterGroupStateFault(ref cause) => cause,
CreateClusterError::InvalidParameterValue(ref cause) => cause,
CreateClusterError::InvalidVPCNetworkStateFault(ref cause) => cause,
CreateClusterError::NodeQuotaForClusterExceededFault(ref cause) => cause,
CreateClusterError::NodeQuotaForCustomerExceededFault(ref cause) => cause,
CreateClusterError::ParameterGroupNotFoundFault(ref cause) => cause,
CreateClusterError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
CreateClusterError::SubnetGroupNotFoundFault(ref cause) => cause,
CreateClusterError::TagQuotaPerResourceExceeded(ref cause) => cause,
CreateClusterError::Validation(ref cause) => cause,
CreateClusterError::Credentials(ref err) => err.description(),
CreateClusterError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateClusterError::ParseError(ref cause) => cause,
CreateClusterError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateParameterGroupError {
InvalidParameterCombination(String),
InvalidParameterGroupStateFault(String),
InvalidParameterValue(String),
ParameterGroupAlreadyExistsFault(String),
ParameterGroupQuotaExceededFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateParameterGroupError {
pub fn from_response(res: BufferedHttpResponse) -> CreateParameterGroupError {
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 {
"InvalidParameterCombinationException" => {
return CreateParameterGroupError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterGroupStateFault" => {
return CreateParameterGroupError::InvalidParameterGroupStateFault(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return CreateParameterGroupError::InvalidParameterValue(String::from(
error_message,
));
}
"ParameterGroupAlreadyExistsFault" => {
return CreateParameterGroupError::ParameterGroupAlreadyExistsFault(
String::from(error_message),
);
}
"ParameterGroupQuotaExceededFault" => {
return CreateParameterGroupError::ParameterGroupQuotaExceededFault(
String::from(error_message),
);
}
"ServiceLinkedRoleNotFoundFault" => {
return CreateParameterGroupError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return CreateParameterGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateParameterGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateParameterGroupError {
fn from(err: serde_json::error::Error) -> CreateParameterGroupError {
CreateParameterGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateParameterGroupError {
fn from(err: CredentialsError) -> CreateParameterGroupError {
CreateParameterGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateParameterGroupError {
fn from(err: HttpDispatchError) -> CreateParameterGroupError {
CreateParameterGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateParameterGroupError {
fn from(err: io::Error) -> CreateParameterGroupError {
CreateParameterGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateParameterGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateParameterGroupError {
fn description(&self) -> &str {
match *self {
CreateParameterGroupError::InvalidParameterCombination(ref cause) => cause,
CreateParameterGroupError::InvalidParameterGroupStateFault(ref cause) => cause,
CreateParameterGroupError::InvalidParameterValue(ref cause) => cause,
CreateParameterGroupError::ParameterGroupAlreadyExistsFault(ref cause) => cause,
CreateParameterGroupError::ParameterGroupQuotaExceededFault(ref cause) => cause,
CreateParameterGroupError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
CreateParameterGroupError::Validation(ref cause) => cause,
CreateParameterGroupError::Credentials(ref err) => err.description(),
CreateParameterGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateParameterGroupError::ParseError(ref cause) => cause,
CreateParameterGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSubnetGroupError {
InvalidSubnet(String),
ServiceLinkedRoleNotFoundFault(String),
SubnetGroupAlreadyExistsFault(String),
SubnetGroupQuotaExceededFault(String),
SubnetQuotaExceededFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateSubnetGroupError {
pub fn from_response(res: BufferedHttpResponse) -> CreateSubnetGroupError {
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 {
"InvalidSubnet" => {
return CreateSubnetGroupError::InvalidSubnet(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return CreateSubnetGroupError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"SubnetGroupAlreadyExistsFault" => {
return CreateSubnetGroupError::SubnetGroupAlreadyExistsFault(String::from(
error_message,
));
}
"SubnetGroupQuotaExceededFault" => {
return CreateSubnetGroupError::SubnetGroupQuotaExceededFault(String::from(
error_message,
));
}
"SubnetQuotaExceededFault" => {
return CreateSubnetGroupError::SubnetQuotaExceededFault(String::from(
error_message,
));
}
"ValidationException" => {
return CreateSubnetGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateSubnetGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateSubnetGroupError {
fn from(err: serde_json::error::Error) -> CreateSubnetGroupError {
CreateSubnetGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateSubnetGroupError {
fn from(err: CredentialsError) -> CreateSubnetGroupError {
CreateSubnetGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateSubnetGroupError {
fn from(err: HttpDispatchError) -> CreateSubnetGroupError {
CreateSubnetGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateSubnetGroupError {
fn from(err: io::Error) -> CreateSubnetGroupError {
CreateSubnetGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateSubnetGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSubnetGroupError {
fn description(&self) -> &str {
match *self {
CreateSubnetGroupError::InvalidSubnet(ref cause) => cause,
CreateSubnetGroupError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
CreateSubnetGroupError::SubnetGroupAlreadyExistsFault(ref cause) => cause,
CreateSubnetGroupError::SubnetGroupQuotaExceededFault(ref cause) => cause,
CreateSubnetGroupError::SubnetQuotaExceededFault(ref cause) => cause,
CreateSubnetGroupError::Validation(ref cause) => cause,
CreateSubnetGroupError::Credentials(ref err) => err.description(),
CreateSubnetGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateSubnetGroupError::ParseError(ref cause) => cause,
CreateSubnetGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DecreaseReplicationFactorError {
ClusterNotFoundFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
NodeNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DecreaseReplicationFactorError {
pub fn from_response(res: BufferedHttpResponse) -> DecreaseReplicationFactorError {
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 {
"ClusterNotFoundFault" => {
return DecreaseReplicationFactorError::ClusterNotFoundFault(String::from(
error_message,
));
}
"InvalidClusterStateFault" => {
return DecreaseReplicationFactorError::InvalidClusterStateFault(String::from(
error_message,
));
}
"InvalidParameterCombinationException" => {
return DecreaseReplicationFactorError::InvalidParameterCombination(
String::from(error_message),
);
}
"InvalidParameterValueException" => {
return DecreaseReplicationFactorError::InvalidParameterValue(String::from(
error_message,
));
}
"NodeNotFoundFault" => {
return DecreaseReplicationFactorError::NodeNotFoundFault(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return DecreaseReplicationFactorError::ServiceLinkedRoleNotFoundFault(
String::from(error_message),
);
}
"ValidationException" => {
return DecreaseReplicationFactorError::Validation(error_message.to_string());
}
_ => {}
}
}
return DecreaseReplicationFactorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DecreaseReplicationFactorError {
fn from(err: serde_json::error::Error) -> DecreaseReplicationFactorError {
DecreaseReplicationFactorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DecreaseReplicationFactorError {
fn from(err: CredentialsError) -> DecreaseReplicationFactorError {
DecreaseReplicationFactorError::Credentials(err)
}
}
impl From<HttpDispatchError> for DecreaseReplicationFactorError {
fn from(err: HttpDispatchError) -> DecreaseReplicationFactorError {
DecreaseReplicationFactorError::HttpDispatch(err)
}
}
impl From<io::Error> for DecreaseReplicationFactorError {
fn from(err: io::Error) -> DecreaseReplicationFactorError {
DecreaseReplicationFactorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DecreaseReplicationFactorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DecreaseReplicationFactorError {
fn description(&self) -> &str {
match *self {
DecreaseReplicationFactorError::ClusterNotFoundFault(ref cause) => cause,
DecreaseReplicationFactorError::InvalidClusterStateFault(ref cause) => cause,
DecreaseReplicationFactorError::InvalidParameterCombination(ref cause) => cause,
DecreaseReplicationFactorError::InvalidParameterValue(ref cause) => cause,
DecreaseReplicationFactorError::NodeNotFoundFault(ref cause) => cause,
DecreaseReplicationFactorError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DecreaseReplicationFactorError::Validation(ref cause) => cause,
DecreaseReplicationFactorError::Credentials(ref err) => err.description(),
DecreaseReplicationFactorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DecreaseReplicationFactorError::ParseError(ref cause) => cause,
DecreaseReplicationFactorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteClusterError {
ClusterNotFoundFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteClusterError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteClusterError {
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 {
"ClusterNotFoundFault" => {
return DeleteClusterError::ClusterNotFoundFault(String::from(error_message));
}
"InvalidClusterStateFault" => {
return DeleteClusterError::InvalidClusterStateFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return DeleteClusterError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return DeleteClusterError::InvalidParameterValue(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return DeleteClusterError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteClusterError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteClusterError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteClusterError {
fn from(err: serde_json::error::Error) -> DeleteClusterError {
DeleteClusterError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteClusterError {
fn from(err: CredentialsError) -> DeleteClusterError {
DeleteClusterError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteClusterError {
fn from(err: HttpDispatchError) -> DeleteClusterError {
DeleteClusterError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteClusterError {
fn from(err: io::Error) -> DeleteClusterError {
DeleteClusterError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteClusterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteClusterError {
fn description(&self) -> &str {
match *self {
DeleteClusterError::ClusterNotFoundFault(ref cause) => cause,
DeleteClusterError::InvalidClusterStateFault(ref cause) => cause,
DeleteClusterError::InvalidParameterCombination(ref cause) => cause,
DeleteClusterError::InvalidParameterValue(ref cause) => cause,
DeleteClusterError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DeleteClusterError::Validation(ref cause) => cause,
DeleteClusterError::Credentials(ref err) => err.description(),
DeleteClusterError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteClusterError::ParseError(ref cause) => cause,
DeleteClusterError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteParameterGroupError {
InvalidParameterCombination(String),
InvalidParameterGroupStateFault(String),
InvalidParameterValue(String),
ParameterGroupNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteParameterGroupError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteParameterGroupError {
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 {
"InvalidParameterCombinationException" => {
return DeleteParameterGroupError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterGroupStateFault" => {
return DeleteParameterGroupError::InvalidParameterGroupStateFault(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return DeleteParameterGroupError::InvalidParameterValue(String::from(
error_message,
));
}
"ParameterGroupNotFoundFault" => {
return DeleteParameterGroupError::ParameterGroupNotFoundFault(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return DeleteParameterGroupError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteParameterGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteParameterGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteParameterGroupError {
fn from(err: serde_json::error::Error) -> DeleteParameterGroupError {
DeleteParameterGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteParameterGroupError {
fn from(err: CredentialsError) -> DeleteParameterGroupError {
DeleteParameterGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteParameterGroupError {
fn from(err: HttpDispatchError) -> DeleteParameterGroupError {
DeleteParameterGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteParameterGroupError {
fn from(err: io::Error) -> DeleteParameterGroupError {
DeleteParameterGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteParameterGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteParameterGroupError {
fn description(&self) -> &str {
match *self {
DeleteParameterGroupError::InvalidParameterCombination(ref cause) => cause,
DeleteParameterGroupError::InvalidParameterGroupStateFault(ref cause) => cause,
DeleteParameterGroupError::InvalidParameterValue(ref cause) => cause,
DeleteParameterGroupError::ParameterGroupNotFoundFault(ref cause) => cause,
DeleteParameterGroupError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DeleteParameterGroupError::Validation(ref cause) => cause,
DeleteParameterGroupError::Credentials(ref err) => err.description(),
DeleteParameterGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteParameterGroupError::ParseError(ref cause) => cause,
DeleteParameterGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSubnetGroupError {
ServiceLinkedRoleNotFoundFault(String),
SubnetGroupInUseFault(String),
SubnetGroupNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSubnetGroupError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSubnetGroupError {
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 {
"ServiceLinkedRoleNotFoundFault" => {
return DeleteSubnetGroupError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"SubnetGroupInUseFault" => {
return DeleteSubnetGroupError::SubnetGroupInUseFault(String::from(
error_message,
));
}
"SubnetGroupNotFoundFault" => {
return DeleteSubnetGroupError::SubnetGroupNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteSubnetGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteSubnetGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSubnetGroupError {
fn from(err: serde_json::error::Error) -> DeleteSubnetGroupError {
DeleteSubnetGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSubnetGroupError {
fn from(err: CredentialsError) -> DeleteSubnetGroupError {
DeleteSubnetGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSubnetGroupError {
fn from(err: HttpDispatchError) -> DeleteSubnetGroupError {
DeleteSubnetGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSubnetGroupError {
fn from(err: io::Error) -> DeleteSubnetGroupError {
DeleteSubnetGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSubnetGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSubnetGroupError {
fn description(&self) -> &str {
match *self {
DeleteSubnetGroupError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DeleteSubnetGroupError::SubnetGroupInUseFault(ref cause) => cause,
DeleteSubnetGroupError::SubnetGroupNotFoundFault(ref cause) => cause,
DeleteSubnetGroupError::Validation(ref cause) => cause,
DeleteSubnetGroupError::Credentials(ref err) => err.description(),
DeleteSubnetGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteSubnetGroupError::ParseError(ref cause) => cause,
DeleteSubnetGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeClustersError {
ClusterNotFoundFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeClustersError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeClustersError {
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 {
"ClusterNotFoundFault" => {
return DescribeClustersError::ClusterNotFoundFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return DescribeClustersError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return DescribeClustersError::InvalidParameterValue(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return DescribeClustersError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeClustersError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeClustersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeClustersError {
fn from(err: serde_json::error::Error) -> DescribeClustersError {
DescribeClustersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeClustersError {
fn from(err: CredentialsError) -> DescribeClustersError {
DescribeClustersError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeClustersError {
fn from(err: HttpDispatchError) -> DescribeClustersError {
DescribeClustersError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeClustersError {
fn from(err: io::Error) -> DescribeClustersError {
DescribeClustersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeClustersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeClustersError {
fn description(&self) -> &str {
match *self {
DescribeClustersError::ClusterNotFoundFault(ref cause) => cause,
DescribeClustersError::InvalidParameterCombination(ref cause) => cause,
DescribeClustersError::InvalidParameterValue(ref cause) => cause,
DescribeClustersError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DescribeClustersError::Validation(ref cause) => cause,
DescribeClustersError::Credentials(ref err) => err.description(),
DescribeClustersError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeClustersError::ParseError(ref cause) => cause,
DescribeClustersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDefaultParametersError {
InvalidParameterCombination(String),
InvalidParameterValue(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDefaultParametersError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeDefaultParametersError {
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 {
"InvalidParameterCombinationException" => {
return DescribeDefaultParametersError::InvalidParameterCombination(
String::from(error_message),
);
}
"InvalidParameterValueException" => {
return DescribeDefaultParametersError::InvalidParameterValue(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return DescribeDefaultParametersError::ServiceLinkedRoleNotFoundFault(
String::from(error_message),
);
}
"ValidationException" => {
return DescribeDefaultParametersError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeDefaultParametersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDefaultParametersError {
fn from(err: serde_json::error::Error) -> DescribeDefaultParametersError {
DescribeDefaultParametersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDefaultParametersError {
fn from(err: CredentialsError) -> DescribeDefaultParametersError {
DescribeDefaultParametersError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDefaultParametersError {
fn from(err: HttpDispatchError) -> DescribeDefaultParametersError {
DescribeDefaultParametersError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDefaultParametersError {
fn from(err: io::Error) -> DescribeDefaultParametersError {
DescribeDefaultParametersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDefaultParametersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDefaultParametersError {
fn description(&self) -> &str {
match *self {
DescribeDefaultParametersError::InvalidParameterCombination(ref cause) => cause,
DescribeDefaultParametersError::InvalidParameterValue(ref cause) => cause,
DescribeDefaultParametersError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DescribeDefaultParametersError::Validation(ref cause) => cause,
DescribeDefaultParametersError::Credentials(ref err) => err.description(),
DescribeDefaultParametersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDefaultParametersError::ParseError(ref cause) => cause,
DescribeDefaultParametersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeEventsError {
InvalidParameterCombination(String),
InvalidParameterValue(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeEventsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeEventsError {
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 {
"InvalidParameterCombinationException" => {
return DescribeEventsError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return DescribeEventsError::InvalidParameterValue(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return DescribeEventsError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeEventsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeEventsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeEventsError {
fn from(err: serde_json::error::Error) -> DescribeEventsError {
DescribeEventsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeEventsError {
fn from(err: CredentialsError) -> DescribeEventsError {
DescribeEventsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeEventsError {
fn from(err: HttpDispatchError) -> DescribeEventsError {
DescribeEventsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeEventsError {
fn from(err: io::Error) -> DescribeEventsError {
DescribeEventsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeEventsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeEventsError {
fn description(&self) -> &str {
match *self {
DescribeEventsError::InvalidParameterCombination(ref cause) => cause,
DescribeEventsError::InvalidParameterValue(ref cause) => cause,
DescribeEventsError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DescribeEventsError::Validation(ref cause) => cause,
DescribeEventsError::Credentials(ref err) => err.description(),
DescribeEventsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeEventsError::ParseError(ref cause) => cause,
DescribeEventsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeParameterGroupsError {
InvalidParameterCombination(String),
InvalidParameterValue(String),
ParameterGroupNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeParameterGroupsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeParameterGroupsError {
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 {
"InvalidParameterCombinationException" => {
return DescribeParameterGroupsError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return DescribeParameterGroupsError::InvalidParameterValue(String::from(
error_message,
));
}
"ParameterGroupNotFoundFault" => {
return DescribeParameterGroupsError::ParameterGroupNotFoundFault(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return DescribeParameterGroupsError::ServiceLinkedRoleNotFoundFault(
String::from(error_message),
);
}
"ValidationException" => {
return DescribeParameterGroupsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeParameterGroupsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeParameterGroupsError {
fn from(err: serde_json::error::Error) -> DescribeParameterGroupsError {
DescribeParameterGroupsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeParameterGroupsError {
fn from(err: CredentialsError) -> DescribeParameterGroupsError {
DescribeParameterGroupsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeParameterGroupsError {
fn from(err: HttpDispatchError) -> DescribeParameterGroupsError {
DescribeParameterGroupsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeParameterGroupsError {
fn from(err: io::Error) -> DescribeParameterGroupsError {
DescribeParameterGroupsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeParameterGroupsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeParameterGroupsError {
fn description(&self) -> &str {
match *self {
DescribeParameterGroupsError::InvalidParameterCombination(ref cause) => cause,
DescribeParameterGroupsError::InvalidParameterValue(ref cause) => cause,
DescribeParameterGroupsError::ParameterGroupNotFoundFault(ref cause) => cause,
DescribeParameterGroupsError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DescribeParameterGroupsError::Validation(ref cause) => cause,
DescribeParameterGroupsError::Credentials(ref err) => err.description(),
DescribeParameterGroupsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeParameterGroupsError::ParseError(ref cause) => cause,
DescribeParameterGroupsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeParametersError {
InvalidParameterCombination(String),
InvalidParameterValue(String),
ParameterGroupNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeParametersError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeParametersError {
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 {
"InvalidParameterCombinationException" => {
return DescribeParametersError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return DescribeParametersError::InvalidParameterValue(String::from(
error_message,
));
}
"ParameterGroupNotFoundFault" => {
return DescribeParametersError::ParameterGroupNotFoundFault(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return DescribeParametersError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeParametersError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeParametersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeParametersError {
fn from(err: serde_json::error::Error) -> DescribeParametersError {
DescribeParametersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeParametersError {
fn from(err: CredentialsError) -> DescribeParametersError {
DescribeParametersError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeParametersError {
fn from(err: HttpDispatchError) -> DescribeParametersError {
DescribeParametersError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeParametersError {
fn from(err: io::Error) -> DescribeParametersError {
DescribeParametersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeParametersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeParametersError {
fn description(&self) -> &str {
match *self {
DescribeParametersError::InvalidParameterCombination(ref cause) => cause,
DescribeParametersError::InvalidParameterValue(ref cause) => cause,
DescribeParametersError::ParameterGroupNotFoundFault(ref cause) => cause,
DescribeParametersError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DescribeParametersError::Validation(ref cause) => cause,
DescribeParametersError::Credentials(ref err) => err.description(),
DescribeParametersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeParametersError::ParseError(ref cause) => cause,
DescribeParametersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeSubnetGroupsError {
ServiceLinkedRoleNotFoundFault(String),
SubnetGroupNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeSubnetGroupsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeSubnetGroupsError {
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 {
"ServiceLinkedRoleNotFoundFault" => {
return DescribeSubnetGroupsError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"SubnetGroupNotFoundFault" => {
return DescribeSubnetGroupsError::SubnetGroupNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeSubnetGroupsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeSubnetGroupsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeSubnetGroupsError {
fn from(err: serde_json::error::Error) -> DescribeSubnetGroupsError {
DescribeSubnetGroupsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeSubnetGroupsError {
fn from(err: CredentialsError) -> DescribeSubnetGroupsError {
DescribeSubnetGroupsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeSubnetGroupsError {
fn from(err: HttpDispatchError) -> DescribeSubnetGroupsError {
DescribeSubnetGroupsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeSubnetGroupsError {
fn from(err: io::Error) -> DescribeSubnetGroupsError {
DescribeSubnetGroupsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeSubnetGroupsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeSubnetGroupsError {
fn description(&self) -> &str {
match *self {
DescribeSubnetGroupsError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
DescribeSubnetGroupsError::SubnetGroupNotFoundFault(ref cause) => cause,
DescribeSubnetGroupsError::Validation(ref cause) => cause,
DescribeSubnetGroupsError::Credentials(ref err) => err.description(),
DescribeSubnetGroupsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeSubnetGroupsError::ParseError(ref cause) => cause,
DescribeSubnetGroupsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum IncreaseReplicationFactorError {
ClusterNotFoundFault(String),
InsufficientClusterCapacityFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
InvalidVPCNetworkStateFault(String),
NodeQuotaForClusterExceededFault(String),
NodeQuotaForCustomerExceededFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl IncreaseReplicationFactorError {
pub fn from_response(res: BufferedHttpResponse) -> IncreaseReplicationFactorError {
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 {
"ClusterNotFoundFault" => {
return IncreaseReplicationFactorError::ClusterNotFoundFault(String::from(
error_message,
));
}
"InsufficientClusterCapacityFault" => {
return IncreaseReplicationFactorError::InsufficientClusterCapacityFault(
String::from(error_message),
);
}
"InvalidClusterStateFault" => {
return IncreaseReplicationFactorError::InvalidClusterStateFault(String::from(
error_message,
));
}
"InvalidParameterCombinationException" => {
return IncreaseReplicationFactorError::InvalidParameterCombination(
String::from(error_message),
);
}
"InvalidParameterValueException" => {
return IncreaseReplicationFactorError::InvalidParameterValue(String::from(
error_message,
));
}
"InvalidVPCNetworkStateFault" => {
return IncreaseReplicationFactorError::InvalidVPCNetworkStateFault(
String::from(error_message),
);
}
"NodeQuotaForClusterExceededFault" => {
return IncreaseReplicationFactorError::NodeQuotaForClusterExceededFault(
String::from(error_message),
);
}
"NodeQuotaForCustomerExceededFault" => {
return IncreaseReplicationFactorError::NodeQuotaForCustomerExceededFault(
String::from(error_message),
);
}
"ServiceLinkedRoleNotFoundFault" => {
return IncreaseReplicationFactorError::ServiceLinkedRoleNotFoundFault(
String::from(error_message),
);
}
"ValidationException" => {
return IncreaseReplicationFactorError::Validation(error_message.to_string());
}
_ => {}
}
}
return IncreaseReplicationFactorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for IncreaseReplicationFactorError {
fn from(err: serde_json::error::Error) -> IncreaseReplicationFactorError {
IncreaseReplicationFactorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for IncreaseReplicationFactorError {
fn from(err: CredentialsError) -> IncreaseReplicationFactorError {
IncreaseReplicationFactorError::Credentials(err)
}
}
impl From<HttpDispatchError> for IncreaseReplicationFactorError {
fn from(err: HttpDispatchError) -> IncreaseReplicationFactorError {
IncreaseReplicationFactorError::HttpDispatch(err)
}
}
impl From<io::Error> for IncreaseReplicationFactorError {
fn from(err: io::Error) -> IncreaseReplicationFactorError {
IncreaseReplicationFactorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for IncreaseReplicationFactorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for IncreaseReplicationFactorError {
fn description(&self) -> &str {
match *self {
IncreaseReplicationFactorError::ClusterNotFoundFault(ref cause) => cause,
IncreaseReplicationFactorError::InsufficientClusterCapacityFault(ref cause) => cause,
IncreaseReplicationFactorError::InvalidClusterStateFault(ref cause) => cause,
IncreaseReplicationFactorError::InvalidParameterCombination(ref cause) => cause,
IncreaseReplicationFactorError::InvalidParameterValue(ref cause) => cause,
IncreaseReplicationFactorError::InvalidVPCNetworkStateFault(ref cause) => cause,
IncreaseReplicationFactorError::NodeQuotaForClusterExceededFault(ref cause) => cause,
IncreaseReplicationFactorError::NodeQuotaForCustomerExceededFault(ref cause) => cause,
IncreaseReplicationFactorError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
IncreaseReplicationFactorError::Validation(ref cause) => cause,
IncreaseReplicationFactorError::Credentials(ref err) => err.description(),
IncreaseReplicationFactorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
IncreaseReplicationFactorError::ParseError(ref cause) => cause,
IncreaseReplicationFactorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsError {
ClusterNotFoundFault(String),
InvalidARNFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTagsError {
pub fn from_response(res: BufferedHttpResponse) -> ListTagsError {
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 {
"ClusterNotFoundFault" => {
return ListTagsError::ClusterNotFoundFault(String::from(error_message));
}
"InvalidARNFault" => {
return ListTagsError::InvalidARNFault(String::from(error_message));
}
"InvalidClusterStateFault" => {
return ListTagsError::InvalidClusterStateFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return ListTagsError::InvalidParameterCombination(String::from(error_message));
}
"InvalidParameterValueException" => {
return ListTagsError::InvalidParameterValue(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return ListTagsError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return ListTagsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTagsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTagsError {
fn from(err: serde_json::error::Error) -> ListTagsError {
ListTagsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTagsError {
fn from(err: CredentialsError) -> ListTagsError {
ListTagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTagsError {
fn from(err: HttpDispatchError) -> ListTagsError {
ListTagsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTagsError {
fn from(err: io::Error) -> ListTagsError {
ListTagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsError {
fn description(&self) -> &str {
match *self {
ListTagsError::ClusterNotFoundFault(ref cause) => cause,
ListTagsError::InvalidARNFault(ref cause) => cause,
ListTagsError::InvalidClusterStateFault(ref cause) => cause,
ListTagsError::InvalidParameterCombination(ref cause) => cause,
ListTagsError::InvalidParameterValue(ref cause) => cause,
ListTagsError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
ListTagsError::Validation(ref cause) => cause,
ListTagsError::Credentials(ref err) => err.description(),
ListTagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListTagsError::ParseError(ref cause) => cause,
ListTagsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RebootNodeError {
ClusterNotFoundFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
NodeNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RebootNodeError {
pub fn from_response(res: BufferedHttpResponse) -> RebootNodeError {
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 {
"ClusterNotFoundFault" => {
return RebootNodeError::ClusterNotFoundFault(String::from(error_message));
}
"InvalidClusterStateFault" => {
return RebootNodeError::InvalidClusterStateFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return RebootNodeError::InvalidParameterCombination(String::from(error_message));
}
"InvalidParameterValueException" => {
return RebootNodeError::InvalidParameterValue(String::from(error_message));
}
"NodeNotFoundFault" => {
return RebootNodeError::NodeNotFoundFault(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return RebootNodeError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return RebootNodeError::Validation(error_message.to_string());
}
_ => {}
}
}
return RebootNodeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RebootNodeError {
fn from(err: serde_json::error::Error) -> RebootNodeError {
RebootNodeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RebootNodeError {
fn from(err: CredentialsError) -> RebootNodeError {
RebootNodeError::Credentials(err)
}
}
impl From<HttpDispatchError> for RebootNodeError {
fn from(err: HttpDispatchError) -> RebootNodeError {
RebootNodeError::HttpDispatch(err)
}
}
impl From<io::Error> for RebootNodeError {
fn from(err: io::Error) -> RebootNodeError {
RebootNodeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RebootNodeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RebootNodeError {
fn description(&self) -> &str {
match *self {
RebootNodeError::ClusterNotFoundFault(ref cause) => cause,
RebootNodeError::InvalidClusterStateFault(ref cause) => cause,
RebootNodeError::InvalidParameterCombination(ref cause) => cause,
RebootNodeError::InvalidParameterValue(ref cause) => cause,
RebootNodeError::NodeNotFoundFault(ref cause) => cause,
RebootNodeError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
RebootNodeError::Validation(ref cause) => cause,
RebootNodeError::Credentials(ref err) => err.description(),
RebootNodeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
RebootNodeError::ParseError(ref cause) => cause,
RebootNodeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
ClusterNotFoundFault(String),
InvalidARNFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
ServiceLinkedRoleNotFoundFault(String),
TagQuotaPerResourceExceeded(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 {
"ClusterNotFoundFault" => {
return TagResourceError::ClusterNotFoundFault(String::from(error_message));
}
"InvalidARNFault" => {
return TagResourceError::InvalidARNFault(String::from(error_message));
}
"InvalidClusterStateFault" => {
return TagResourceError::InvalidClusterStateFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return TagResourceError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return TagResourceError::InvalidParameterValue(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return TagResourceError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"TagQuotaPerResourceExceeded" => {
return TagResourceError::TagQuotaPerResourceExceeded(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::ClusterNotFoundFault(ref cause) => cause,
TagResourceError::InvalidARNFault(ref cause) => cause,
TagResourceError::InvalidClusterStateFault(ref cause) => cause,
TagResourceError::InvalidParameterCombination(ref cause) => cause,
TagResourceError::InvalidParameterValue(ref cause) => cause,
TagResourceError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
TagResourceError::TagQuotaPerResourceExceeded(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 {
ClusterNotFoundFault(String),
InvalidARNFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
ServiceLinkedRoleNotFoundFault(String),
TagNotFoundFault(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 {
"ClusterNotFoundFault" => {
return UntagResourceError::ClusterNotFoundFault(String::from(error_message));
}
"InvalidARNFault" => {
return UntagResourceError::InvalidARNFault(String::from(error_message));
}
"InvalidClusterStateFault" => {
return UntagResourceError::InvalidClusterStateFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return UntagResourceError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return UntagResourceError::InvalidParameterValue(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return UntagResourceError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"TagNotFoundFault" => {
return UntagResourceError::TagNotFoundFault(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::ClusterNotFoundFault(ref cause) => cause,
UntagResourceError::InvalidARNFault(ref cause) => cause,
UntagResourceError::InvalidClusterStateFault(ref cause) => cause,
UntagResourceError::InvalidParameterCombination(ref cause) => cause,
UntagResourceError::InvalidParameterValue(ref cause) => cause,
UntagResourceError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
UntagResourceError::TagNotFoundFault(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 UpdateClusterError {
ClusterNotFoundFault(String),
InvalidClusterStateFault(String),
InvalidParameterCombination(String),
InvalidParameterGroupStateFault(String),
InvalidParameterValue(String),
ParameterGroupNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateClusterError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateClusterError {
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 {
"ClusterNotFoundFault" => {
return UpdateClusterError::ClusterNotFoundFault(String::from(error_message));
}
"InvalidClusterStateFault" => {
return UpdateClusterError::InvalidClusterStateFault(String::from(error_message));
}
"InvalidParameterCombinationException" => {
return UpdateClusterError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterGroupStateFault" => {
return UpdateClusterError::InvalidParameterGroupStateFault(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return UpdateClusterError::InvalidParameterValue(String::from(error_message));
}
"ParameterGroupNotFoundFault" => {
return UpdateClusterError::ParameterGroupNotFoundFault(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return UpdateClusterError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateClusterError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateClusterError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateClusterError {
fn from(err: serde_json::error::Error) -> UpdateClusterError {
UpdateClusterError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateClusterError {
fn from(err: CredentialsError) -> UpdateClusterError {
UpdateClusterError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateClusterError {
fn from(err: HttpDispatchError) -> UpdateClusterError {
UpdateClusterError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateClusterError {
fn from(err: io::Error) -> UpdateClusterError {
UpdateClusterError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateClusterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateClusterError {
fn description(&self) -> &str {
match *self {
UpdateClusterError::ClusterNotFoundFault(ref cause) => cause,
UpdateClusterError::InvalidClusterStateFault(ref cause) => cause,
UpdateClusterError::InvalidParameterCombination(ref cause) => cause,
UpdateClusterError::InvalidParameterGroupStateFault(ref cause) => cause,
UpdateClusterError::InvalidParameterValue(ref cause) => cause,
UpdateClusterError::ParameterGroupNotFoundFault(ref cause) => cause,
UpdateClusterError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
UpdateClusterError::Validation(ref cause) => cause,
UpdateClusterError::Credentials(ref err) => err.description(),
UpdateClusterError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateClusterError::ParseError(ref cause) => cause,
UpdateClusterError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateParameterGroupError {
InvalidParameterCombination(String),
InvalidParameterGroupStateFault(String),
InvalidParameterValue(String),
ParameterGroupNotFoundFault(String),
ServiceLinkedRoleNotFoundFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateParameterGroupError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateParameterGroupError {
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 {
"InvalidParameterCombinationException" => {
return UpdateParameterGroupError::InvalidParameterCombination(String::from(
error_message,
));
}
"InvalidParameterGroupStateFault" => {
return UpdateParameterGroupError::InvalidParameterGroupStateFault(String::from(
error_message,
));
}
"InvalidParameterValueException" => {
return UpdateParameterGroupError::InvalidParameterValue(String::from(
error_message,
));
}
"ParameterGroupNotFoundFault" => {
return UpdateParameterGroupError::ParameterGroupNotFoundFault(String::from(
error_message,
));
}
"ServiceLinkedRoleNotFoundFault" => {
return UpdateParameterGroupError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateParameterGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateParameterGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateParameterGroupError {
fn from(err: serde_json::error::Error) -> UpdateParameterGroupError {
UpdateParameterGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateParameterGroupError {
fn from(err: CredentialsError) -> UpdateParameterGroupError {
UpdateParameterGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateParameterGroupError {
fn from(err: HttpDispatchError) -> UpdateParameterGroupError {
UpdateParameterGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateParameterGroupError {
fn from(err: io::Error) -> UpdateParameterGroupError {
UpdateParameterGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateParameterGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateParameterGroupError {
fn description(&self) -> &str {
match *self {
UpdateParameterGroupError::InvalidParameterCombination(ref cause) => cause,
UpdateParameterGroupError::InvalidParameterGroupStateFault(ref cause) => cause,
UpdateParameterGroupError::InvalidParameterValue(ref cause) => cause,
UpdateParameterGroupError::ParameterGroupNotFoundFault(ref cause) => cause,
UpdateParameterGroupError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
UpdateParameterGroupError::Validation(ref cause) => cause,
UpdateParameterGroupError::Credentials(ref err) => err.description(),
UpdateParameterGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateParameterGroupError::ParseError(ref cause) => cause,
UpdateParameterGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateSubnetGroupError {
InvalidSubnet(String),
ServiceLinkedRoleNotFoundFault(String),
SubnetGroupNotFoundFault(String),
SubnetInUse(String),
SubnetQuotaExceededFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateSubnetGroupError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateSubnetGroupError {
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 {
"InvalidSubnet" => {
return UpdateSubnetGroupError::InvalidSubnet(String::from(error_message));
}
"ServiceLinkedRoleNotFoundFault" => {
return UpdateSubnetGroupError::ServiceLinkedRoleNotFoundFault(String::from(
error_message,
));
}
"SubnetGroupNotFoundFault" => {
return UpdateSubnetGroupError::SubnetGroupNotFoundFault(String::from(
error_message,
));
}
"SubnetInUse" => {
return UpdateSubnetGroupError::SubnetInUse(String::from(error_message));
}
"SubnetQuotaExceededFault" => {
return UpdateSubnetGroupError::SubnetQuotaExceededFault(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateSubnetGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateSubnetGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateSubnetGroupError {
fn from(err: serde_json::error::Error) -> UpdateSubnetGroupError {
UpdateSubnetGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateSubnetGroupError {
fn from(err: CredentialsError) -> UpdateSubnetGroupError {
UpdateSubnetGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateSubnetGroupError {
fn from(err: HttpDispatchError) -> UpdateSubnetGroupError {
UpdateSubnetGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateSubnetGroupError {
fn from(err: io::Error) -> UpdateSubnetGroupError {
UpdateSubnetGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateSubnetGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateSubnetGroupError {
fn description(&self) -> &str {
match *self {
UpdateSubnetGroupError::InvalidSubnet(ref cause) => cause,
UpdateSubnetGroupError::ServiceLinkedRoleNotFoundFault(ref cause) => cause,
UpdateSubnetGroupError::SubnetGroupNotFoundFault(ref cause) => cause,
UpdateSubnetGroupError::SubnetInUse(ref cause) => cause,
UpdateSubnetGroupError::SubnetQuotaExceededFault(ref cause) => cause,
UpdateSubnetGroupError::Validation(ref cause) => cause,
UpdateSubnetGroupError::Credentials(ref err) => err.description(),
UpdateSubnetGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateSubnetGroupError::ParseError(ref cause) => cause,
UpdateSubnetGroupError::Unknown(_) => "unknown error",
}
}
}
pub trait DynamodbAccelerator {
fn create_cluster(
&self,
input: CreateClusterRequest,
) -> RusotoFuture<CreateClusterResponse, CreateClusterError>;
fn create_parameter_group(
&self,
input: CreateParameterGroupRequest,
) -> RusotoFuture<CreateParameterGroupResponse, CreateParameterGroupError>;
fn create_subnet_group(
&self,
input: CreateSubnetGroupRequest,
) -> RusotoFuture<CreateSubnetGroupResponse, CreateSubnetGroupError>;
fn decrease_replication_factor(
&self,
input: DecreaseReplicationFactorRequest,
) -> RusotoFuture<DecreaseReplicationFactorResponse, DecreaseReplicationFactorError>;
fn delete_cluster(
&self,
input: DeleteClusterRequest,
) -> RusotoFuture<DeleteClusterResponse, DeleteClusterError>;
fn delete_parameter_group(
&self,
input: DeleteParameterGroupRequest,
) -> RusotoFuture<DeleteParameterGroupResponse, DeleteParameterGroupError>;
fn delete_subnet_group(
&self,
input: DeleteSubnetGroupRequest,
) -> RusotoFuture<DeleteSubnetGroupResponse, DeleteSubnetGroupError>;
fn describe_clusters(
&self,
input: DescribeClustersRequest,
) -> RusotoFuture<DescribeClustersResponse, DescribeClustersError>;
fn describe_default_parameters(
&self,
input: DescribeDefaultParametersRequest,
) -> RusotoFuture<DescribeDefaultParametersResponse, DescribeDefaultParametersError>;
fn describe_events(
&self,
input: DescribeEventsRequest,
) -> RusotoFuture<DescribeEventsResponse, DescribeEventsError>;
fn describe_parameter_groups(
&self,
input: DescribeParameterGroupsRequest,
) -> RusotoFuture<DescribeParameterGroupsResponse, DescribeParameterGroupsError>;
fn describe_parameters(
&self,
input: DescribeParametersRequest,
) -> RusotoFuture<DescribeParametersResponse, DescribeParametersError>;
fn describe_subnet_groups(
&self,
input: DescribeSubnetGroupsRequest,
) -> RusotoFuture<DescribeSubnetGroupsResponse, DescribeSubnetGroupsError>;
fn increase_replication_factor(
&self,
input: IncreaseReplicationFactorRequest,
) -> RusotoFuture<IncreaseReplicationFactorResponse, IncreaseReplicationFactorError>;
fn list_tags(&self, input: ListTagsRequest) -> RusotoFuture<ListTagsResponse, ListTagsError>;
fn reboot_node(
&self,
input: RebootNodeRequest,
) -> RusotoFuture<RebootNodeResponse, RebootNodeError>;
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError>;
fn update_cluster(
&self,
input: UpdateClusterRequest,
) -> RusotoFuture<UpdateClusterResponse, UpdateClusterError>;
fn update_parameter_group(
&self,
input: UpdateParameterGroupRequest,
) -> RusotoFuture<UpdateParameterGroupResponse, UpdateParameterGroupError>;
fn update_subnet_group(
&self,
input: UpdateSubnetGroupRequest,
) -> RusotoFuture<UpdateSubnetGroupResponse, UpdateSubnetGroupError>;
}
#[derive(Clone)]
pub struct DynamodbAcceleratorClient {
client: Client,
region: region::Region,
}
impl DynamodbAcceleratorClient {
pub fn new(region: region::Region) -> DynamodbAcceleratorClient {
DynamodbAcceleratorClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> DynamodbAcceleratorClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
DynamodbAcceleratorClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl DynamodbAccelerator for DynamodbAcceleratorClient {
fn create_cluster(
&self,
input: CreateClusterRequest,
) -> RusotoFuture<CreateClusterResponse, CreateClusterError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.CreateCluster");
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::<CreateClusterResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateClusterError::from_response(response))),
)
}
})
}
fn create_parameter_group(
&self,
input: CreateParameterGroupRequest,
) -> RusotoFuture<CreateParameterGroupResponse, CreateParameterGroupError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.CreateParameterGroup");
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::<CreateParameterGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateParameterGroupError::from_response(response))
}),
)
}
})
}
fn create_subnet_group(
&self,
input: CreateSubnetGroupRequest,
) -> RusotoFuture<CreateSubnetGroupResponse, CreateSubnetGroupError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.CreateSubnetGroup");
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::<CreateSubnetGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateSubnetGroupError::from_response(response))),
)
}
})
}
fn decrease_replication_factor(
&self,
input: DecreaseReplicationFactorRequest,
) -> RusotoFuture<DecreaseReplicationFactorResponse, DecreaseReplicationFactorError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DecreaseReplicationFactor");
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::<DecreaseReplicationFactorResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DecreaseReplicationFactorError::from_response(response))
}))
}
})
}
fn delete_cluster(
&self,
input: DeleteClusterRequest,
) -> RusotoFuture<DeleteClusterResponse, DeleteClusterError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DeleteCluster");
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::<DeleteClusterResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteClusterError::from_response(response))),
)
}
})
}
fn delete_parameter_group(
&self,
input: DeleteParameterGroupRequest,
) -> RusotoFuture<DeleteParameterGroupResponse, DeleteParameterGroupError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DeleteParameterGroup");
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::<DeleteParameterGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteParameterGroupError::from_response(response))
}),
)
}
})
}
fn delete_subnet_group(
&self,
input: DeleteSubnetGroupRequest,
) -> RusotoFuture<DeleteSubnetGroupResponse, DeleteSubnetGroupError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DeleteSubnetGroup");
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::<DeleteSubnetGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteSubnetGroupError::from_response(response))),
)
}
})
}
fn describe_clusters(
&self,
input: DescribeClustersRequest,
) -> RusotoFuture<DescribeClustersResponse, DescribeClustersError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DescribeClusters");
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::<DescribeClustersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeClustersError::from_response(response))),
)
}
})
}
fn describe_default_parameters(
&self,
input: DescribeDefaultParametersRequest,
) -> RusotoFuture<DescribeDefaultParametersResponse, DescribeDefaultParametersError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DescribeDefaultParameters");
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::<DescribeDefaultParametersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeDefaultParametersError::from_response(response))
}))
}
})
}
fn describe_events(
&self,
input: DescribeEventsRequest,
) -> RusotoFuture<DescribeEventsResponse, DescribeEventsError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DescribeEvents");
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::<DescribeEventsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeEventsError::from_response(response))),
)
}
})
}
fn describe_parameter_groups(
&self,
input: DescribeParameterGroupsRequest,
) -> RusotoFuture<DescribeParameterGroupsResponse, DescribeParameterGroupsError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DescribeParameterGroups");
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::<DescribeParameterGroupsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeParameterGroupsError::from_response(response))
}))
}
})
}
fn describe_parameters(
&self,
input: DescribeParametersRequest,
) -> RusotoFuture<DescribeParametersResponse, DescribeParametersError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DescribeParameters");
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::<DescribeParametersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeParametersError::from_response(response))),
)
}
})
}
fn describe_subnet_groups(
&self,
input: DescribeSubnetGroupsRequest,
) -> RusotoFuture<DescribeSubnetGroupsResponse, DescribeSubnetGroupsError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.DescribeSubnetGroups");
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::<DescribeSubnetGroupsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeSubnetGroupsError::from_response(response))
}),
)
}
})
}
fn increase_replication_factor(
&self,
input: IncreaseReplicationFactorRequest,
) -> RusotoFuture<IncreaseReplicationFactorResponse, IncreaseReplicationFactorError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.IncreaseReplicationFactor");
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::<IncreaseReplicationFactorResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(IncreaseReplicationFactorError::from_response(response))
}))
}
})
}
fn list_tags(&self, input: ListTagsRequest) -> RusotoFuture<ListTagsResponse, ListTagsError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.ListTags");
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::<ListTagsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListTagsError::from_response(response))),
)
}
})
}
fn reboot_node(
&self,
input: RebootNodeRequest,
) -> RusotoFuture<RebootNodeResponse, RebootNodeError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.RebootNode");
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::<RebootNodeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(RebootNodeError::from_response(response))),
)
}
})
}
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.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", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.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_cluster(
&self,
input: UpdateClusterRequest,
) -> RusotoFuture<UpdateClusterResponse, UpdateClusterError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.UpdateCluster");
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::<UpdateClusterResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateClusterError::from_response(response))),
)
}
})
}
fn update_parameter_group(
&self,
input: UpdateParameterGroupRequest,
) -> RusotoFuture<UpdateParameterGroupResponse, UpdateParameterGroupError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.UpdateParameterGroup");
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::<UpdateParameterGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateParameterGroupError::from_response(response))
}),
)
}
})
}
fn update_subnet_group(
&self,
input: UpdateSubnetGroupRequest,
) -> RusotoFuture<UpdateSubnetGroupResponse, UpdateSubnetGroupError> {
let mut request = SignedRequest::new("POST", "dax", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AmazonDAXV3.UpdateSubnetGroup");
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::<UpdateSubnetGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateSubnetGroupError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}