use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AcceptSharedDirectoryRequest {
#[serde(rename = "SharedDirectoryId")]
pub shared_directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AcceptSharedDirectoryResult {
#[serde(rename = "SharedDirectory")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_directory: Option<SharedDirectory>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AddIpRoutesRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "IpRoutes")]
pub ip_routes: Vec<IpRoute>,
#[serde(rename = "UpdateSecurityGroupForDirectoryControllers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub update_security_group_for_directory_controllers: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddIpRoutesResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AddTagsToResourceRequest {
#[serde(rename = "ResourceId")]
pub resource_id: String,
#[serde(rename = "Tags")]
pub tags: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddTagsToResourceResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Attribute {
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CancelSchemaExtensionRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "SchemaExtensionId")]
pub schema_extension_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CancelSchemaExtensionResult {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Computer {
#[serde(rename = "ComputerAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub computer_attributes: Option<Vec<Attribute>>,
#[serde(rename = "ComputerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub computer_id: Option<String>,
#[serde(rename = "ComputerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub computer_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ConditionalForwarder {
#[serde(rename = "DnsIpAddrs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dns_ip_addrs: Option<Vec<String>>,
#[serde(rename = "RemoteDomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_domain_name: Option<String>,
#[serde(rename = "ReplicationScope")]
#[serde(skip_serializing_if = "Option::is_none")]
pub replication_scope: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ConnectDirectoryRequest {
#[serde(rename = "ConnectSettings")]
pub connect_settings: DirectoryConnectSettings,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Password")]
pub password: String,
#[serde(rename = "ShortName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(rename = "Size")]
pub size: 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 ConnectDirectoryResult {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateAliasRequest {
#[serde(rename = "Alias")]
pub alias: String,
#[serde(rename = "DirectoryId")]
pub directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateAliasResult {
#[serde(rename = "Alias")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alias: Option<String>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateComputerRequest {
#[serde(rename = "ComputerAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub computer_attributes: Option<Vec<Attribute>>,
#[serde(rename = "ComputerName")]
pub computer_name: String,
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "OrganizationalUnitDistinguishedName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub organizational_unit_distinguished_name: Option<String>,
#[serde(rename = "Password")]
pub password: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateComputerResult {
#[serde(rename = "Computer")]
#[serde(skip_serializing_if = "Option::is_none")]
pub computer: Option<Computer>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateConditionalForwarderRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "DnsIpAddrs")]
pub dns_ip_addrs: Vec<String>,
#[serde(rename = "RemoteDomainName")]
pub remote_domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateConditionalForwarderResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDirectoryRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Password")]
pub password: String,
#[serde(rename = "ShortName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(rename = "Size")]
pub size: String,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "VpcSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_settings: Option<DirectoryVpcSettings>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDirectoryResult {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateLogSubscriptionRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "LogGroupName")]
pub log_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateLogSubscriptionResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateMicrosoftADRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Edition")]
#[serde(skip_serializing_if = "Option::is_none")]
pub edition: Option<String>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Password")]
pub password: String,
#[serde(rename = "ShortName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "VpcSettings")]
pub vpc_settings: DirectoryVpcSettings,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateMicrosoftADResult {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSnapshotRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSnapshotResult {
#[serde(rename = "SnapshotId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub snapshot_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateTrustRequest {
#[serde(rename = "ConditionalForwarderIpAddrs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub conditional_forwarder_ip_addrs: Option<Vec<String>>,
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "RemoteDomainName")]
pub remote_domain_name: String,
#[serde(rename = "SelectiveAuth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub selective_auth: Option<String>,
#[serde(rename = "TrustDirection")]
pub trust_direction: String,
#[serde(rename = "TrustPassword")]
pub trust_password: String,
#[serde(rename = "TrustType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateTrustResult {
#[serde(rename = "TrustId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteConditionalForwarderRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "RemoteDomainName")]
pub remote_domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteConditionalForwarderResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDirectoryRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteDirectoryResult {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteLogSubscriptionRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteLogSubscriptionResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSnapshotRequest {
#[serde(rename = "SnapshotId")]
pub snapshot_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSnapshotResult {
#[serde(rename = "SnapshotId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub snapshot_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteTrustRequest {
#[serde(rename = "DeleteAssociatedConditionalForwarder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delete_associated_conditional_forwarder: Option<bool>,
#[serde(rename = "TrustId")]
pub trust_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteTrustResult {
#[serde(rename = "TrustId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeregisterEventTopicRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "TopicName")]
pub topic_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeregisterEventTopicResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeConditionalForwardersRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "RemoteDomainNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_domain_names: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeConditionalForwardersResult {
#[serde(rename = "ConditionalForwarders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub conditional_forwarders: Option<Vec<ConditionalForwarder>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDirectoriesRequest {
#[serde(rename = "DirectoryIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_ids: Option<Vec<String>>,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: 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 DescribeDirectoriesResult {
#[serde(rename = "DirectoryDescriptions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_descriptions: Option<Vec<DirectoryDescription>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDomainControllersRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "DomainControllerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_controller_ids: Option<Vec<String>>,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: 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 DescribeDomainControllersResult {
#[serde(rename = "DomainControllers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_controllers: Option<Vec<DomainController>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeEventTopicsRequest {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "TopicNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub topic_names: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeEventTopicsResult {
#[serde(rename = "EventTopics")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_topics: Option<Vec<EventTopic>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeSharedDirectoriesRequest {
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "OwnerDirectoryId")]
pub owner_directory_id: String,
#[serde(rename = "SharedDirectoryIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_directory_ids: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeSharedDirectoriesResult {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SharedDirectories")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_directories: Option<Vec<SharedDirectory>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeSnapshotsRequest {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SnapshotIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub snapshot_ids: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeSnapshotsResult {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Snapshots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub snapshots: Option<Vec<Snapshot>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeTrustsRequest {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TrustIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_ids: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeTrustsResult {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Trusts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trusts: Option<Vec<Trust>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DirectoryConnectSettings {
#[serde(rename = "CustomerDnsIps")]
pub customer_dns_ips: Vec<String>,
#[serde(rename = "CustomerUserName")]
pub customer_user_name: String,
#[serde(rename = "SubnetIds")]
pub subnet_ids: Vec<String>,
#[serde(rename = "VpcId")]
pub vpc_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DirectoryConnectSettingsDescription {
#[serde(rename = "AvailabilityZones")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zones: Option<Vec<String>>,
#[serde(rename = "ConnectIps")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connect_ips: Option<Vec<String>>,
#[serde(rename = "CustomerUserName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_user_name: Option<String>,
#[serde(rename = "SecurityGroupId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_group_id: Option<String>,
#[serde(rename = "SubnetIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_ids: Option<Vec<String>>,
#[serde(rename = "VpcId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DirectoryDescription {
#[serde(rename = "AccessUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_url: Option<String>,
#[serde(rename = "Alias")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alias: Option<String>,
#[serde(rename = "ConnectSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connect_settings: Option<DirectoryConnectSettingsDescription>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "DesiredNumberOfDomainControllers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_number_of_domain_controllers: Option<i64>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "DnsIpAddrs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dns_ip_addrs: Option<Vec<String>>,
#[serde(rename = "Edition")]
#[serde(skip_serializing_if = "Option::is_none")]
pub edition: Option<String>,
#[serde(rename = "LaunchTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub launch_time: Option<f64>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "OwnerDirectoryDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_directory_description: Option<OwnerDirectoryDescription>,
#[serde(rename = "RadiusSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_settings: Option<RadiusSettings>,
#[serde(rename = "RadiusStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_status: Option<String>,
#[serde(rename = "ShareMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub share_method: Option<String>,
#[serde(rename = "ShareNotes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub share_notes: Option<String>,
#[serde(rename = "ShareStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub share_status: Option<String>,
#[serde(rename = "ShortName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(rename = "Size")]
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<String>,
#[serde(rename = "SsoEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sso_enabled: Option<bool>,
#[serde(rename = "Stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
#[serde(rename = "StageLastUpdatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_last_updated_date_time: Option<f64>,
#[serde(rename = "StageReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_reason: Option<String>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[serde(rename = "VpcSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_settings: Option<DirectoryVpcSettingsDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DirectoryLimits {
#[serde(rename = "CloudOnlyDirectoriesCurrentCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_only_directories_current_count: Option<i64>,
#[serde(rename = "CloudOnlyDirectoriesLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_only_directories_limit: Option<i64>,
#[serde(rename = "CloudOnlyDirectoriesLimitReached")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_only_directories_limit_reached: Option<bool>,
#[serde(rename = "CloudOnlyMicrosoftADCurrentCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_only_microsoft_ad_current_count: Option<i64>,
#[serde(rename = "CloudOnlyMicrosoftADLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_only_microsoft_ad_limit: Option<i64>,
#[serde(rename = "CloudOnlyMicrosoftADLimitReached")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_only_microsoft_ad_limit_reached: Option<bool>,
#[serde(rename = "ConnectedDirectoriesCurrentCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connected_directories_current_count: Option<i64>,
#[serde(rename = "ConnectedDirectoriesLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connected_directories_limit: Option<i64>,
#[serde(rename = "ConnectedDirectoriesLimitReached")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connected_directories_limit_reached: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DirectoryVpcSettings {
#[serde(rename = "SubnetIds")]
pub subnet_ids: Vec<String>,
#[serde(rename = "VpcId")]
pub vpc_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DirectoryVpcSettingsDescription {
#[serde(rename = "AvailabilityZones")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zones: Option<Vec<String>>,
#[serde(rename = "SecurityGroupId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_group_id: Option<String>,
#[serde(rename = "SubnetIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_ids: Option<Vec<String>>,
#[serde(rename = "VpcId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisableRadiusRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisableRadiusResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisableSsoRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "Password")]
#[serde(skip_serializing_if = "Option::is_none")]
pub password: Option<String>,
#[serde(rename = "UserName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisableSsoResult {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DomainController {
#[serde(rename = "AvailabilityZone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zone: Option<String>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "DnsIpAddr")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dns_ip_addr: Option<String>,
#[serde(rename = "DomainControllerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_controller_id: Option<String>,
#[serde(rename = "LaunchTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub launch_time: Option<f64>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "StatusLastUpdatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_last_updated_date_time: Option<f64>,
#[serde(rename = "StatusReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_reason: Option<String>,
#[serde(rename = "SubnetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_id: Option<String>,
#[serde(rename = "VpcId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct EnableRadiusRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "RadiusSettings")]
pub radius_settings: RadiusSettings,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EnableRadiusResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct EnableSsoRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "Password")]
#[serde(skip_serializing_if = "Option::is_none")]
pub password: Option<String>,
#[serde(rename = "UserName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EnableSsoResult {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EventTopic {
#[serde(rename = "CreatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date_time: Option<f64>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "TopicArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub topic_arn: Option<String>,
#[serde(rename = "TopicName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub topic_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDirectoryLimitsRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDirectoryLimitsResult {
#[serde(rename = "DirectoryLimits")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_limits: Option<DirectoryLimits>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSnapshotLimitsRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSnapshotLimitsResult {
#[serde(rename = "SnapshotLimits")]
#[serde(skip_serializing_if = "Option::is_none")]
pub snapshot_limits: Option<SnapshotLimits>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct IpRoute {
#[serde(rename = "CidrIp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cidr_ip: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IpRouteInfo {
#[serde(rename = "AddedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub added_date_time: Option<f64>,
#[serde(rename = "CidrIp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cidr_ip: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "IpRouteStatusMsg")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ip_route_status_msg: Option<String>,
#[serde(rename = "IpRouteStatusReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ip_route_status_reason: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListIpRoutesRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: 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 ListIpRoutesResult {
#[serde(rename = "IpRoutesInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ip_routes_info: Option<Vec<IpRouteInfo>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListLogSubscriptionsRequest {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: 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 ListLogSubscriptionsResult {
#[serde(rename = "LogSubscriptions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_subscriptions: Option<Vec<LogSubscription>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListSchemaExtensionsRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: 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 ListSchemaExtensionsResult {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaExtensionsInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_extensions_info: Option<Vec<SchemaExtensionInfo>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsForResourceRequest {
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ResourceId")]
pub resource_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForResourceResult {
#[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 LogSubscription {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "LogGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_group_name: Option<String>,
#[serde(rename = "SubscriptionCreatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_created_date_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct OwnerDirectoryDescription {
#[serde(rename = "AccountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "DnsIpAddrs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dns_ip_addrs: Option<Vec<String>>,
#[serde(rename = "RadiusSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_settings: Option<RadiusSettings>,
#[serde(rename = "RadiusStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_status: Option<String>,
#[serde(rename = "VpcSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_settings: Option<DirectoryVpcSettingsDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RadiusSettings {
#[serde(rename = "AuthenticationProtocol")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authentication_protocol: Option<String>,
#[serde(rename = "DisplayLabel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_label: Option<String>,
#[serde(rename = "RadiusPort")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_port: Option<i64>,
#[serde(rename = "RadiusRetries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_retries: Option<i64>,
#[serde(rename = "RadiusServers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_servers: Option<Vec<String>>,
#[serde(rename = "RadiusTimeout")]
#[serde(skip_serializing_if = "Option::is_none")]
pub radius_timeout: Option<i64>,
#[serde(rename = "SharedSecret")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_secret: Option<String>,
#[serde(rename = "UseSameUsername")]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_same_username: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RegisterEventTopicRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "TopicName")]
pub topic_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RegisterEventTopicResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RejectSharedDirectoryRequest {
#[serde(rename = "SharedDirectoryId")]
pub shared_directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RejectSharedDirectoryResult {
#[serde(rename = "SharedDirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RemoveIpRoutesRequest {
#[serde(rename = "CidrIps")]
pub cidr_ips: Vec<String>,
#[serde(rename = "DirectoryId")]
pub directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RemoveIpRoutesResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RemoveTagsFromResourceRequest {
#[serde(rename = "ResourceId")]
pub resource_id: String,
#[serde(rename = "TagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RemoveTagsFromResourceResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ResetUserPasswordRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "NewPassword")]
pub new_password: String,
#[serde(rename = "UserName")]
pub user_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ResetUserPasswordResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RestoreFromSnapshotRequest {
#[serde(rename = "SnapshotId")]
pub snapshot_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RestoreFromSnapshotResult {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SchemaExtensionInfo {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "EndDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date_time: Option<f64>,
#[serde(rename = "SchemaExtensionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_extension_id: Option<String>,
#[serde(rename = "SchemaExtensionStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_extension_status: Option<String>,
#[serde(rename = "SchemaExtensionStatusReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_extension_status_reason: Option<String>,
#[serde(rename = "StartDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_date_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ShareDirectoryRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "ShareMethod")]
pub share_method: String,
#[serde(rename = "ShareNotes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub share_notes: Option<String>,
#[serde(rename = "ShareTarget")]
pub share_target: ShareTarget,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ShareDirectoryResult {
#[serde(rename = "SharedDirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ShareTarget {
#[serde(rename = "Id")]
pub id: String,
#[serde(rename = "Type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SharedDirectory {
#[serde(rename = "CreatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date_time: Option<f64>,
#[serde(rename = "LastUpdatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date_time: Option<f64>,
#[serde(rename = "OwnerAccountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_account_id: Option<String>,
#[serde(rename = "OwnerDirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_directory_id: Option<String>,
#[serde(rename = "ShareMethod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub share_method: Option<String>,
#[serde(rename = "ShareNotes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub share_notes: Option<String>,
#[serde(rename = "ShareStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub share_status: Option<String>,
#[serde(rename = "SharedAccountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_account_id: Option<String>,
#[serde(rename = "SharedDirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Snapshot {
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "SnapshotId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub snapshot_id: Option<String>,
#[serde(rename = "StartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SnapshotLimits {
#[serde(rename = "ManualSnapshotsCurrentCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_snapshots_current_count: Option<i64>,
#[serde(rename = "ManualSnapshotsLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_snapshots_limit: Option<i64>,
#[serde(rename = "ManualSnapshotsLimitReached")]
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_snapshots_limit_reached: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartSchemaExtensionRequest {
#[serde(rename = "CreateSnapshotBeforeSchemaExtension")]
pub create_snapshot_before_schema_extension: bool,
#[serde(rename = "Description")]
pub description: String,
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "LdifContent")]
pub ldif_content: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartSchemaExtensionResult {
#[serde(rename = "SchemaExtensionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_extension_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Trust {
#[serde(rename = "CreatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date_time: Option<f64>,
#[serde(rename = "DirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_id: Option<String>,
#[serde(rename = "LastUpdatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date_time: Option<f64>,
#[serde(rename = "RemoteDomainName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_domain_name: Option<String>,
#[serde(rename = "SelectiveAuth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub selective_auth: Option<String>,
#[serde(rename = "StateLastUpdatedDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state_last_updated_date_time: Option<f64>,
#[serde(rename = "TrustDirection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_direction: Option<String>,
#[serde(rename = "TrustId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_id: Option<String>,
#[serde(rename = "TrustState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_state: Option<String>,
#[serde(rename = "TrustStateReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_state_reason: Option<String>,
#[serde(rename = "TrustType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UnshareDirectoryRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "UnshareTarget")]
pub unshare_target: UnshareTarget,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UnshareDirectoryResult {
#[serde(rename = "SharedDirectoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_directory_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UnshareTarget {
#[serde(rename = "Id")]
pub id: String,
#[serde(rename = "Type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateConditionalForwarderRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "DnsIpAddrs")]
pub dns_ip_addrs: Vec<String>,
#[serde(rename = "RemoteDomainName")]
pub remote_domain_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateConditionalForwarderResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateNumberOfDomainControllersRequest {
#[serde(rename = "DesiredNumber")]
pub desired_number: i64,
#[serde(rename = "DirectoryId")]
pub directory_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateNumberOfDomainControllersResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRadiusRequest {
#[serde(rename = "DirectoryId")]
pub directory_id: String,
#[serde(rename = "RadiusSettings")]
pub radius_settings: RadiusSettings,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateRadiusResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateTrustRequest {
#[serde(rename = "SelectiveAuth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub selective_auth: Option<String>,
#[serde(rename = "TrustId")]
pub trust_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateTrustResult {
#[serde(rename = "RequestId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub request_id: Option<String>,
#[serde(rename = "TrustId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct VerifyTrustRequest {
#[serde(rename = "TrustId")]
pub trust_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VerifyTrustResult {
#[serde(rename = "TrustId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trust_id: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum AcceptSharedDirectoryError {
Client(String),
DirectoryAlreadyShared(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AcceptSharedDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> AcceptSharedDirectoryError {
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 {
"ClientException" => {
return AcceptSharedDirectoryError::Client(String::from(error_message));
}
"DirectoryAlreadySharedException" => {
return AcceptSharedDirectoryError::DirectoryAlreadyShared(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return AcceptSharedDirectoryError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AcceptSharedDirectoryError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return AcceptSharedDirectoryError::Service(String::from(error_message));
}
"ValidationException" => {
return AcceptSharedDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return AcceptSharedDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AcceptSharedDirectoryError {
fn from(err: serde_json::error::Error) -> AcceptSharedDirectoryError {
AcceptSharedDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AcceptSharedDirectoryError {
fn from(err: CredentialsError) -> AcceptSharedDirectoryError {
AcceptSharedDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for AcceptSharedDirectoryError {
fn from(err: HttpDispatchError) -> AcceptSharedDirectoryError {
AcceptSharedDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for AcceptSharedDirectoryError {
fn from(err: io::Error) -> AcceptSharedDirectoryError {
AcceptSharedDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AcceptSharedDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AcceptSharedDirectoryError {
fn description(&self) -> &str {
match *self {
AcceptSharedDirectoryError::Client(ref cause) => cause,
AcceptSharedDirectoryError::DirectoryAlreadyShared(ref cause) => cause,
AcceptSharedDirectoryError::EntityDoesNotExist(ref cause) => cause,
AcceptSharedDirectoryError::InvalidParameter(ref cause) => cause,
AcceptSharedDirectoryError::Service(ref cause) => cause,
AcceptSharedDirectoryError::Validation(ref cause) => cause,
AcceptSharedDirectoryError::Credentials(ref err) => err.description(),
AcceptSharedDirectoryError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AcceptSharedDirectoryError::ParseError(ref cause) => cause,
AcceptSharedDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AddIpRoutesError {
Client(String),
DirectoryUnavailable(String),
EntityAlreadyExists(String),
EntityDoesNotExist(String),
InvalidParameter(String),
IpRouteLimitExceeded(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AddIpRoutesError {
pub fn from_response(res: BufferedHttpResponse) -> AddIpRoutesError {
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 {
"ClientException" => return AddIpRoutesError::Client(String::from(error_message)),
"DirectoryUnavailableException" => {
return AddIpRoutesError::DirectoryUnavailable(String::from(error_message));
}
"EntityAlreadyExistsException" => {
return AddIpRoutesError::EntityAlreadyExists(String::from(error_message));
}
"EntityDoesNotExistException" => {
return AddIpRoutesError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return AddIpRoutesError::InvalidParameter(String::from(error_message));
}
"IpRouteLimitExceededException" => {
return AddIpRoutesError::IpRouteLimitExceeded(String::from(error_message));
}
"ServiceException" => return AddIpRoutesError::Service(String::from(error_message)),
"ValidationException" => {
return AddIpRoutesError::Validation(error_message.to_string());
}
_ => {}
}
}
return AddIpRoutesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AddIpRoutesError {
fn from(err: serde_json::error::Error) -> AddIpRoutesError {
AddIpRoutesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AddIpRoutesError {
fn from(err: CredentialsError) -> AddIpRoutesError {
AddIpRoutesError::Credentials(err)
}
}
impl From<HttpDispatchError> for AddIpRoutesError {
fn from(err: HttpDispatchError) -> AddIpRoutesError {
AddIpRoutesError::HttpDispatch(err)
}
}
impl From<io::Error> for AddIpRoutesError {
fn from(err: io::Error) -> AddIpRoutesError {
AddIpRoutesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AddIpRoutesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AddIpRoutesError {
fn description(&self) -> &str {
match *self {
AddIpRoutesError::Client(ref cause) => cause,
AddIpRoutesError::DirectoryUnavailable(ref cause) => cause,
AddIpRoutesError::EntityAlreadyExists(ref cause) => cause,
AddIpRoutesError::EntityDoesNotExist(ref cause) => cause,
AddIpRoutesError::InvalidParameter(ref cause) => cause,
AddIpRoutesError::IpRouteLimitExceeded(ref cause) => cause,
AddIpRoutesError::Service(ref cause) => cause,
AddIpRoutesError::Validation(ref cause) => cause,
AddIpRoutesError::Credentials(ref err) => err.description(),
AddIpRoutesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AddIpRoutesError::ParseError(ref cause) => cause,
AddIpRoutesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AddTagsToResourceError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
TagLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AddTagsToResourceError {
pub fn from_response(res: BufferedHttpResponse) -> AddTagsToResourceError {
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 {
"ClientException" => {
return AddTagsToResourceError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return AddTagsToResourceError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return AddTagsToResourceError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return AddTagsToResourceError::Service(String::from(error_message));
}
"TagLimitExceededException" => {
return AddTagsToResourceError::TagLimitExceeded(String::from(error_message));
}
"ValidationException" => {
return AddTagsToResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return AddTagsToResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AddTagsToResourceError {
fn from(err: serde_json::error::Error) -> AddTagsToResourceError {
AddTagsToResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AddTagsToResourceError {
fn from(err: CredentialsError) -> AddTagsToResourceError {
AddTagsToResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AddTagsToResourceError {
fn from(err: HttpDispatchError) -> AddTagsToResourceError {
AddTagsToResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for AddTagsToResourceError {
fn from(err: io::Error) -> AddTagsToResourceError {
AddTagsToResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AddTagsToResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AddTagsToResourceError {
fn description(&self) -> &str {
match *self {
AddTagsToResourceError::Client(ref cause) => cause,
AddTagsToResourceError::EntityDoesNotExist(ref cause) => cause,
AddTagsToResourceError::InvalidParameter(ref cause) => cause,
AddTagsToResourceError::Service(ref cause) => cause,
AddTagsToResourceError::TagLimitExceeded(ref cause) => cause,
AddTagsToResourceError::Validation(ref cause) => cause,
AddTagsToResourceError::Credentials(ref err) => err.description(),
AddTagsToResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AddTagsToResourceError::ParseError(ref cause) => cause,
AddTagsToResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CancelSchemaExtensionError {
Client(String),
EntityDoesNotExist(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CancelSchemaExtensionError {
pub fn from_response(res: BufferedHttpResponse) -> CancelSchemaExtensionError {
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 {
"ClientException" => {
return CancelSchemaExtensionError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return CancelSchemaExtensionError::EntityDoesNotExist(String::from(
error_message,
));
}
"ServiceException" => {
return CancelSchemaExtensionError::Service(String::from(error_message));
}
"ValidationException" => {
return CancelSchemaExtensionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CancelSchemaExtensionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CancelSchemaExtensionError {
fn from(err: serde_json::error::Error) -> CancelSchemaExtensionError {
CancelSchemaExtensionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CancelSchemaExtensionError {
fn from(err: CredentialsError) -> CancelSchemaExtensionError {
CancelSchemaExtensionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CancelSchemaExtensionError {
fn from(err: HttpDispatchError) -> CancelSchemaExtensionError {
CancelSchemaExtensionError::HttpDispatch(err)
}
}
impl From<io::Error> for CancelSchemaExtensionError {
fn from(err: io::Error) -> CancelSchemaExtensionError {
CancelSchemaExtensionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CancelSchemaExtensionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CancelSchemaExtensionError {
fn description(&self) -> &str {
match *self {
CancelSchemaExtensionError::Client(ref cause) => cause,
CancelSchemaExtensionError::EntityDoesNotExist(ref cause) => cause,
CancelSchemaExtensionError::Service(ref cause) => cause,
CancelSchemaExtensionError::Validation(ref cause) => cause,
CancelSchemaExtensionError::Credentials(ref err) => err.description(),
CancelSchemaExtensionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CancelSchemaExtensionError::ParseError(ref cause) => cause,
CancelSchemaExtensionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConnectDirectoryError {
Client(String),
DirectoryLimitExceeded(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConnectDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> ConnectDirectoryError {
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 {
"ClientException" => {
return ConnectDirectoryError::Client(String::from(error_message));
}
"DirectoryLimitExceededException" => {
return ConnectDirectoryError::DirectoryLimitExceeded(String::from(
error_message,
));
}
"InvalidParameterException" => {
return ConnectDirectoryError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return ConnectDirectoryError::Service(String::from(error_message));
}
"ValidationException" => {
return ConnectDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return ConnectDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ConnectDirectoryError {
fn from(err: serde_json::error::Error) -> ConnectDirectoryError {
ConnectDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ConnectDirectoryError {
fn from(err: CredentialsError) -> ConnectDirectoryError {
ConnectDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConnectDirectoryError {
fn from(err: HttpDispatchError) -> ConnectDirectoryError {
ConnectDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for ConnectDirectoryError {
fn from(err: io::Error) -> ConnectDirectoryError {
ConnectDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConnectDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConnectDirectoryError {
fn description(&self) -> &str {
match *self {
ConnectDirectoryError::Client(ref cause) => cause,
ConnectDirectoryError::DirectoryLimitExceeded(ref cause) => cause,
ConnectDirectoryError::InvalidParameter(ref cause) => cause,
ConnectDirectoryError::Service(ref cause) => cause,
ConnectDirectoryError::Validation(ref cause) => cause,
ConnectDirectoryError::Credentials(ref err) => err.description(),
ConnectDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ConnectDirectoryError::ParseError(ref cause) => cause,
ConnectDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateAliasError {
Client(String),
EntityAlreadyExists(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateAliasError {
pub fn from_response(res: BufferedHttpResponse) -> CreateAliasError {
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 {
"ClientException" => return CreateAliasError::Client(String::from(error_message)),
"EntityAlreadyExistsException" => {
return CreateAliasError::EntityAlreadyExists(String::from(error_message));
}
"EntityDoesNotExistException" => {
return CreateAliasError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return CreateAliasError::InvalidParameter(String::from(error_message));
}
"ServiceException" => return CreateAliasError::Service(String::from(error_message)),
"ValidationException" => {
return CreateAliasError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateAliasError {
fn from(err: serde_json::error::Error) -> CreateAliasError {
CreateAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateAliasError {
fn from(err: CredentialsError) -> CreateAliasError {
CreateAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateAliasError {
fn from(err: HttpDispatchError) -> CreateAliasError {
CreateAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateAliasError {
fn from(err: io::Error) -> CreateAliasError {
CreateAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateAliasError {
fn description(&self) -> &str {
match *self {
CreateAliasError::Client(ref cause) => cause,
CreateAliasError::EntityAlreadyExists(ref cause) => cause,
CreateAliasError::EntityDoesNotExist(ref cause) => cause,
CreateAliasError::InvalidParameter(ref cause) => cause,
CreateAliasError::Service(ref cause) => cause,
CreateAliasError::Validation(ref cause) => cause,
CreateAliasError::Credentials(ref err) => err.description(),
CreateAliasError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateAliasError::ParseError(ref cause) => cause,
CreateAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateComputerError {
AuthenticationFailed(String),
Client(String),
DirectoryUnavailable(String),
EntityAlreadyExists(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateComputerError {
pub fn from_response(res: BufferedHttpResponse) -> CreateComputerError {
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 {
"AuthenticationFailedException" => {
return CreateComputerError::AuthenticationFailed(String::from(error_message));
}
"ClientException" => {
return CreateComputerError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return CreateComputerError::DirectoryUnavailable(String::from(error_message));
}
"EntityAlreadyExistsException" => {
return CreateComputerError::EntityAlreadyExists(String::from(error_message));
}
"EntityDoesNotExistException" => {
return CreateComputerError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return CreateComputerError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return CreateComputerError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return CreateComputerError::UnsupportedOperation(String::from(error_message));
}
"ValidationException" => {
return CreateComputerError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateComputerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateComputerError {
fn from(err: serde_json::error::Error) -> CreateComputerError {
CreateComputerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateComputerError {
fn from(err: CredentialsError) -> CreateComputerError {
CreateComputerError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateComputerError {
fn from(err: HttpDispatchError) -> CreateComputerError {
CreateComputerError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateComputerError {
fn from(err: io::Error) -> CreateComputerError {
CreateComputerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateComputerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateComputerError {
fn description(&self) -> &str {
match *self {
CreateComputerError::AuthenticationFailed(ref cause) => cause,
CreateComputerError::Client(ref cause) => cause,
CreateComputerError::DirectoryUnavailable(ref cause) => cause,
CreateComputerError::EntityAlreadyExists(ref cause) => cause,
CreateComputerError::EntityDoesNotExist(ref cause) => cause,
CreateComputerError::InvalidParameter(ref cause) => cause,
CreateComputerError::Service(ref cause) => cause,
CreateComputerError::UnsupportedOperation(ref cause) => cause,
CreateComputerError::Validation(ref cause) => cause,
CreateComputerError::Credentials(ref err) => err.description(),
CreateComputerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateComputerError::ParseError(ref cause) => cause,
CreateComputerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateConditionalForwarderError {
Client(String),
DirectoryUnavailable(String),
EntityAlreadyExists(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateConditionalForwarderError {
pub fn from_response(res: BufferedHttpResponse) -> CreateConditionalForwarderError {
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 {
"ClientException" => {
return CreateConditionalForwarderError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return CreateConditionalForwarderError::DirectoryUnavailable(String::from(
error_message,
));
}
"EntityAlreadyExistsException" => {
return CreateConditionalForwarderError::EntityAlreadyExists(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return CreateConditionalForwarderError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return CreateConditionalForwarderError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return CreateConditionalForwarderError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return CreateConditionalForwarderError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return CreateConditionalForwarderError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateConditionalForwarderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateConditionalForwarderError {
fn from(err: serde_json::error::Error) -> CreateConditionalForwarderError {
CreateConditionalForwarderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateConditionalForwarderError {
fn from(err: CredentialsError) -> CreateConditionalForwarderError {
CreateConditionalForwarderError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateConditionalForwarderError {
fn from(err: HttpDispatchError) -> CreateConditionalForwarderError {
CreateConditionalForwarderError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateConditionalForwarderError {
fn from(err: io::Error) -> CreateConditionalForwarderError {
CreateConditionalForwarderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateConditionalForwarderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateConditionalForwarderError {
fn description(&self) -> &str {
match *self {
CreateConditionalForwarderError::Client(ref cause) => cause,
CreateConditionalForwarderError::DirectoryUnavailable(ref cause) => cause,
CreateConditionalForwarderError::EntityAlreadyExists(ref cause) => cause,
CreateConditionalForwarderError::EntityDoesNotExist(ref cause) => cause,
CreateConditionalForwarderError::InvalidParameter(ref cause) => cause,
CreateConditionalForwarderError::Service(ref cause) => cause,
CreateConditionalForwarderError::UnsupportedOperation(ref cause) => cause,
CreateConditionalForwarderError::Validation(ref cause) => cause,
CreateConditionalForwarderError::Credentials(ref err) => err.description(),
CreateConditionalForwarderError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateConditionalForwarderError::ParseError(ref cause) => cause,
CreateConditionalForwarderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDirectoryError {
Client(String),
DirectoryLimitExceeded(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDirectoryError {
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 {
"ClientException" => {
return CreateDirectoryError::Client(String::from(error_message));
}
"DirectoryLimitExceededException" => {
return CreateDirectoryError::DirectoryLimitExceeded(String::from(error_message));
}
"InvalidParameterException" => {
return CreateDirectoryError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return CreateDirectoryError::Service(String::from(error_message));
}
"ValidationException" => {
return CreateDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDirectoryError {
fn from(err: serde_json::error::Error) -> CreateDirectoryError {
CreateDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDirectoryError {
fn from(err: CredentialsError) -> CreateDirectoryError {
CreateDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDirectoryError {
fn from(err: HttpDispatchError) -> CreateDirectoryError {
CreateDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDirectoryError {
fn from(err: io::Error) -> CreateDirectoryError {
CreateDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDirectoryError {
fn description(&self) -> &str {
match *self {
CreateDirectoryError::Client(ref cause) => cause,
CreateDirectoryError::DirectoryLimitExceeded(ref cause) => cause,
CreateDirectoryError::InvalidParameter(ref cause) => cause,
CreateDirectoryError::Service(ref cause) => cause,
CreateDirectoryError::Validation(ref cause) => cause,
CreateDirectoryError::Credentials(ref err) => err.description(),
CreateDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateDirectoryError::ParseError(ref cause) => cause,
CreateDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateLogSubscriptionError {
Client(String),
EntityAlreadyExists(String),
EntityDoesNotExist(String),
InsufficientPermissions(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateLogSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateLogSubscriptionError {
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 {
"ClientException" => {
return CreateLogSubscriptionError::Client(String::from(error_message));
}
"EntityAlreadyExistsException" => {
return CreateLogSubscriptionError::EntityAlreadyExists(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return CreateLogSubscriptionError::EntityDoesNotExist(String::from(
error_message,
));
}
"InsufficientPermissionsException" => {
return CreateLogSubscriptionError::InsufficientPermissions(String::from(
error_message,
));
}
"ServiceException" => {
return CreateLogSubscriptionError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return CreateLogSubscriptionError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return CreateLogSubscriptionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateLogSubscriptionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateLogSubscriptionError {
fn from(err: serde_json::error::Error) -> CreateLogSubscriptionError {
CreateLogSubscriptionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateLogSubscriptionError {
fn from(err: CredentialsError) -> CreateLogSubscriptionError {
CreateLogSubscriptionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateLogSubscriptionError {
fn from(err: HttpDispatchError) -> CreateLogSubscriptionError {
CreateLogSubscriptionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateLogSubscriptionError {
fn from(err: io::Error) -> CreateLogSubscriptionError {
CreateLogSubscriptionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateLogSubscriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateLogSubscriptionError {
fn description(&self) -> &str {
match *self {
CreateLogSubscriptionError::Client(ref cause) => cause,
CreateLogSubscriptionError::EntityAlreadyExists(ref cause) => cause,
CreateLogSubscriptionError::EntityDoesNotExist(ref cause) => cause,
CreateLogSubscriptionError::InsufficientPermissions(ref cause) => cause,
CreateLogSubscriptionError::Service(ref cause) => cause,
CreateLogSubscriptionError::UnsupportedOperation(ref cause) => cause,
CreateLogSubscriptionError::Validation(ref cause) => cause,
CreateLogSubscriptionError::Credentials(ref err) => err.description(),
CreateLogSubscriptionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateLogSubscriptionError::ParseError(ref cause) => cause,
CreateLogSubscriptionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateMicrosoftADError {
Client(String),
DirectoryLimitExceeded(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateMicrosoftADError {
pub fn from_response(res: BufferedHttpResponse) -> CreateMicrosoftADError {
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 {
"ClientException" => {
return CreateMicrosoftADError::Client(String::from(error_message));
}
"DirectoryLimitExceededException" => {
return CreateMicrosoftADError::DirectoryLimitExceeded(String::from(
error_message,
));
}
"InvalidParameterException" => {
return CreateMicrosoftADError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return CreateMicrosoftADError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return CreateMicrosoftADError::UnsupportedOperation(String::from(error_message));
}
"ValidationException" => {
return CreateMicrosoftADError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateMicrosoftADError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateMicrosoftADError {
fn from(err: serde_json::error::Error) -> CreateMicrosoftADError {
CreateMicrosoftADError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateMicrosoftADError {
fn from(err: CredentialsError) -> CreateMicrosoftADError {
CreateMicrosoftADError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateMicrosoftADError {
fn from(err: HttpDispatchError) -> CreateMicrosoftADError {
CreateMicrosoftADError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateMicrosoftADError {
fn from(err: io::Error) -> CreateMicrosoftADError {
CreateMicrosoftADError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateMicrosoftADError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateMicrosoftADError {
fn description(&self) -> &str {
match *self {
CreateMicrosoftADError::Client(ref cause) => cause,
CreateMicrosoftADError::DirectoryLimitExceeded(ref cause) => cause,
CreateMicrosoftADError::InvalidParameter(ref cause) => cause,
CreateMicrosoftADError::Service(ref cause) => cause,
CreateMicrosoftADError::UnsupportedOperation(ref cause) => cause,
CreateMicrosoftADError::Validation(ref cause) => cause,
CreateMicrosoftADError::Credentials(ref err) => err.description(),
CreateMicrosoftADError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateMicrosoftADError::ParseError(ref cause) => cause,
CreateMicrosoftADError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSnapshotError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
SnapshotLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateSnapshotError {
pub fn from_response(res: BufferedHttpResponse) -> CreateSnapshotError {
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 {
"ClientException" => {
return CreateSnapshotError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return CreateSnapshotError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return CreateSnapshotError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return CreateSnapshotError::Service(String::from(error_message));
}
"SnapshotLimitExceededException" => {
return CreateSnapshotError::SnapshotLimitExceeded(String::from(error_message));
}
"ValidationException" => {
return CreateSnapshotError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateSnapshotError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateSnapshotError {
fn from(err: serde_json::error::Error) -> CreateSnapshotError {
CreateSnapshotError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateSnapshotError {
fn from(err: CredentialsError) -> CreateSnapshotError {
CreateSnapshotError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateSnapshotError {
fn from(err: HttpDispatchError) -> CreateSnapshotError {
CreateSnapshotError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateSnapshotError {
fn from(err: io::Error) -> CreateSnapshotError {
CreateSnapshotError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateSnapshotError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSnapshotError {
fn description(&self) -> &str {
match *self {
CreateSnapshotError::Client(ref cause) => cause,
CreateSnapshotError::EntityDoesNotExist(ref cause) => cause,
CreateSnapshotError::InvalidParameter(ref cause) => cause,
CreateSnapshotError::Service(ref cause) => cause,
CreateSnapshotError::SnapshotLimitExceeded(ref cause) => cause,
CreateSnapshotError::Validation(ref cause) => cause,
CreateSnapshotError::Credentials(ref err) => err.description(),
CreateSnapshotError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateSnapshotError::ParseError(ref cause) => cause,
CreateSnapshotError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateTrustError {
Client(String),
EntityAlreadyExists(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateTrustError {
pub fn from_response(res: BufferedHttpResponse) -> CreateTrustError {
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 {
"ClientException" => return CreateTrustError::Client(String::from(error_message)),
"EntityAlreadyExistsException" => {
return CreateTrustError::EntityAlreadyExists(String::from(error_message));
}
"EntityDoesNotExistException" => {
return CreateTrustError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return CreateTrustError::InvalidParameter(String::from(error_message));
}
"ServiceException" => return CreateTrustError::Service(String::from(error_message)),
"UnsupportedOperationException" => {
return CreateTrustError::UnsupportedOperation(String::from(error_message));
}
"ValidationException" => {
return CreateTrustError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateTrustError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateTrustError {
fn from(err: serde_json::error::Error) -> CreateTrustError {
CreateTrustError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateTrustError {
fn from(err: CredentialsError) -> CreateTrustError {
CreateTrustError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateTrustError {
fn from(err: HttpDispatchError) -> CreateTrustError {
CreateTrustError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateTrustError {
fn from(err: io::Error) -> CreateTrustError {
CreateTrustError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateTrustError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateTrustError {
fn description(&self) -> &str {
match *self {
CreateTrustError::Client(ref cause) => cause,
CreateTrustError::EntityAlreadyExists(ref cause) => cause,
CreateTrustError::EntityDoesNotExist(ref cause) => cause,
CreateTrustError::InvalidParameter(ref cause) => cause,
CreateTrustError::Service(ref cause) => cause,
CreateTrustError::UnsupportedOperation(ref cause) => cause,
CreateTrustError::Validation(ref cause) => cause,
CreateTrustError::Credentials(ref err) => err.description(),
CreateTrustError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateTrustError::ParseError(ref cause) => cause,
CreateTrustError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteConditionalForwarderError {
Client(String),
DirectoryUnavailable(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteConditionalForwarderError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteConditionalForwarderError {
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 {
"ClientException" => {
return DeleteConditionalForwarderError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return DeleteConditionalForwarderError::DirectoryUnavailable(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return DeleteConditionalForwarderError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return DeleteConditionalForwarderError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return DeleteConditionalForwarderError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return DeleteConditionalForwarderError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteConditionalForwarderError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteConditionalForwarderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteConditionalForwarderError {
fn from(err: serde_json::error::Error) -> DeleteConditionalForwarderError {
DeleteConditionalForwarderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteConditionalForwarderError {
fn from(err: CredentialsError) -> DeleteConditionalForwarderError {
DeleteConditionalForwarderError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteConditionalForwarderError {
fn from(err: HttpDispatchError) -> DeleteConditionalForwarderError {
DeleteConditionalForwarderError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteConditionalForwarderError {
fn from(err: io::Error) -> DeleteConditionalForwarderError {
DeleteConditionalForwarderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteConditionalForwarderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteConditionalForwarderError {
fn description(&self) -> &str {
match *self {
DeleteConditionalForwarderError::Client(ref cause) => cause,
DeleteConditionalForwarderError::DirectoryUnavailable(ref cause) => cause,
DeleteConditionalForwarderError::EntityDoesNotExist(ref cause) => cause,
DeleteConditionalForwarderError::InvalidParameter(ref cause) => cause,
DeleteConditionalForwarderError::Service(ref cause) => cause,
DeleteConditionalForwarderError::UnsupportedOperation(ref cause) => cause,
DeleteConditionalForwarderError::Validation(ref cause) => cause,
DeleteConditionalForwarderError::Credentials(ref err) => err.description(),
DeleteConditionalForwarderError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteConditionalForwarderError::ParseError(ref cause) => cause,
DeleteConditionalForwarderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDirectoryError {
Client(String),
EntityDoesNotExist(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDirectoryError {
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 {
"ClientException" => {
return DeleteDirectoryError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DeleteDirectoryError::EntityDoesNotExist(String::from(error_message));
}
"ServiceException" => {
return DeleteDirectoryError::Service(String::from(error_message));
}
"ValidationException" => {
return DeleteDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDirectoryError {
fn from(err: serde_json::error::Error) -> DeleteDirectoryError {
DeleteDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDirectoryError {
fn from(err: CredentialsError) -> DeleteDirectoryError {
DeleteDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDirectoryError {
fn from(err: HttpDispatchError) -> DeleteDirectoryError {
DeleteDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDirectoryError {
fn from(err: io::Error) -> DeleteDirectoryError {
DeleteDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDirectoryError {
fn description(&self) -> &str {
match *self {
DeleteDirectoryError::Client(ref cause) => cause,
DeleteDirectoryError::EntityDoesNotExist(ref cause) => cause,
DeleteDirectoryError::Service(ref cause) => cause,
DeleteDirectoryError::Validation(ref cause) => cause,
DeleteDirectoryError::Credentials(ref err) => err.description(),
DeleteDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteDirectoryError::ParseError(ref cause) => cause,
DeleteDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteLogSubscriptionError {
Client(String),
EntityDoesNotExist(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteLogSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteLogSubscriptionError {
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 {
"ClientException" => {
return DeleteLogSubscriptionError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DeleteLogSubscriptionError::EntityDoesNotExist(String::from(
error_message,
));
}
"ServiceException" => {
return DeleteLogSubscriptionError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return DeleteLogSubscriptionError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteLogSubscriptionError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteLogSubscriptionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteLogSubscriptionError {
fn from(err: serde_json::error::Error) -> DeleteLogSubscriptionError {
DeleteLogSubscriptionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteLogSubscriptionError {
fn from(err: CredentialsError) -> DeleteLogSubscriptionError {
DeleteLogSubscriptionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteLogSubscriptionError {
fn from(err: HttpDispatchError) -> DeleteLogSubscriptionError {
DeleteLogSubscriptionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteLogSubscriptionError {
fn from(err: io::Error) -> DeleteLogSubscriptionError {
DeleteLogSubscriptionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteLogSubscriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteLogSubscriptionError {
fn description(&self) -> &str {
match *self {
DeleteLogSubscriptionError::Client(ref cause) => cause,
DeleteLogSubscriptionError::EntityDoesNotExist(ref cause) => cause,
DeleteLogSubscriptionError::Service(ref cause) => cause,
DeleteLogSubscriptionError::UnsupportedOperation(ref cause) => cause,
DeleteLogSubscriptionError::Validation(ref cause) => cause,
DeleteLogSubscriptionError::Credentials(ref err) => err.description(),
DeleteLogSubscriptionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteLogSubscriptionError::ParseError(ref cause) => cause,
DeleteLogSubscriptionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSnapshotError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSnapshotError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSnapshotError {
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 {
"ClientException" => {
return DeleteSnapshotError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DeleteSnapshotError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteSnapshotError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return DeleteSnapshotError::Service(String::from(error_message));
}
"ValidationException" => {
return DeleteSnapshotError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteSnapshotError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSnapshotError {
fn from(err: serde_json::error::Error) -> DeleteSnapshotError {
DeleteSnapshotError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSnapshotError {
fn from(err: CredentialsError) -> DeleteSnapshotError {
DeleteSnapshotError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSnapshotError {
fn from(err: HttpDispatchError) -> DeleteSnapshotError {
DeleteSnapshotError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSnapshotError {
fn from(err: io::Error) -> DeleteSnapshotError {
DeleteSnapshotError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSnapshotError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSnapshotError {
fn description(&self) -> &str {
match *self {
DeleteSnapshotError::Client(ref cause) => cause,
DeleteSnapshotError::EntityDoesNotExist(ref cause) => cause,
DeleteSnapshotError::InvalidParameter(ref cause) => cause,
DeleteSnapshotError::Service(ref cause) => cause,
DeleteSnapshotError::Validation(ref cause) => cause,
DeleteSnapshotError::Credentials(ref err) => err.description(),
DeleteSnapshotError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteSnapshotError::ParseError(ref cause) => cause,
DeleteSnapshotError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteTrustError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteTrustError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteTrustError {
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 {
"ClientException" => return DeleteTrustError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return DeleteTrustError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteTrustError::InvalidParameter(String::from(error_message));
}
"ServiceException" => return DeleteTrustError::Service(String::from(error_message)),
"UnsupportedOperationException" => {
return DeleteTrustError::UnsupportedOperation(String::from(error_message));
}
"ValidationException" => {
return DeleteTrustError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteTrustError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteTrustError {
fn from(err: serde_json::error::Error) -> DeleteTrustError {
DeleteTrustError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteTrustError {
fn from(err: CredentialsError) -> DeleteTrustError {
DeleteTrustError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteTrustError {
fn from(err: HttpDispatchError) -> DeleteTrustError {
DeleteTrustError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteTrustError {
fn from(err: io::Error) -> DeleteTrustError {
DeleteTrustError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteTrustError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteTrustError {
fn description(&self) -> &str {
match *self {
DeleteTrustError::Client(ref cause) => cause,
DeleteTrustError::EntityDoesNotExist(ref cause) => cause,
DeleteTrustError::InvalidParameter(ref cause) => cause,
DeleteTrustError::Service(ref cause) => cause,
DeleteTrustError::UnsupportedOperation(ref cause) => cause,
DeleteTrustError::Validation(ref cause) => cause,
DeleteTrustError::Credentials(ref err) => err.description(),
DeleteTrustError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteTrustError::ParseError(ref cause) => cause,
DeleteTrustError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeregisterEventTopicError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeregisterEventTopicError {
pub fn from_response(res: BufferedHttpResponse) -> DeregisterEventTopicError {
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 {
"ClientException" => {
return DeregisterEventTopicError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DeregisterEventTopicError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return DeregisterEventTopicError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return DeregisterEventTopicError::Service(String::from(error_message));
}
"ValidationException" => {
return DeregisterEventTopicError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeregisterEventTopicError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeregisterEventTopicError {
fn from(err: serde_json::error::Error) -> DeregisterEventTopicError {
DeregisterEventTopicError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeregisterEventTopicError {
fn from(err: CredentialsError) -> DeregisterEventTopicError {
DeregisterEventTopicError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeregisterEventTopicError {
fn from(err: HttpDispatchError) -> DeregisterEventTopicError {
DeregisterEventTopicError::HttpDispatch(err)
}
}
impl From<io::Error> for DeregisterEventTopicError {
fn from(err: io::Error) -> DeregisterEventTopicError {
DeregisterEventTopicError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeregisterEventTopicError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeregisterEventTopicError {
fn description(&self) -> &str {
match *self {
DeregisterEventTopicError::Client(ref cause) => cause,
DeregisterEventTopicError::EntityDoesNotExist(ref cause) => cause,
DeregisterEventTopicError::InvalidParameter(ref cause) => cause,
DeregisterEventTopicError::Service(ref cause) => cause,
DeregisterEventTopicError::Validation(ref cause) => cause,
DeregisterEventTopicError::Credentials(ref err) => err.description(),
DeregisterEventTopicError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeregisterEventTopicError::ParseError(ref cause) => cause,
DeregisterEventTopicError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeConditionalForwardersError {
Client(String),
DirectoryUnavailable(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeConditionalForwardersError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeConditionalForwardersError {
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 {
"ClientException" => {
return DescribeConditionalForwardersError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return DescribeConditionalForwardersError::DirectoryUnavailable(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return DescribeConditionalForwardersError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return DescribeConditionalForwardersError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return DescribeConditionalForwardersError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return DescribeConditionalForwardersError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeConditionalForwardersError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeConditionalForwardersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeConditionalForwardersError {
fn from(err: serde_json::error::Error) -> DescribeConditionalForwardersError {
DescribeConditionalForwardersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeConditionalForwardersError {
fn from(err: CredentialsError) -> DescribeConditionalForwardersError {
DescribeConditionalForwardersError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeConditionalForwardersError {
fn from(err: HttpDispatchError) -> DescribeConditionalForwardersError {
DescribeConditionalForwardersError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeConditionalForwardersError {
fn from(err: io::Error) -> DescribeConditionalForwardersError {
DescribeConditionalForwardersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeConditionalForwardersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeConditionalForwardersError {
fn description(&self) -> &str {
match *self {
DescribeConditionalForwardersError::Client(ref cause) => cause,
DescribeConditionalForwardersError::DirectoryUnavailable(ref cause) => cause,
DescribeConditionalForwardersError::EntityDoesNotExist(ref cause) => cause,
DescribeConditionalForwardersError::InvalidParameter(ref cause) => cause,
DescribeConditionalForwardersError::Service(ref cause) => cause,
DescribeConditionalForwardersError::UnsupportedOperation(ref cause) => cause,
DescribeConditionalForwardersError::Validation(ref cause) => cause,
DescribeConditionalForwardersError::Credentials(ref err) => err.description(),
DescribeConditionalForwardersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeConditionalForwardersError::ParseError(ref cause) => cause,
DescribeConditionalForwardersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDirectoriesError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDirectoriesError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeDirectoriesError {
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 {
"ClientException" => {
return DescribeDirectoriesError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DescribeDirectoriesError::EntityDoesNotExist(String::from(error_message));
}
"InvalidNextTokenException" => {
return DescribeDirectoriesError::InvalidNextToken(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeDirectoriesError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return DescribeDirectoriesError::Service(String::from(error_message));
}
"ValidationException" => {
return DescribeDirectoriesError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeDirectoriesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDirectoriesError {
fn from(err: serde_json::error::Error) -> DescribeDirectoriesError {
DescribeDirectoriesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDirectoriesError {
fn from(err: CredentialsError) -> DescribeDirectoriesError {
DescribeDirectoriesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDirectoriesError {
fn from(err: HttpDispatchError) -> DescribeDirectoriesError {
DescribeDirectoriesError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDirectoriesError {
fn from(err: io::Error) -> DescribeDirectoriesError {
DescribeDirectoriesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDirectoriesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDirectoriesError {
fn description(&self) -> &str {
match *self {
DescribeDirectoriesError::Client(ref cause) => cause,
DescribeDirectoriesError::EntityDoesNotExist(ref cause) => cause,
DescribeDirectoriesError::InvalidNextToken(ref cause) => cause,
DescribeDirectoriesError::InvalidParameter(ref cause) => cause,
DescribeDirectoriesError::Service(ref cause) => cause,
DescribeDirectoriesError::Validation(ref cause) => cause,
DescribeDirectoriesError::Credentials(ref err) => err.description(),
DescribeDirectoriesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDirectoriesError::ParseError(ref cause) => cause,
DescribeDirectoriesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDomainControllersError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDomainControllersError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeDomainControllersError {
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 {
"ClientException" => {
return DescribeDomainControllersError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DescribeDomainControllersError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidNextTokenException" => {
return DescribeDomainControllersError::InvalidNextToken(String::from(
error_message,
));
}
"InvalidParameterException" => {
return DescribeDomainControllersError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return DescribeDomainControllersError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return DescribeDomainControllersError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeDomainControllersError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeDomainControllersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDomainControllersError {
fn from(err: serde_json::error::Error) -> DescribeDomainControllersError {
DescribeDomainControllersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDomainControllersError {
fn from(err: CredentialsError) -> DescribeDomainControllersError {
DescribeDomainControllersError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDomainControllersError {
fn from(err: HttpDispatchError) -> DescribeDomainControllersError {
DescribeDomainControllersError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDomainControllersError {
fn from(err: io::Error) -> DescribeDomainControllersError {
DescribeDomainControllersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDomainControllersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDomainControllersError {
fn description(&self) -> &str {
match *self {
DescribeDomainControllersError::Client(ref cause) => cause,
DescribeDomainControllersError::EntityDoesNotExist(ref cause) => cause,
DescribeDomainControllersError::InvalidNextToken(ref cause) => cause,
DescribeDomainControllersError::InvalidParameter(ref cause) => cause,
DescribeDomainControllersError::Service(ref cause) => cause,
DescribeDomainControllersError::UnsupportedOperation(ref cause) => cause,
DescribeDomainControllersError::Validation(ref cause) => cause,
DescribeDomainControllersError::Credentials(ref err) => err.description(),
DescribeDomainControllersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDomainControllersError::ParseError(ref cause) => cause,
DescribeDomainControllersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeEventTopicsError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeEventTopicsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeEventTopicsError {
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 {
"ClientException" => {
return DescribeEventTopicsError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DescribeEventTopicsError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeEventTopicsError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return DescribeEventTopicsError::Service(String::from(error_message));
}
"ValidationException" => {
return DescribeEventTopicsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeEventTopicsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeEventTopicsError {
fn from(err: serde_json::error::Error) -> DescribeEventTopicsError {
DescribeEventTopicsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeEventTopicsError {
fn from(err: CredentialsError) -> DescribeEventTopicsError {
DescribeEventTopicsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeEventTopicsError {
fn from(err: HttpDispatchError) -> DescribeEventTopicsError {
DescribeEventTopicsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeEventTopicsError {
fn from(err: io::Error) -> DescribeEventTopicsError {
DescribeEventTopicsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeEventTopicsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeEventTopicsError {
fn description(&self) -> &str {
match *self {
DescribeEventTopicsError::Client(ref cause) => cause,
DescribeEventTopicsError::EntityDoesNotExist(ref cause) => cause,
DescribeEventTopicsError::InvalidParameter(ref cause) => cause,
DescribeEventTopicsError::Service(ref cause) => cause,
DescribeEventTopicsError::Validation(ref cause) => cause,
DescribeEventTopicsError::Credentials(ref err) => err.description(),
DescribeEventTopicsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeEventTopicsError::ParseError(ref cause) => cause,
DescribeEventTopicsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeSharedDirectoriesError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeSharedDirectoriesError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeSharedDirectoriesError {
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 {
"ClientException" => {
return DescribeSharedDirectoriesError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DescribeSharedDirectoriesError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidNextTokenException" => {
return DescribeSharedDirectoriesError::InvalidNextToken(String::from(
error_message,
));
}
"InvalidParameterException" => {
return DescribeSharedDirectoriesError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return DescribeSharedDirectoriesError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return DescribeSharedDirectoriesError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeSharedDirectoriesError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeSharedDirectoriesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeSharedDirectoriesError {
fn from(err: serde_json::error::Error) -> DescribeSharedDirectoriesError {
DescribeSharedDirectoriesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeSharedDirectoriesError {
fn from(err: CredentialsError) -> DescribeSharedDirectoriesError {
DescribeSharedDirectoriesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeSharedDirectoriesError {
fn from(err: HttpDispatchError) -> DescribeSharedDirectoriesError {
DescribeSharedDirectoriesError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeSharedDirectoriesError {
fn from(err: io::Error) -> DescribeSharedDirectoriesError {
DescribeSharedDirectoriesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeSharedDirectoriesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeSharedDirectoriesError {
fn description(&self) -> &str {
match *self {
DescribeSharedDirectoriesError::Client(ref cause) => cause,
DescribeSharedDirectoriesError::EntityDoesNotExist(ref cause) => cause,
DescribeSharedDirectoriesError::InvalidNextToken(ref cause) => cause,
DescribeSharedDirectoriesError::InvalidParameter(ref cause) => cause,
DescribeSharedDirectoriesError::Service(ref cause) => cause,
DescribeSharedDirectoriesError::UnsupportedOperation(ref cause) => cause,
DescribeSharedDirectoriesError::Validation(ref cause) => cause,
DescribeSharedDirectoriesError::Credentials(ref err) => err.description(),
DescribeSharedDirectoriesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeSharedDirectoriesError::ParseError(ref cause) => cause,
DescribeSharedDirectoriesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeSnapshotsError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeSnapshotsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeSnapshotsError {
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 {
"ClientException" => {
return DescribeSnapshotsError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DescribeSnapshotsError::EntityDoesNotExist(String::from(error_message));
}
"InvalidNextTokenException" => {
return DescribeSnapshotsError::InvalidNextToken(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeSnapshotsError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return DescribeSnapshotsError::Service(String::from(error_message));
}
"ValidationException" => {
return DescribeSnapshotsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeSnapshotsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeSnapshotsError {
fn from(err: serde_json::error::Error) -> DescribeSnapshotsError {
DescribeSnapshotsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeSnapshotsError {
fn from(err: CredentialsError) -> DescribeSnapshotsError {
DescribeSnapshotsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeSnapshotsError {
fn from(err: HttpDispatchError) -> DescribeSnapshotsError {
DescribeSnapshotsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeSnapshotsError {
fn from(err: io::Error) -> DescribeSnapshotsError {
DescribeSnapshotsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeSnapshotsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeSnapshotsError {
fn description(&self) -> &str {
match *self {
DescribeSnapshotsError::Client(ref cause) => cause,
DescribeSnapshotsError::EntityDoesNotExist(ref cause) => cause,
DescribeSnapshotsError::InvalidNextToken(ref cause) => cause,
DescribeSnapshotsError::InvalidParameter(ref cause) => cause,
DescribeSnapshotsError::Service(ref cause) => cause,
DescribeSnapshotsError::Validation(ref cause) => cause,
DescribeSnapshotsError::Credentials(ref err) => err.description(),
DescribeSnapshotsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeSnapshotsError::ParseError(ref cause) => cause,
DescribeSnapshotsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeTrustsError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeTrustsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeTrustsError {
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 {
"ClientException" => {
return DescribeTrustsError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return DescribeTrustsError::EntityDoesNotExist(String::from(error_message));
}
"InvalidNextTokenException" => {
return DescribeTrustsError::InvalidNextToken(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeTrustsError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return DescribeTrustsError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return DescribeTrustsError::UnsupportedOperation(String::from(error_message));
}
"ValidationException" => {
return DescribeTrustsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeTrustsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeTrustsError {
fn from(err: serde_json::error::Error) -> DescribeTrustsError {
DescribeTrustsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeTrustsError {
fn from(err: CredentialsError) -> DescribeTrustsError {
DescribeTrustsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeTrustsError {
fn from(err: HttpDispatchError) -> DescribeTrustsError {
DescribeTrustsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeTrustsError {
fn from(err: io::Error) -> DescribeTrustsError {
DescribeTrustsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeTrustsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeTrustsError {
fn description(&self) -> &str {
match *self {
DescribeTrustsError::Client(ref cause) => cause,
DescribeTrustsError::EntityDoesNotExist(ref cause) => cause,
DescribeTrustsError::InvalidNextToken(ref cause) => cause,
DescribeTrustsError::InvalidParameter(ref cause) => cause,
DescribeTrustsError::Service(ref cause) => cause,
DescribeTrustsError::UnsupportedOperation(ref cause) => cause,
DescribeTrustsError::Validation(ref cause) => cause,
DescribeTrustsError::Credentials(ref err) => err.description(),
DescribeTrustsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeTrustsError::ParseError(ref cause) => cause,
DescribeTrustsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisableRadiusError {
Client(String),
EntityDoesNotExist(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisableRadiusError {
pub fn from_response(res: BufferedHttpResponse) -> DisableRadiusError {
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 {
"ClientException" => return DisableRadiusError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return DisableRadiusError::EntityDoesNotExist(String::from(error_message));
}
"ServiceException" => {
return DisableRadiusError::Service(String::from(error_message));
}
"ValidationException" => {
return DisableRadiusError::Validation(error_message.to_string());
}
_ => {}
}
}
return DisableRadiusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisableRadiusError {
fn from(err: serde_json::error::Error) -> DisableRadiusError {
DisableRadiusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisableRadiusError {
fn from(err: CredentialsError) -> DisableRadiusError {
DisableRadiusError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisableRadiusError {
fn from(err: HttpDispatchError) -> DisableRadiusError {
DisableRadiusError::HttpDispatch(err)
}
}
impl From<io::Error> for DisableRadiusError {
fn from(err: io::Error) -> DisableRadiusError {
DisableRadiusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisableRadiusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisableRadiusError {
fn description(&self) -> &str {
match *self {
DisableRadiusError::Client(ref cause) => cause,
DisableRadiusError::EntityDoesNotExist(ref cause) => cause,
DisableRadiusError::Service(ref cause) => cause,
DisableRadiusError::Validation(ref cause) => cause,
DisableRadiusError::Credentials(ref err) => err.description(),
DisableRadiusError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DisableRadiusError::ParseError(ref cause) => cause,
DisableRadiusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisableSsoError {
AuthenticationFailed(String),
Client(String),
EntityDoesNotExist(String),
InsufficientPermissions(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisableSsoError {
pub fn from_response(res: BufferedHttpResponse) -> DisableSsoError {
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 {
"AuthenticationFailedException" => {
return DisableSsoError::AuthenticationFailed(String::from(error_message));
}
"ClientException" => return DisableSsoError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return DisableSsoError::EntityDoesNotExist(String::from(error_message));
}
"InsufficientPermissionsException" => {
return DisableSsoError::InsufficientPermissions(String::from(error_message));
}
"ServiceException" => return DisableSsoError::Service(String::from(error_message)),
"ValidationException" => {
return DisableSsoError::Validation(error_message.to_string());
}
_ => {}
}
}
return DisableSsoError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisableSsoError {
fn from(err: serde_json::error::Error) -> DisableSsoError {
DisableSsoError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisableSsoError {
fn from(err: CredentialsError) -> DisableSsoError {
DisableSsoError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisableSsoError {
fn from(err: HttpDispatchError) -> DisableSsoError {
DisableSsoError::HttpDispatch(err)
}
}
impl From<io::Error> for DisableSsoError {
fn from(err: io::Error) -> DisableSsoError {
DisableSsoError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisableSsoError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisableSsoError {
fn description(&self) -> &str {
match *self {
DisableSsoError::AuthenticationFailed(ref cause) => cause,
DisableSsoError::Client(ref cause) => cause,
DisableSsoError::EntityDoesNotExist(ref cause) => cause,
DisableSsoError::InsufficientPermissions(ref cause) => cause,
DisableSsoError::Service(ref cause) => cause,
DisableSsoError::Validation(ref cause) => cause,
DisableSsoError::Credentials(ref err) => err.description(),
DisableSsoError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DisableSsoError::ParseError(ref cause) => cause,
DisableSsoError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum EnableRadiusError {
Client(String),
EntityAlreadyExists(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl EnableRadiusError {
pub fn from_response(res: BufferedHttpResponse) -> EnableRadiusError {
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 {
"ClientException" => return EnableRadiusError::Client(String::from(error_message)),
"EntityAlreadyExistsException" => {
return EnableRadiusError::EntityAlreadyExists(String::from(error_message));
}
"EntityDoesNotExistException" => {
return EnableRadiusError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return EnableRadiusError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return EnableRadiusError::Service(String::from(error_message));
}
"ValidationException" => {
return EnableRadiusError::Validation(error_message.to_string());
}
_ => {}
}
}
return EnableRadiusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for EnableRadiusError {
fn from(err: serde_json::error::Error) -> EnableRadiusError {
EnableRadiusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for EnableRadiusError {
fn from(err: CredentialsError) -> EnableRadiusError {
EnableRadiusError::Credentials(err)
}
}
impl From<HttpDispatchError> for EnableRadiusError {
fn from(err: HttpDispatchError) -> EnableRadiusError {
EnableRadiusError::HttpDispatch(err)
}
}
impl From<io::Error> for EnableRadiusError {
fn from(err: io::Error) -> EnableRadiusError {
EnableRadiusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for EnableRadiusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for EnableRadiusError {
fn description(&self) -> &str {
match *self {
EnableRadiusError::Client(ref cause) => cause,
EnableRadiusError::EntityAlreadyExists(ref cause) => cause,
EnableRadiusError::EntityDoesNotExist(ref cause) => cause,
EnableRadiusError::InvalidParameter(ref cause) => cause,
EnableRadiusError::Service(ref cause) => cause,
EnableRadiusError::Validation(ref cause) => cause,
EnableRadiusError::Credentials(ref err) => err.description(),
EnableRadiusError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
EnableRadiusError::ParseError(ref cause) => cause,
EnableRadiusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum EnableSsoError {
AuthenticationFailed(String),
Client(String),
EntityDoesNotExist(String),
InsufficientPermissions(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl EnableSsoError {
pub fn from_response(res: BufferedHttpResponse) -> EnableSsoError {
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 {
"AuthenticationFailedException" => {
return EnableSsoError::AuthenticationFailed(String::from(error_message));
}
"ClientException" => return EnableSsoError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return EnableSsoError::EntityDoesNotExist(String::from(error_message));
}
"InsufficientPermissionsException" => {
return EnableSsoError::InsufficientPermissions(String::from(error_message));
}
"ServiceException" => return EnableSsoError::Service(String::from(error_message)),
"ValidationException" => {
return EnableSsoError::Validation(error_message.to_string());
}
_ => {}
}
}
return EnableSsoError::Unknown(res);
}
}
impl From<serde_json::error::Error> for EnableSsoError {
fn from(err: serde_json::error::Error) -> EnableSsoError {
EnableSsoError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for EnableSsoError {
fn from(err: CredentialsError) -> EnableSsoError {
EnableSsoError::Credentials(err)
}
}
impl From<HttpDispatchError> for EnableSsoError {
fn from(err: HttpDispatchError) -> EnableSsoError {
EnableSsoError::HttpDispatch(err)
}
}
impl From<io::Error> for EnableSsoError {
fn from(err: io::Error) -> EnableSsoError {
EnableSsoError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for EnableSsoError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for EnableSsoError {
fn description(&self) -> &str {
match *self {
EnableSsoError::AuthenticationFailed(ref cause) => cause,
EnableSsoError::Client(ref cause) => cause,
EnableSsoError::EntityDoesNotExist(ref cause) => cause,
EnableSsoError::InsufficientPermissions(ref cause) => cause,
EnableSsoError::Service(ref cause) => cause,
EnableSsoError::Validation(ref cause) => cause,
EnableSsoError::Credentials(ref err) => err.description(),
EnableSsoError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
EnableSsoError::ParseError(ref cause) => cause,
EnableSsoError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDirectoryLimitsError {
Client(String),
EntityDoesNotExist(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDirectoryLimitsError {
pub fn from_response(res: BufferedHttpResponse) -> GetDirectoryLimitsError {
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 {
"ClientException" => {
return GetDirectoryLimitsError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return GetDirectoryLimitsError::EntityDoesNotExist(String::from(error_message));
}
"ServiceException" => {
return GetDirectoryLimitsError::Service(String::from(error_message));
}
"ValidationException" => {
return GetDirectoryLimitsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDirectoryLimitsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDirectoryLimitsError {
fn from(err: serde_json::error::Error) -> GetDirectoryLimitsError {
GetDirectoryLimitsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDirectoryLimitsError {
fn from(err: CredentialsError) -> GetDirectoryLimitsError {
GetDirectoryLimitsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDirectoryLimitsError {
fn from(err: HttpDispatchError) -> GetDirectoryLimitsError {
GetDirectoryLimitsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDirectoryLimitsError {
fn from(err: io::Error) -> GetDirectoryLimitsError {
GetDirectoryLimitsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDirectoryLimitsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDirectoryLimitsError {
fn description(&self) -> &str {
match *self {
GetDirectoryLimitsError::Client(ref cause) => cause,
GetDirectoryLimitsError::EntityDoesNotExist(ref cause) => cause,
GetDirectoryLimitsError::Service(ref cause) => cause,
GetDirectoryLimitsError::Validation(ref cause) => cause,
GetDirectoryLimitsError::Credentials(ref err) => err.description(),
GetDirectoryLimitsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetDirectoryLimitsError::ParseError(ref cause) => cause,
GetDirectoryLimitsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSnapshotLimitsError {
Client(String),
EntityDoesNotExist(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSnapshotLimitsError {
pub fn from_response(res: BufferedHttpResponse) -> GetSnapshotLimitsError {
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 {
"ClientException" => {
return GetSnapshotLimitsError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return GetSnapshotLimitsError::EntityDoesNotExist(String::from(error_message));
}
"ServiceException" => {
return GetSnapshotLimitsError::Service(String::from(error_message));
}
"ValidationException" => {
return GetSnapshotLimitsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSnapshotLimitsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSnapshotLimitsError {
fn from(err: serde_json::error::Error) -> GetSnapshotLimitsError {
GetSnapshotLimitsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSnapshotLimitsError {
fn from(err: CredentialsError) -> GetSnapshotLimitsError {
GetSnapshotLimitsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSnapshotLimitsError {
fn from(err: HttpDispatchError) -> GetSnapshotLimitsError {
GetSnapshotLimitsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSnapshotLimitsError {
fn from(err: io::Error) -> GetSnapshotLimitsError {
GetSnapshotLimitsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSnapshotLimitsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSnapshotLimitsError {
fn description(&self) -> &str {
match *self {
GetSnapshotLimitsError::Client(ref cause) => cause,
GetSnapshotLimitsError::EntityDoesNotExist(ref cause) => cause,
GetSnapshotLimitsError::Service(ref cause) => cause,
GetSnapshotLimitsError::Validation(ref cause) => cause,
GetSnapshotLimitsError::Credentials(ref err) => err.description(),
GetSnapshotLimitsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetSnapshotLimitsError::ParseError(ref cause) => cause,
GetSnapshotLimitsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListIpRoutesError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListIpRoutesError {
pub fn from_response(res: BufferedHttpResponse) -> ListIpRoutesError {
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 {
"ClientException" => return ListIpRoutesError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return ListIpRoutesError::EntityDoesNotExist(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListIpRoutesError::InvalidNextToken(String::from(error_message));
}
"InvalidParameterException" => {
return ListIpRoutesError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return ListIpRoutesError::Service(String::from(error_message));
}
"ValidationException" => {
return ListIpRoutesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListIpRoutesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListIpRoutesError {
fn from(err: serde_json::error::Error) -> ListIpRoutesError {
ListIpRoutesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListIpRoutesError {
fn from(err: CredentialsError) -> ListIpRoutesError {
ListIpRoutesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListIpRoutesError {
fn from(err: HttpDispatchError) -> ListIpRoutesError {
ListIpRoutesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListIpRoutesError {
fn from(err: io::Error) -> ListIpRoutesError {
ListIpRoutesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListIpRoutesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListIpRoutesError {
fn description(&self) -> &str {
match *self {
ListIpRoutesError::Client(ref cause) => cause,
ListIpRoutesError::EntityDoesNotExist(ref cause) => cause,
ListIpRoutesError::InvalidNextToken(ref cause) => cause,
ListIpRoutesError::InvalidParameter(ref cause) => cause,
ListIpRoutesError::Service(ref cause) => cause,
ListIpRoutesError::Validation(ref cause) => cause,
ListIpRoutesError::Credentials(ref err) => err.description(),
ListIpRoutesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListIpRoutesError::ParseError(ref cause) => cause,
ListIpRoutesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListLogSubscriptionsError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListLogSubscriptionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListLogSubscriptionsError {
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 {
"ClientException" => {
return ListLogSubscriptionsError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return ListLogSubscriptionsError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidNextTokenException" => {
return ListLogSubscriptionsError::InvalidNextToken(String::from(error_message));
}
"ServiceException" => {
return ListLogSubscriptionsError::Service(String::from(error_message));
}
"ValidationException" => {
return ListLogSubscriptionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListLogSubscriptionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListLogSubscriptionsError {
fn from(err: serde_json::error::Error) -> ListLogSubscriptionsError {
ListLogSubscriptionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListLogSubscriptionsError {
fn from(err: CredentialsError) -> ListLogSubscriptionsError {
ListLogSubscriptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListLogSubscriptionsError {
fn from(err: HttpDispatchError) -> ListLogSubscriptionsError {
ListLogSubscriptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListLogSubscriptionsError {
fn from(err: io::Error) -> ListLogSubscriptionsError {
ListLogSubscriptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListLogSubscriptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListLogSubscriptionsError {
fn description(&self) -> &str {
match *self {
ListLogSubscriptionsError::Client(ref cause) => cause,
ListLogSubscriptionsError::EntityDoesNotExist(ref cause) => cause,
ListLogSubscriptionsError::InvalidNextToken(ref cause) => cause,
ListLogSubscriptionsError::Service(ref cause) => cause,
ListLogSubscriptionsError::Validation(ref cause) => cause,
ListLogSubscriptionsError::Credentials(ref err) => err.description(),
ListLogSubscriptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListLogSubscriptionsError::ParseError(ref cause) => cause,
ListLogSubscriptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSchemaExtensionsError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListSchemaExtensionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListSchemaExtensionsError {
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 {
"ClientException" => {
return ListSchemaExtensionsError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return ListSchemaExtensionsError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidNextTokenException" => {
return ListSchemaExtensionsError::InvalidNextToken(String::from(error_message));
}
"ServiceException" => {
return ListSchemaExtensionsError::Service(String::from(error_message));
}
"ValidationException" => {
return ListSchemaExtensionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListSchemaExtensionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListSchemaExtensionsError {
fn from(err: serde_json::error::Error) -> ListSchemaExtensionsError {
ListSchemaExtensionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListSchemaExtensionsError {
fn from(err: CredentialsError) -> ListSchemaExtensionsError {
ListSchemaExtensionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListSchemaExtensionsError {
fn from(err: HttpDispatchError) -> ListSchemaExtensionsError {
ListSchemaExtensionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListSchemaExtensionsError {
fn from(err: io::Error) -> ListSchemaExtensionsError {
ListSchemaExtensionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListSchemaExtensionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListSchemaExtensionsError {
fn description(&self) -> &str {
match *self {
ListSchemaExtensionsError::Client(ref cause) => cause,
ListSchemaExtensionsError::EntityDoesNotExist(ref cause) => cause,
ListSchemaExtensionsError::InvalidNextToken(ref cause) => cause,
ListSchemaExtensionsError::Service(ref cause) => cause,
ListSchemaExtensionsError::Validation(ref cause) => cause,
ListSchemaExtensionsError::Credentials(ref err) => err.description(),
ListSchemaExtensionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListSchemaExtensionsError::ParseError(ref cause) => cause,
ListSchemaExtensionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
Client(String),
EntityDoesNotExist(String),
InvalidNextToken(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> ListTagsForResourceError {
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 {
"ClientException" => {
return ListTagsForResourceError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return ListTagsForResourceError::EntityDoesNotExist(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListTagsForResourceError::InvalidNextToken(String::from(error_message));
}
"InvalidParameterException" => {
return ListTagsForResourceError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return ListTagsForResourceError::Service(String::from(error_message));
}
"ValidationException" => {
return ListTagsForResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTagsForResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTagsForResourceError {
fn from(err: serde_json::error::Error) -> ListTagsForResourceError {
ListTagsForResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTagsForResourceError {
fn from(err: CredentialsError) -> ListTagsForResourceError {
ListTagsForResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTagsForResourceError {
fn from(err: HttpDispatchError) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTagsForResourceError {
fn from(err: io::Error) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTagsForResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForResourceError {
fn description(&self) -> &str {
match *self {
ListTagsForResourceError::Client(ref cause) => cause,
ListTagsForResourceError::EntityDoesNotExist(ref cause) => cause,
ListTagsForResourceError::InvalidNextToken(ref cause) => cause,
ListTagsForResourceError::InvalidParameter(ref cause) => cause,
ListTagsForResourceError::Service(ref cause) => cause,
ListTagsForResourceError::Validation(ref cause) => cause,
ListTagsForResourceError::Credentials(ref err) => err.description(),
ListTagsForResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTagsForResourceError::ParseError(ref cause) => cause,
ListTagsForResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RegisterEventTopicError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RegisterEventTopicError {
pub fn from_response(res: BufferedHttpResponse) -> RegisterEventTopicError {
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 {
"ClientException" => {
return RegisterEventTopicError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return RegisterEventTopicError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return RegisterEventTopicError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return RegisterEventTopicError::Service(String::from(error_message));
}
"ValidationException" => {
return RegisterEventTopicError::Validation(error_message.to_string());
}
_ => {}
}
}
return RegisterEventTopicError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RegisterEventTopicError {
fn from(err: serde_json::error::Error) -> RegisterEventTopicError {
RegisterEventTopicError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RegisterEventTopicError {
fn from(err: CredentialsError) -> RegisterEventTopicError {
RegisterEventTopicError::Credentials(err)
}
}
impl From<HttpDispatchError> for RegisterEventTopicError {
fn from(err: HttpDispatchError) -> RegisterEventTopicError {
RegisterEventTopicError::HttpDispatch(err)
}
}
impl From<io::Error> for RegisterEventTopicError {
fn from(err: io::Error) -> RegisterEventTopicError {
RegisterEventTopicError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RegisterEventTopicError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RegisterEventTopicError {
fn description(&self) -> &str {
match *self {
RegisterEventTopicError::Client(ref cause) => cause,
RegisterEventTopicError::EntityDoesNotExist(ref cause) => cause,
RegisterEventTopicError::InvalidParameter(ref cause) => cause,
RegisterEventTopicError::Service(ref cause) => cause,
RegisterEventTopicError::Validation(ref cause) => cause,
RegisterEventTopicError::Credentials(ref err) => err.description(),
RegisterEventTopicError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RegisterEventTopicError::ParseError(ref cause) => cause,
RegisterEventTopicError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RejectSharedDirectoryError {
Client(String),
DirectoryAlreadyShared(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RejectSharedDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> RejectSharedDirectoryError {
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 {
"ClientException" => {
return RejectSharedDirectoryError::Client(String::from(error_message));
}
"DirectoryAlreadySharedException" => {
return RejectSharedDirectoryError::DirectoryAlreadyShared(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return RejectSharedDirectoryError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return RejectSharedDirectoryError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return RejectSharedDirectoryError::Service(String::from(error_message));
}
"ValidationException" => {
return RejectSharedDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return RejectSharedDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RejectSharedDirectoryError {
fn from(err: serde_json::error::Error) -> RejectSharedDirectoryError {
RejectSharedDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RejectSharedDirectoryError {
fn from(err: CredentialsError) -> RejectSharedDirectoryError {
RejectSharedDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for RejectSharedDirectoryError {
fn from(err: HttpDispatchError) -> RejectSharedDirectoryError {
RejectSharedDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for RejectSharedDirectoryError {
fn from(err: io::Error) -> RejectSharedDirectoryError {
RejectSharedDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RejectSharedDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RejectSharedDirectoryError {
fn description(&self) -> &str {
match *self {
RejectSharedDirectoryError::Client(ref cause) => cause,
RejectSharedDirectoryError::DirectoryAlreadyShared(ref cause) => cause,
RejectSharedDirectoryError::EntityDoesNotExist(ref cause) => cause,
RejectSharedDirectoryError::InvalidParameter(ref cause) => cause,
RejectSharedDirectoryError::Service(ref cause) => cause,
RejectSharedDirectoryError::Validation(ref cause) => cause,
RejectSharedDirectoryError::Credentials(ref err) => err.description(),
RejectSharedDirectoryError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RejectSharedDirectoryError::ParseError(ref cause) => cause,
RejectSharedDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RemoveIpRoutesError {
Client(String),
DirectoryUnavailable(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RemoveIpRoutesError {
pub fn from_response(res: BufferedHttpResponse) -> RemoveIpRoutesError {
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 {
"ClientException" => {
return RemoveIpRoutesError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return RemoveIpRoutesError::DirectoryUnavailable(String::from(error_message));
}
"EntityDoesNotExistException" => {
return RemoveIpRoutesError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return RemoveIpRoutesError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return RemoveIpRoutesError::Service(String::from(error_message));
}
"ValidationException" => {
return RemoveIpRoutesError::Validation(error_message.to_string());
}
_ => {}
}
}
return RemoveIpRoutesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RemoveIpRoutesError {
fn from(err: serde_json::error::Error) -> RemoveIpRoutesError {
RemoveIpRoutesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RemoveIpRoutesError {
fn from(err: CredentialsError) -> RemoveIpRoutesError {
RemoveIpRoutesError::Credentials(err)
}
}
impl From<HttpDispatchError> for RemoveIpRoutesError {
fn from(err: HttpDispatchError) -> RemoveIpRoutesError {
RemoveIpRoutesError::HttpDispatch(err)
}
}
impl From<io::Error> for RemoveIpRoutesError {
fn from(err: io::Error) -> RemoveIpRoutesError {
RemoveIpRoutesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RemoveIpRoutesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RemoveIpRoutesError {
fn description(&self) -> &str {
match *self {
RemoveIpRoutesError::Client(ref cause) => cause,
RemoveIpRoutesError::DirectoryUnavailable(ref cause) => cause,
RemoveIpRoutesError::EntityDoesNotExist(ref cause) => cause,
RemoveIpRoutesError::InvalidParameter(ref cause) => cause,
RemoveIpRoutesError::Service(ref cause) => cause,
RemoveIpRoutesError::Validation(ref cause) => cause,
RemoveIpRoutesError::Credentials(ref err) => err.description(),
RemoveIpRoutesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
RemoveIpRoutesError::ParseError(ref cause) => cause,
RemoveIpRoutesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RemoveTagsFromResourceError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RemoveTagsFromResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RemoveTagsFromResourceError {
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 {
"ClientException" => {
return RemoveTagsFromResourceError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return RemoveTagsFromResourceError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return RemoveTagsFromResourceError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return RemoveTagsFromResourceError::Service(String::from(error_message));
}
"ValidationException" => {
return RemoveTagsFromResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return RemoveTagsFromResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RemoveTagsFromResourceError {
fn from(err: serde_json::error::Error) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RemoveTagsFromResourceError {
fn from(err: CredentialsError) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for RemoveTagsFromResourceError {
fn from(err: HttpDispatchError) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for RemoveTagsFromResourceError {
fn from(err: io::Error) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RemoveTagsFromResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RemoveTagsFromResourceError {
fn description(&self) -> &str {
match *self {
RemoveTagsFromResourceError::Client(ref cause) => cause,
RemoveTagsFromResourceError::EntityDoesNotExist(ref cause) => cause,
RemoveTagsFromResourceError::InvalidParameter(ref cause) => cause,
RemoveTagsFromResourceError::Service(ref cause) => cause,
RemoveTagsFromResourceError::Validation(ref cause) => cause,
RemoveTagsFromResourceError::Credentials(ref err) => err.description(),
RemoveTagsFromResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RemoveTagsFromResourceError::ParseError(ref cause) => cause,
RemoveTagsFromResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ResetUserPasswordError {
Client(String),
DirectoryUnavailable(String),
EntityDoesNotExist(String),
InvalidPassword(String),
Service(String),
UnsupportedOperation(String),
UserDoesNotExist(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ResetUserPasswordError {
pub fn from_response(res: BufferedHttpResponse) -> ResetUserPasswordError {
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 {
"ClientException" => {
return ResetUserPasswordError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return ResetUserPasswordError::DirectoryUnavailable(String::from(error_message));
}
"EntityDoesNotExistException" => {
return ResetUserPasswordError::EntityDoesNotExist(String::from(error_message));
}
"InvalidPasswordException" => {
return ResetUserPasswordError::InvalidPassword(String::from(error_message));
}
"ServiceException" => {
return ResetUserPasswordError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return ResetUserPasswordError::UnsupportedOperation(String::from(error_message));
}
"UserDoesNotExistException" => {
return ResetUserPasswordError::UserDoesNotExist(String::from(error_message));
}
"ValidationException" => {
return ResetUserPasswordError::Validation(error_message.to_string());
}
_ => {}
}
}
return ResetUserPasswordError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ResetUserPasswordError {
fn from(err: serde_json::error::Error) -> ResetUserPasswordError {
ResetUserPasswordError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ResetUserPasswordError {
fn from(err: CredentialsError) -> ResetUserPasswordError {
ResetUserPasswordError::Credentials(err)
}
}
impl From<HttpDispatchError> for ResetUserPasswordError {
fn from(err: HttpDispatchError) -> ResetUserPasswordError {
ResetUserPasswordError::HttpDispatch(err)
}
}
impl From<io::Error> for ResetUserPasswordError {
fn from(err: io::Error) -> ResetUserPasswordError {
ResetUserPasswordError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ResetUserPasswordError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ResetUserPasswordError {
fn description(&self) -> &str {
match *self {
ResetUserPasswordError::Client(ref cause) => cause,
ResetUserPasswordError::DirectoryUnavailable(ref cause) => cause,
ResetUserPasswordError::EntityDoesNotExist(ref cause) => cause,
ResetUserPasswordError::InvalidPassword(ref cause) => cause,
ResetUserPasswordError::Service(ref cause) => cause,
ResetUserPasswordError::UnsupportedOperation(ref cause) => cause,
ResetUserPasswordError::UserDoesNotExist(ref cause) => cause,
ResetUserPasswordError::Validation(ref cause) => cause,
ResetUserPasswordError::Credentials(ref err) => err.description(),
ResetUserPasswordError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ResetUserPasswordError::ParseError(ref cause) => cause,
ResetUserPasswordError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RestoreFromSnapshotError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RestoreFromSnapshotError {
pub fn from_response(res: BufferedHttpResponse) -> RestoreFromSnapshotError {
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 {
"ClientException" => {
return RestoreFromSnapshotError::Client(String::from(error_message));
}
"EntityDoesNotExistException" => {
return RestoreFromSnapshotError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return RestoreFromSnapshotError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return RestoreFromSnapshotError::Service(String::from(error_message));
}
"ValidationException" => {
return RestoreFromSnapshotError::Validation(error_message.to_string());
}
_ => {}
}
}
return RestoreFromSnapshotError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RestoreFromSnapshotError {
fn from(err: serde_json::error::Error) -> RestoreFromSnapshotError {
RestoreFromSnapshotError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RestoreFromSnapshotError {
fn from(err: CredentialsError) -> RestoreFromSnapshotError {
RestoreFromSnapshotError::Credentials(err)
}
}
impl From<HttpDispatchError> for RestoreFromSnapshotError {
fn from(err: HttpDispatchError) -> RestoreFromSnapshotError {
RestoreFromSnapshotError::HttpDispatch(err)
}
}
impl From<io::Error> for RestoreFromSnapshotError {
fn from(err: io::Error) -> RestoreFromSnapshotError {
RestoreFromSnapshotError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RestoreFromSnapshotError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RestoreFromSnapshotError {
fn description(&self) -> &str {
match *self {
RestoreFromSnapshotError::Client(ref cause) => cause,
RestoreFromSnapshotError::EntityDoesNotExist(ref cause) => cause,
RestoreFromSnapshotError::InvalidParameter(ref cause) => cause,
RestoreFromSnapshotError::Service(ref cause) => cause,
RestoreFromSnapshotError::Validation(ref cause) => cause,
RestoreFromSnapshotError::Credentials(ref err) => err.description(),
RestoreFromSnapshotError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RestoreFromSnapshotError::ParseError(ref cause) => cause,
RestoreFromSnapshotError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ShareDirectoryError {
AccessDenied(String),
Client(String),
DirectoryAlreadyShared(String),
EntityDoesNotExist(String),
InvalidParameter(String),
InvalidTarget(String),
Organizations(String),
Service(String),
ShareLimitExceeded(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ShareDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> ShareDirectoryError {
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 {
"AccessDeniedException" => {
return ShareDirectoryError::AccessDenied(String::from(error_message));
}
"ClientException" => {
return ShareDirectoryError::Client(String::from(error_message));
}
"DirectoryAlreadySharedException" => {
return ShareDirectoryError::DirectoryAlreadyShared(String::from(error_message));
}
"EntityDoesNotExistException" => {
return ShareDirectoryError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return ShareDirectoryError::InvalidParameter(String::from(error_message));
}
"InvalidTargetException" => {
return ShareDirectoryError::InvalidTarget(String::from(error_message));
}
"OrganizationsException" => {
return ShareDirectoryError::Organizations(String::from(error_message));
}
"ServiceException" => {
return ShareDirectoryError::Service(String::from(error_message));
}
"ShareLimitExceededException" => {
return ShareDirectoryError::ShareLimitExceeded(String::from(error_message));
}
"UnsupportedOperationException" => {
return ShareDirectoryError::UnsupportedOperation(String::from(error_message));
}
"ValidationException" => {
return ShareDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return ShareDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ShareDirectoryError {
fn from(err: serde_json::error::Error) -> ShareDirectoryError {
ShareDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ShareDirectoryError {
fn from(err: CredentialsError) -> ShareDirectoryError {
ShareDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for ShareDirectoryError {
fn from(err: HttpDispatchError) -> ShareDirectoryError {
ShareDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for ShareDirectoryError {
fn from(err: io::Error) -> ShareDirectoryError {
ShareDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ShareDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ShareDirectoryError {
fn description(&self) -> &str {
match *self {
ShareDirectoryError::AccessDenied(ref cause) => cause,
ShareDirectoryError::Client(ref cause) => cause,
ShareDirectoryError::DirectoryAlreadyShared(ref cause) => cause,
ShareDirectoryError::EntityDoesNotExist(ref cause) => cause,
ShareDirectoryError::InvalidParameter(ref cause) => cause,
ShareDirectoryError::InvalidTarget(ref cause) => cause,
ShareDirectoryError::Organizations(ref cause) => cause,
ShareDirectoryError::Service(ref cause) => cause,
ShareDirectoryError::ShareLimitExceeded(ref cause) => cause,
ShareDirectoryError::UnsupportedOperation(ref cause) => cause,
ShareDirectoryError::Validation(ref cause) => cause,
ShareDirectoryError::Credentials(ref err) => err.description(),
ShareDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ShareDirectoryError::ParseError(ref cause) => cause,
ShareDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartSchemaExtensionError {
Client(String),
DirectoryUnavailable(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
SnapshotLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartSchemaExtensionError {
pub fn from_response(res: BufferedHttpResponse) -> StartSchemaExtensionError {
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 {
"ClientException" => {
return StartSchemaExtensionError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return StartSchemaExtensionError::DirectoryUnavailable(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return StartSchemaExtensionError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return StartSchemaExtensionError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return StartSchemaExtensionError::Service(String::from(error_message));
}
"SnapshotLimitExceededException" => {
return StartSchemaExtensionError::SnapshotLimitExceeded(String::from(
error_message,
));
}
"ValidationException" => {
return StartSchemaExtensionError::Validation(error_message.to_string());
}
_ => {}
}
}
return StartSchemaExtensionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartSchemaExtensionError {
fn from(err: serde_json::error::Error) -> StartSchemaExtensionError {
StartSchemaExtensionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartSchemaExtensionError {
fn from(err: CredentialsError) -> StartSchemaExtensionError {
StartSchemaExtensionError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartSchemaExtensionError {
fn from(err: HttpDispatchError) -> StartSchemaExtensionError {
StartSchemaExtensionError::HttpDispatch(err)
}
}
impl From<io::Error> for StartSchemaExtensionError {
fn from(err: io::Error) -> StartSchemaExtensionError {
StartSchemaExtensionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartSchemaExtensionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartSchemaExtensionError {
fn description(&self) -> &str {
match *self {
StartSchemaExtensionError::Client(ref cause) => cause,
StartSchemaExtensionError::DirectoryUnavailable(ref cause) => cause,
StartSchemaExtensionError::EntityDoesNotExist(ref cause) => cause,
StartSchemaExtensionError::InvalidParameter(ref cause) => cause,
StartSchemaExtensionError::Service(ref cause) => cause,
StartSchemaExtensionError::SnapshotLimitExceeded(ref cause) => cause,
StartSchemaExtensionError::Validation(ref cause) => cause,
StartSchemaExtensionError::Credentials(ref err) => err.description(),
StartSchemaExtensionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartSchemaExtensionError::ParseError(ref cause) => cause,
StartSchemaExtensionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UnshareDirectoryError {
Client(String),
DirectoryNotShared(String),
EntityDoesNotExist(String),
InvalidTarget(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UnshareDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> UnshareDirectoryError {
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 {
"ClientException" => {
return UnshareDirectoryError::Client(String::from(error_message));
}
"DirectoryNotSharedException" => {
return UnshareDirectoryError::DirectoryNotShared(String::from(error_message));
}
"EntityDoesNotExistException" => {
return UnshareDirectoryError::EntityDoesNotExist(String::from(error_message));
}
"InvalidTargetException" => {
return UnshareDirectoryError::InvalidTarget(String::from(error_message));
}
"ServiceException" => {
return UnshareDirectoryError::Service(String::from(error_message));
}
"ValidationException" => {
return UnshareDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return UnshareDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UnshareDirectoryError {
fn from(err: serde_json::error::Error) -> UnshareDirectoryError {
UnshareDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UnshareDirectoryError {
fn from(err: CredentialsError) -> UnshareDirectoryError {
UnshareDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for UnshareDirectoryError {
fn from(err: HttpDispatchError) -> UnshareDirectoryError {
UnshareDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for UnshareDirectoryError {
fn from(err: io::Error) -> UnshareDirectoryError {
UnshareDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UnshareDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UnshareDirectoryError {
fn description(&self) -> &str {
match *self {
UnshareDirectoryError::Client(ref cause) => cause,
UnshareDirectoryError::DirectoryNotShared(ref cause) => cause,
UnshareDirectoryError::EntityDoesNotExist(ref cause) => cause,
UnshareDirectoryError::InvalidTarget(ref cause) => cause,
UnshareDirectoryError::Service(ref cause) => cause,
UnshareDirectoryError::Validation(ref cause) => cause,
UnshareDirectoryError::Credentials(ref err) => err.description(),
UnshareDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UnshareDirectoryError::ParseError(ref cause) => cause,
UnshareDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateConditionalForwarderError {
Client(String),
DirectoryUnavailable(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateConditionalForwarderError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateConditionalForwarderError {
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 {
"ClientException" => {
return UpdateConditionalForwarderError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return UpdateConditionalForwarderError::DirectoryUnavailable(String::from(
error_message,
));
}
"EntityDoesNotExistException" => {
return UpdateConditionalForwarderError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return UpdateConditionalForwarderError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return UpdateConditionalForwarderError::Service(String::from(error_message));
}
"UnsupportedOperationException" => {
return UpdateConditionalForwarderError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateConditionalForwarderError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateConditionalForwarderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateConditionalForwarderError {
fn from(err: serde_json::error::Error) -> UpdateConditionalForwarderError {
UpdateConditionalForwarderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateConditionalForwarderError {
fn from(err: CredentialsError) -> UpdateConditionalForwarderError {
UpdateConditionalForwarderError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateConditionalForwarderError {
fn from(err: HttpDispatchError) -> UpdateConditionalForwarderError {
UpdateConditionalForwarderError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateConditionalForwarderError {
fn from(err: io::Error) -> UpdateConditionalForwarderError {
UpdateConditionalForwarderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateConditionalForwarderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateConditionalForwarderError {
fn description(&self) -> &str {
match *self {
UpdateConditionalForwarderError::Client(ref cause) => cause,
UpdateConditionalForwarderError::DirectoryUnavailable(ref cause) => cause,
UpdateConditionalForwarderError::EntityDoesNotExist(ref cause) => cause,
UpdateConditionalForwarderError::InvalidParameter(ref cause) => cause,
UpdateConditionalForwarderError::Service(ref cause) => cause,
UpdateConditionalForwarderError::UnsupportedOperation(ref cause) => cause,
UpdateConditionalForwarderError::Validation(ref cause) => cause,
UpdateConditionalForwarderError::Credentials(ref err) => err.description(),
UpdateConditionalForwarderError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateConditionalForwarderError::ParseError(ref cause) => cause,
UpdateConditionalForwarderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateNumberOfDomainControllersError {
Client(String),
DirectoryUnavailable(String),
DomainControllerLimitExceeded(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateNumberOfDomainControllersError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateNumberOfDomainControllersError {
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 {
"ClientException" => {
return UpdateNumberOfDomainControllersError::Client(String::from(error_message));
}
"DirectoryUnavailableException" => {
return UpdateNumberOfDomainControllersError::DirectoryUnavailable(String::from(
error_message,
));
}
"DomainControllerLimitExceededException" => {
return UpdateNumberOfDomainControllersError::DomainControllerLimitExceeded(
String::from(error_message),
);
}
"EntityDoesNotExistException" => {
return UpdateNumberOfDomainControllersError::EntityDoesNotExist(String::from(
error_message,
));
}
"InvalidParameterException" => {
return UpdateNumberOfDomainControllersError::InvalidParameter(String::from(
error_message,
));
}
"ServiceException" => {
return UpdateNumberOfDomainControllersError::Service(String::from(
error_message,
));
}
"UnsupportedOperationException" => {
return UpdateNumberOfDomainControllersError::UnsupportedOperation(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateNumberOfDomainControllersError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return UpdateNumberOfDomainControllersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateNumberOfDomainControllersError {
fn from(err: serde_json::error::Error) -> UpdateNumberOfDomainControllersError {
UpdateNumberOfDomainControllersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateNumberOfDomainControllersError {
fn from(err: CredentialsError) -> UpdateNumberOfDomainControllersError {
UpdateNumberOfDomainControllersError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateNumberOfDomainControllersError {
fn from(err: HttpDispatchError) -> UpdateNumberOfDomainControllersError {
UpdateNumberOfDomainControllersError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateNumberOfDomainControllersError {
fn from(err: io::Error) -> UpdateNumberOfDomainControllersError {
UpdateNumberOfDomainControllersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateNumberOfDomainControllersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateNumberOfDomainControllersError {
fn description(&self) -> &str {
match *self {
UpdateNumberOfDomainControllersError::Client(ref cause) => cause,
UpdateNumberOfDomainControllersError::DirectoryUnavailable(ref cause) => cause,
UpdateNumberOfDomainControllersError::DomainControllerLimitExceeded(ref cause) => cause,
UpdateNumberOfDomainControllersError::EntityDoesNotExist(ref cause) => cause,
UpdateNumberOfDomainControllersError::InvalidParameter(ref cause) => cause,
UpdateNumberOfDomainControllersError::Service(ref cause) => cause,
UpdateNumberOfDomainControllersError::UnsupportedOperation(ref cause) => cause,
UpdateNumberOfDomainControllersError::Validation(ref cause) => cause,
UpdateNumberOfDomainControllersError::Credentials(ref err) => err.description(),
UpdateNumberOfDomainControllersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateNumberOfDomainControllersError::ParseError(ref cause) => cause,
UpdateNumberOfDomainControllersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRadiusError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRadiusError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRadiusError {
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 {
"ClientException" => return UpdateRadiusError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return UpdateRadiusError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateRadiusError::InvalidParameter(String::from(error_message));
}
"ServiceException" => {
return UpdateRadiusError::Service(String::from(error_message));
}
"ValidationException" => {
return UpdateRadiusError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateRadiusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRadiusError {
fn from(err: serde_json::error::Error) -> UpdateRadiusError {
UpdateRadiusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRadiusError {
fn from(err: CredentialsError) -> UpdateRadiusError {
UpdateRadiusError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRadiusError {
fn from(err: HttpDispatchError) -> UpdateRadiusError {
UpdateRadiusError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRadiusError {
fn from(err: io::Error) -> UpdateRadiusError {
UpdateRadiusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRadiusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRadiusError {
fn description(&self) -> &str {
match *self {
UpdateRadiusError::Client(ref cause) => cause,
UpdateRadiusError::EntityDoesNotExist(ref cause) => cause,
UpdateRadiusError::InvalidParameter(ref cause) => cause,
UpdateRadiusError::Service(ref cause) => cause,
UpdateRadiusError::Validation(ref cause) => cause,
UpdateRadiusError::Credentials(ref err) => err.description(),
UpdateRadiusError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateRadiusError::ParseError(ref cause) => cause,
UpdateRadiusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateTrustError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateTrustError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateTrustError {
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 {
"ClientException" => return UpdateTrustError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return UpdateTrustError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateTrustError::InvalidParameter(String::from(error_message));
}
"ServiceException" => return UpdateTrustError::Service(String::from(error_message)),
"ValidationException" => {
return UpdateTrustError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateTrustError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateTrustError {
fn from(err: serde_json::error::Error) -> UpdateTrustError {
UpdateTrustError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateTrustError {
fn from(err: CredentialsError) -> UpdateTrustError {
UpdateTrustError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateTrustError {
fn from(err: HttpDispatchError) -> UpdateTrustError {
UpdateTrustError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateTrustError {
fn from(err: io::Error) -> UpdateTrustError {
UpdateTrustError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateTrustError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateTrustError {
fn description(&self) -> &str {
match *self {
UpdateTrustError::Client(ref cause) => cause,
UpdateTrustError::EntityDoesNotExist(ref cause) => cause,
UpdateTrustError::InvalidParameter(ref cause) => cause,
UpdateTrustError::Service(ref cause) => cause,
UpdateTrustError::Validation(ref cause) => cause,
UpdateTrustError::Credentials(ref err) => err.description(),
UpdateTrustError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateTrustError::ParseError(ref cause) => cause,
UpdateTrustError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum VerifyTrustError {
Client(String),
EntityDoesNotExist(String),
InvalidParameter(String),
Service(String),
UnsupportedOperation(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl VerifyTrustError {
pub fn from_response(res: BufferedHttpResponse) -> VerifyTrustError {
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 {
"ClientException" => return VerifyTrustError::Client(String::from(error_message)),
"EntityDoesNotExistException" => {
return VerifyTrustError::EntityDoesNotExist(String::from(error_message));
}
"InvalidParameterException" => {
return VerifyTrustError::InvalidParameter(String::from(error_message));
}
"ServiceException" => return VerifyTrustError::Service(String::from(error_message)),
"UnsupportedOperationException" => {
return VerifyTrustError::UnsupportedOperation(String::from(error_message));
}
"ValidationException" => {
return VerifyTrustError::Validation(error_message.to_string());
}
_ => {}
}
}
return VerifyTrustError::Unknown(res);
}
}
impl From<serde_json::error::Error> for VerifyTrustError {
fn from(err: serde_json::error::Error) -> VerifyTrustError {
VerifyTrustError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for VerifyTrustError {
fn from(err: CredentialsError) -> VerifyTrustError {
VerifyTrustError::Credentials(err)
}
}
impl From<HttpDispatchError> for VerifyTrustError {
fn from(err: HttpDispatchError) -> VerifyTrustError {
VerifyTrustError::HttpDispatch(err)
}
}
impl From<io::Error> for VerifyTrustError {
fn from(err: io::Error) -> VerifyTrustError {
VerifyTrustError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for VerifyTrustError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for VerifyTrustError {
fn description(&self) -> &str {
match *self {
VerifyTrustError::Client(ref cause) => cause,
VerifyTrustError::EntityDoesNotExist(ref cause) => cause,
VerifyTrustError::InvalidParameter(ref cause) => cause,
VerifyTrustError::Service(ref cause) => cause,
VerifyTrustError::UnsupportedOperation(ref cause) => cause,
VerifyTrustError::Validation(ref cause) => cause,
VerifyTrustError::Credentials(ref err) => err.description(),
VerifyTrustError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
VerifyTrustError::ParseError(ref cause) => cause,
VerifyTrustError::Unknown(_) => "unknown error",
}
}
}
pub trait DirectoryService {
fn accept_shared_directory(
&self,
input: AcceptSharedDirectoryRequest,
) -> RusotoFuture<AcceptSharedDirectoryResult, AcceptSharedDirectoryError>;
fn add_ip_routes(
&self,
input: AddIpRoutesRequest,
) -> RusotoFuture<AddIpRoutesResult, AddIpRoutesError>;
fn add_tags_to_resource(
&self,
input: AddTagsToResourceRequest,
) -> RusotoFuture<AddTagsToResourceResult, AddTagsToResourceError>;
fn cancel_schema_extension(
&self,
input: CancelSchemaExtensionRequest,
) -> RusotoFuture<CancelSchemaExtensionResult, CancelSchemaExtensionError>;
fn connect_directory(
&self,
input: ConnectDirectoryRequest,
) -> RusotoFuture<ConnectDirectoryResult, ConnectDirectoryError>;
fn create_alias(
&self,
input: CreateAliasRequest,
) -> RusotoFuture<CreateAliasResult, CreateAliasError>;
fn create_computer(
&self,
input: CreateComputerRequest,
) -> RusotoFuture<CreateComputerResult, CreateComputerError>;
fn create_conditional_forwarder(
&self,
input: CreateConditionalForwarderRequest,
) -> RusotoFuture<CreateConditionalForwarderResult, CreateConditionalForwarderError>;
fn create_directory(
&self,
input: CreateDirectoryRequest,
) -> RusotoFuture<CreateDirectoryResult, CreateDirectoryError>;
fn create_log_subscription(
&self,
input: CreateLogSubscriptionRequest,
) -> RusotoFuture<CreateLogSubscriptionResult, CreateLogSubscriptionError>;
fn create_microsoft_ad(
&self,
input: CreateMicrosoftADRequest,
) -> RusotoFuture<CreateMicrosoftADResult, CreateMicrosoftADError>;
fn create_snapshot(
&self,
input: CreateSnapshotRequest,
) -> RusotoFuture<CreateSnapshotResult, CreateSnapshotError>;
fn create_trust(
&self,
input: CreateTrustRequest,
) -> RusotoFuture<CreateTrustResult, CreateTrustError>;
fn delete_conditional_forwarder(
&self,
input: DeleteConditionalForwarderRequest,
) -> RusotoFuture<DeleteConditionalForwarderResult, DeleteConditionalForwarderError>;
fn delete_directory(
&self,
input: DeleteDirectoryRequest,
) -> RusotoFuture<DeleteDirectoryResult, DeleteDirectoryError>;
fn delete_log_subscription(
&self,
input: DeleteLogSubscriptionRequest,
) -> RusotoFuture<DeleteLogSubscriptionResult, DeleteLogSubscriptionError>;
fn delete_snapshot(
&self,
input: DeleteSnapshotRequest,
) -> RusotoFuture<DeleteSnapshotResult, DeleteSnapshotError>;
fn delete_trust(
&self,
input: DeleteTrustRequest,
) -> RusotoFuture<DeleteTrustResult, DeleteTrustError>;
fn deregister_event_topic(
&self,
input: DeregisterEventTopicRequest,
) -> RusotoFuture<DeregisterEventTopicResult, DeregisterEventTopicError>;
fn describe_conditional_forwarders(
&self,
input: DescribeConditionalForwardersRequest,
) -> RusotoFuture<DescribeConditionalForwardersResult, DescribeConditionalForwardersError>;
fn describe_directories(
&self,
input: DescribeDirectoriesRequest,
) -> RusotoFuture<DescribeDirectoriesResult, DescribeDirectoriesError>;
fn describe_domain_controllers(
&self,
input: DescribeDomainControllersRequest,
) -> RusotoFuture<DescribeDomainControllersResult, DescribeDomainControllersError>;
fn describe_event_topics(
&self,
input: DescribeEventTopicsRequest,
) -> RusotoFuture<DescribeEventTopicsResult, DescribeEventTopicsError>;
fn describe_shared_directories(
&self,
input: DescribeSharedDirectoriesRequest,
) -> RusotoFuture<DescribeSharedDirectoriesResult, DescribeSharedDirectoriesError>;
fn describe_snapshots(
&self,
input: DescribeSnapshotsRequest,
) -> RusotoFuture<DescribeSnapshotsResult, DescribeSnapshotsError>;
fn describe_trusts(
&self,
input: DescribeTrustsRequest,
) -> RusotoFuture<DescribeTrustsResult, DescribeTrustsError>;
fn disable_radius(
&self,
input: DisableRadiusRequest,
) -> RusotoFuture<DisableRadiusResult, DisableRadiusError>;
fn disable_sso(
&self,
input: DisableSsoRequest,
) -> RusotoFuture<DisableSsoResult, DisableSsoError>;
fn enable_radius(
&self,
input: EnableRadiusRequest,
) -> RusotoFuture<EnableRadiusResult, EnableRadiusError>;
fn enable_sso(&self, input: EnableSsoRequest) -> RusotoFuture<EnableSsoResult, EnableSsoError>;
fn get_directory_limits(
&self,
) -> RusotoFuture<GetDirectoryLimitsResult, GetDirectoryLimitsError>;
fn get_snapshot_limits(
&self,
input: GetSnapshotLimitsRequest,
) -> RusotoFuture<GetSnapshotLimitsResult, GetSnapshotLimitsError>;
fn list_ip_routes(
&self,
input: ListIpRoutesRequest,
) -> RusotoFuture<ListIpRoutesResult, ListIpRoutesError>;
fn list_log_subscriptions(
&self,
input: ListLogSubscriptionsRequest,
) -> RusotoFuture<ListLogSubscriptionsResult, ListLogSubscriptionsError>;
fn list_schema_extensions(
&self,
input: ListSchemaExtensionsRequest,
) -> RusotoFuture<ListSchemaExtensionsResult, ListSchemaExtensionsError>;
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResult, ListTagsForResourceError>;
fn register_event_topic(
&self,
input: RegisterEventTopicRequest,
) -> RusotoFuture<RegisterEventTopicResult, RegisterEventTopicError>;
fn reject_shared_directory(
&self,
input: RejectSharedDirectoryRequest,
) -> RusotoFuture<RejectSharedDirectoryResult, RejectSharedDirectoryError>;
fn remove_ip_routes(
&self,
input: RemoveIpRoutesRequest,
) -> RusotoFuture<RemoveIpRoutesResult, RemoveIpRoutesError>;
fn remove_tags_from_resource(
&self,
input: RemoveTagsFromResourceRequest,
) -> RusotoFuture<RemoveTagsFromResourceResult, RemoveTagsFromResourceError>;
fn reset_user_password(
&self,
input: ResetUserPasswordRequest,
) -> RusotoFuture<ResetUserPasswordResult, ResetUserPasswordError>;
fn restore_from_snapshot(
&self,
input: RestoreFromSnapshotRequest,
) -> RusotoFuture<RestoreFromSnapshotResult, RestoreFromSnapshotError>;
fn share_directory(
&self,
input: ShareDirectoryRequest,
) -> RusotoFuture<ShareDirectoryResult, ShareDirectoryError>;
fn start_schema_extension(
&self,
input: StartSchemaExtensionRequest,
) -> RusotoFuture<StartSchemaExtensionResult, StartSchemaExtensionError>;
fn unshare_directory(
&self,
input: UnshareDirectoryRequest,
) -> RusotoFuture<UnshareDirectoryResult, UnshareDirectoryError>;
fn update_conditional_forwarder(
&self,
input: UpdateConditionalForwarderRequest,
) -> RusotoFuture<UpdateConditionalForwarderResult, UpdateConditionalForwarderError>;
fn update_number_of_domain_controllers(
&self,
input: UpdateNumberOfDomainControllersRequest,
) -> RusotoFuture<UpdateNumberOfDomainControllersResult, UpdateNumberOfDomainControllersError>;
fn update_radius(
&self,
input: UpdateRadiusRequest,
) -> RusotoFuture<UpdateRadiusResult, UpdateRadiusError>;
fn update_trust(
&self,
input: UpdateTrustRequest,
) -> RusotoFuture<UpdateTrustResult, UpdateTrustError>;
fn verify_trust(
&self,
input: VerifyTrustRequest,
) -> RusotoFuture<VerifyTrustResult, VerifyTrustError>;
}
#[derive(Clone)]
pub struct DirectoryServiceClient {
client: Client,
region: region::Region,
}
impl DirectoryServiceClient {
pub fn new(region: region::Region) -> DirectoryServiceClient {
DirectoryServiceClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> DirectoryServiceClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
DirectoryServiceClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl DirectoryService for DirectoryServiceClient {
fn accept_shared_directory(
&self,
input: AcceptSharedDirectoryRequest,
) -> RusotoFuture<AcceptSharedDirectoryResult, AcceptSharedDirectoryError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.AcceptSharedDirectory",
);
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::<AcceptSharedDirectoryResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AcceptSharedDirectoryError::from_response(response))
}),
)
}
})
}
fn add_ip_routes(
&self,
input: AddIpRoutesRequest,
) -> RusotoFuture<AddIpRoutesResult, AddIpRoutesError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.AddIpRoutes");
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::<AddIpRoutesResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AddIpRoutesError::from_response(response))),
)
}
})
}
fn add_tags_to_resource(
&self,
input: AddTagsToResourceRequest,
) -> RusotoFuture<AddTagsToResourceResult, AddTagsToResourceError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.AddTagsToResource",
);
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::<AddTagsToResourceResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AddTagsToResourceError::from_response(response))),
)
}
})
}
fn cancel_schema_extension(
&self,
input: CancelSchemaExtensionRequest,
) -> RusotoFuture<CancelSchemaExtensionResult, CancelSchemaExtensionError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.CancelSchemaExtension",
);
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::<CancelSchemaExtensionResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CancelSchemaExtensionError::from_response(response))
}),
)
}
})
}
fn connect_directory(
&self,
input: ConnectDirectoryRequest,
) -> RusotoFuture<ConnectDirectoryResult, ConnectDirectoryError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.ConnectDirectory");
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::<ConnectDirectoryResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ConnectDirectoryError::from_response(response))),
)
}
})
}
fn create_alias(
&self,
input: CreateAliasRequest,
) -> RusotoFuture<CreateAliasResult, CreateAliasError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.CreateAlias");
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::<CreateAliasResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateAliasError::from_response(response))),
)
}
})
}
fn create_computer(
&self,
input: CreateComputerRequest,
) -> RusotoFuture<CreateComputerResult, CreateComputerError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.CreateComputer");
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::<CreateComputerResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateComputerError::from_response(response))),
)
}
})
}
fn create_conditional_forwarder(
&self,
input: CreateConditionalForwarderRequest,
) -> RusotoFuture<CreateConditionalForwarderResult, CreateConditionalForwarderError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.CreateConditionalForwarder",
);
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::<CreateConditionalForwarderResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateConditionalForwarderError::from_response(response))
}))
}
})
}
fn create_directory(
&self,
input: CreateDirectoryRequest,
) -> RusotoFuture<CreateDirectoryResult, CreateDirectoryError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.CreateDirectory");
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::<CreateDirectoryResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDirectoryError::from_response(response))),
)
}
})
}
fn create_log_subscription(
&self,
input: CreateLogSubscriptionRequest,
) -> RusotoFuture<CreateLogSubscriptionResult, CreateLogSubscriptionError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.CreateLogSubscription",
);
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::<CreateLogSubscriptionResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateLogSubscriptionError::from_response(response))
}),
)
}
})
}
fn create_microsoft_ad(
&self,
input: CreateMicrosoftADRequest,
) -> RusotoFuture<CreateMicrosoftADResult, CreateMicrosoftADError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.CreateMicrosoftAD",
);
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::<CreateMicrosoftADResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateMicrosoftADError::from_response(response))),
)
}
})
}
fn create_snapshot(
&self,
input: CreateSnapshotRequest,
) -> RusotoFuture<CreateSnapshotResult, CreateSnapshotError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.CreateSnapshot");
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::<CreateSnapshotResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateSnapshotError::from_response(response))),
)
}
})
}
fn create_trust(
&self,
input: CreateTrustRequest,
) -> RusotoFuture<CreateTrustResult, CreateTrustError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.CreateTrust");
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::<CreateTrustResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateTrustError::from_response(response))),
)
}
})
}
fn delete_conditional_forwarder(
&self,
input: DeleteConditionalForwarderRequest,
) -> RusotoFuture<DeleteConditionalForwarderResult, DeleteConditionalForwarderError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DeleteConditionalForwarder",
);
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::<DeleteConditionalForwarderResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteConditionalForwarderError::from_response(response))
}))
}
})
}
fn delete_directory(
&self,
input: DeleteDirectoryRequest,
) -> RusotoFuture<DeleteDirectoryResult, DeleteDirectoryError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.DeleteDirectory");
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::<DeleteDirectoryResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteDirectoryError::from_response(response))),
)
}
})
}
fn delete_log_subscription(
&self,
input: DeleteLogSubscriptionRequest,
) -> RusotoFuture<DeleteLogSubscriptionResult, DeleteLogSubscriptionError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DeleteLogSubscription",
);
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::<DeleteLogSubscriptionResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteLogSubscriptionError::from_response(response))
}),
)
}
})
}
fn delete_snapshot(
&self,
input: DeleteSnapshotRequest,
) -> RusotoFuture<DeleteSnapshotResult, DeleteSnapshotError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.DeleteSnapshot");
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::<DeleteSnapshotResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteSnapshotError::from_response(response))),
)
}
})
}
fn delete_trust(
&self,
input: DeleteTrustRequest,
) -> RusotoFuture<DeleteTrustResult, DeleteTrustError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.DeleteTrust");
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::<DeleteTrustResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteTrustError::from_response(response))),
)
}
})
}
fn deregister_event_topic(
&self,
input: DeregisterEventTopicRequest,
) -> RusotoFuture<DeregisterEventTopicResult, DeregisterEventTopicError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DeregisterEventTopic",
);
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::<DeregisterEventTopicResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeregisterEventTopicError::from_response(response))
}),
)
}
})
}
fn describe_conditional_forwarders(
&self,
input: DescribeConditionalForwardersRequest,
) -> RusotoFuture<DescribeConditionalForwardersResult, DescribeConditionalForwardersError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DescribeConditionalForwarders",
);
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::<DescribeConditionalForwardersResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeConditionalForwardersError::from_response(response))
}))
}
})
}
fn describe_directories(
&self,
input: DescribeDirectoriesRequest,
) -> RusotoFuture<DescribeDirectoriesResult, DescribeDirectoriesError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DescribeDirectories",
);
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::<DescribeDirectoriesResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeDirectoriesError::from_response(response))
}),
)
}
})
}
fn describe_domain_controllers(
&self,
input: DescribeDomainControllersRequest,
) -> RusotoFuture<DescribeDomainControllersResult, DescribeDomainControllersError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DescribeDomainControllers",
);
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::<DescribeDomainControllersResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeDomainControllersError::from_response(response))
}))
}
})
}
fn describe_event_topics(
&self,
input: DescribeEventTopicsRequest,
) -> RusotoFuture<DescribeEventTopicsResult, DescribeEventTopicsError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DescribeEventTopics",
);
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::<DescribeEventTopicsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeEventTopicsError::from_response(response))
}),
)
}
})
}
fn describe_shared_directories(
&self,
input: DescribeSharedDirectoriesRequest,
) -> RusotoFuture<DescribeSharedDirectoriesResult, DescribeSharedDirectoriesError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DescribeSharedDirectories",
);
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::<DescribeSharedDirectoriesResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeSharedDirectoriesError::from_response(response))
}))
}
})
}
fn describe_snapshots(
&self,
input: DescribeSnapshotsRequest,
) -> RusotoFuture<DescribeSnapshotsResult, DescribeSnapshotsError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.DescribeSnapshots",
);
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::<DescribeSnapshotsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeSnapshotsError::from_response(response))),
)
}
})
}
fn describe_trusts(
&self,
input: DescribeTrustsRequest,
) -> RusotoFuture<DescribeTrustsResult, DescribeTrustsError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.DescribeTrusts");
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::<DescribeTrustsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeTrustsError::from_response(response))),
)
}
})
}
fn disable_radius(
&self,
input: DisableRadiusRequest,
) -> RusotoFuture<DisableRadiusResult, DisableRadiusError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.DisableRadius");
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::<DisableRadiusResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DisableRadiusError::from_response(response))),
)
}
})
}
fn disable_sso(
&self,
input: DisableSsoRequest,
) -> RusotoFuture<DisableSsoResult, DisableSsoError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.DisableSso");
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::<DisableSsoResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DisableSsoError::from_response(response))),
)
}
})
}
fn enable_radius(
&self,
input: EnableRadiusRequest,
) -> RusotoFuture<EnableRadiusResult, EnableRadiusError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.EnableRadius");
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::<EnableRadiusResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(EnableRadiusError::from_response(response))),
)
}
})
}
fn enable_sso(&self, input: EnableSsoRequest) -> RusotoFuture<EnableSsoResult, EnableSsoError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.EnableSso");
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::<EnableSsoResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(EnableSsoError::from_response(response))),
)
}
})
}
fn get_directory_limits(
&self,
) -> RusotoFuture<GetDirectoryLimitsResult, GetDirectoryLimitsError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.GetDirectoryLimits",
);
request.set_payload(Some(b"{}".to_vec()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetDirectoryLimitsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDirectoryLimitsError::from_response(response))),
)
}
})
}
fn get_snapshot_limits(
&self,
input: GetSnapshotLimitsRequest,
) -> RusotoFuture<GetSnapshotLimitsResult, GetSnapshotLimitsError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.GetSnapshotLimits",
);
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::<GetSnapshotLimitsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSnapshotLimitsError::from_response(response))),
)
}
})
}
fn list_ip_routes(
&self,
input: ListIpRoutesRequest,
) -> RusotoFuture<ListIpRoutesResult, ListIpRoutesError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.ListIpRoutes");
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::<ListIpRoutesResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListIpRoutesError::from_response(response))),
)
}
})
}
fn list_log_subscriptions(
&self,
input: ListLogSubscriptionsRequest,
) -> RusotoFuture<ListLogSubscriptionsResult, ListLogSubscriptionsError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.ListLogSubscriptions",
);
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::<ListLogSubscriptionsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListLogSubscriptionsError::from_response(response))
}),
)
}
})
}
fn list_schema_extensions(
&self,
input: ListSchemaExtensionsRequest,
) -> RusotoFuture<ListSchemaExtensionsResult, ListSchemaExtensionsError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.ListSchemaExtensions",
);
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::<ListSchemaExtensionsResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListSchemaExtensionsError::from_response(response))
}),
)
}
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResult, ListTagsForResourceError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.ListTagsForResource",
);
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::<ListTagsForResourceResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
)
}
})
}
fn register_event_topic(
&self,
input: RegisterEventTopicRequest,
) -> RusotoFuture<RegisterEventTopicResult, RegisterEventTopicError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.RegisterEventTopic",
);
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::<RegisterEventTopicResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(RegisterEventTopicError::from_response(response))),
)
}
})
}
fn reject_shared_directory(
&self,
input: RejectSharedDirectoryRequest,
) -> RusotoFuture<RejectSharedDirectoryResult, RejectSharedDirectoryError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.RejectSharedDirectory",
);
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::<RejectSharedDirectoryResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RejectSharedDirectoryError::from_response(response))
}),
)
}
})
}
fn remove_ip_routes(
&self,
input: RemoveIpRoutesRequest,
) -> RusotoFuture<RemoveIpRoutesResult, RemoveIpRoutesError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.RemoveIpRoutes");
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::<RemoveIpRoutesResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(RemoveIpRoutesError::from_response(response))),
)
}
})
}
fn remove_tags_from_resource(
&self,
input: RemoveTagsFromResourceRequest,
) -> RusotoFuture<RemoveTagsFromResourceResult, RemoveTagsFromResourceError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.RemoveTagsFromResource",
);
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::<RemoveTagsFromResourceResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RemoveTagsFromResourceError::from_response(response))
}),
)
}
})
}
fn reset_user_password(
&self,
input: ResetUserPasswordRequest,
) -> RusotoFuture<ResetUserPasswordResult, ResetUserPasswordError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.ResetUserPassword",
);
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::<ResetUserPasswordResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ResetUserPasswordError::from_response(response))),
)
}
})
}
fn restore_from_snapshot(
&self,
input: RestoreFromSnapshotRequest,
) -> RusotoFuture<RestoreFromSnapshotResult, RestoreFromSnapshotError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.RestoreFromSnapshot",
);
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::<RestoreFromSnapshotResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RestoreFromSnapshotError::from_response(response))
}),
)
}
})
}
fn share_directory(
&self,
input: ShareDirectoryRequest,
) -> RusotoFuture<ShareDirectoryResult, ShareDirectoryError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.ShareDirectory");
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::<ShareDirectoryResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ShareDirectoryError::from_response(response))),
)
}
})
}
fn start_schema_extension(
&self,
input: StartSchemaExtensionRequest,
) -> RusotoFuture<StartSchemaExtensionResult, StartSchemaExtensionError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.StartSchemaExtension",
);
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::<StartSchemaExtensionResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StartSchemaExtensionError::from_response(response))
}),
)
}
})
}
fn unshare_directory(
&self,
input: UnshareDirectoryRequest,
) -> RusotoFuture<UnshareDirectoryResult, UnshareDirectoryError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.UnshareDirectory");
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::<UnshareDirectoryResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UnshareDirectoryError::from_response(response))),
)
}
})
}
fn update_conditional_forwarder(
&self,
input: UpdateConditionalForwarderRequest,
) -> RusotoFuture<UpdateConditionalForwarderResult, UpdateConditionalForwarderError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.UpdateConditionalForwarder",
);
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::<UpdateConditionalForwarderResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateConditionalForwarderError::from_response(response))
}))
}
})
}
fn update_number_of_domain_controllers(
&self,
input: UpdateNumberOfDomainControllersRequest,
) -> RusotoFuture<UpdateNumberOfDomainControllersResult, UpdateNumberOfDomainControllersError>
{
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"DirectoryService_20150416.UpdateNumberOfDomainControllers",
);
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::<UpdateNumberOfDomainControllersResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateNumberOfDomainControllersError::from_response(
response,
))
}))
}
})
}
fn update_radius(
&self,
input: UpdateRadiusRequest,
) -> RusotoFuture<UpdateRadiusResult, UpdateRadiusError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.UpdateRadius");
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::<UpdateRadiusResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateRadiusError::from_response(response))),
)
}
})
}
fn update_trust(
&self,
input: UpdateTrustRequest,
) -> RusotoFuture<UpdateTrustResult, UpdateTrustError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.UpdateTrust");
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::<UpdateTrustResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateTrustError::from_response(response))),
)
}
})
}
fn verify_trust(
&self,
input: VerifyTrustRequest,
) -> RusotoFuture<VerifyTrustResult, VerifyTrustError> {
let mut request = SignedRequest::new("POST", "ds", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "DirectoryService_20150416.VerifyTrust");
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::<VerifyTrustResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(VerifyTrustError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}