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 AddFacetToObjectRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectAttributeList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_attribute_list: Option<Vec<AttributeKeyAndValue>>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "SchemaFacet")]
pub schema_facet: SchemaFacet,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddFacetToObjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ApplySchemaRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "PublishedSchemaArn")]
pub published_schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ApplySchemaResponse {
#[serde(rename = "AppliedSchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub applied_schema_arn: Option<String>,
#[serde(rename = "DirectoryArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachObjectRequest {
#[serde(rename = "ChildReference")]
pub child_reference: ObjectReference,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "LinkName")]
pub link_name: String,
#[serde(rename = "ParentReference")]
pub parent_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttachObjectResponse {
#[serde(rename = "AttachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachPolicyRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "PolicyReference")]
pub policy_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttachPolicyResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachToIndexRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "IndexReference")]
pub index_reference: ObjectReference,
#[serde(rename = "TargetReference")]
pub target_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttachToIndexResponse {
#[serde(rename = "AttachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachTypedLinkRequest {
#[serde(rename = "Attributes")]
pub attributes: Vec<AttributeNameAndValue>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "SourceObjectReference")]
pub source_object_reference: ObjectReference,
#[serde(rename = "TargetObjectReference")]
pub target_object_reference: ObjectReference,
#[serde(rename = "TypedLinkFacet")]
pub typed_link_facet: TypedLinkSchemaAndFacetName,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttachTypedLinkResponse {
#[serde(rename = "TypedLinkSpecifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub typed_link_specifier: Option<TypedLinkSpecifier>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AttributeKey {
#[serde(rename = "FacetName")]
pub facet_name: String,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AttributeKeyAndValue {
#[serde(rename = "Key")]
pub key: AttributeKey,
#[serde(rename = "Value")]
pub value: TypedAttributeValue,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AttributeNameAndValue {
#[serde(rename = "AttributeName")]
pub attribute_name: String,
#[serde(rename = "Value")]
pub value: TypedAttributeValue,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchAddFacetToObject {
#[serde(rename = "ObjectAttributeList")]
pub object_attribute_list: Vec<AttributeKeyAndValue>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "SchemaFacet")]
pub schema_facet: SchemaFacet,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchAddFacetToObjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchAttachObject {
#[serde(rename = "ChildReference")]
pub child_reference: ObjectReference,
#[serde(rename = "LinkName")]
pub link_name: String,
#[serde(rename = "ParentReference")]
pub parent_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchAttachObjectResponse {
#[serde(rename = "attachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchAttachPolicy {
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "PolicyReference")]
pub policy_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchAttachPolicyResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchAttachToIndex {
#[serde(rename = "IndexReference")]
pub index_reference: ObjectReference,
#[serde(rename = "TargetReference")]
pub target_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchAttachToIndexResponse {
#[serde(rename = "AttachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchAttachTypedLink {
#[serde(rename = "Attributes")]
pub attributes: Vec<AttributeNameAndValue>,
#[serde(rename = "SourceObjectReference")]
pub source_object_reference: ObjectReference,
#[serde(rename = "TargetObjectReference")]
pub target_object_reference: ObjectReference,
#[serde(rename = "TypedLinkFacet")]
pub typed_link_facet: TypedLinkSchemaAndFacetName,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchAttachTypedLinkResponse {
#[serde(rename = "TypedLinkSpecifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub typed_link_specifier: Option<TypedLinkSpecifier>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchCreateIndex {
#[serde(rename = "BatchReferenceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub batch_reference_name: Option<String>,
#[serde(rename = "IsUnique")]
pub is_unique: bool,
#[serde(rename = "LinkName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub link_name: Option<String>,
#[serde(rename = "OrderedIndexedAttributeList")]
pub ordered_indexed_attribute_list: Vec<AttributeKey>,
#[serde(rename = "ParentReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_reference: Option<ObjectReference>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchCreateIndexResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchCreateObject {
#[serde(rename = "BatchReferenceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub batch_reference_name: Option<String>,
#[serde(rename = "LinkName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub link_name: Option<String>,
#[serde(rename = "ObjectAttributeList")]
pub object_attribute_list: Vec<AttributeKeyAndValue>,
#[serde(rename = "ParentReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_reference: Option<ObjectReference>,
#[serde(rename = "SchemaFacet")]
pub schema_facet: Vec<SchemaFacet>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchCreateObjectResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchDeleteObject {
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchDeleteObjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchDetachFromIndex {
#[serde(rename = "IndexReference")]
pub index_reference: ObjectReference,
#[serde(rename = "TargetReference")]
pub target_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchDetachFromIndexResponse {
#[serde(rename = "DetachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchDetachObject {
#[serde(rename = "BatchReferenceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub batch_reference_name: Option<String>,
#[serde(rename = "LinkName")]
pub link_name: String,
#[serde(rename = "ParentReference")]
pub parent_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchDetachObjectResponse {
#[serde(rename = "detachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchDetachPolicy {
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "PolicyReference")]
pub policy_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchDetachPolicyResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchDetachTypedLink {
#[serde(rename = "TypedLinkSpecifier")]
pub typed_link_specifier: TypedLinkSpecifier,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchDetachTypedLinkResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchGetLinkAttributes {
#[serde(rename = "AttributeNames")]
pub attribute_names: Vec<String>,
#[serde(rename = "TypedLinkSpecifier")]
pub typed_link_specifier: TypedLinkSpecifier,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchGetLinkAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<AttributeKeyAndValue>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchGetObjectAttributes {
#[serde(rename = "AttributeNames")]
pub attribute_names: Vec<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "SchemaFacet")]
pub schema_facet: SchemaFacet,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchGetObjectAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<AttributeKeyAndValue>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchGetObjectInformation {
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchGetObjectInformationResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
#[serde(rename = "SchemaFacets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_facets: Option<Vec<SchemaFacet>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListAttachedIndices {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TargetReference")]
pub target_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListAttachedIndicesResponse {
#[serde(rename = "IndexAttachments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_attachments: Option<Vec<IndexAttachment>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListIncomingTypedLinks {
#[serde(rename = "FilterAttributeRanges")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_attribute_ranges: Option<Vec<TypedLinkAttributeRange>>,
#[serde(rename = "FilterTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_typed_link: Option<TypedLinkSchemaAndFacetName>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListIncomingTypedLinksResponse {
#[serde(rename = "LinkSpecifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub link_specifiers: Option<Vec<TypedLinkSpecifier>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListIndex {
#[serde(rename = "IndexReference")]
pub index_reference: ObjectReference,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "RangesOnIndexedValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ranges_on_indexed_values: Option<Vec<ObjectAttributeRange>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListIndexResponse {
#[serde(rename = "IndexAttachments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_attachments: Option<Vec<IndexAttachment>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListObjectAttributes {
#[serde(rename = "FacetFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub facet_filter: Option<SchemaFacet>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListObjectAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<AttributeKeyAndValue>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListObjectChildren {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListObjectChildrenResponse {
#[serde(rename = "Children")]
#[serde(skip_serializing_if = "Option::is_none")]
pub children: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListObjectParentPaths {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListObjectParentPathsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PathToObjectIdentifiersList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path_to_object_identifiers_list: Option<Vec<PathToObjectIdentifiers>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListObjectPolicies {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListObjectPoliciesResponse {
#[serde(rename = "AttachedPolicyIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attached_policy_ids: Option<Vec<String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListOutgoingTypedLinks {
#[serde(rename = "FilterAttributeRanges")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_attribute_ranges: Option<Vec<TypedLinkAttributeRange>>,
#[serde(rename = "FilterTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_typed_link: Option<TypedLinkSchemaAndFacetName>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListOutgoingTypedLinksResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TypedLinkSpecifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub typed_link_specifiers: Option<Vec<TypedLinkSpecifier>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchListPolicyAttachments {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyReference")]
pub policy_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchListPolicyAttachmentsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectIdentifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifiers: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchLookupPolicy {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchLookupPolicyResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyToPathList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_to_path_list: Option<Vec<PolicyToPath>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchReadException {
#[serde(rename = "Message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchReadOperation {
#[serde(rename = "GetLinkAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub get_link_attributes: Option<BatchGetLinkAttributes>,
#[serde(rename = "GetObjectAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub get_object_attributes: Option<BatchGetObjectAttributes>,
#[serde(rename = "GetObjectInformation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub get_object_information: Option<BatchGetObjectInformation>,
#[serde(rename = "ListAttachedIndices")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_attached_indices: Option<BatchListAttachedIndices>,
#[serde(rename = "ListIncomingTypedLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_incoming_typed_links: Option<BatchListIncomingTypedLinks>,
#[serde(rename = "ListIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_index: Option<BatchListIndex>,
#[serde(rename = "ListObjectAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_attributes: Option<BatchListObjectAttributes>,
#[serde(rename = "ListObjectChildren")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_children: Option<BatchListObjectChildren>,
#[serde(rename = "ListObjectParentPaths")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_parent_paths: Option<BatchListObjectParentPaths>,
#[serde(rename = "ListObjectPolicies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_policies: Option<BatchListObjectPolicies>,
#[serde(rename = "ListOutgoingTypedLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_outgoing_typed_links: Option<BatchListOutgoingTypedLinks>,
#[serde(rename = "ListPolicyAttachments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_policy_attachments: Option<BatchListPolicyAttachments>,
#[serde(rename = "LookupPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lookup_policy: Option<BatchLookupPolicy>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchReadOperationResponse {
#[serde(rename = "ExceptionResponse")]
#[serde(skip_serializing_if = "Option::is_none")]
pub exception_response: Option<BatchReadException>,
#[serde(rename = "SuccessfulResponse")]
#[serde(skip_serializing_if = "Option::is_none")]
pub successful_response: Option<BatchReadSuccessfulResponse>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchReadRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "Operations")]
pub operations: Vec<BatchReadOperation>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchReadResponse {
#[serde(rename = "Responses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub responses: Option<Vec<BatchReadOperationResponse>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchReadSuccessfulResponse {
#[serde(rename = "GetLinkAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub get_link_attributes: Option<BatchGetLinkAttributesResponse>,
#[serde(rename = "GetObjectAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub get_object_attributes: Option<BatchGetObjectAttributesResponse>,
#[serde(rename = "GetObjectInformation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub get_object_information: Option<BatchGetObjectInformationResponse>,
#[serde(rename = "ListAttachedIndices")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_attached_indices: Option<BatchListAttachedIndicesResponse>,
#[serde(rename = "ListIncomingTypedLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_incoming_typed_links: Option<BatchListIncomingTypedLinksResponse>,
#[serde(rename = "ListIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_index: Option<BatchListIndexResponse>,
#[serde(rename = "ListObjectAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_attributes: Option<BatchListObjectAttributesResponse>,
#[serde(rename = "ListObjectChildren")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_children: Option<BatchListObjectChildrenResponse>,
#[serde(rename = "ListObjectParentPaths")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_parent_paths: Option<BatchListObjectParentPathsResponse>,
#[serde(rename = "ListObjectPolicies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_object_policies: Option<BatchListObjectPoliciesResponse>,
#[serde(rename = "ListOutgoingTypedLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_outgoing_typed_links: Option<BatchListOutgoingTypedLinksResponse>,
#[serde(rename = "ListPolicyAttachments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub list_policy_attachments: Option<BatchListPolicyAttachmentsResponse>,
#[serde(rename = "LookupPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lookup_policy: Option<BatchLookupPolicyResponse>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchRemoveFacetFromObject {
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "SchemaFacet")]
pub schema_facet: SchemaFacet,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchRemoveFacetFromObjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchUpdateLinkAttributes {
#[serde(rename = "AttributeUpdates")]
pub attribute_updates: Vec<LinkAttributeUpdate>,
#[serde(rename = "TypedLinkSpecifier")]
pub typed_link_specifier: TypedLinkSpecifier,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchUpdateLinkAttributesResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchUpdateObjectAttributes {
#[serde(rename = "AttributeUpdates")]
pub attribute_updates: Vec<ObjectAttributeUpdate>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchUpdateObjectAttributesResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchWriteOperation {
#[serde(rename = "AddFacetToObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub add_facet_to_object: Option<BatchAddFacetToObject>,
#[serde(rename = "AttachObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_object: Option<BatchAttachObject>,
#[serde(rename = "AttachPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_policy: Option<BatchAttachPolicy>,
#[serde(rename = "AttachToIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_to_index: Option<BatchAttachToIndex>,
#[serde(rename = "AttachTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_typed_link: Option<BatchAttachTypedLink>,
#[serde(rename = "CreateIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_index: Option<BatchCreateIndex>,
#[serde(rename = "CreateObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_object: Option<BatchCreateObject>,
#[serde(rename = "DeleteObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delete_object: Option<BatchDeleteObject>,
#[serde(rename = "DetachFromIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_from_index: Option<BatchDetachFromIndex>,
#[serde(rename = "DetachObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_object: Option<BatchDetachObject>,
#[serde(rename = "DetachPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_policy: Option<BatchDetachPolicy>,
#[serde(rename = "DetachTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_typed_link: Option<BatchDetachTypedLink>,
#[serde(rename = "RemoveFacetFromObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_facet_from_object: Option<BatchRemoveFacetFromObject>,
#[serde(rename = "UpdateLinkAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub update_link_attributes: Option<BatchUpdateLinkAttributes>,
#[serde(rename = "UpdateObjectAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub update_object_attributes: Option<BatchUpdateObjectAttributes>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchWriteOperationResponse {
#[serde(rename = "AddFacetToObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub add_facet_to_object: Option<BatchAddFacetToObjectResponse>,
#[serde(rename = "AttachObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_object: Option<BatchAttachObjectResponse>,
#[serde(rename = "AttachPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_policy: Option<BatchAttachPolicyResponse>,
#[serde(rename = "AttachToIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_to_index: Option<BatchAttachToIndexResponse>,
#[serde(rename = "AttachTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_typed_link: Option<BatchAttachTypedLinkResponse>,
#[serde(rename = "CreateIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_index: Option<BatchCreateIndexResponse>,
#[serde(rename = "CreateObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_object: Option<BatchCreateObjectResponse>,
#[serde(rename = "DeleteObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delete_object: Option<BatchDeleteObjectResponse>,
#[serde(rename = "DetachFromIndex")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_from_index: Option<BatchDetachFromIndexResponse>,
#[serde(rename = "DetachObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_object: Option<BatchDetachObjectResponse>,
#[serde(rename = "DetachPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_policy: Option<BatchDetachPolicyResponse>,
#[serde(rename = "DetachTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detach_typed_link: Option<BatchDetachTypedLinkResponse>,
#[serde(rename = "RemoveFacetFromObject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_facet_from_object: Option<BatchRemoveFacetFromObjectResponse>,
#[serde(rename = "UpdateLinkAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub update_link_attributes: Option<BatchUpdateLinkAttributesResponse>,
#[serde(rename = "UpdateObjectAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub update_object_attributes: Option<BatchUpdateObjectAttributesResponse>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchWriteRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "Operations")]
pub operations: Vec<BatchWriteOperation>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchWriteResponse {
#[serde(rename = "Responses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub responses: Option<Vec<BatchWriteOperationResponse>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDirectoryRequest {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDirectoryResponse {
#[serde(rename = "AppliedSchemaArn")]
pub applied_schema_arn: String,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "ObjectIdentifier")]
pub object_identifier: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateFacetRequest {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<FacetAttribute>>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "ObjectType")]
pub object_type: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateFacetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateIndexRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "IsUnique")]
pub is_unique: bool,
#[serde(rename = "LinkName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub link_name: Option<String>,
#[serde(rename = "OrderedIndexedAttributeList")]
pub ordered_indexed_attribute_list: Vec<AttributeKey>,
#[serde(rename = "ParentReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_reference: Option<ObjectReference>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateIndexResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateObjectRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "LinkName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub link_name: Option<String>,
#[serde(rename = "ObjectAttributeList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_attribute_list: Option<Vec<AttributeKeyAndValue>>,
#[serde(rename = "ParentReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_reference: Option<ObjectReference>,
#[serde(rename = "SchemaFacets")]
pub schema_facets: Vec<SchemaFacet>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateObjectResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSchemaRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSchemaResponse {
#[serde(rename = "SchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateTypedLinkFacetRequest {
#[serde(rename = "Facet")]
pub facet: TypedLinkFacet,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateTypedLinkFacetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDirectoryRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteDirectoryResponse {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteFacetRequest {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteFacetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteObjectRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteObjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSchemaRequest {
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSchemaResponse {
#[serde(rename = "SchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteTypedLinkFacetRequest {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteTypedLinkFacetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachFromIndexRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "IndexReference")]
pub index_reference: ObjectReference,
#[serde(rename = "TargetReference")]
pub target_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetachFromIndexResponse {
#[serde(rename = "DetachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachObjectRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "LinkName")]
pub link_name: String,
#[serde(rename = "ParentReference")]
pub parent_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetachObjectResponse {
#[serde(rename = "DetachedObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detached_object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachPolicyRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "PolicyReference")]
pub policy_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetachPolicyResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachTypedLinkRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "TypedLinkSpecifier")]
pub typed_link_specifier: TypedLinkSpecifier,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Directory {
#[serde(rename = "CreationDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date_time: Option<f64>,
#[serde(rename = "DirectoryArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_arn: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "State")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisableDirectoryRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisableDirectoryResponse {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct EnableDirectoryRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EnableDirectoryResponse {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Facet {
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ObjectType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FacetAttribute {
#[serde(rename = "AttributeDefinition")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_definition: Option<FacetAttributeDefinition>,
#[serde(rename = "AttributeReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_reference: Option<FacetAttributeReference>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "RequiredBehavior")]
#[serde(skip_serializing_if = "Option::is_none")]
pub required_behavior: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FacetAttributeDefinition {
#[serde(rename = "DefaultValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_value: Option<TypedAttributeValue>,
#[serde(rename = "IsImmutable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_immutable: Option<bool>,
#[serde(rename = "Rules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rules: Option<::std::collections::HashMap<String, Rule>>,
#[serde(rename = "Type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FacetAttributeReference {
#[serde(rename = "TargetAttributeName")]
pub target_attribute_name: String,
#[serde(rename = "TargetFacetName")]
pub target_facet_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct FacetAttributeUpdate {
#[serde(rename = "Action")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action: Option<String>,
#[serde(rename = "Attribute")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute: Option<FacetAttribute>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAppliedSchemaVersionRequest {
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetAppliedSchemaVersionResponse {
#[serde(rename = "AppliedSchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub applied_schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDirectoryRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDirectoryResponse {
#[serde(rename = "Directory")]
pub directory: Directory,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetFacetRequest {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetFacetResponse {
#[serde(rename = "Facet")]
#[serde(skip_serializing_if = "Option::is_none")]
pub facet: Option<Facet>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetLinkAttributesRequest {
#[serde(rename = "AttributeNames")]
pub attribute_names: Vec<String>,
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "TypedLinkSpecifier")]
pub typed_link_specifier: TypedLinkSpecifier,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetLinkAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<AttributeKeyAndValue>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetObjectAttributesRequest {
#[serde(rename = "AttributeNames")]
pub attribute_names: Vec<String>,
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "SchemaFacet")]
pub schema_facet: SchemaFacet,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetObjectAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<AttributeKeyAndValue>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetObjectInformationRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetObjectInformationResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
#[serde(rename = "SchemaFacets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_facets: Option<Vec<SchemaFacet>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSchemaAsJsonRequest {
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSchemaAsJsonResponse {
#[serde(rename = "Document")]
#[serde(skip_serializing_if = "Option::is_none")]
pub document: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetTypedLinkFacetInformationRequest {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetTypedLinkFacetInformationResponse {
#[serde(rename = "IdentityAttributeOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_attribute_order: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IndexAttachment {
#[serde(rename = "IndexedAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_attributes: Option<Vec<AttributeKeyAndValue>>,
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct LinkAttributeAction {
#[serde(rename = "AttributeActionType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_action_type: Option<String>,
#[serde(rename = "AttributeUpdateValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_update_value: Option<TypedAttributeValue>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct LinkAttributeUpdate {
#[serde(rename = "AttributeAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_action: Option<LinkAttributeAction>,
#[serde(rename = "AttributeKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_key: Option<AttributeKey>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAppliedSchemaArnsRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAppliedSchemaArnsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAttachedIndicesRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TargetReference")]
pub target_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAttachedIndicesResponse {
#[serde(rename = "IndexAttachments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_attachments: Option<Vec<IndexAttachment>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDevelopmentSchemaArnsRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListDevelopmentSchemaArnsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDirectoriesRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "state")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListDirectoriesResponse {
#[serde(rename = "Directories")]
pub directories: Vec<Directory>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListFacetAttributesRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListFacetAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<FacetAttribute>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListFacetNamesRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListFacetNamesResponse {
#[serde(rename = "FacetNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub facet_names: Option<Vec<String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListIncomingTypedLinksRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "FilterAttributeRanges")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_attribute_ranges: Option<Vec<TypedLinkAttributeRange>>,
#[serde(rename = "FilterTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_typed_link: Option<TypedLinkSchemaAndFacetName>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListIncomingTypedLinksResponse {
#[serde(rename = "LinkSpecifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub link_specifiers: Option<Vec<TypedLinkSpecifier>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListIndexRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "IndexReference")]
pub index_reference: ObjectReference,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "RangesOnIndexedValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ranges_on_indexed_values: Option<Vec<ObjectAttributeRange>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListIndexResponse {
#[serde(rename = "IndexAttachments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_attachments: Option<Vec<IndexAttachment>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListObjectAttributesRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "FacetFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub facet_filter: Option<SchemaFacet>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListObjectAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<AttributeKeyAndValue>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListObjectChildrenRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListObjectChildrenResponse {
#[serde(rename = "Children")]
#[serde(skip_serializing_if = "Option::is_none")]
pub children: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListObjectParentPathsRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListObjectParentPathsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PathToObjectIdentifiersList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path_to_object_identifiers_list: Option<Vec<PathToObjectIdentifiers>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListObjectParentsRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListObjectParentsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Parents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parents: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListObjectPoliciesRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListObjectPoliciesResponse {
#[serde(rename = "AttachedPolicyIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attached_policy_ids: Option<Vec<String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListOutgoingTypedLinksRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "FilterAttributeRanges")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_attribute_ranges: Option<Vec<TypedLinkAttributeRange>>,
#[serde(rename = "FilterTypedLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_typed_link: Option<TypedLinkSchemaAndFacetName>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListOutgoingTypedLinksResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TypedLinkSpecifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub typed_link_specifiers: Option<Vec<TypedLinkSpecifier>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPolicyAttachmentsRequest {
#[serde(rename = "ConsistencyLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub consistency_level: Option<String>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyReference")]
pub policy_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPolicyAttachmentsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectIdentifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifiers: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPublishedSchemaArnsRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPublishedSchemaArnsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arns: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsForResourceRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForResourceResponse {
#[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, Serialize)]
pub struct ListTypedLinkFacetAttributesRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTypedLinkFacetAttributesResponse {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<TypedLinkAttributeDefinition>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTypedLinkFacetNamesRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTypedLinkFacetNamesResponse {
#[serde(rename = "FacetNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub facet_names: Option<Vec<String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct LookupPolicyRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LookupPolicyResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyToPathList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_to_path_list: Option<Vec<PolicyToPath>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ObjectAttributeAction {
#[serde(rename = "ObjectAttributeActionType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_attribute_action_type: Option<String>,
#[serde(rename = "ObjectAttributeUpdateValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_attribute_update_value: Option<TypedAttributeValue>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ObjectAttributeRange {
#[serde(rename = "AttributeKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_key: Option<AttributeKey>,
#[serde(rename = "Range")]
#[serde(skip_serializing_if = "Option::is_none")]
pub range: Option<TypedAttributeValueRange>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ObjectAttributeUpdate {
#[serde(rename = "ObjectAttributeAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_attribute_action: Option<ObjectAttributeAction>,
#[serde(rename = "ObjectAttributeKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_attribute_key: Option<AttributeKey>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ObjectReference {
#[serde(rename = "Selector")]
#[serde(skip_serializing_if = "Option::is_none")]
pub selector: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PathToObjectIdentifiers {
#[serde(rename = "ObjectIdentifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifiers: Option<Vec<String>>,
#[serde(rename = "Path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PolicyAttachment {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
#[serde(rename = "PolicyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_id: Option<String>,
#[serde(rename = "PolicyType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PolicyToPath {
#[serde(rename = "Path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
#[serde(rename = "Policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<PolicyAttachment>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PublishSchemaRequest {
#[serde(rename = "DevelopmentSchemaArn")]
pub development_schema_arn: String,
#[serde(rename = "MinorVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub minor_version: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PublishSchemaResponse {
#[serde(rename = "PublishedSchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub published_schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutSchemaFromJsonRequest {
#[serde(rename = "Document")]
pub document: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutSchemaFromJsonResponse {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RemoveFacetFromObjectRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
#[serde(rename = "SchemaFacet")]
pub schema_facet: SchemaFacet,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RemoveFacetFromObjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Rule {
#[serde(rename = "Parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SchemaFacet {
#[serde(rename = "FacetName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub facet_name: Option<String>,
#[serde(rename = "SchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "Key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "Tags")]
pub tags: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TypedAttributeValue {
#[serde(rename = "BinaryValue")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub binary_value: Option<Vec<u8>>,
#[serde(rename = "BooleanValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub boolean_value: Option<bool>,
#[serde(rename = "DatetimeValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datetime_value: Option<f64>,
#[serde(rename = "NumberValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_value: Option<String>,
#[serde(rename = "StringValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub string_value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TypedAttributeValueRange {
#[serde(rename = "EndMode")]
pub end_mode: String,
#[serde(rename = "EndValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_value: Option<TypedAttributeValue>,
#[serde(rename = "StartMode")]
pub start_mode: String,
#[serde(rename = "StartValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_value: Option<TypedAttributeValue>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TypedLinkAttributeDefinition {
#[serde(rename = "DefaultValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_value: Option<TypedAttributeValue>,
#[serde(rename = "IsImmutable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_immutable: Option<bool>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "RequiredBehavior")]
pub required_behavior: String,
#[serde(rename = "Rules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rules: Option<::std::collections::HashMap<String, Rule>>,
#[serde(rename = "Type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TypedLinkAttributeRange {
#[serde(rename = "AttributeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_name: Option<String>,
#[serde(rename = "Range")]
pub range: TypedAttributeValueRange,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TypedLinkFacet {
#[serde(rename = "Attributes")]
pub attributes: Vec<TypedLinkAttributeDefinition>,
#[serde(rename = "IdentityAttributeOrder")]
pub identity_attribute_order: Vec<String>,
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TypedLinkFacetAttributeUpdate {
#[serde(rename = "Action")]
pub action: String,
#[serde(rename = "Attribute")]
pub attribute: TypedLinkAttributeDefinition,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TypedLinkSchemaAndFacetName {
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
#[serde(rename = "TypedLinkName")]
pub typed_link_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TypedLinkSpecifier {
#[serde(rename = "IdentityAttributeValues")]
pub identity_attribute_values: Vec<AttributeNameAndValue>,
#[serde(rename = "SourceObjectReference")]
pub source_object_reference: ObjectReference,
#[serde(rename = "TargetObjectReference")]
pub target_object_reference: ObjectReference,
#[serde(rename = "TypedLinkFacet")]
pub typed_link_facet: TypedLinkSchemaAndFacetName,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "TagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateFacetRequest {
#[serde(rename = "AttributeUpdates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_updates: Option<Vec<FacetAttributeUpdate>>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "ObjectType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_type: Option<String>,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateFacetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateLinkAttributesRequest {
#[serde(rename = "AttributeUpdates")]
pub attribute_updates: Vec<LinkAttributeUpdate>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "TypedLinkSpecifier")]
pub typed_link_specifier: TypedLinkSpecifier,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateLinkAttributesResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateObjectAttributesRequest {
#[serde(rename = "AttributeUpdates")]
pub attribute_updates: Vec<ObjectAttributeUpdate>,
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "ObjectReference")]
pub object_reference: ObjectReference,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateObjectAttributesResponse {
#[serde(rename = "ObjectIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub object_identifier: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateSchemaRequest {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateSchemaResponse {
#[serde(rename = "SchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateTypedLinkFacetRequest {
#[serde(rename = "AttributeUpdates")]
pub attribute_updates: Vec<TypedLinkFacetAttributeUpdate>,
#[serde(rename = "IdentityAttributeOrder")]
pub identity_attribute_order: Vec<String>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "SchemaArn")]
pub schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateTypedLinkFacetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpgradeAppliedSchemaRequest {
#[serde(rename = "DirectoryArn")]
pub directory_arn: String,
#[serde(rename = "DryRun")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dry_run: Option<bool>,
#[serde(rename = "PublishedSchemaArn")]
pub published_schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpgradeAppliedSchemaResponse {
#[serde(rename = "DirectoryArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_arn: Option<String>,
#[serde(rename = "UpgradedSchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub upgraded_schema_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpgradePublishedSchemaRequest {
#[serde(rename = "DevelopmentSchemaArn")]
pub development_schema_arn: String,
#[serde(rename = "DryRun")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dry_run: Option<bool>,
#[serde(rename = "MinorVersion")]
pub minor_version: String,
#[serde(rename = "PublishedSchemaArn")]
pub published_schema_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpgradePublishedSchemaResponse {
#[serde(rename = "UpgradedSchemaArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub upgraded_schema_arn: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum AddFacetToObjectError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AddFacetToObjectError {
pub fn from_response(res: BufferedHttpResponse) -> AddFacetToObjectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return AddFacetToObjectError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return AddFacetToObjectError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return AddFacetToObjectError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return AddFacetToObjectError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return AddFacetToObjectError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return AddFacetToObjectError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return AddFacetToObjectError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return AddFacetToObjectError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return AddFacetToObjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return AddFacetToObjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AddFacetToObjectError {
fn from(err: serde_json::error::Error) -> AddFacetToObjectError {
AddFacetToObjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AddFacetToObjectError {
fn from(err: CredentialsError) -> AddFacetToObjectError {
AddFacetToObjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for AddFacetToObjectError {
fn from(err: HttpDispatchError) -> AddFacetToObjectError {
AddFacetToObjectError::HttpDispatch(err)
}
}
impl From<io::Error> for AddFacetToObjectError {
fn from(err: io::Error) -> AddFacetToObjectError {
AddFacetToObjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AddFacetToObjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AddFacetToObjectError {
fn description(&self) -> &str {
match *self {
AddFacetToObjectError::AccessDenied(ref cause) => cause,
AddFacetToObjectError::DirectoryNotEnabled(ref cause) => cause,
AddFacetToObjectError::FacetValidation(ref cause) => cause,
AddFacetToObjectError::InternalService(ref cause) => cause,
AddFacetToObjectError::InvalidArn(ref cause) => cause,
AddFacetToObjectError::LimitExceeded(ref cause) => cause,
AddFacetToObjectError::ResourceNotFound(ref cause) => cause,
AddFacetToObjectError::RetryableConflict(ref cause) => cause,
AddFacetToObjectError::Validation(ref cause) => cause,
AddFacetToObjectError::Credentials(ref err) => err.description(),
AddFacetToObjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AddFacetToObjectError::ParseError(ref cause) => cause,
AddFacetToObjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ApplySchemaError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidAttachment(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ApplySchemaError {
pub fn from_response(res: BufferedHttpResponse) -> ApplySchemaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ApplySchemaError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ApplySchemaError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ApplySchemaError::InvalidArn(String::from(error_message));
}
"InvalidAttachmentException" => {
return ApplySchemaError::InvalidAttachment(String::from(error_message));
}
"LimitExceededException" => {
return ApplySchemaError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ApplySchemaError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ApplySchemaError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ApplySchemaError::Validation(error_message.to_string());
}
_ => {}
}
}
return ApplySchemaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ApplySchemaError {
fn from(err: serde_json::error::Error) -> ApplySchemaError {
ApplySchemaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ApplySchemaError {
fn from(err: CredentialsError) -> ApplySchemaError {
ApplySchemaError::Credentials(err)
}
}
impl From<HttpDispatchError> for ApplySchemaError {
fn from(err: HttpDispatchError) -> ApplySchemaError {
ApplySchemaError::HttpDispatch(err)
}
}
impl From<io::Error> for ApplySchemaError {
fn from(err: io::Error) -> ApplySchemaError {
ApplySchemaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ApplySchemaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ApplySchemaError {
fn description(&self) -> &str {
match *self {
ApplySchemaError::AccessDenied(ref cause) => cause,
ApplySchemaError::InternalService(ref cause) => cause,
ApplySchemaError::InvalidArn(ref cause) => cause,
ApplySchemaError::InvalidAttachment(ref cause) => cause,
ApplySchemaError::LimitExceeded(ref cause) => cause,
ApplySchemaError::ResourceNotFound(ref cause) => cause,
ApplySchemaError::RetryableConflict(ref cause) => cause,
ApplySchemaError::Validation(ref cause) => cause,
ApplySchemaError::Credentials(ref err) => err.description(),
ApplySchemaError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ApplySchemaError::ParseError(ref cause) => cause,
ApplySchemaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachObjectError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidAttachment(String),
LimitExceeded(String),
LinkNameAlreadyInUse(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachObjectError {
pub fn from_response(res: BufferedHttpResponse) -> AttachObjectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return AttachObjectError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return AttachObjectError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return AttachObjectError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return AttachObjectError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return AttachObjectError::InvalidArn(String::from(error_message));
}
"InvalidAttachmentException" => {
return AttachObjectError::InvalidAttachment(String::from(error_message));
}
"LimitExceededException" => {
return AttachObjectError::LimitExceeded(String::from(error_message));
}
"LinkNameAlreadyInUseException" => {
return AttachObjectError::LinkNameAlreadyInUse(String::from(error_message));
}
"ResourceNotFoundException" => {
return AttachObjectError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return AttachObjectError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return AttachObjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return AttachObjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachObjectError {
fn from(err: serde_json::error::Error) -> AttachObjectError {
AttachObjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachObjectError {
fn from(err: CredentialsError) -> AttachObjectError {
AttachObjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachObjectError {
fn from(err: HttpDispatchError) -> AttachObjectError {
AttachObjectError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachObjectError {
fn from(err: io::Error) -> AttachObjectError {
AttachObjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachObjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachObjectError {
fn description(&self) -> &str {
match *self {
AttachObjectError::AccessDenied(ref cause) => cause,
AttachObjectError::DirectoryNotEnabled(ref cause) => cause,
AttachObjectError::FacetValidation(ref cause) => cause,
AttachObjectError::InternalService(ref cause) => cause,
AttachObjectError::InvalidArn(ref cause) => cause,
AttachObjectError::InvalidAttachment(ref cause) => cause,
AttachObjectError::LimitExceeded(ref cause) => cause,
AttachObjectError::LinkNameAlreadyInUse(ref cause) => cause,
AttachObjectError::ResourceNotFound(ref cause) => cause,
AttachObjectError::RetryableConflict(ref cause) => cause,
AttachObjectError::Validation(ref cause) => cause,
AttachObjectError::Credentials(ref err) => err.description(),
AttachObjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AttachObjectError::ParseError(ref cause) => cause,
AttachObjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachPolicyError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
NotPolicy(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> AttachPolicyError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return AttachPolicyError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return AttachPolicyError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return AttachPolicyError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return AttachPolicyError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return AttachPolicyError::LimitExceeded(String::from(error_message));
}
"NotPolicyException" => {
return AttachPolicyError::NotPolicy(String::from(error_message));
}
"ResourceNotFoundException" => {
return AttachPolicyError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return AttachPolicyError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return AttachPolicyError::Validation(error_message.to_string());
}
_ => {}
}
}
return AttachPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachPolicyError {
fn from(err: serde_json::error::Error) -> AttachPolicyError {
AttachPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachPolicyError {
fn from(err: CredentialsError) -> AttachPolicyError {
AttachPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachPolicyError {
fn from(err: HttpDispatchError) -> AttachPolicyError {
AttachPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachPolicyError {
fn from(err: io::Error) -> AttachPolicyError {
AttachPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachPolicyError {
fn description(&self) -> &str {
match *self {
AttachPolicyError::AccessDenied(ref cause) => cause,
AttachPolicyError::DirectoryNotEnabled(ref cause) => cause,
AttachPolicyError::InternalService(ref cause) => cause,
AttachPolicyError::InvalidArn(ref cause) => cause,
AttachPolicyError::LimitExceeded(ref cause) => cause,
AttachPolicyError::NotPolicy(ref cause) => cause,
AttachPolicyError::ResourceNotFound(ref cause) => cause,
AttachPolicyError::RetryableConflict(ref cause) => cause,
AttachPolicyError::Validation(ref cause) => cause,
AttachPolicyError::Credentials(ref err) => err.description(),
AttachPolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AttachPolicyError::ParseError(ref cause) => cause,
AttachPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachToIndexError {
AccessDenied(String),
DirectoryNotEnabled(String),
IndexedAttributeMissing(String),
InternalService(String),
InvalidArn(String),
InvalidAttachment(String),
LimitExceeded(String),
LinkNameAlreadyInUse(String),
NotIndex(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachToIndexError {
pub fn from_response(res: BufferedHttpResponse) -> AttachToIndexError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return AttachToIndexError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return AttachToIndexError::DirectoryNotEnabled(String::from(error_message));
}
"IndexedAttributeMissingException" => {
return AttachToIndexError::IndexedAttributeMissing(String::from(error_message));
}
"InternalServiceException" => {
return AttachToIndexError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return AttachToIndexError::InvalidArn(String::from(error_message));
}
"InvalidAttachmentException" => {
return AttachToIndexError::InvalidAttachment(String::from(error_message));
}
"LimitExceededException" => {
return AttachToIndexError::LimitExceeded(String::from(error_message));
}
"LinkNameAlreadyInUseException" => {
return AttachToIndexError::LinkNameAlreadyInUse(String::from(error_message));
}
"NotIndexException" => {
return AttachToIndexError::NotIndex(String::from(error_message));
}
"ResourceNotFoundException" => {
return AttachToIndexError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return AttachToIndexError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return AttachToIndexError::Validation(error_message.to_string());
}
_ => {}
}
}
return AttachToIndexError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachToIndexError {
fn from(err: serde_json::error::Error) -> AttachToIndexError {
AttachToIndexError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachToIndexError {
fn from(err: CredentialsError) -> AttachToIndexError {
AttachToIndexError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachToIndexError {
fn from(err: HttpDispatchError) -> AttachToIndexError {
AttachToIndexError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachToIndexError {
fn from(err: io::Error) -> AttachToIndexError {
AttachToIndexError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachToIndexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachToIndexError {
fn description(&self) -> &str {
match *self {
AttachToIndexError::AccessDenied(ref cause) => cause,
AttachToIndexError::DirectoryNotEnabled(ref cause) => cause,
AttachToIndexError::IndexedAttributeMissing(ref cause) => cause,
AttachToIndexError::InternalService(ref cause) => cause,
AttachToIndexError::InvalidArn(ref cause) => cause,
AttachToIndexError::InvalidAttachment(ref cause) => cause,
AttachToIndexError::LimitExceeded(ref cause) => cause,
AttachToIndexError::LinkNameAlreadyInUse(ref cause) => cause,
AttachToIndexError::NotIndex(ref cause) => cause,
AttachToIndexError::ResourceNotFound(ref cause) => cause,
AttachToIndexError::RetryableConflict(ref cause) => cause,
AttachToIndexError::Validation(ref cause) => cause,
AttachToIndexError::Credentials(ref err) => err.description(),
AttachToIndexError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AttachToIndexError::ParseError(ref cause) => cause,
AttachToIndexError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachTypedLinkError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidAttachment(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachTypedLinkError {
pub fn from_response(res: BufferedHttpResponse) -> AttachTypedLinkError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return AttachTypedLinkError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return AttachTypedLinkError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return AttachTypedLinkError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return AttachTypedLinkError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return AttachTypedLinkError::InvalidArn(String::from(error_message));
}
"InvalidAttachmentException" => {
return AttachTypedLinkError::InvalidAttachment(String::from(error_message));
}
"LimitExceededException" => {
return AttachTypedLinkError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return AttachTypedLinkError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return AttachTypedLinkError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return AttachTypedLinkError::Validation(error_message.to_string());
}
_ => {}
}
}
return AttachTypedLinkError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachTypedLinkError {
fn from(err: serde_json::error::Error) -> AttachTypedLinkError {
AttachTypedLinkError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachTypedLinkError {
fn from(err: CredentialsError) -> AttachTypedLinkError {
AttachTypedLinkError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachTypedLinkError {
fn from(err: HttpDispatchError) -> AttachTypedLinkError {
AttachTypedLinkError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachTypedLinkError {
fn from(err: io::Error) -> AttachTypedLinkError {
AttachTypedLinkError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachTypedLinkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachTypedLinkError {
fn description(&self) -> &str {
match *self {
AttachTypedLinkError::AccessDenied(ref cause) => cause,
AttachTypedLinkError::DirectoryNotEnabled(ref cause) => cause,
AttachTypedLinkError::FacetValidation(ref cause) => cause,
AttachTypedLinkError::InternalService(ref cause) => cause,
AttachTypedLinkError::InvalidArn(ref cause) => cause,
AttachTypedLinkError::InvalidAttachment(ref cause) => cause,
AttachTypedLinkError::LimitExceeded(ref cause) => cause,
AttachTypedLinkError::ResourceNotFound(ref cause) => cause,
AttachTypedLinkError::RetryableConflict(ref cause) => cause,
AttachTypedLinkError::Validation(ref cause) => cause,
AttachTypedLinkError::Credentials(ref err) => err.description(),
AttachTypedLinkError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AttachTypedLinkError::ParseError(ref cause) => cause,
AttachTypedLinkError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum BatchReadError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl BatchReadError {
pub fn from_response(res: BufferedHttpResponse) -> BatchReadError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return BatchReadError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return BatchReadError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return BatchReadError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return BatchReadError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return BatchReadError::LimitExceeded(String::from(error_message));
}
"RetryableConflictException" => {
return BatchReadError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return BatchReadError::Validation(error_message.to_string());
}
_ => {}
}
}
return BatchReadError::Unknown(res);
}
}
impl From<serde_json::error::Error> for BatchReadError {
fn from(err: serde_json::error::Error) -> BatchReadError {
BatchReadError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for BatchReadError {
fn from(err: CredentialsError) -> BatchReadError {
BatchReadError::Credentials(err)
}
}
impl From<HttpDispatchError> for BatchReadError {
fn from(err: HttpDispatchError) -> BatchReadError {
BatchReadError::HttpDispatch(err)
}
}
impl From<io::Error> for BatchReadError {
fn from(err: io::Error) -> BatchReadError {
BatchReadError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for BatchReadError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BatchReadError {
fn description(&self) -> &str {
match *self {
BatchReadError::AccessDenied(ref cause) => cause,
BatchReadError::DirectoryNotEnabled(ref cause) => cause,
BatchReadError::InternalService(ref cause) => cause,
BatchReadError::InvalidArn(ref cause) => cause,
BatchReadError::LimitExceeded(ref cause) => cause,
BatchReadError::RetryableConflict(ref cause) => cause,
BatchReadError::Validation(ref cause) => cause,
BatchReadError::Credentials(ref err) => err.description(),
BatchReadError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
BatchReadError::ParseError(ref cause) => cause,
BatchReadError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum BatchWriteError {
AccessDenied(String),
BatchWrite(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl BatchWriteError {
pub fn from_response(res: BufferedHttpResponse) -> BatchWriteError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return BatchWriteError::AccessDenied(String::from(error_message));
}
"BatchWriteException" => {
return BatchWriteError::BatchWrite(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return BatchWriteError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return BatchWriteError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return BatchWriteError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return BatchWriteError::LimitExceeded(String::from(error_message));
}
"RetryableConflictException" => {
return BatchWriteError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return BatchWriteError::Validation(error_message.to_string());
}
_ => {}
}
}
return BatchWriteError::Unknown(res);
}
}
impl From<serde_json::error::Error> for BatchWriteError {
fn from(err: serde_json::error::Error) -> BatchWriteError {
BatchWriteError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for BatchWriteError {
fn from(err: CredentialsError) -> BatchWriteError {
BatchWriteError::Credentials(err)
}
}
impl From<HttpDispatchError> for BatchWriteError {
fn from(err: HttpDispatchError) -> BatchWriteError {
BatchWriteError::HttpDispatch(err)
}
}
impl From<io::Error> for BatchWriteError {
fn from(err: io::Error) -> BatchWriteError {
BatchWriteError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for BatchWriteError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BatchWriteError {
fn description(&self) -> &str {
match *self {
BatchWriteError::AccessDenied(ref cause) => cause,
BatchWriteError::BatchWrite(ref cause) => cause,
BatchWriteError::DirectoryNotEnabled(ref cause) => cause,
BatchWriteError::InternalService(ref cause) => cause,
BatchWriteError::InvalidArn(ref cause) => cause,
BatchWriteError::LimitExceeded(ref cause) => cause,
BatchWriteError::RetryableConflict(ref cause) => cause,
BatchWriteError::Validation(ref cause) => cause,
BatchWriteError::Credentials(ref err) => err.description(),
BatchWriteError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
BatchWriteError::ParseError(ref cause) => cause,
BatchWriteError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDirectoryError {
AccessDenied(String),
DirectoryAlreadyExists(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(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 error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return CreateDirectoryError::AccessDenied(String::from(error_message));
}
"DirectoryAlreadyExistsException" => {
return CreateDirectoryError::DirectoryAlreadyExists(String::from(error_message));
}
"InternalServiceException" => {
return CreateDirectoryError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return CreateDirectoryError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return CreateDirectoryError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateDirectoryError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return CreateDirectoryError::RetryableConflict(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::AccessDenied(ref cause) => cause,
CreateDirectoryError::DirectoryAlreadyExists(ref cause) => cause,
CreateDirectoryError::InternalService(ref cause) => cause,
CreateDirectoryError::InvalidArn(ref cause) => cause,
CreateDirectoryError::LimitExceeded(ref cause) => cause,
CreateDirectoryError::ResourceNotFound(ref cause) => cause,
CreateDirectoryError::RetryableConflict(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 CreateFacetError {
AccessDenied(String),
FacetAlreadyExists(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidRule(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateFacetError {
pub fn from_response(res: BufferedHttpResponse) -> CreateFacetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return CreateFacetError::AccessDenied(String::from(error_message));
}
"FacetAlreadyExistsException" => {
return CreateFacetError::FacetAlreadyExists(String::from(error_message));
}
"FacetValidationException" => {
return CreateFacetError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return CreateFacetError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return CreateFacetError::InvalidArn(String::from(error_message));
}
"InvalidRuleException" => {
return CreateFacetError::InvalidRule(String::from(error_message));
}
"LimitExceededException" => {
return CreateFacetError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateFacetError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return CreateFacetError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return CreateFacetError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateFacetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateFacetError {
fn from(err: serde_json::error::Error) -> CreateFacetError {
CreateFacetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateFacetError {
fn from(err: CredentialsError) -> CreateFacetError {
CreateFacetError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateFacetError {
fn from(err: HttpDispatchError) -> CreateFacetError {
CreateFacetError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateFacetError {
fn from(err: io::Error) -> CreateFacetError {
CreateFacetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateFacetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateFacetError {
fn description(&self) -> &str {
match *self {
CreateFacetError::AccessDenied(ref cause) => cause,
CreateFacetError::FacetAlreadyExists(ref cause) => cause,
CreateFacetError::FacetValidation(ref cause) => cause,
CreateFacetError::InternalService(ref cause) => cause,
CreateFacetError::InvalidArn(ref cause) => cause,
CreateFacetError::InvalidRule(ref cause) => cause,
CreateFacetError::LimitExceeded(ref cause) => cause,
CreateFacetError::ResourceNotFound(ref cause) => cause,
CreateFacetError::RetryableConflict(ref cause) => cause,
CreateFacetError::Validation(ref cause) => cause,
CreateFacetError::Credentials(ref err) => err.description(),
CreateFacetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateFacetError::ParseError(ref cause) => cause,
CreateFacetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateIndexError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
LinkNameAlreadyInUse(String),
ResourceNotFound(String),
RetryableConflict(String),
UnsupportedIndexType(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateIndexError {
pub fn from_response(res: BufferedHttpResponse) -> CreateIndexError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return CreateIndexError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return CreateIndexError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return CreateIndexError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return CreateIndexError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return CreateIndexError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return CreateIndexError::LimitExceeded(String::from(error_message));
}
"LinkNameAlreadyInUseException" => {
return CreateIndexError::LinkNameAlreadyInUse(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateIndexError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return CreateIndexError::RetryableConflict(String::from(error_message));
}
"UnsupportedIndexTypeException" => {
return CreateIndexError::UnsupportedIndexType(String::from(error_message));
}
"ValidationException" => {
return CreateIndexError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateIndexError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateIndexError {
fn from(err: serde_json::error::Error) -> CreateIndexError {
CreateIndexError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateIndexError {
fn from(err: CredentialsError) -> CreateIndexError {
CreateIndexError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateIndexError {
fn from(err: HttpDispatchError) -> CreateIndexError {
CreateIndexError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateIndexError {
fn from(err: io::Error) -> CreateIndexError {
CreateIndexError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateIndexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateIndexError {
fn description(&self) -> &str {
match *self {
CreateIndexError::AccessDenied(ref cause) => cause,
CreateIndexError::DirectoryNotEnabled(ref cause) => cause,
CreateIndexError::FacetValidation(ref cause) => cause,
CreateIndexError::InternalService(ref cause) => cause,
CreateIndexError::InvalidArn(ref cause) => cause,
CreateIndexError::LimitExceeded(ref cause) => cause,
CreateIndexError::LinkNameAlreadyInUse(ref cause) => cause,
CreateIndexError::ResourceNotFound(ref cause) => cause,
CreateIndexError::RetryableConflict(ref cause) => cause,
CreateIndexError::UnsupportedIndexType(ref cause) => cause,
CreateIndexError::Validation(ref cause) => cause,
CreateIndexError::Credentials(ref err) => err.description(),
CreateIndexError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateIndexError::ParseError(ref cause) => cause,
CreateIndexError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateObjectError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
LinkNameAlreadyInUse(String),
ResourceNotFound(String),
RetryableConflict(String),
UnsupportedIndexType(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateObjectError {
pub fn from_response(res: BufferedHttpResponse) -> CreateObjectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return CreateObjectError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return CreateObjectError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return CreateObjectError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return CreateObjectError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return CreateObjectError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return CreateObjectError::LimitExceeded(String::from(error_message));
}
"LinkNameAlreadyInUseException" => {
return CreateObjectError::LinkNameAlreadyInUse(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateObjectError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return CreateObjectError::RetryableConflict(String::from(error_message));
}
"UnsupportedIndexTypeException" => {
return CreateObjectError::UnsupportedIndexType(String::from(error_message));
}
"ValidationException" => {
return CreateObjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateObjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateObjectError {
fn from(err: serde_json::error::Error) -> CreateObjectError {
CreateObjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateObjectError {
fn from(err: CredentialsError) -> CreateObjectError {
CreateObjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateObjectError {
fn from(err: HttpDispatchError) -> CreateObjectError {
CreateObjectError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateObjectError {
fn from(err: io::Error) -> CreateObjectError {
CreateObjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateObjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateObjectError {
fn description(&self) -> &str {
match *self {
CreateObjectError::AccessDenied(ref cause) => cause,
CreateObjectError::DirectoryNotEnabled(ref cause) => cause,
CreateObjectError::FacetValidation(ref cause) => cause,
CreateObjectError::InternalService(ref cause) => cause,
CreateObjectError::InvalidArn(ref cause) => cause,
CreateObjectError::LimitExceeded(ref cause) => cause,
CreateObjectError::LinkNameAlreadyInUse(ref cause) => cause,
CreateObjectError::ResourceNotFound(ref cause) => cause,
CreateObjectError::RetryableConflict(ref cause) => cause,
CreateObjectError::UnsupportedIndexType(ref cause) => cause,
CreateObjectError::Validation(ref cause) => cause,
CreateObjectError::Credentials(ref err) => err.description(),
CreateObjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateObjectError::ParseError(ref cause) => cause,
CreateObjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSchemaError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
RetryableConflict(String),
SchemaAlreadyExists(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateSchemaError {
pub fn from_response(res: BufferedHttpResponse) -> CreateSchemaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return CreateSchemaError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return CreateSchemaError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return CreateSchemaError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return CreateSchemaError::LimitExceeded(String::from(error_message));
}
"RetryableConflictException" => {
return CreateSchemaError::RetryableConflict(String::from(error_message));
}
"SchemaAlreadyExistsException" => {
return CreateSchemaError::SchemaAlreadyExists(String::from(error_message));
}
"ValidationException" => {
return CreateSchemaError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateSchemaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateSchemaError {
fn from(err: serde_json::error::Error) -> CreateSchemaError {
CreateSchemaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateSchemaError {
fn from(err: CredentialsError) -> CreateSchemaError {
CreateSchemaError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateSchemaError {
fn from(err: HttpDispatchError) -> CreateSchemaError {
CreateSchemaError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateSchemaError {
fn from(err: io::Error) -> CreateSchemaError {
CreateSchemaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateSchemaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSchemaError {
fn description(&self) -> &str {
match *self {
CreateSchemaError::AccessDenied(ref cause) => cause,
CreateSchemaError::InternalService(ref cause) => cause,
CreateSchemaError::InvalidArn(ref cause) => cause,
CreateSchemaError::LimitExceeded(ref cause) => cause,
CreateSchemaError::RetryableConflict(ref cause) => cause,
CreateSchemaError::SchemaAlreadyExists(ref cause) => cause,
CreateSchemaError::Validation(ref cause) => cause,
CreateSchemaError::Credentials(ref err) => err.description(),
CreateSchemaError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateSchemaError::ParseError(ref cause) => cause,
CreateSchemaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateTypedLinkFacetError {
AccessDenied(String),
FacetAlreadyExists(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidRule(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateTypedLinkFacetError {
pub fn from_response(res: BufferedHttpResponse) -> CreateTypedLinkFacetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return CreateTypedLinkFacetError::AccessDenied(String::from(error_message));
}
"FacetAlreadyExistsException" => {
return CreateTypedLinkFacetError::FacetAlreadyExists(String::from(
error_message,
));
}
"FacetValidationException" => {
return CreateTypedLinkFacetError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return CreateTypedLinkFacetError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return CreateTypedLinkFacetError::InvalidArn(String::from(error_message));
}
"InvalidRuleException" => {
return CreateTypedLinkFacetError::InvalidRule(String::from(error_message));
}
"LimitExceededException" => {
return CreateTypedLinkFacetError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateTypedLinkFacetError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return CreateTypedLinkFacetError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return CreateTypedLinkFacetError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateTypedLinkFacetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateTypedLinkFacetError {
fn from(err: serde_json::error::Error) -> CreateTypedLinkFacetError {
CreateTypedLinkFacetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateTypedLinkFacetError {
fn from(err: CredentialsError) -> CreateTypedLinkFacetError {
CreateTypedLinkFacetError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateTypedLinkFacetError {
fn from(err: HttpDispatchError) -> CreateTypedLinkFacetError {
CreateTypedLinkFacetError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateTypedLinkFacetError {
fn from(err: io::Error) -> CreateTypedLinkFacetError {
CreateTypedLinkFacetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateTypedLinkFacetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateTypedLinkFacetError {
fn description(&self) -> &str {
match *self {
CreateTypedLinkFacetError::AccessDenied(ref cause) => cause,
CreateTypedLinkFacetError::FacetAlreadyExists(ref cause) => cause,
CreateTypedLinkFacetError::FacetValidation(ref cause) => cause,
CreateTypedLinkFacetError::InternalService(ref cause) => cause,
CreateTypedLinkFacetError::InvalidArn(ref cause) => cause,
CreateTypedLinkFacetError::InvalidRule(ref cause) => cause,
CreateTypedLinkFacetError::LimitExceeded(ref cause) => cause,
CreateTypedLinkFacetError::ResourceNotFound(ref cause) => cause,
CreateTypedLinkFacetError::RetryableConflict(ref cause) => cause,
CreateTypedLinkFacetError::Validation(ref cause) => cause,
CreateTypedLinkFacetError::Credentials(ref err) => err.description(),
CreateTypedLinkFacetError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateTypedLinkFacetError::ParseError(ref cause) => cause,
CreateTypedLinkFacetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDirectoryError {
AccessDenied(String),
DirectoryDeleted(String),
DirectoryNotDisabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(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 error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DeleteDirectoryError::AccessDenied(String::from(error_message));
}
"DirectoryDeletedException" => {
return DeleteDirectoryError::DirectoryDeleted(String::from(error_message));
}
"DirectoryNotDisabledException" => {
return DeleteDirectoryError::DirectoryNotDisabled(String::from(error_message));
}
"InternalServiceException" => {
return DeleteDirectoryError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DeleteDirectoryError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DeleteDirectoryError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteDirectoryError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DeleteDirectoryError::RetryableConflict(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::AccessDenied(ref cause) => cause,
DeleteDirectoryError::DirectoryDeleted(ref cause) => cause,
DeleteDirectoryError::DirectoryNotDisabled(ref cause) => cause,
DeleteDirectoryError::InternalService(ref cause) => cause,
DeleteDirectoryError::InvalidArn(ref cause) => cause,
DeleteDirectoryError::LimitExceeded(ref cause) => cause,
DeleteDirectoryError::ResourceNotFound(ref cause) => cause,
DeleteDirectoryError::RetryableConflict(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 DeleteFacetError {
AccessDenied(String),
FacetInUse(String),
FacetNotFound(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteFacetError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteFacetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DeleteFacetError::AccessDenied(String::from(error_message));
}
"FacetInUseException" => {
return DeleteFacetError::FacetInUse(String::from(error_message));
}
"FacetNotFoundException" => {
return DeleteFacetError::FacetNotFound(String::from(error_message));
}
"InternalServiceException" => {
return DeleteFacetError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DeleteFacetError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DeleteFacetError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteFacetError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DeleteFacetError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DeleteFacetError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteFacetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteFacetError {
fn from(err: serde_json::error::Error) -> DeleteFacetError {
DeleteFacetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteFacetError {
fn from(err: CredentialsError) -> DeleteFacetError {
DeleteFacetError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteFacetError {
fn from(err: HttpDispatchError) -> DeleteFacetError {
DeleteFacetError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteFacetError {
fn from(err: io::Error) -> DeleteFacetError {
DeleteFacetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteFacetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteFacetError {
fn description(&self) -> &str {
match *self {
DeleteFacetError::AccessDenied(ref cause) => cause,
DeleteFacetError::FacetInUse(ref cause) => cause,
DeleteFacetError::FacetNotFound(ref cause) => cause,
DeleteFacetError::InternalService(ref cause) => cause,
DeleteFacetError::InvalidArn(ref cause) => cause,
DeleteFacetError::LimitExceeded(ref cause) => cause,
DeleteFacetError::ResourceNotFound(ref cause) => cause,
DeleteFacetError::RetryableConflict(ref cause) => cause,
DeleteFacetError::Validation(ref cause) => cause,
DeleteFacetError::Credentials(ref err) => err.description(),
DeleteFacetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteFacetError::ParseError(ref cause) => cause,
DeleteFacetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteObjectError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ObjectNotDetached(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteObjectError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteObjectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DeleteObjectError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return DeleteObjectError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return DeleteObjectError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DeleteObjectError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DeleteObjectError::LimitExceeded(String::from(error_message));
}
"ObjectNotDetachedException" => {
return DeleteObjectError::ObjectNotDetached(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteObjectError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DeleteObjectError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DeleteObjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteObjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteObjectError {
fn from(err: serde_json::error::Error) -> DeleteObjectError {
DeleteObjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteObjectError {
fn from(err: CredentialsError) -> DeleteObjectError {
DeleteObjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteObjectError {
fn from(err: HttpDispatchError) -> DeleteObjectError {
DeleteObjectError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteObjectError {
fn from(err: io::Error) -> DeleteObjectError {
DeleteObjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteObjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteObjectError {
fn description(&self) -> &str {
match *self {
DeleteObjectError::AccessDenied(ref cause) => cause,
DeleteObjectError::DirectoryNotEnabled(ref cause) => cause,
DeleteObjectError::InternalService(ref cause) => cause,
DeleteObjectError::InvalidArn(ref cause) => cause,
DeleteObjectError::LimitExceeded(ref cause) => cause,
DeleteObjectError::ObjectNotDetached(ref cause) => cause,
DeleteObjectError::ResourceNotFound(ref cause) => cause,
DeleteObjectError::RetryableConflict(ref cause) => cause,
DeleteObjectError::Validation(ref cause) => cause,
DeleteObjectError::Credentials(ref err) => err.description(),
DeleteObjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteObjectError::ParseError(ref cause) => cause,
DeleteObjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSchemaError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
StillContainsLinks(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSchemaError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSchemaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DeleteSchemaError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return DeleteSchemaError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DeleteSchemaError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DeleteSchemaError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteSchemaError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DeleteSchemaError::RetryableConflict(String::from(error_message));
}
"StillContainsLinksException" => {
return DeleteSchemaError::StillContainsLinks(String::from(error_message));
}
"ValidationException" => {
return DeleteSchemaError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteSchemaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSchemaError {
fn from(err: serde_json::error::Error) -> DeleteSchemaError {
DeleteSchemaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSchemaError {
fn from(err: CredentialsError) -> DeleteSchemaError {
DeleteSchemaError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSchemaError {
fn from(err: HttpDispatchError) -> DeleteSchemaError {
DeleteSchemaError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSchemaError {
fn from(err: io::Error) -> DeleteSchemaError {
DeleteSchemaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSchemaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSchemaError {
fn description(&self) -> &str {
match *self {
DeleteSchemaError::AccessDenied(ref cause) => cause,
DeleteSchemaError::InternalService(ref cause) => cause,
DeleteSchemaError::InvalidArn(ref cause) => cause,
DeleteSchemaError::LimitExceeded(ref cause) => cause,
DeleteSchemaError::ResourceNotFound(ref cause) => cause,
DeleteSchemaError::RetryableConflict(ref cause) => cause,
DeleteSchemaError::StillContainsLinks(ref cause) => cause,
DeleteSchemaError::Validation(ref cause) => cause,
DeleteSchemaError::Credentials(ref err) => err.description(),
DeleteSchemaError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteSchemaError::ParseError(ref cause) => cause,
DeleteSchemaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteTypedLinkFacetError {
AccessDenied(String),
FacetNotFound(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteTypedLinkFacetError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteTypedLinkFacetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DeleteTypedLinkFacetError::AccessDenied(String::from(error_message));
}
"FacetNotFoundException" => {
return DeleteTypedLinkFacetError::FacetNotFound(String::from(error_message));
}
"InternalServiceException" => {
return DeleteTypedLinkFacetError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DeleteTypedLinkFacetError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DeleteTypedLinkFacetError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteTypedLinkFacetError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DeleteTypedLinkFacetError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DeleteTypedLinkFacetError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteTypedLinkFacetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteTypedLinkFacetError {
fn from(err: serde_json::error::Error) -> DeleteTypedLinkFacetError {
DeleteTypedLinkFacetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteTypedLinkFacetError {
fn from(err: CredentialsError) -> DeleteTypedLinkFacetError {
DeleteTypedLinkFacetError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteTypedLinkFacetError {
fn from(err: HttpDispatchError) -> DeleteTypedLinkFacetError {
DeleteTypedLinkFacetError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteTypedLinkFacetError {
fn from(err: io::Error) -> DeleteTypedLinkFacetError {
DeleteTypedLinkFacetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteTypedLinkFacetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteTypedLinkFacetError {
fn description(&self) -> &str {
match *self {
DeleteTypedLinkFacetError::AccessDenied(ref cause) => cause,
DeleteTypedLinkFacetError::FacetNotFound(ref cause) => cause,
DeleteTypedLinkFacetError::InternalService(ref cause) => cause,
DeleteTypedLinkFacetError::InvalidArn(ref cause) => cause,
DeleteTypedLinkFacetError::LimitExceeded(ref cause) => cause,
DeleteTypedLinkFacetError::ResourceNotFound(ref cause) => cause,
DeleteTypedLinkFacetError::RetryableConflict(ref cause) => cause,
DeleteTypedLinkFacetError::Validation(ref cause) => cause,
DeleteTypedLinkFacetError::Credentials(ref err) => err.description(),
DeleteTypedLinkFacetError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteTypedLinkFacetError::ParseError(ref cause) => cause,
DeleteTypedLinkFacetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachFromIndexError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
NotIndex(String),
ObjectAlreadyDetached(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachFromIndexError {
pub fn from_response(res: BufferedHttpResponse) -> DetachFromIndexError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DetachFromIndexError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return DetachFromIndexError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return DetachFromIndexError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DetachFromIndexError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DetachFromIndexError::LimitExceeded(String::from(error_message));
}
"NotIndexException" => {
return DetachFromIndexError::NotIndex(String::from(error_message));
}
"ObjectAlreadyDetachedException" => {
return DetachFromIndexError::ObjectAlreadyDetached(String::from(error_message));
}
"ResourceNotFoundException" => {
return DetachFromIndexError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DetachFromIndexError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DetachFromIndexError::Validation(error_message.to_string());
}
_ => {}
}
}
return DetachFromIndexError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachFromIndexError {
fn from(err: serde_json::error::Error) -> DetachFromIndexError {
DetachFromIndexError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachFromIndexError {
fn from(err: CredentialsError) -> DetachFromIndexError {
DetachFromIndexError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachFromIndexError {
fn from(err: HttpDispatchError) -> DetachFromIndexError {
DetachFromIndexError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachFromIndexError {
fn from(err: io::Error) -> DetachFromIndexError {
DetachFromIndexError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachFromIndexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachFromIndexError {
fn description(&self) -> &str {
match *self {
DetachFromIndexError::AccessDenied(ref cause) => cause,
DetachFromIndexError::DirectoryNotEnabled(ref cause) => cause,
DetachFromIndexError::InternalService(ref cause) => cause,
DetachFromIndexError::InvalidArn(ref cause) => cause,
DetachFromIndexError::LimitExceeded(ref cause) => cause,
DetachFromIndexError::NotIndex(ref cause) => cause,
DetachFromIndexError::ObjectAlreadyDetached(ref cause) => cause,
DetachFromIndexError::ResourceNotFound(ref cause) => cause,
DetachFromIndexError::RetryableConflict(ref cause) => cause,
DetachFromIndexError::Validation(ref cause) => cause,
DetachFromIndexError::Credentials(ref err) => err.description(),
DetachFromIndexError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetachFromIndexError::ParseError(ref cause) => cause,
DetachFromIndexError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachObjectError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
NotNode(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachObjectError {
pub fn from_response(res: BufferedHttpResponse) -> DetachObjectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DetachObjectError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return DetachObjectError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return DetachObjectError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DetachObjectError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DetachObjectError::LimitExceeded(String::from(error_message));
}
"NotNodeException" => {
return DetachObjectError::NotNode(String::from(error_message));
}
"ResourceNotFoundException" => {
return DetachObjectError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DetachObjectError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DetachObjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return DetachObjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachObjectError {
fn from(err: serde_json::error::Error) -> DetachObjectError {
DetachObjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachObjectError {
fn from(err: CredentialsError) -> DetachObjectError {
DetachObjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachObjectError {
fn from(err: HttpDispatchError) -> DetachObjectError {
DetachObjectError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachObjectError {
fn from(err: io::Error) -> DetachObjectError {
DetachObjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachObjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachObjectError {
fn description(&self) -> &str {
match *self {
DetachObjectError::AccessDenied(ref cause) => cause,
DetachObjectError::DirectoryNotEnabled(ref cause) => cause,
DetachObjectError::InternalService(ref cause) => cause,
DetachObjectError::InvalidArn(ref cause) => cause,
DetachObjectError::LimitExceeded(ref cause) => cause,
DetachObjectError::NotNode(ref cause) => cause,
DetachObjectError::ResourceNotFound(ref cause) => cause,
DetachObjectError::RetryableConflict(ref cause) => cause,
DetachObjectError::Validation(ref cause) => cause,
DetachObjectError::Credentials(ref err) => err.description(),
DetachObjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetachObjectError::ParseError(ref cause) => cause,
DetachObjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachPolicyError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
NotPolicy(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> DetachPolicyError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DetachPolicyError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return DetachPolicyError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return DetachPolicyError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DetachPolicyError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DetachPolicyError::LimitExceeded(String::from(error_message));
}
"NotPolicyException" => {
return DetachPolicyError::NotPolicy(String::from(error_message));
}
"ResourceNotFoundException" => {
return DetachPolicyError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DetachPolicyError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DetachPolicyError::Validation(error_message.to_string());
}
_ => {}
}
}
return DetachPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachPolicyError {
fn from(err: serde_json::error::Error) -> DetachPolicyError {
DetachPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachPolicyError {
fn from(err: CredentialsError) -> DetachPolicyError {
DetachPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachPolicyError {
fn from(err: HttpDispatchError) -> DetachPolicyError {
DetachPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachPolicyError {
fn from(err: io::Error) -> DetachPolicyError {
DetachPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachPolicyError {
fn description(&self) -> &str {
match *self {
DetachPolicyError::AccessDenied(ref cause) => cause,
DetachPolicyError::DirectoryNotEnabled(ref cause) => cause,
DetachPolicyError::InternalService(ref cause) => cause,
DetachPolicyError::InvalidArn(ref cause) => cause,
DetachPolicyError::LimitExceeded(ref cause) => cause,
DetachPolicyError::NotPolicy(ref cause) => cause,
DetachPolicyError::ResourceNotFound(ref cause) => cause,
DetachPolicyError::RetryableConflict(ref cause) => cause,
DetachPolicyError::Validation(ref cause) => cause,
DetachPolicyError::Credentials(ref err) => err.description(),
DetachPolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetachPolicyError::ParseError(ref cause) => cause,
DetachPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachTypedLinkError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachTypedLinkError {
pub fn from_response(res: BufferedHttpResponse) -> DetachTypedLinkError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DetachTypedLinkError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return DetachTypedLinkError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return DetachTypedLinkError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return DetachTypedLinkError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DetachTypedLinkError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DetachTypedLinkError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return DetachTypedLinkError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DetachTypedLinkError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DetachTypedLinkError::Validation(error_message.to_string());
}
_ => {}
}
}
return DetachTypedLinkError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachTypedLinkError {
fn from(err: serde_json::error::Error) -> DetachTypedLinkError {
DetachTypedLinkError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachTypedLinkError {
fn from(err: CredentialsError) -> DetachTypedLinkError {
DetachTypedLinkError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachTypedLinkError {
fn from(err: HttpDispatchError) -> DetachTypedLinkError {
DetachTypedLinkError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachTypedLinkError {
fn from(err: io::Error) -> DetachTypedLinkError {
DetachTypedLinkError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachTypedLinkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachTypedLinkError {
fn description(&self) -> &str {
match *self {
DetachTypedLinkError::AccessDenied(ref cause) => cause,
DetachTypedLinkError::DirectoryNotEnabled(ref cause) => cause,
DetachTypedLinkError::FacetValidation(ref cause) => cause,
DetachTypedLinkError::InternalService(ref cause) => cause,
DetachTypedLinkError::InvalidArn(ref cause) => cause,
DetachTypedLinkError::LimitExceeded(ref cause) => cause,
DetachTypedLinkError::ResourceNotFound(ref cause) => cause,
DetachTypedLinkError::RetryableConflict(ref cause) => cause,
DetachTypedLinkError::Validation(ref cause) => cause,
DetachTypedLinkError::Credentials(ref err) => err.description(),
DetachTypedLinkError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetachTypedLinkError::ParseError(ref cause) => cause,
DetachTypedLinkError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisableDirectoryError {
AccessDenied(String),
DirectoryDeleted(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisableDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> DisableDirectoryError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return DisableDirectoryError::AccessDenied(String::from(error_message));
}
"DirectoryDeletedException" => {
return DisableDirectoryError::DirectoryDeleted(String::from(error_message));
}
"InternalServiceException" => {
return DisableDirectoryError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return DisableDirectoryError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return DisableDirectoryError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return DisableDirectoryError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return DisableDirectoryError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return DisableDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return DisableDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisableDirectoryError {
fn from(err: serde_json::error::Error) -> DisableDirectoryError {
DisableDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisableDirectoryError {
fn from(err: CredentialsError) -> DisableDirectoryError {
DisableDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisableDirectoryError {
fn from(err: HttpDispatchError) -> DisableDirectoryError {
DisableDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for DisableDirectoryError {
fn from(err: io::Error) -> DisableDirectoryError {
DisableDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisableDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisableDirectoryError {
fn description(&self) -> &str {
match *self {
DisableDirectoryError::AccessDenied(ref cause) => cause,
DisableDirectoryError::DirectoryDeleted(ref cause) => cause,
DisableDirectoryError::InternalService(ref cause) => cause,
DisableDirectoryError::InvalidArn(ref cause) => cause,
DisableDirectoryError::LimitExceeded(ref cause) => cause,
DisableDirectoryError::ResourceNotFound(ref cause) => cause,
DisableDirectoryError::RetryableConflict(ref cause) => cause,
DisableDirectoryError::Validation(ref cause) => cause,
DisableDirectoryError::Credentials(ref err) => err.description(),
DisableDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DisableDirectoryError::ParseError(ref cause) => cause,
DisableDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum EnableDirectoryError {
AccessDenied(String),
DirectoryDeleted(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl EnableDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> EnableDirectoryError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return EnableDirectoryError::AccessDenied(String::from(error_message));
}
"DirectoryDeletedException" => {
return EnableDirectoryError::DirectoryDeleted(String::from(error_message));
}
"InternalServiceException" => {
return EnableDirectoryError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return EnableDirectoryError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return EnableDirectoryError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return EnableDirectoryError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return EnableDirectoryError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return EnableDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return EnableDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for EnableDirectoryError {
fn from(err: serde_json::error::Error) -> EnableDirectoryError {
EnableDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for EnableDirectoryError {
fn from(err: CredentialsError) -> EnableDirectoryError {
EnableDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for EnableDirectoryError {
fn from(err: HttpDispatchError) -> EnableDirectoryError {
EnableDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for EnableDirectoryError {
fn from(err: io::Error) -> EnableDirectoryError {
EnableDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for EnableDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for EnableDirectoryError {
fn description(&self) -> &str {
match *self {
EnableDirectoryError::AccessDenied(ref cause) => cause,
EnableDirectoryError::DirectoryDeleted(ref cause) => cause,
EnableDirectoryError::InternalService(ref cause) => cause,
EnableDirectoryError::InvalidArn(ref cause) => cause,
EnableDirectoryError::LimitExceeded(ref cause) => cause,
EnableDirectoryError::ResourceNotFound(ref cause) => cause,
EnableDirectoryError::RetryableConflict(ref cause) => cause,
EnableDirectoryError::Validation(ref cause) => cause,
EnableDirectoryError::Credentials(ref err) => err.description(),
EnableDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
EnableDirectoryError::ParseError(ref cause) => cause,
EnableDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAppliedSchemaVersionError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetAppliedSchemaVersionError {
pub fn from_response(res: BufferedHttpResponse) -> GetAppliedSchemaVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetAppliedSchemaVersionError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return GetAppliedSchemaVersionError::InternalService(String::from(
error_message,
));
}
"InvalidArnException" => {
return GetAppliedSchemaVersionError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return GetAppliedSchemaVersionError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetAppliedSchemaVersionError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return GetAppliedSchemaVersionError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return GetAppliedSchemaVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetAppliedSchemaVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetAppliedSchemaVersionError {
fn from(err: serde_json::error::Error) -> GetAppliedSchemaVersionError {
GetAppliedSchemaVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetAppliedSchemaVersionError {
fn from(err: CredentialsError) -> GetAppliedSchemaVersionError {
GetAppliedSchemaVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetAppliedSchemaVersionError {
fn from(err: HttpDispatchError) -> GetAppliedSchemaVersionError {
GetAppliedSchemaVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for GetAppliedSchemaVersionError {
fn from(err: io::Error) -> GetAppliedSchemaVersionError {
GetAppliedSchemaVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetAppliedSchemaVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetAppliedSchemaVersionError {
fn description(&self) -> &str {
match *self {
GetAppliedSchemaVersionError::AccessDenied(ref cause) => cause,
GetAppliedSchemaVersionError::InternalService(ref cause) => cause,
GetAppliedSchemaVersionError::InvalidArn(ref cause) => cause,
GetAppliedSchemaVersionError::LimitExceeded(ref cause) => cause,
GetAppliedSchemaVersionError::ResourceNotFound(ref cause) => cause,
GetAppliedSchemaVersionError::RetryableConflict(ref cause) => cause,
GetAppliedSchemaVersionError::Validation(ref cause) => cause,
GetAppliedSchemaVersionError::Credentials(ref err) => err.description(),
GetAppliedSchemaVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetAppliedSchemaVersionError::ParseError(ref cause) => cause,
GetAppliedSchemaVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDirectoryError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDirectoryError {
pub fn from_response(res: BufferedHttpResponse) -> GetDirectoryError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetDirectoryError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return GetDirectoryError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return GetDirectoryError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return GetDirectoryError::LimitExceeded(String::from(error_message));
}
"RetryableConflictException" => {
return GetDirectoryError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return GetDirectoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDirectoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDirectoryError {
fn from(err: serde_json::error::Error) -> GetDirectoryError {
GetDirectoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDirectoryError {
fn from(err: CredentialsError) -> GetDirectoryError {
GetDirectoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDirectoryError {
fn from(err: HttpDispatchError) -> GetDirectoryError {
GetDirectoryError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDirectoryError {
fn from(err: io::Error) -> GetDirectoryError {
GetDirectoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDirectoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDirectoryError {
fn description(&self) -> &str {
match *self {
GetDirectoryError::AccessDenied(ref cause) => cause,
GetDirectoryError::InternalService(ref cause) => cause,
GetDirectoryError::InvalidArn(ref cause) => cause,
GetDirectoryError::LimitExceeded(ref cause) => cause,
GetDirectoryError::RetryableConflict(ref cause) => cause,
GetDirectoryError::Validation(ref cause) => cause,
GetDirectoryError::Credentials(ref err) => err.description(),
GetDirectoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetDirectoryError::ParseError(ref cause) => cause,
GetDirectoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetFacetError {
AccessDenied(String),
FacetNotFound(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetFacetError {
pub fn from_response(res: BufferedHttpResponse) -> GetFacetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetFacetError::AccessDenied(String::from(error_message));
}
"FacetNotFoundException" => {
return GetFacetError::FacetNotFound(String::from(error_message));
}
"InternalServiceException" => {
return GetFacetError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return GetFacetError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return GetFacetError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetFacetError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return GetFacetError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return GetFacetError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetFacetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetFacetError {
fn from(err: serde_json::error::Error) -> GetFacetError {
GetFacetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetFacetError {
fn from(err: CredentialsError) -> GetFacetError {
GetFacetError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetFacetError {
fn from(err: HttpDispatchError) -> GetFacetError {
GetFacetError::HttpDispatch(err)
}
}
impl From<io::Error> for GetFacetError {
fn from(err: io::Error) -> GetFacetError {
GetFacetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetFacetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetFacetError {
fn description(&self) -> &str {
match *self {
GetFacetError::AccessDenied(ref cause) => cause,
GetFacetError::FacetNotFound(ref cause) => cause,
GetFacetError::InternalService(ref cause) => cause,
GetFacetError::InvalidArn(ref cause) => cause,
GetFacetError::LimitExceeded(ref cause) => cause,
GetFacetError::ResourceNotFound(ref cause) => cause,
GetFacetError::RetryableConflict(ref cause) => cause,
GetFacetError::Validation(ref cause) => cause,
GetFacetError::Credentials(ref err) => err.description(),
GetFacetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetFacetError::ParseError(ref cause) => cause,
GetFacetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetLinkAttributesError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetLinkAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> GetLinkAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetLinkAttributesError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return GetLinkAttributesError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return GetLinkAttributesError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return GetLinkAttributesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return GetLinkAttributesError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return GetLinkAttributesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetLinkAttributesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return GetLinkAttributesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return GetLinkAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetLinkAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetLinkAttributesError {
fn from(err: serde_json::error::Error) -> GetLinkAttributesError {
GetLinkAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetLinkAttributesError {
fn from(err: CredentialsError) -> GetLinkAttributesError {
GetLinkAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetLinkAttributesError {
fn from(err: HttpDispatchError) -> GetLinkAttributesError {
GetLinkAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetLinkAttributesError {
fn from(err: io::Error) -> GetLinkAttributesError {
GetLinkAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetLinkAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetLinkAttributesError {
fn description(&self) -> &str {
match *self {
GetLinkAttributesError::AccessDenied(ref cause) => cause,
GetLinkAttributesError::DirectoryNotEnabled(ref cause) => cause,
GetLinkAttributesError::FacetValidation(ref cause) => cause,
GetLinkAttributesError::InternalService(ref cause) => cause,
GetLinkAttributesError::InvalidArn(ref cause) => cause,
GetLinkAttributesError::LimitExceeded(ref cause) => cause,
GetLinkAttributesError::ResourceNotFound(ref cause) => cause,
GetLinkAttributesError::RetryableConflict(ref cause) => cause,
GetLinkAttributesError::Validation(ref cause) => cause,
GetLinkAttributesError::Credentials(ref err) => err.description(),
GetLinkAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetLinkAttributesError::ParseError(ref cause) => cause,
GetLinkAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetObjectAttributesError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetObjectAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> GetObjectAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetObjectAttributesError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return GetObjectAttributesError::DirectoryNotEnabled(String::from(
error_message,
));
}
"FacetValidationException" => {
return GetObjectAttributesError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return GetObjectAttributesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return GetObjectAttributesError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return GetObjectAttributesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetObjectAttributesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return GetObjectAttributesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return GetObjectAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetObjectAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetObjectAttributesError {
fn from(err: serde_json::error::Error) -> GetObjectAttributesError {
GetObjectAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetObjectAttributesError {
fn from(err: CredentialsError) -> GetObjectAttributesError {
GetObjectAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetObjectAttributesError {
fn from(err: HttpDispatchError) -> GetObjectAttributesError {
GetObjectAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetObjectAttributesError {
fn from(err: io::Error) -> GetObjectAttributesError {
GetObjectAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetObjectAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetObjectAttributesError {
fn description(&self) -> &str {
match *self {
GetObjectAttributesError::AccessDenied(ref cause) => cause,
GetObjectAttributesError::DirectoryNotEnabled(ref cause) => cause,
GetObjectAttributesError::FacetValidation(ref cause) => cause,
GetObjectAttributesError::InternalService(ref cause) => cause,
GetObjectAttributesError::InvalidArn(ref cause) => cause,
GetObjectAttributesError::LimitExceeded(ref cause) => cause,
GetObjectAttributesError::ResourceNotFound(ref cause) => cause,
GetObjectAttributesError::RetryableConflict(ref cause) => cause,
GetObjectAttributesError::Validation(ref cause) => cause,
GetObjectAttributesError::Credentials(ref err) => err.description(),
GetObjectAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetObjectAttributesError::ParseError(ref cause) => cause,
GetObjectAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetObjectInformationError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetObjectInformationError {
pub fn from_response(res: BufferedHttpResponse) -> GetObjectInformationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetObjectInformationError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return GetObjectInformationError::DirectoryNotEnabled(String::from(
error_message,
));
}
"InternalServiceException" => {
return GetObjectInformationError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return GetObjectInformationError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return GetObjectInformationError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetObjectInformationError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return GetObjectInformationError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return GetObjectInformationError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetObjectInformationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetObjectInformationError {
fn from(err: serde_json::error::Error) -> GetObjectInformationError {
GetObjectInformationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetObjectInformationError {
fn from(err: CredentialsError) -> GetObjectInformationError {
GetObjectInformationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetObjectInformationError {
fn from(err: HttpDispatchError) -> GetObjectInformationError {
GetObjectInformationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetObjectInformationError {
fn from(err: io::Error) -> GetObjectInformationError {
GetObjectInformationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetObjectInformationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetObjectInformationError {
fn description(&self) -> &str {
match *self {
GetObjectInformationError::AccessDenied(ref cause) => cause,
GetObjectInformationError::DirectoryNotEnabled(ref cause) => cause,
GetObjectInformationError::InternalService(ref cause) => cause,
GetObjectInformationError::InvalidArn(ref cause) => cause,
GetObjectInformationError::LimitExceeded(ref cause) => cause,
GetObjectInformationError::ResourceNotFound(ref cause) => cause,
GetObjectInformationError::RetryableConflict(ref cause) => cause,
GetObjectInformationError::Validation(ref cause) => cause,
GetObjectInformationError::Credentials(ref err) => err.description(),
GetObjectInformationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetObjectInformationError::ParseError(ref cause) => cause,
GetObjectInformationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSchemaAsJsonError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSchemaAsJsonError {
pub fn from_response(res: BufferedHttpResponse) -> GetSchemaAsJsonError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetSchemaAsJsonError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return GetSchemaAsJsonError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return GetSchemaAsJsonError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return GetSchemaAsJsonError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetSchemaAsJsonError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return GetSchemaAsJsonError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return GetSchemaAsJsonError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSchemaAsJsonError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSchemaAsJsonError {
fn from(err: serde_json::error::Error) -> GetSchemaAsJsonError {
GetSchemaAsJsonError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSchemaAsJsonError {
fn from(err: CredentialsError) -> GetSchemaAsJsonError {
GetSchemaAsJsonError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSchemaAsJsonError {
fn from(err: HttpDispatchError) -> GetSchemaAsJsonError {
GetSchemaAsJsonError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSchemaAsJsonError {
fn from(err: io::Error) -> GetSchemaAsJsonError {
GetSchemaAsJsonError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSchemaAsJsonError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSchemaAsJsonError {
fn description(&self) -> &str {
match *self {
GetSchemaAsJsonError::AccessDenied(ref cause) => cause,
GetSchemaAsJsonError::InternalService(ref cause) => cause,
GetSchemaAsJsonError::InvalidArn(ref cause) => cause,
GetSchemaAsJsonError::LimitExceeded(ref cause) => cause,
GetSchemaAsJsonError::ResourceNotFound(ref cause) => cause,
GetSchemaAsJsonError::RetryableConflict(ref cause) => cause,
GetSchemaAsJsonError::Validation(ref cause) => cause,
GetSchemaAsJsonError::Credentials(ref err) => err.description(),
GetSchemaAsJsonError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSchemaAsJsonError::ParseError(ref cause) => cause,
GetSchemaAsJsonError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetTypedLinkFacetInformationError {
AccessDenied(String),
FacetNotFound(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetTypedLinkFacetInformationError {
pub fn from_response(res: BufferedHttpResponse) -> GetTypedLinkFacetInformationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return GetTypedLinkFacetInformationError::AccessDenied(String::from(
error_message,
));
}
"FacetNotFoundException" => {
return GetTypedLinkFacetInformationError::FacetNotFound(String::from(
error_message,
));
}
"InternalServiceException" => {
return GetTypedLinkFacetInformationError::InternalService(String::from(
error_message,
));
}
"InvalidArnException" => {
return GetTypedLinkFacetInformationError::InvalidArn(String::from(
error_message,
));
}
"InvalidNextTokenException" => {
return GetTypedLinkFacetInformationError::InvalidNextToken(String::from(
error_message,
));
}
"LimitExceededException" => {
return GetTypedLinkFacetInformationError::LimitExceeded(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return GetTypedLinkFacetInformationError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return GetTypedLinkFacetInformationError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return GetTypedLinkFacetInformationError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetTypedLinkFacetInformationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetTypedLinkFacetInformationError {
fn from(err: serde_json::error::Error) -> GetTypedLinkFacetInformationError {
GetTypedLinkFacetInformationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetTypedLinkFacetInformationError {
fn from(err: CredentialsError) -> GetTypedLinkFacetInformationError {
GetTypedLinkFacetInformationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetTypedLinkFacetInformationError {
fn from(err: HttpDispatchError) -> GetTypedLinkFacetInformationError {
GetTypedLinkFacetInformationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetTypedLinkFacetInformationError {
fn from(err: io::Error) -> GetTypedLinkFacetInformationError {
GetTypedLinkFacetInformationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetTypedLinkFacetInformationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetTypedLinkFacetInformationError {
fn description(&self) -> &str {
match *self {
GetTypedLinkFacetInformationError::AccessDenied(ref cause) => cause,
GetTypedLinkFacetInformationError::FacetNotFound(ref cause) => cause,
GetTypedLinkFacetInformationError::InternalService(ref cause) => cause,
GetTypedLinkFacetInformationError::InvalidArn(ref cause) => cause,
GetTypedLinkFacetInformationError::InvalidNextToken(ref cause) => cause,
GetTypedLinkFacetInformationError::LimitExceeded(ref cause) => cause,
GetTypedLinkFacetInformationError::ResourceNotFound(ref cause) => cause,
GetTypedLinkFacetInformationError::RetryableConflict(ref cause) => cause,
GetTypedLinkFacetInformationError::Validation(ref cause) => cause,
GetTypedLinkFacetInformationError::Credentials(ref err) => err.description(),
GetTypedLinkFacetInformationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetTypedLinkFacetInformationError::ParseError(ref cause) => cause,
GetTypedLinkFacetInformationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAppliedSchemaArnsError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAppliedSchemaArnsError {
pub fn from_response(res: BufferedHttpResponse) -> ListAppliedSchemaArnsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListAppliedSchemaArnsError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ListAppliedSchemaArnsError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListAppliedSchemaArnsError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListAppliedSchemaArnsError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListAppliedSchemaArnsError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListAppliedSchemaArnsError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListAppliedSchemaArnsError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListAppliedSchemaArnsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListAppliedSchemaArnsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAppliedSchemaArnsError {
fn from(err: serde_json::error::Error) -> ListAppliedSchemaArnsError {
ListAppliedSchemaArnsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAppliedSchemaArnsError {
fn from(err: CredentialsError) -> ListAppliedSchemaArnsError {
ListAppliedSchemaArnsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAppliedSchemaArnsError {
fn from(err: HttpDispatchError) -> ListAppliedSchemaArnsError {
ListAppliedSchemaArnsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAppliedSchemaArnsError {
fn from(err: io::Error) -> ListAppliedSchemaArnsError {
ListAppliedSchemaArnsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAppliedSchemaArnsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAppliedSchemaArnsError {
fn description(&self) -> &str {
match *self {
ListAppliedSchemaArnsError::AccessDenied(ref cause) => cause,
ListAppliedSchemaArnsError::InternalService(ref cause) => cause,
ListAppliedSchemaArnsError::InvalidArn(ref cause) => cause,
ListAppliedSchemaArnsError::InvalidNextToken(ref cause) => cause,
ListAppliedSchemaArnsError::LimitExceeded(ref cause) => cause,
ListAppliedSchemaArnsError::ResourceNotFound(ref cause) => cause,
ListAppliedSchemaArnsError::RetryableConflict(ref cause) => cause,
ListAppliedSchemaArnsError::Validation(ref cause) => cause,
ListAppliedSchemaArnsError::Credentials(ref err) => err.description(),
ListAppliedSchemaArnsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListAppliedSchemaArnsError::ParseError(ref cause) => cause,
ListAppliedSchemaArnsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAttachedIndicesError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAttachedIndicesError {
pub fn from_response(res: BufferedHttpResponse) -> ListAttachedIndicesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListAttachedIndicesError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListAttachedIndicesError::DirectoryNotEnabled(String::from(
error_message,
));
}
"InternalServiceException" => {
return ListAttachedIndicesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListAttachedIndicesError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return ListAttachedIndicesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListAttachedIndicesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListAttachedIndicesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListAttachedIndicesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListAttachedIndicesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAttachedIndicesError {
fn from(err: serde_json::error::Error) -> ListAttachedIndicesError {
ListAttachedIndicesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAttachedIndicesError {
fn from(err: CredentialsError) -> ListAttachedIndicesError {
ListAttachedIndicesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAttachedIndicesError {
fn from(err: HttpDispatchError) -> ListAttachedIndicesError {
ListAttachedIndicesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAttachedIndicesError {
fn from(err: io::Error) -> ListAttachedIndicesError {
ListAttachedIndicesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAttachedIndicesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAttachedIndicesError {
fn description(&self) -> &str {
match *self {
ListAttachedIndicesError::AccessDenied(ref cause) => cause,
ListAttachedIndicesError::DirectoryNotEnabled(ref cause) => cause,
ListAttachedIndicesError::InternalService(ref cause) => cause,
ListAttachedIndicesError::InvalidArn(ref cause) => cause,
ListAttachedIndicesError::LimitExceeded(ref cause) => cause,
ListAttachedIndicesError::ResourceNotFound(ref cause) => cause,
ListAttachedIndicesError::RetryableConflict(ref cause) => cause,
ListAttachedIndicesError::Validation(ref cause) => cause,
ListAttachedIndicesError::Credentials(ref err) => err.description(),
ListAttachedIndicesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListAttachedIndicesError::ParseError(ref cause) => cause,
ListAttachedIndicesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDevelopmentSchemaArnsError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListDevelopmentSchemaArnsError {
pub fn from_response(res: BufferedHttpResponse) -> ListDevelopmentSchemaArnsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListDevelopmentSchemaArnsError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ListDevelopmentSchemaArnsError::InternalService(String::from(
error_message,
));
}
"InvalidArnException" => {
return ListDevelopmentSchemaArnsError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListDevelopmentSchemaArnsError::InvalidNextToken(String::from(
error_message,
));
}
"LimitExceededException" => {
return ListDevelopmentSchemaArnsError::LimitExceeded(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return ListDevelopmentSchemaArnsError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return ListDevelopmentSchemaArnsError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListDevelopmentSchemaArnsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListDevelopmentSchemaArnsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListDevelopmentSchemaArnsError {
fn from(err: serde_json::error::Error) -> ListDevelopmentSchemaArnsError {
ListDevelopmentSchemaArnsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListDevelopmentSchemaArnsError {
fn from(err: CredentialsError) -> ListDevelopmentSchemaArnsError {
ListDevelopmentSchemaArnsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListDevelopmentSchemaArnsError {
fn from(err: HttpDispatchError) -> ListDevelopmentSchemaArnsError {
ListDevelopmentSchemaArnsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListDevelopmentSchemaArnsError {
fn from(err: io::Error) -> ListDevelopmentSchemaArnsError {
ListDevelopmentSchemaArnsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListDevelopmentSchemaArnsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDevelopmentSchemaArnsError {
fn description(&self) -> &str {
match *self {
ListDevelopmentSchemaArnsError::AccessDenied(ref cause) => cause,
ListDevelopmentSchemaArnsError::InternalService(ref cause) => cause,
ListDevelopmentSchemaArnsError::InvalidArn(ref cause) => cause,
ListDevelopmentSchemaArnsError::InvalidNextToken(ref cause) => cause,
ListDevelopmentSchemaArnsError::LimitExceeded(ref cause) => cause,
ListDevelopmentSchemaArnsError::ResourceNotFound(ref cause) => cause,
ListDevelopmentSchemaArnsError::RetryableConflict(ref cause) => cause,
ListDevelopmentSchemaArnsError::Validation(ref cause) => cause,
ListDevelopmentSchemaArnsError::Credentials(ref err) => err.description(),
ListDevelopmentSchemaArnsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListDevelopmentSchemaArnsError::ParseError(ref cause) => cause,
ListDevelopmentSchemaArnsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDirectoriesError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListDirectoriesError {
pub fn from_response(res: BufferedHttpResponse) -> ListDirectoriesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListDirectoriesError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ListDirectoriesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListDirectoriesError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListDirectoriesError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListDirectoriesError::LimitExceeded(String::from(error_message));
}
"RetryableConflictException" => {
return ListDirectoriesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListDirectoriesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListDirectoriesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListDirectoriesError {
fn from(err: serde_json::error::Error) -> ListDirectoriesError {
ListDirectoriesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListDirectoriesError {
fn from(err: CredentialsError) -> ListDirectoriesError {
ListDirectoriesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListDirectoriesError {
fn from(err: HttpDispatchError) -> ListDirectoriesError {
ListDirectoriesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListDirectoriesError {
fn from(err: io::Error) -> ListDirectoriesError {
ListDirectoriesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListDirectoriesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDirectoriesError {
fn description(&self) -> &str {
match *self {
ListDirectoriesError::AccessDenied(ref cause) => cause,
ListDirectoriesError::InternalService(ref cause) => cause,
ListDirectoriesError::InvalidArn(ref cause) => cause,
ListDirectoriesError::InvalidNextToken(ref cause) => cause,
ListDirectoriesError::LimitExceeded(ref cause) => cause,
ListDirectoriesError::RetryableConflict(ref cause) => cause,
ListDirectoriesError::Validation(ref cause) => cause,
ListDirectoriesError::Credentials(ref err) => err.description(),
ListDirectoriesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListDirectoriesError::ParseError(ref cause) => cause,
ListDirectoriesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListFacetAttributesError {
AccessDenied(String),
FacetNotFound(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListFacetAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> ListFacetAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListFacetAttributesError::AccessDenied(String::from(error_message));
}
"FacetNotFoundException" => {
return ListFacetAttributesError::FacetNotFound(String::from(error_message));
}
"InternalServiceException" => {
return ListFacetAttributesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListFacetAttributesError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListFacetAttributesError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListFacetAttributesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListFacetAttributesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListFacetAttributesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListFacetAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListFacetAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListFacetAttributesError {
fn from(err: serde_json::error::Error) -> ListFacetAttributesError {
ListFacetAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListFacetAttributesError {
fn from(err: CredentialsError) -> ListFacetAttributesError {
ListFacetAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListFacetAttributesError {
fn from(err: HttpDispatchError) -> ListFacetAttributesError {
ListFacetAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListFacetAttributesError {
fn from(err: io::Error) -> ListFacetAttributesError {
ListFacetAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListFacetAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListFacetAttributesError {
fn description(&self) -> &str {
match *self {
ListFacetAttributesError::AccessDenied(ref cause) => cause,
ListFacetAttributesError::FacetNotFound(ref cause) => cause,
ListFacetAttributesError::InternalService(ref cause) => cause,
ListFacetAttributesError::InvalidArn(ref cause) => cause,
ListFacetAttributesError::InvalidNextToken(ref cause) => cause,
ListFacetAttributesError::LimitExceeded(ref cause) => cause,
ListFacetAttributesError::ResourceNotFound(ref cause) => cause,
ListFacetAttributesError::RetryableConflict(ref cause) => cause,
ListFacetAttributesError::Validation(ref cause) => cause,
ListFacetAttributesError::Credentials(ref err) => err.description(),
ListFacetAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListFacetAttributesError::ParseError(ref cause) => cause,
ListFacetAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListFacetNamesError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListFacetNamesError {
pub fn from_response(res: BufferedHttpResponse) -> ListFacetNamesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListFacetNamesError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ListFacetNamesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListFacetNamesError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListFacetNamesError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListFacetNamesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListFacetNamesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListFacetNamesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListFacetNamesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListFacetNamesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListFacetNamesError {
fn from(err: serde_json::error::Error) -> ListFacetNamesError {
ListFacetNamesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListFacetNamesError {
fn from(err: CredentialsError) -> ListFacetNamesError {
ListFacetNamesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListFacetNamesError {
fn from(err: HttpDispatchError) -> ListFacetNamesError {
ListFacetNamesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListFacetNamesError {
fn from(err: io::Error) -> ListFacetNamesError {
ListFacetNamesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListFacetNamesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListFacetNamesError {
fn description(&self) -> &str {
match *self {
ListFacetNamesError::AccessDenied(ref cause) => cause,
ListFacetNamesError::InternalService(ref cause) => cause,
ListFacetNamesError::InvalidArn(ref cause) => cause,
ListFacetNamesError::InvalidNextToken(ref cause) => cause,
ListFacetNamesError::LimitExceeded(ref cause) => cause,
ListFacetNamesError::ResourceNotFound(ref cause) => cause,
ListFacetNamesError::RetryableConflict(ref cause) => cause,
ListFacetNamesError::Validation(ref cause) => cause,
ListFacetNamesError::Credentials(ref err) => err.description(),
ListFacetNamesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListFacetNamesError::ParseError(ref cause) => cause,
ListFacetNamesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListIncomingTypedLinksError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListIncomingTypedLinksError {
pub fn from_response(res: BufferedHttpResponse) -> ListIncomingTypedLinksError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListIncomingTypedLinksError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListIncomingTypedLinksError::DirectoryNotEnabled(String::from(
error_message,
));
}
"FacetValidationException" => {
return ListIncomingTypedLinksError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return ListIncomingTypedLinksError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListIncomingTypedLinksError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListIncomingTypedLinksError::InvalidNextToken(String::from(
error_message,
));
}
"LimitExceededException" => {
return ListIncomingTypedLinksError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListIncomingTypedLinksError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return ListIncomingTypedLinksError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListIncomingTypedLinksError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListIncomingTypedLinksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListIncomingTypedLinksError {
fn from(err: serde_json::error::Error) -> ListIncomingTypedLinksError {
ListIncomingTypedLinksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListIncomingTypedLinksError {
fn from(err: CredentialsError) -> ListIncomingTypedLinksError {
ListIncomingTypedLinksError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListIncomingTypedLinksError {
fn from(err: HttpDispatchError) -> ListIncomingTypedLinksError {
ListIncomingTypedLinksError::HttpDispatch(err)
}
}
impl From<io::Error> for ListIncomingTypedLinksError {
fn from(err: io::Error) -> ListIncomingTypedLinksError {
ListIncomingTypedLinksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListIncomingTypedLinksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListIncomingTypedLinksError {
fn description(&self) -> &str {
match *self {
ListIncomingTypedLinksError::AccessDenied(ref cause) => cause,
ListIncomingTypedLinksError::DirectoryNotEnabled(ref cause) => cause,
ListIncomingTypedLinksError::FacetValidation(ref cause) => cause,
ListIncomingTypedLinksError::InternalService(ref cause) => cause,
ListIncomingTypedLinksError::InvalidArn(ref cause) => cause,
ListIncomingTypedLinksError::InvalidNextToken(ref cause) => cause,
ListIncomingTypedLinksError::LimitExceeded(ref cause) => cause,
ListIncomingTypedLinksError::ResourceNotFound(ref cause) => cause,
ListIncomingTypedLinksError::RetryableConflict(ref cause) => cause,
ListIncomingTypedLinksError::Validation(ref cause) => cause,
ListIncomingTypedLinksError::Credentials(ref err) => err.description(),
ListIncomingTypedLinksError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListIncomingTypedLinksError::ParseError(ref cause) => cause,
ListIncomingTypedLinksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListIndexError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
NotIndex(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListIndexError {
pub fn from_response(res: BufferedHttpResponse) -> ListIndexError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListIndexError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListIndexError::DirectoryNotEnabled(String::from(error_message));
}
"FacetValidationException" => {
return ListIndexError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return ListIndexError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListIndexError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListIndexError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListIndexError::LimitExceeded(String::from(error_message));
}
"NotIndexException" => return ListIndexError::NotIndex(String::from(error_message)),
"ResourceNotFoundException" => {
return ListIndexError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListIndexError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListIndexError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListIndexError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListIndexError {
fn from(err: serde_json::error::Error) -> ListIndexError {
ListIndexError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListIndexError {
fn from(err: CredentialsError) -> ListIndexError {
ListIndexError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListIndexError {
fn from(err: HttpDispatchError) -> ListIndexError {
ListIndexError::HttpDispatch(err)
}
}
impl From<io::Error> for ListIndexError {
fn from(err: io::Error) -> ListIndexError {
ListIndexError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListIndexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListIndexError {
fn description(&self) -> &str {
match *self {
ListIndexError::AccessDenied(ref cause) => cause,
ListIndexError::DirectoryNotEnabled(ref cause) => cause,
ListIndexError::FacetValidation(ref cause) => cause,
ListIndexError::InternalService(ref cause) => cause,
ListIndexError::InvalidArn(ref cause) => cause,
ListIndexError::InvalidNextToken(ref cause) => cause,
ListIndexError::LimitExceeded(ref cause) => cause,
ListIndexError::NotIndex(ref cause) => cause,
ListIndexError::ResourceNotFound(ref cause) => cause,
ListIndexError::RetryableConflict(ref cause) => cause,
ListIndexError::Validation(ref cause) => cause,
ListIndexError::Credentials(ref err) => err.description(),
ListIndexError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListIndexError::ParseError(ref cause) => cause,
ListIndexError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListObjectAttributesError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListObjectAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> ListObjectAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListObjectAttributesError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListObjectAttributesError::DirectoryNotEnabled(String::from(
error_message,
));
}
"FacetValidationException" => {
return ListObjectAttributesError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return ListObjectAttributesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListObjectAttributesError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListObjectAttributesError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListObjectAttributesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListObjectAttributesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListObjectAttributesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListObjectAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListObjectAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListObjectAttributesError {
fn from(err: serde_json::error::Error) -> ListObjectAttributesError {
ListObjectAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListObjectAttributesError {
fn from(err: CredentialsError) -> ListObjectAttributesError {
ListObjectAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListObjectAttributesError {
fn from(err: HttpDispatchError) -> ListObjectAttributesError {
ListObjectAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListObjectAttributesError {
fn from(err: io::Error) -> ListObjectAttributesError {
ListObjectAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListObjectAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListObjectAttributesError {
fn description(&self) -> &str {
match *self {
ListObjectAttributesError::AccessDenied(ref cause) => cause,
ListObjectAttributesError::DirectoryNotEnabled(ref cause) => cause,
ListObjectAttributesError::FacetValidation(ref cause) => cause,
ListObjectAttributesError::InternalService(ref cause) => cause,
ListObjectAttributesError::InvalidArn(ref cause) => cause,
ListObjectAttributesError::InvalidNextToken(ref cause) => cause,
ListObjectAttributesError::LimitExceeded(ref cause) => cause,
ListObjectAttributesError::ResourceNotFound(ref cause) => cause,
ListObjectAttributesError::RetryableConflict(ref cause) => cause,
ListObjectAttributesError::Validation(ref cause) => cause,
ListObjectAttributesError::Credentials(ref err) => err.description(),
ListObjectAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListObjectAttributesError::ParseError(ref cause) => cause,
ListObjectAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListObjectChildrenError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
NotNode(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListObjectChildrenError {
pub fn from_response(res: BufferedHttpResponse) -> ListObjectChildrenError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListObjectChildrenError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListObjectChildrenError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return ListObjectChildrenError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListObjectChildrenError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListObjectChildrenError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListObjectChildrenError::LimitExceeded(String::from(error_message));
}
"NotNodeException" => {
return ListObjectChildrenError::NotNode(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListObjectChildrenError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListObjectChildrenError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListObjectChildrenError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListObjectChildrenError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListObjectChildrenError {
fn from(err: serde_json::error::Error) -> ListObjectChildrenError {
ListObjectChildrenError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListObjectChildrenError {
fn from(err: CredentialsError) -> ListObjectChildrenError {
ListObjectChildrenError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListObjectChildrenError {
fn from(err: HttpDispatchError) -> ListObjectChildrenError {
ListObjectChildrenError::HttpDispatch(err)
}
}
impl From<io::Error> for ListObjectChildrenError {
fn from(err: io::Error) -> ListObjectChildrenError {
ListObjectChildrenError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListObjectChildrenError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListObjectChildrenError {
fn description(&self) -> &str {
match *self {
ListObjectChildrenError::AccessDenied(ref cause) => cause,
ListObjectChildrenError::DirectoryNotEnabled(ref cause) => cause,
ListObjectChildrenError::InternalService(ref cause) => cause,
ListObjectChildrenError::InvalidArn(ref cause) => cause,
ListObjectChildrenError::InvalidNextToken(ref cause) => cause,
ListObjectChildrenError::LimitExceeded(ref cause) => cause,
ListObjectChildrenError::NotNode(ref cause) => cause,
ListObjectChildrenError::ResourceNotFound(ref cause) => cause,
ListObjectChildrenError::RetryableConflict(ref cause) => cause,
ListObjectChildrenError::Validation(ref cause) => cause,
ListObjectChildrenError::Credentials(ref err) => err.description(),
ListObjectChildrenError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListObjectChildrenError::ParseError(ref cause) => cause,
ListObjectChildrenError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListObjectParentPathsError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListObjectParentPathsError {
pub fn from_response(res: BufferedHttpResponse) -> ListObjectParentPathsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListObjectParentPathsError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListObjectParentPathsError::DirectoryNotEnabled(String::from(
error_message,
));
}
"InternalServiceException" => {
return ListObjectParentPathsError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListObjectParentPathsError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListObjectParentPathsError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListObjectParentPathsError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListObjectParentPathsError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListObjectParentPathsError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListObjectParentPathsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListObjectParentPathsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListObjectParentPathsError {
fn from(err: serde_json::error::Error) -> ListObjectParentPathsError {
ListObjectParentPathsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListObjectParentPathsError {
fn from(err: CredentialsError) -> ListObjectParentPathsError {
ListObjectParentPathsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListObjectParentPathsError {
fn from(err: HttpDispatchError) -> ListObjectParentPathsError {
ListObjectParentPathsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListObjectParentPathsError {
fn from(err: io::Error) -> ListObjectParentPathsError {
ListObjectParentPathsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListObjectParentPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListObjectParentPathsError {
fn description(&self) -> &str {
match *self {
ListObjectParentPathsError::AccessDenied(ref cause) => cause,
ListObjectParentPathsError::DirectoryNotEnabled(ref cause) => cause,
ListObjectParentPathsError::InternalService(ref cause) => cause,
ListObjectParentPathsError::InvalidArn(ref cause) => cause,
ListObjectParentPathsError::InvalidNextToken(ref cause) => cause,
ListObjectParentPathsError::LimitExceeded(ref cause) => cause,
ListObjectParentPathsError::ResourceNotFound(ref cause) => cause,
ListObjectParentPathsError::RetryableConflict(ref cause) => cause,
ListObjectParentPathsError::Validation(ref cause) => cause,
ListObjectParentPathsError::Credentials(ref err) => err.description(),
ListObjectParentPathsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListObjectParentPathsError::ParseError(ref cause) => cause,
ListObjectParentPathsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListObjectParentsError {
AccessDenied(String),
CannotListParentOfRoot(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListObjectParentsError {
pub fn from_response(res: BufferedHttpResponse) -> ListObjectParentsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListObjectParentsError::AccessDenied(String::from(error_message));
}
"CannotListParentOfRootException" => {
return ListObjectParentsError::CannotListParentOfRoot(String::from(
error_message,
));
}
"DirectoryNotEnabledException" => {
return ListObjectParentsError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return ListObjectParentsError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListObjectParentsError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListObjectParentsError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListObjectParentsError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListObjectParentsError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListObjectParentsError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListObjectParentsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListObjectParentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListObjectParentsError {
fn from(err: serde_json::error::Error) -> ListObjectParentsError {
ListObjectParentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListObjectParentsError {
fn from(err: CredentialsError) -> ListObjectParentsError {
ListObjectParentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListObjectParentsError {
fn from(err: HttpDispatchError) -> ListObjectParentsError {
ListObjectParentsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListObjectParentsError {
fn from(err: io::Error) -> ListObjectParentsError {
ListObjectParentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListObjectParentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListObjectParentsError {
fn description(&self) -> &str {
match *self {
ListObjectParentsError::AccessDenied(ref cause) => cause,
ListObjectParentsError::CannotListParentOfRoot(ref cause) => cause,
ListObjectParentsError::DirectoryNotEnabled(ref cause) => cause,
ListObjectParentsError::InternalService(ref cause) => cause,
ListObjectParentsError::InvalidArn(ref cause) => cause,
ListObjectParentsError::InvalidNextToken(ref cause) => cause,
ListObjectParentsError::LimitExceeded(ref cause) => cause,
ListObjectParentsError::ResourceNotFound(ref cause) => cause,
ListObjectParentsError::RetryableConflict(ref cause) => cause,
ListObjectParentsError::Validation(ref cause) => cause,
ListObjectParentsError::Credentials(ref err) => err.description(),
ListObjectParentsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListObjectParentsError::ParseError(ref cause) => cause,
ListObjectParentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListObjectPoliciesError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListObjectPoliciesError {
pub fn from_response(res: BufferedHttpResponse) -> ListObjectPoliciesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListObjectPoliciesError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListObjectPoliciesError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return ListObjectPoliciesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListObjectPoliciesError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListObjectPoliciesError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListObjectPoliciesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListObjectPoliciesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListObjectPoliciesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return ListObjectPoliciesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListObjectPoliciesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListObjectPoliciesError {
fn from(err: serde_json::error::Error) -> ListObjectPoliciesError {
ListObjectPoliciesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListObjectPoliciesError {
fn from(err: CredentialsError) -> ListObjectPoliciesError {
ListObjectPoliciesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListObjectPoliciesError {
fn from(err: HttpDispatchError) -> ListObjectPoliciesError {
ListObjectPoliciesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListObjectPoliciesError {
fn from(err: io::Error) -> ListObjectPoliciesError {
ListObjectPoliciesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListObjectPoliciesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListObjectPoliciesError {
fn description(&self) -> &str {
match *self {
ListObjectPoliciesError::AccessDenied(ref cause) => cause,
ListObjectPoliciesError::DirectoryNotEnabled(ref cause) => cause,
ListObjectPoliciesError::InternalService(ref cause) => cause,
ListObjectPoliciesError::InvalidArn(ref cause) => cause,
ListObjectPoliciesError::InvalidNextToken(ref cause) => cause,
ListObjectPoliciesError::LimitExceeded(ref cause) => cause,
ListObjectPoliciesError::ResourceNotFound(ref cause) => cause,
ListObjectPoliciesError::RetryableConflict(ref cause) => cause,
ListObjectPoliciesError::Validation(ref cause) => cause,
ListObjectPoliciesError::Credentials(ref err) => err.description(),
ListObjectPoliciesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListObjectPoliciesError::ParseError(ref cause) => cause,
ListObjectPoliciesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListOutgoingTypedLinksError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListOutgoingTypedLinksError {
pub fn from_response(res: BufferedHttpResponse) -> ListOutgoingTypedLinksError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListOutgoingTypedLinksError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListOutgoingTypedLinksError::DirectoryNotEnabled(String::from(
error_message,
));
}
"FacetValidationException" => {
return ListOutgoingTypedLinksError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return ListOutgoingTypedLinksError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListOutgoingTypedLinksError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListOutgoingTypedLinksError::InvalidNextToken(String::from(
error_message,
));
}
"LimitExceededException" => {
return ListOutgoingTypedLinksError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListOutgoingTypedLinksError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return ListOutgoingTypedLinksError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListOutgoingTypedLinksError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListOutgoingTypedLinksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListOutgoingTypedLinksError {
fn from(err: serde_json::error::Error) -> ListOutgoingTypedLinksError {
ListOutgoingTypedLinksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListOutgoingTypedLinksError {
fn from(err: CredentialsError) -> ListOutgoingTypedLinksError {
ListOutgoingTypedLinksError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListOutgoingTypedLinksError {
fn from(err: HttpDispatchError) -> ListOutgoingTypedLinksError {
ListOutgoingTypedLinksError::HttpDispatch(err)
}
}
impl From<io::Error> for ListOutgoingTypedLinksError {
fn from(err: io::Error) -> ListOutgoingTypedLinksError {
ListOutgoingTypedLinksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListOutgoingTypedLinksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListOutgoingTypedLinksError {
fn description(&self) -> &str {
match *self {
ListOutgoingTypedLinksError::AccessDenied(ref cause) => cause,
ListOutgoingTypedLinksError::DirectoryNotEnabled(ref cause) => cause,
ListOutgoingTypedLinksError::FacetValidation(ref cause) => cause,
ListOutgoingTypedLinksError::InternalService(ref cause) => cause,
ListOutgoingTypedLinksError::InvalidArn(ref cause) => cause,
ListOutgoingTypedLinksError::InvalidNextToken(ref cause) => cause,
ListOutgoingTypedLinksError::LimitExceeded(ref cause) => cause,
ListOutgoingTypedLinksError::ResourceNotFound(ref cause) => cause,
ListOutgoingTypedLinksError::RetryableConflict(ref cause) => cause,
ListOutgoingTypedLinksError::Validation(ref cause) => cause,
ListOutgoingTypedLinksError::Credentials(ref err) => err.description(),
ListOutgoingTypedLinksError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListOutgoingTypedLinksError::ParseError(ref cause) => cause,
ListOutgoingTypedLinksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPolicyAttachmentsError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
NotPolicy(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPolicyAttachmentsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPolicyAttachmentsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListPolicyAttachmentsError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return ListPolicyAttachmentsError::DirectoryNotEnabled(String::from(
error_message,
));
}
"InternalServiceException" => {
return ListPolicyAttachmentsError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListPolicyAttachmentsError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListPolicyAttachmentsError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return ListPolicyAttachmentsError::LimitExceeded(String::from(error_message));
}
"NotPolicyException" => {
return ListPolicyAttachmentsError::NotPolicy(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListPolicyAttachmentsError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListPolicyAttachmentsError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListPolicyAttachmentsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListPolicyAttachmentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPolicyAttachmentsError {
fn from(err: serde_json::error::Error) -> ListPolicyAttachmentsError {
ListPolicyAttachmentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPolicyAttachmentsError {
fn from(err: CredentialsError) -> ListPolicyAttachmentsError {
ListPolicyAttachmentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPolicyAttachmentsError {
fn from(err: HttpDispatchError) -> ListPolicyAttachmentsError {
ListPolicyAttachmentsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPolicyAttachmentsError {
fn from(err: io::Error) -> ListPolicyAttachmentsError {
ListPolicyAttachmentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPolicyAttachmentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPolicyAttachmentsError {
fn description(&self) -> &str {
match *self {
ListPolicyAttachmentsError::AccessDenied(ref cause) => cause,
ListPolicyAttachmentsError::DirectoryNotEnabled(ref cause) => cause,
ListPolicyAttachmentsError::InternalService(ref cause) => cause,
ListPolicyAttachmentsError::InvalidArn(ref cause) => cause,
ListPolicyAttachmentsError::InvalidNextToken(ref cause) => cause,
ListPolicyAttachmentsError::LimitExceeded(ref cause) => cause,
ListPolicyAttachmentsError::NotPolicy(ref cause) => cause,
ListPolicyAttachmentsError::ResourceNotFound(ref cause) => cause,
ListPolicyAttachmentsError::RetryableConflict(ref cause) => cause,
ListPolicyAttachmentsError::Validation(ref cause) => cause,
ListPolicyAttachmentsError::Credentials(ref err) => err.description(),
ListPolicyAttachmentsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPolicyAttachmentsError::ParseError(ref cause) => cause,
ListPolicyAttachmentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPublishedSchemaArnsError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPublishedSchemaArnsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPublishedSchemaArnsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListPublishedSchemaArnsError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ListPublishedSchemaArnsError::InternalService(String::from(
error_message,
));
}
"InvalidArnException" => {
return ListPublishedSchemaArnsError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListPublishedSchemaArnsError::InvalidNextToken(String::from(
error_message,
));
}
"LimitExceededException" => {
return ListPublishedSchemaArnsError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListPublishedSchemaArnsError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return ListPublishedSchemaArnsError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListPublishedSchemaArnsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListPublishedSchemaArnsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPublishedSchemaArnsError {
fn from(err: serde_json::error::Error) -> ListPublishedSchemaArnsError {
ListPublishedSchemaArnsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPublishedSchemaArnsError {
fn from(err: CredentialsError) -> ListPublishedSchemaArnsError {
ListPublishedSchemaArnsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPublishedSchemaArnsError {
fn from(err: HttpDispatchError) -> ListPublishedSchemaArnsError {
ListPublishedSchemaArnsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPublishedSchemaArnsError {
fn from(err: io::Error) -> ListPublishedSchemaArnsError {
ListPublishedSchemaArnsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPublishedSchemaArnsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPublishedSchemaArnsError {
fn description(&self) -> &str {
match *self {
ListPublishedSchemaArnsError::AccessDenied(ref cause) => cause,
ListPublishedSchemaArnsError::InternalService(ref cause) => cause,
ListPublishedSchemaArnsError::InvalidArn(ref cause) => cause,
ListPublishedSchemaArnsError::InvalidNextToken(ref cause) => cause,
ListPublishedSchemaArnsError::LimitExceeded(ref cause) => cause,
ListPublishedSchemaArnsError::ResourceNotFound(ref cause) => cause,
ListPublishedSchemaArnsError::RetryableConflict(ref cause) => cause,
ListPublishedSchemaArnsError::Validation(ref cause) => cause,
ListPublishedSchemaArnsError::Credentials(ref err) => err.description(),
ListPublishedSchemaArnsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPublishedSchemaArnsError::ParseError(ref cause) => cause,
ListPublishedSchemaArnsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidTaggingRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(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 error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListTagsForResourceError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ListTagsForResourceError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return ListTagsForResourceError::InvalidArn(String::from(error_message));
}
"InvalidTaggingRequestException" => {
return ListTagsForResourceError::InvalidTaggingRequest(String::from(
error_message,
));
}
"LimitExceededException" => {
return ListTagsForResourceError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListTagsForResourceError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return ListTagsForResourceError::RetryableConflict(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::AccessDenied(ref cause) => cause,
ListTagsForResourceError::InternalService(ref cause) => cause,
ListTagsForResourceError::InvalidArn(ref cause) => cause,
ListTagsForResourceError::InvalidTaggingRequest(ref cause) => cause,
ListTagsForResourceError::LimitExceeded(ref cause) => cause,
ListTagsForResourceError::ResourceNotFound(ref cause) => cause,
ListTagsForResourceError::RetryableConflict(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 ListTypedLinkFacetAttributesError {
AccessDenied(String),
FacetNotFound(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTypedLinkFacetAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> ListTypedLinkFacetAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListTypedLinkFacetAttributesError::AccessDenied(String::from(
error_message,
));
}
"FacetNotFoundException" => {
return ListTypedLinkFacetAttributesError::FacetNotFound(String::from(
error_message,
));
}
"InternalServiceException" => {
return ListTypedLinkFacetAttributesError::InternalService(String::from(
error_message,
));
}
"InvalidArnException" => {
return ListTypedLinkFacetAttributesError::InvalidArn(String::from(
error_message,
));
}
"InvalidNextTokenException" => {
return ListTypedLinkFacetAttributesError::InvalidNextToken(String::from(
error_message,
));
}
"LimitExceededException" => {
return ListTypedLinkFacetAttributesError::LimitExceeded(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return ListTypedLinkFacetAttributesError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return ListTypedLinkFacetAttributesError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListTypedLinkFacetAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTypedLinkFacetAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTypedLinkFacetAttributesError {
fn from(err: serde_json::error::Error) -> ListTypedLinkFacetAttributesError {
ListTypedLinkFacetAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTypedLinkFacetAttributesError {
fn from(err: CredentialsError) -> ListTypedLinkFacetAttributesError {
ListTypedLinkFacetAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTypedLinkFacetAttributesError {
fn from(err: HttpDispatchError) -> ListTypedLinkFacetAttributesError {
ListTypedLinkFacetAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTypedLinkFacetAttributesError {
fn from(err: io::Error) -> ListTypedLinkFacetAttributesError {
ListTypedLinkFacetAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTypedLinkFacetAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTypedLinkFacetAttributesError {
fn description(&self) -> &str {
match *self {
ListTypedLinkFacetAttributesError::AccessDenied(ref cause) => cause,
ListTypedLinkFacetAttributesError::FacetNotFound(ref cause) => cause,
ListTypedLinkFacetAttributesError::InternalService(ref cause) => cause,
ListTypedLinkFacetAttributesError::InvalidArn(ref cause) => cause,
ListTypedLinkFacetAttributesError::InvalidNextToken(ref cause) => cause,
ListTypedLinkFacetAttributesError::LimitExceeded(ref cause) => cause,
ListTypedLinkFacetAttributesError::ResourceNotFound(ref cause) => cause,
ListTypedLinkFacetAttributesError::RetryableConflict(ref cause) => cause,
ListTypedLinkFacetAttributesError::Validation(ref cause) => cause,
ListTypedLinkFacetAttributesError::Credentials(ref err) => err.description(),
ListTypedLinkFacetAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTypedLinkFacetAttributesError::ParseError(ref cause) => cause,
ListTypedLinkFacetAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTypedLinkFacetNamesError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTypedLinkFacetNamesError {
pub fn from_response(res: BufferedHttpResponse) -> ListTypedLinkFacetNamesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return ListTypedLinkFacetNamesError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return ListTypedLinkFacetNamesError::InternalService(String::from(
error_message,
));
}
"InvalidArnException" => {
return ListTypedLinkFacetNamesError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return ListTypedLinkFacetNamesError::InvalidNextToken(String::from(
error_message,
));
}
"LimitExceededException" => {
return ListTypedLinkFacetNamesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListTypedLinkFacetNamesError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return ListTypedLinkFacetNamesError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return ListTypedLinkFacetNamesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTypedLinkFacetNamesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTypedLinkFacetNamesError {
fn from(err: serde_json::error::Error) -> ListTypedLinkFacetNamesError {
ListTypedLinkFacetNamesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTypedLinkFacetNamesError {
fn from(err: CredentialsError) -> ListTypedLinkFacetNamesError {
ListTypedLinkFacetNamesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTypedLinkFacetNamesError {
fn from(err: HttpDispatchError) -> ListTypedLinkFacetNamesError {
ListTypedLinkFacetNamesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTypedLinkFacetNamesError {
fn from(err: io::Error) -> ListTypedLinkFacetNamesError {
ListTypedLinkFacetNamesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTypedLinkFacetNamesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTypedLinkFacetNamesError {
fn description(&self) -> &str {
match *self {
ListTypedLinkFacetNamesError::AccessDenied(ref cause) => cause,
ListTypedLinkFacetNamesError::InternalService(ref cause) => cause,
ListTypedLinkFacetNamesError::InvalidArn(ref cause) => cause,
ListTypedLinkFacetNamesError::InvalidNextToken(ref cause) => cause,
ListTypedLinkFacetNamesError::LimitExceeded(ref cause) => cause,
ListTypedLinkFacetNamesError::ResourceNotFound(ref cause) => cause,
ListTypedLinkFacetNamesError::RetryableConflict(ref cause) => cause,
ListTypedLinkFacetNamesError::Validation(ref cause) => cause,
ListTypedLinkFacetNamesError::Credentials(ref err) => err.description(),
ListTypedLinkFacetNamesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTypedLinkFacetNamesError::ParseError(ref cause) => cause,
ListTypedLinkFacetNamesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum LookupPolicyError {
AccessDenied(String),
DirectoryNotEnabled(String),
InternalService(String),
InvalidArn(String),
InvalidNextToken(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl LookupPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> LookupPolicyError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return LookupPolicyError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return LookupPolicyError::DirectoryNotEnabled(String::from(error_message));
}
"InternalServiceException" => {
return LookupPolicyError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return LookupPolicyError::InvalidArn(String::from(error_message));
}
"InvalidNextTokenException" => {
return LookupPolicyError::InvalidNextToken(String::from(error_message));
}
"LimitExceededException" => {
return LookupPolicyError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return LookupPolicyError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return LookupPolicyError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return LookupPolicyError::Validation(error_message.to_string());
}
_ => {}
}
}
return LookupPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for LookupPolicyError {
fn from(err: serde_json::error::Error) -> LookupPolicyError {
LookupPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for LookupPolicyError {
fn from(err: CredentialsError) -> LookupPolicyError {
LookupPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for LookupPolicyError {
fn from(err: HttpDispatchError) -> LookupPolicyError {
LookupPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for LookupPolicyError {
fn from(err: io::Error) -> LookupPolicyError {
LookupPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for LookupPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for LookupPolicyError {
fn description(&self) -> &str {
match *self {
LookupPolicyError::AccessDenied(ref cause) => cause,
LookupPolicyError::DirectoryNotEnabled(ref cause) => cause,
LookupPolicyError::InternalService(ref cause) => cause,
LookupPolicyError::InvalidArn(ref cause) => cause,
LookupPolicyError::InvalidNextToken(ref cause) => cause,
LookupPolicyError::LimitExceeded(ref cause) => cause,
LookupPolicyError::ResourceNotFound(ref cause) => cause,
LookupPolicyError::RetryableConflict(ref cause) => cause,
LookupPolicyError::Validation(ref cause) => cause,
LookupPolicyError::Credentials(ref err) => err.description(),
LookupPolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
LookupPolicyError::ParseError(ref cause) => cause,
LookupPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PublishSchemaError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
SchemaAlreadyPublished(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PublishSchemaError {
pub fn from_response(res: BufferedHttpResponse) -> PublishSchemaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return PublishSchemaError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return PublishSchemaError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return PublishSchemaError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return PublishSchemaError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return PublishSchemaError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return PublishSchemaError::RetryableConflict(String::from(error_message));
}
"SchemaAlreadyPublishedException" => {
return PublishSchemaError::SchemaAlreadyPublished(String::from(error_message));
}
"ValidationException" => {
return PublishSchemaError::Validation(error_message.to_string());
}
_ => {}
}
}
return PublishSchemaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PublishSchemaError {
fn from(err: serde_json::error::Error) -> PublishSchemaError {
PublishSchemaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PublishSchemaError {
fn from(err: CredentialsError) -> PublishSchemaError {
PublishSchemaError::Credentials(err)
}
}
impl From<HttpDispatchError> for PublishSchemaError {
fn from(err: HttpDispatchError) -> PublishSchemaError {
PublishSchemaError::HttpDispatch(err)
}
}
impl From<io::Error> for PublishSchemaError {
fn from(err: io::Error) -> PublishSchemaError {
PublishSchemaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PublishSchemaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PublishSchemaError {
fn description(&self) -> &str {
match *self {
PublishSchemaError::AccessDenied(ref cause) => cause,
PublishSchemaError::InternalService(ref cause) => cause,
PublishSchemaError::InvalidArn(ref cause) => cause,
PublishSchemaError::LimitExceeded(ref cause) => cause,
PublishSchemaError::ResourceNotFound(ref cause) => cause,
PublishSchemaError::RetryableConflict(ref cause) => cause,
PublishSchemaError::SchemaAlreadyPublished(ref cause) => cause,
PublishSchemaError::Validation(ref cause) => cause,
PublishSchemaError::Credentials(ref err) => err.description(),
PublishSchemaError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PublishSchemaError::ParseError(ref cause) => cause,
PublishSchemaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutSchemaFromJsonError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidRule(String),
InvalidSchemaDoc(String),
LimitExceeded(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutSchemaFromJsonError {
pub fn from_response(res: BufferedHttpResponse) -> PutSchemaFromJsonError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return PutSchemaFromJsonError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return PutSchemaFromJsonError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return PutSchemaFromJsonError::InvalidArn(String::from(error_message));
}
"InvalidRuleException" => {
return PutSchemaFromJsonError::InvalidRule(String::from(error_message));
}
"InvalidSchemaDocException" => {
return PutSchemaFromJsonError::InvalidSchemaDoc(String::from(error_message));
}
"LimitExceededException" => {
return PutSchemaFromJsonError::LimitExceeded(String::from(error_message));
}
"RetryableConflictException" => {
return PutSchemaFromJsonError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return PutSchemaFromJsonError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutSchemaFromJsonError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutSchemaFromJsonError {
fn from(err: serde_json::error::Error) -> PutSchemaFromJsonError {
PutSchemaFromJsonError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutSchemaFromJsonError {
fn from(err: CredentialsError) -> PutSchemaFromJsonError {
PutSchemaFromJsonError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutSchemaFromJsonError {
fn from(err: HttpDispatchError) -> PutSchemaFromJsonError {
PutSchemaFromJsonError::HttpDispatch(err)
}
}
impl From<io::Error> for PutSchemaFromJsonError {
fn from(err: io::Error) -> PutSchemaFromJsonError {
PutSchemaFromJsonError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutSchemaFromJsonError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutSchemaFromJsonError {
fn description(&self) -> &str {
match *self {
PutSchemaFromJsonError::AccessDenied(ref cause) => cause,
PutSchemaFromJsonError::InternalService(ref cause) => cause,
PutSchemaFromJsonError::InvalidArn(ref cause) => cause,
PutSchemaFromJsonError::InvalidRule(ref cause) => cause,
PutSchemaFromJsonError::InvalidSchemaDoc(ref cause) => cause,
PutSchemaFromJsonError::LimitExceeded(ref cause) => cause,
PutSchemaFromJsonError::RetryableConflict(ref cause) => cause,
PutSchemaFromJsonError::Validation(ref cause) => cause,
PutSchemaFromJsonError::Credentials(ref err) => err.description(),
PutSchemaFromJsonError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutSchemaFromJsonError::ParseError(ref cause) => cause,
PutSchemaFromJsonError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RemoveFacetFromObjectError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RemoveFacetFromObjectError {
pub fn from_response(res: BufferedHttpResponse) -> RemoveFacetFromObjectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return RemoveFacetFromObjectError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return RemoveFacetFromObjectError::DirectoryNotEnabled(String::from(
error_message,
));
}
"FacetValidationException" => {
return RemoveFacetFromObjectError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return RemoveFacetFromObjectError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return RemoveFacetFromObjectError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return RemoveFacetFromObjectError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return RemoveFacetFromObjectError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return RemoveFacetFromObjectError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return RemoveFacetFromObjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return RemoveFacetFromObjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RemoveFacetFromObjectError {
fn from(err: serde_json::error::Error) -> RemoveFacetFromObjectError {
RemoveFacetFromObjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RemoveFacetFromObjectError {
fn from(err: CredentialsError) -> RemoveFacetFromObjectError {
RemoveFacetFromObjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for RemoveFacetFromObjectError {
fn from(err: HttpDispatchError) -> RemoveFacetFromObjectError {
RemoveFacetFromObjectError::HttpDispatch(err)
}
}
impl From<io::Error> for RemoveFacetFromObjectError {
fn from(err: io::Error) -> RemoveFacetFromObjectError {
RemoveFacetFromObjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RemoveFacetFromObjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RemoveFacetFromObjectError {
fn description(&self) -> &str {
match *self {
RemoveFacetFromObjectError::AccessDenied(ref cause) => cause,
RemoveFacetFromObjectError::DirectoryNotEnabled(ref cause) => cause,
RemoveFacetFromObjectError::FacetValidation(ref cause) => cause,
RemoveFacetFromObjectError::InternalService(ref cause) => cause,
RemoveFacetFromObjectError::InvalidArn(ref cause) => cause,
RemoveFacetFromObjectError::LimitExceeded(ref cause) => cause,
RemoveFacetFromObjectError::ResourceNotFound(ref cause) => cause,
RemoveFacetFromObjectError::RetryableConflict(ref cause) => cause,
RemoveFacetFromObjectError::Validation(ref cause) => cause,
RemoveFacetFromObjectError::Credentials(ref err) => err.description(),
RemoveFacetFromObjectError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RemoveFacetFromObjectError::ParseError(ref cause) => cause,
RemoveFacetFromObjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidTaggingRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> TagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return TagResourceError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return TagResourceError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return TagResourceError::InvalidArn(String::from(error_message));
}
"InvalidTaggingRequestException" => {
return TagResourceError::InvalidTaggingRequest(String::from(error_message));
}
"LimitExceededException" => {
return TagResourceError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return TagResourceError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return TagResourceError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return TagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return TagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TagResourceError {
fn from(err: serde_json::error::Error) -> TagResourceError {
TagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TagResourceError {
fn from(err: CredentialsError) -> TagResourceError {
TagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for TagResourceError {
fn from(err: HttpDispatchError) -> TagResourceError {
TagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for TagResourceError {
fn from(err: io::Error) -> TagResourceError {
TagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::AccessDenied(ref cause) => cause,
TagResourceError::InternalService(ref cause) => cause,
TagResourceError::InvalidArn(ref cause) => cause,
TagResourceError::InvalidTaggingRequest(ref cause) => cause,
TagResourceError::LimitExceeded(ref cause) => cause,
TagResourceError::ResourceNotFound(ref cause) => cause,
TagResourceError::RetryableConflict(ref cause) => cause,
TagResourceError::Validation(ref cause) => cause,
TagResourceError::Credentials(ref err) => err.description(),
TagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TagResourceError::ParseError(ref cause) => cause,
TagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
InvalidTaggingRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> UntagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UntagResourceError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return UntagResourceError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UntagResourceError::InvalidArn(String::from(error_message));
}
"InvalidTaggingRequestException" => {
return UntagResourceError::InvalidTaggingRequest(String::from(error_message));
}
"LimitExceededException" => {
return UntagResourceError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UntagResourceError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return UntagResourceError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return UntagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return UntagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UntagResourceError {
fn from(err: serde_json::error::Error) -> UntagResourceError {
UntagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UntagResourceError {
fn from(err: CredentialsError) -> UntagResourceError {
UntagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UntagResourceError {
fn from(err: HttpDispatchError) -> UntagResourceError {
UntagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for UntagResourceError {
fn from(err: io::Error) -> UntagResourceError {
UntagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::AccessDenied(ref cause) => cause,
UntagResourceError::InternalService(ref cause) => cause,
UntagResourceError::InvalidArn(ref cause) => cause,
UntagResourceError::InvalidTaggingRequest(ref cause) => cause,
UntagResourceError::LimitExceeded(ref cause) => cause,
UntagResourceError::ResourceNotFound(ref cause) => cause,
UntagResourceError::RetryableConflict(ref cause) => cause,
UntagResourceError::Validation(ref cause) => cause,
UntagResourceError::Credentials(ref err) => err.description(),
UntagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UntagResourceError::ParseError(ref cause) => cause,
UntagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateFacetError {
AccessDenied(String),
FacetNotFound(String),
InternalService(String),
InvalidArn(String),
InvalidFacetUpdate(String),
InvalidRule(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateFacetError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateFacetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UpdateFacetError::AccessDenied(String::from(error_message));
}
"FacetNotFoundException" => {
return UpdateFacetError::FacetNotFound(String::from(error_message));
}
"InternalServiceException" => {
return UpdateFacetError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UpdateFacetError::InvalidArn(String::from(error_message));
}
"InvalidFacetUpdateException" => {
return UpdateFacetError::InvalidFacetUpdate(String::from(error_message));
}
"InvalidRuleException" => {
return UpdateFacetError::InvalidRule(String::from(error_message));
}
"LimitExceededException" => {
return UpdateFacetError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateFacetError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return UpdateFacetError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return UpdateFacetError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateFacetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateFacetError {
fn from(err: serde_json::error::Error) -> UpdateFacetError {
UpdateFacetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateFacetError {
fn from(err: CredentialsError) -> UpdateFacetError {
UpdateFacetError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateFacetError {
fn from(err: HttpDispatchError) -> UpdateFacetError {
UpdateFacetError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateFacetError {
fn from(err: io::Error) -> UpdateFacetError {
UpdateFacetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateFacetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateFacetError {
fn description(&self) -> &str {
match *self {
UpdateFacetError::AccessDenied(ref cause) => cause,
UpdateFacetError::FacetNotFound(ref cause) => cause,
UpdateFacetError::InternalService(ref cause) => cause,
UpdateFacetError::InvalidArn(ref cause) => cause,
UpdateFacetError::InvalidFacetUpdate(ref cause) => cause,
UpdateFacetError::InvalidRule(ref cause) => cause,
UpdateFacetError::LimitExceeded(ref cause) => cause,
UpdateFacetError::ResourceNotFound(ref cause) => cause,
UpdateFacetError::RetryableConflict(ref cause) => cause,
UpdateFacetError::Validation(ref cause) => cause,
UpdateFacetError::Credentials(ref err) => err.description(),
UpdateFacetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateFacetError::ParseError(ref cause) => cause,
UpdateFacetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateLinkAttributesError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateLinkAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateLinkAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UpdateLinkAttributesError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return UpdateLinkAttributesError::DirectoryNotEnabled(String::from(
error_message,
));
}
"FacetValidationException" => {
return UpdateLinkAttributesError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return UpdateLinkAttributesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UpdateLinkAttributesError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return UpdateLinkAttributesError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateLinkAttributesError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return UpdateLinkAttributesError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return UpdateLinkAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateLinkAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateLinkAttributesError {
fn from(err: serde_json::error::Error) -> UpdateLinkAttributesError {
UpdateLinkAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateLinkAttributesError {
fn from(err: CredentialsError) -> UpdateLinkAttributesError {
UpdateLinkAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateLinkAttributesError {
fn from(err: HttpDispatchError) -> UpdateLinkAttributesError {
UpdateLinkAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateLinkAttributesError {
fn from(err: io::Error) -> UpdateLinkAttributesError {
UpdateLinkAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateLinkAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateLinkAttributesError {
fn description(&self) -> &str {
match *self {
UpdateLinkAttributesError::AccessDenied(ref cause) => cause,
UpdateLinkAttributesError::DirectoryNotEnabled(ref cause) => cause,
UpdateLinkAttributesError::FacetValidation(ref cause) => cause,
UpdateLinkAttributesError::InternalService(ref cause) => cause,
UpdateLinkAttributesError::InvalidArn(ref cause) => cause,
UpdateLinkAttributesError::LimitExceeded(ref cause) => cause,
UpdateLinkAttributesError::ResourceNotFound(ref cause) => cause,
UpdateLinkAttributesError::RetryableConflict(ref cause) => cause,
UpdateLinkAttributesError::Validation(ref cause) => cause,
UpdateLinkAttributesError::Credentials(ref err) => err.description(),
UpdateLinkAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateLinkAttributesError::ParseError(ref cause) => cause,
UpdateLinkAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateObjectAttributesError {
AccessDenied(String),
DirectoryNotEnabled(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
LinkNameAlreadyInUse(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateObjectAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateObjectAttributesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UpdateObjectAttributesError::AccessDenied(String::from(error_message));
}
"DirectoryNotEnabledException" => {
return UpdateObjectAttributesError::DirectoryNotEnabled(String::from(
error_message,
));
}
"FacetValidationException" => {
return UpdateObjectAttributesError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return UpdateObjectAttributesError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UpdateObjectAttributesError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return UpdateObjectAttributesError::LimitExceeded(String::from(error_message));
}
"LinkNameAlreadyInUseException" => {
return UpdateObjectAttributesError::LinkNameAlreadyInUse(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return UpdateObjectAttributesError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return UpdateObjectAttributesError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateObjectAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateObjectAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateObjectAttributesError {
fn from(err: serde_json::error::Error) -> UpdateObjectAttributesError {
UpdateObjectAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateObjectAttributesError {
fn from(err: CredentialsError) -> UpdateObjectAttributesError {
UpdateObjectAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateObjectAttributesError {
fn from(err: HttpDispatchError) -> UpdateObjectAttributesError {
UpdateObjectAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateObjectAttributesError {
fn from(err: io::Error) -> UpdateObjectAttributesError {
UpdateObjectAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateObjectAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateObjectAttributesError {
fn description(&self) -> &str {
match *self {
UpdateObjectAttributesError::AccessDenied(ref cause) => cause,
UpdateObjectAttributesError::DirectoryNotEnabled(ref cause) => cause,
UpdateObjectAttributesError::FacetValidation(ref cause) => cause,
UpdateObjectAttributesError::InternalService(ref cause) => cause,
UpdateObjectAttributesError::InvalidArn(ref cause) => cause,
UpdateObjectAttributesError::LimitExceeded(ref cause) => cause,
UpdateObjectAttributesError::LinkNameAlreadyInUse(ref cause) => cause,
UpdateObjectAttributesError::ResourceNotFound(ref cause) => cause,
UpdateObjectAttributesError::RetryableConflict(ref cause) => cause,
UpdateObjectAttributesError::Validation(ref cause) => cause,
UpdateObjectAttributesError::Credentials(ref err) => err.description(),
UpdateObjectAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateObjectAttributesError::ParseError(ref cause) => cause,
UpdateObjectAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateSchemaError {
AccessDenied(String),
InternalService(String),
InvalidArn(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateSchemaError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateSchemaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UpdateSchemaError::AccessDenied(String::from(error_message));
}
"InternalServiceException" => {
return UpdateSchemaError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UpdateSchemaError::InvalidArn(String::from(error_message));
}
"LimitExceededException" => {
return UpdateSchemaError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateSchemaError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return UpdateSchemaError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return UpdateSchemaError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateSchemaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateSchemaError {
fn from(err: serde_json::error::Error) -> UpdateSchemaError {
UpdateSchemaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateSchemaError {
fn from(err: CredentialsError) -> UpdateSchemaError {
UpdateSchemaError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateSchemaError {
fn from(err: HttpDispatchError) -> UpdateSchemaError {
UpdateSchemaError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateSchemaError {
fn from(err: io::Error) -> UpdateSchemaError {
UpdateSchemaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateSchemaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateSchemaError {
fn description(&self) -> &str {
match *self {
UpdateSchemaError::AccessDenied(ref cause) => cause,
UpdateSchemaError::InternalService(ref cause) => cause,
UpdateSchemaError::InvalidArn(ref cause) => cause,
UpdateSchemaError::LimitExceeded(ref cause) => cause,
UpdateSchemaError::ResourceNotFound(ref cause) => cause,
UpdateSchemaError::RetryableConflict(ref cause) => cause,
UpdateSchemaError::Validation(ref cause) => cause,
UpdateSchemaError::Credentials(ref err) => err.description(),
UpdateSchemaError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateSchemaError::ParseError(ref cause) => cause,
UpdateSchemaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateTypedLinkFacetError {
AccessDenied(String),
FacetNotFound(String),
FacetValidation(String),
InternalService(String),
InvalidArn(String),
InvalidFacetUpdate(String),
InvalidRule(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateTypedLinkFacetError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateTypedLinkFacetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UpdateTypedLinkFacetError::AccessDenied(String::from(error_message));
}
"FacetNotFoundException" => {
return UpdateTypedLinkFacetError::FacetNotFound(String::from(error_message));
}
"FacetValidationException" => {
return UpdateTypedLinkFacetError::FacetValidation(String::from(error_message));
}
"InternalServiceException" => {
return UpdateTypedLinkFacetError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UpdateTypedLinkFacetError::InvalidArn(String::from(error_message));
}
"InvalidFacetUpdateException" => {
return UpdateTypedLinkFacetError::InvalidFacetUpdate(String::from(
error_message,
));
}
"InvalidRuleException" => {
return UpdateTypedLinkFacetError::InvalidRule(String::from(error_message));
}
"LimitExceededException" => {
return UpdateTypedLinkFacetError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateTypedLinkFacetError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return UpdateTypedLinkFacetError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return UpdateTypedLinkFacetError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateTypedLinkFacetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateTypedLinkFacetError {
fn from(err: serde_json::error::Error) -> UpdateTypedLinkFacetError {
UpdateTypedLinkFacetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateTypedLinkFacetError {
fn from(err: CredentialsError) -> UpdateTypedLinkFacetError {
UpdateTypedLinkFacetError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateTypedLinkFacetError {
fn from(err: HttpDispatchError) -> UpdateTypedLinkFacetError {
UpdateTypedLinkFacetError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateTypedLinkFacetError {
fn from(err: io::Error) -> UpdateTypedLinkFacetError {
UpdateTypedLinkFacetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateTypedLinkFacetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateTypedLinkFacetError {
fn description(&self) -> &str {
match *self {
UpdateTypedLinkFacetError::AccessDenied(ref cause) => cause,
UpdateTypedLinkFacetError::FacetNotFound(ref cause) => cause,
UpdateTypedLinkFacetError::FacetValidation(ref cause) => cause,
UpdateTypedLinkFacetError::InternalService(ref cause) => cause,
UpdateTypedLinkFacetError::InvalidArn(ref cause) => cause,
UpdateTypedLinkFacetError::InvalidFacetUpdate(ref cause) => cause,
UpdateTypedLinkFacetError::InvalidRule(ref cause) => cause,
UpdateTypedLinkFacetError::LimitExceeded(ref cause) => cause,
UpdateTypedLinkFacetError::ResourceNotFound(ref cause) => cause,
UpdateTypedLinkFacetError::RetryableConflict(ref cause) => cause,
UpdateTypedLinkFacetError::Validation(ref cause) => cause,
UpdateTypedLinkFacetError::Credentials(ref err) => err.description(),
UpdateTypedLinkFacetError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateTypedLinkFacetError::ParseError(ref cause) => cause,
UpdateTypedLinkFacetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpgradeAppliedSchemaError {
AccessDenied(String),
IncompatibleSchema(String),
InternalService(String),
InvalidArn(String),
InvalidAttachment(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpgradeAppliedSchemaError {
pub fn from_response(res: BufferedHttpResponse) -> UpgradeAppliedSchemaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UpgradeAppliedSchemaError::AccessDenied(String::from(error_message));
}
"IncompatibleSchemaException" => {
return UpgradeAppliedSchemaError::IncompatibleSchema(String::from(
error_message,
));
}
"InternalServiceException" => {
return UpgradeAppliedSchemaError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UpgradeAppliedSchemaError::InvalidArn(String::from(error_message));
}
"InvalidAttachmentException" => {
return UpgradeAppliedSchemaError::InvalidAttachment(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpgradeAppliedSchemaError::ResourceNotFound(String::from(error_message));
}
"RetryableConflictException" => {
return UpgradeAppliedSchemaError::RetryableConflict(String::from(error_message));
}
"ValidationException" => {
return UpgradeAppliedSchemaError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpgradeAppliedSchemaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpgradeAppliedSchemaError {
fn from(err: serde_json::error::Error) -> UpgradeAppliedSchemaError {
UpgradeAppliedSchemaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpgradeAppliedSchemaError {
fn from(err: CredentialsError) -> UpgradeAppliedSchemaError {
UpgradeAppliedSchemaError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpgradeAppliedSchemaError {
fn from(err: HttpDispatchError) -> UpgradeAppliedSchemaError {
UpgradeAppliedSchemaError::HttpDispatch(err)
}
}
impl From<io::Error> for UpgradeAppliedSchemaError {
fn from(err: io::Error) -> UpgradeAppliedSchemaError {
UpgradeAppliedSchemaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpgradeAppliedSchemaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpgradeAppliedSchemaError {
fn description(&self) -> &str {
match *self {
UpgradeAppliedSchemaError::AccessDenied(ref cause) => cause,
UpgradeAppliedSchemaError::IncompatibleSchema(ref cause) => cause,
UpgradeAppliedSchemaError::InternalService(ref cause) => cause,
UpgradeAppliedSchemaError::InvalidArn(ref cause) => cause,
UpgradeAppliedSchemaError::InvalidAttachment(ref cause) => cause,
UpgradeAppliedSchemaError::ResourceNotFound(ref cause) => cause,
UpgradeAppliedSchemaError::RetryableConflict(ref cause) => cause,
UpgradeAppliedSchemaError::Validation(ref cause) => cause,
UpgradeAppliedSchemaError::Credentials(ref err) => err.description(),
UpgradeAppliedSchemaError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpgradeAppliedSchemaError::ParseError(ref cause) => cause,
UpgradeAppliedSchemaError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpgradePublishedSchemaError {
AccessDenied(String),
IncompatibleSchema(String),
InternalService(String),
InvalidArn(String),
InvalidAttachment(String),
LimitExceeded(String),
ResourceNotFound(String),
RetryableConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpgradePublishedSchemaError {
pub fn from_response(res: BufferedHttpResponse) -> UpgradePublishedSchemaError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"AccessDeniedException" => {
return UpgradePublishedSchemaError::AccessDenied(String::from(error_message));
}
"IncompatibleSchemaException" => {
return UpgradePublishedSchemaError::IncompatibleSchema(String::from(
error_message,
));
}
"InternalServiceException" => {
return UpgradePublishedSchemaError::InternalService(String::from(error_message));
}
"InvalidArnException" => {
return UpgradePublishedSchemaError::InvalidArn(String::from(error_message));
}
"InvalidAttachmentException" => {
return UpgradePublishedSchemaError::InvalidAttachment(String::from(
error_message,
));
}
"LimitExceededException" => {
return UpgradePublishedSchemaError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpgradePublishedSchemaError::ResourceNotFound(String::from(
error_message,
));
}
"RetryableConflictException" => {
return UpgradePublishedSchemaError::RetryableConflict(String::from(
error_message,
));
}
"ValidationException" => {
return UpgradePublishedSchemaError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpgradePublishedSchemaError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpgradePublishedSchemaError {
fn from(err: serde_json::error::Error) -> UpgradePublishedSchemaError {
UpgradePublishedSchemaError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpgradePublishedSchemaError {
fn from(err: CredentialsError) -> UpgradePublishedSchemaError {
UpgradePublishedSchemaError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpgradePublishedSchemaError {
fn from(err: HttpDispatchError) -> UpgradePublishedSchemaError {
UpgradePublishedSchemaError::HttpDispatch(err)
}
}
impl From<io::Error> for UpgradePublishedSchemaError {
fn from(err: io::Error) -> UpgradePublishedSchemaError {
UpgradePublishedSchemaError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpgradePublishedSchemaError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpgradePublishedSchemaError {
fn description(&self) -> &str {
match *self {
UpgradePublishedSchemaError::AccessDenied(ref cause) => cause,
UpgradePublishedSchemaError::IncompatibleSchema(ref cause) => cause,
UpgradePublishedSchemaError::InternalService(ref cause) => cause,
UpgradePublishedSchemaError::InvalidArn(ref cause) => cause,
UpgradePublishedSchemaError::InvalidAttachment(ref cause) => cause,
UpgradePublishedSchemaError::LimitExceeded(ref cause) => cause,
UpgradePublishedSchemaError::ResourceNotFound(ref cause) => cause,
UpgradePublishedSchemaError::RetryableConflict(ref cause) => cause,
UpgradePublishedSchemaError::Validation(ref cause) => cause,
UpgradePublishedSchemaError::Credentials(ref err) => err.description(),
UpgradePublishedSchemaError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpgradePublishedSchemaError::ParseError(ref cause) => cause,
UpgradePublishedSchemaError::Unknown(_) => "unknown error",
}
}
}
pub trait CloudDirectory {
fn add_facet_to_object(
&self,
input: AddFacetToObjectRequest,
) -> RusotoFuture<AddFacetToObjectResponse, AddFacetToObjectError>;
fn apply_schema(
&self,
input: ApplySchemaRequest,
) -> RusotoFuture<ApplySchemaResponse, ApplySchemaError>;
fn attach_object(
&self,
input: AttachObjectRequest,
) -> RusotoFuture<AttachObjectResponse, AttachObjectError>;
fn attach_policy(
&self,
input: AttachPolicyRequest,
) -> RusotoFuture<AttachPolicyResponse, AttachPolicyError>;
fn attach_to_index(
&self,
input: AttachToIndexRequest,
) -> RusotoFuture<AttachToIndexResponse, AttachToIndexError>;
fn attach_typed_link(
&self,
input: AttachTypedLinkRequest,
) -> RusotoFuture<AttachTypedLinkResponse, AttachTypedLinkError>;
fn batch_read(
&self,
input: BatchReadRequest,
) -> RusotoFuture<BatchReadResponse, BatchReadError>;
fn batch_write(
&self,
input: BatchWriteRequest,
) -> RusotoFuture<BatchWriteResponse, BatchWriteError>;
fn create_directory(
&self,
input: CreateDirectoryRequest,
) -> RusotoFuture<CreateDirectoryResponse, CreateDirectoryError>;
fn create_facet(
&self,
input: CreateFacetRequest,
) -> RusotoFuture<CreateFacetResponse, CreateFacetError>;
fn create_index(
&self,
input: CreateIndexRequest,
) -> RusotoFuture<CreateIndexResponse, CreateIndexError>;
fn create_object(
&self,
input: CreateObjectRequest,
) -> RusotoFuture<CreateObjectResponse, CreateObjectError>;
fn create_schema(
&self,
input: CreateSchemaRequest,
) -> RusotoFuture<CreateSchemaResponse, CreateSchemaError>;
fn create_typed_link_facet(
&self,
input: CreateTypedLinkFacetRequest,
) -> RusotoFuture<CreateTypedLinkFacetResponse, CreateTypedLinkFacetError>;
fn delete_directory(
&self,
input: DeleteDirectoryRequest,
) -> RusotoFuture<DeleteDirectoryResponse, DeleteDirectoryError>;
fn delete_facet(
&self,
input: DeleteFacetRequest,
) -> RusotoFuture<DeleteFacetResponse, DeleteFacetError>;
fn delete_object(
&self,
input: DeleteObjectRequest,
) -> RusotoFuture<DeleteObjectResponse, DeleteObjectError>;
fn delete_schema(
&self,
input: DeleteSchemaRequest,
) -> RusotoFuture<DeleteSchemaResponse, DeleteSchemaError>;
fn delete_typed_link_facet(
&self,
input: DeleteTypedLinkFacetRequest,
) -> RusotoFuture<DeleteTypedLinkFacetResponse, DeleteTypedLinkFacetError>;
fn detach_from_index(
&self,
input: DetachFromIndexRequest,
) -> RusotoFuture<DetachFromIndexResponse, DetachFromIndexError>;
fn detach_object(
&self,
input: DetachObjectRequest,
) -> RusotoFuture<DetachObjectResponse, DetachObjectError>;
fn detach_policy(
&self,
input: DetachPolicyRequest,
) -> RusotoFuture<DetachPolicyResponse, DetachPolicyError>;
fn detach_typed_link(
&self,
input: DetachTypedLinkRequest,
) -> RusotoFuture<(), DetachTypedLinkError>;
fn disable_directory(
&self,
input: DisableDirectoryRequest,
) -> RusotoFuture<DisableDirectoryResponse, DisableDirectoryError>;
fn enable_directory(
&self,
input: EnableDirectoryRequest,
) -> RusotoFuture<EnableDirectoryResponse, EnableDirectoryError>;
fn get_applied_schema_version(
&self,
input: GetAppliedSchemaVersionRequest,
) -> RusotoFuture<GetAppliedSchemaVersionResponse, GetAppliedSchemaVersionError>;
fn get_directory(
&self,
input: GetDirectoryRequest,
) -> RusotoFuture<GetDirectoryResponse, GetDirectoryError>;
fn get_facet(&self, input: GetFacetRequest) -> RusotoFuture<GetFacetResponse, GetFacetError>;
fn get_link_attributes(
&self,
input: GetLinkAttributesRequest,
) -> RusotoFuture<GetLinkAttributesResponse, GetLinkAttributesError>;
fn get_object_attributes(
&self,
input: GetObjectAttributesRequest,
) -> RusotoFuture<GetObjectAttributesResponse, GetObjectAttributesError>;
fn get_object_information(
&self,
input: GetObjectInformationRequest,
) -> RusotoFuture<GetObjectInformationResponse, GetObjectInformationError>;
fn get_schema_as_json(
&self,
input: GetSchemaAsJsonRequest,
) -> RusotoFuture<GetSchemaAsJsonResponse, GetSchemaAsJsonError>;
fn get_typed_link_facet_information(
&self,
input: GetTypedLinkFacetInformationRequest,
) -> RusotoFuture<GetTypedLinkFacetInformationResponse, GetTypedLinkFacetInformationError>;
fn list_applied_schema_arns(
&self,
input: ListAppliedSchemaArnsRequest,
) -> RusotoFuture<ListAppliedSchemaArnsResponse, ListAppliedSchemaArnsError>;
fn list_attached_indices(
&self,
input: ListAttachedIndicesRequest,
) -> RusotoFuture<ListAttachedIndicesResponse, ListAttachedIndicesError>;
fn list_development_schema_arns(
&self,
input: ListDevelopmentSchemaArnsRequest,
) -> RusotoFuture<ListDevelopmentSchemaArnsResponse, ListDevelopmentSchemaArnsError>;
fn list_directories(
&self,
input: ListDirectoriesRequest,
) -> RusotoFuture<ListDirectoriesResponse, ListDirectoriesError>;
fn list_facet_attributes(
&self,
input: ListFacetAttributesRequest,
) -> RusotoFuture<ListFacetAttributesResponse, ListFacetAttributesError>;
fn list_facet_names(
&self,
input: ListFacetNamesRequest,
) -> RusotoFuture<ListFacetNamesResponse, ListFacetNamesError>;
fn list_incoming_typed_links(
&self,
input: ListIncomingTypedLinksRequest,
) -> RusotoFuture<ListIncomingTypedLinksResponse, ListIncomingTypedLinksError>;
fn list_index(
&self,
input: ListIndexRequest,
) -> RusotoFuture<ListIndexResponse, ListIndexError>;
fn list_object_attributes(
&self,
input: ListObjectAttributesRequest,
) -> RusotoFuture<ListObjectAttributesResponse, ListObjectAttributesError>;
fn list_object_children(
&self,
input: ListObjectChildrenRequest,
) -> RusotoFuture<ListObjectChildrenResponse, ListObjectChildrenError>;
fn list_object_parent_paths(
&self,
input: ListObjectParentPathsRequest,
) -> RusotoFuture<ListObjectParentPathsResponse, ListObjectParentPathsError>;
fn list_object_parents(
&self,
input: ListObjectParentsRequest,
) -> RusotoFuture<ListObjectParentsResponse, ListObjectParentsError>;
fn list_object_policies(
&self,
input: ListObjectPoliciesRequest,
) -> RusotoFuture<ListObjectPoliciesResponse, ListObjectPoliciesError>;
fn list_outgoing_typed_links(
&self,
input: ListOutgoingTypedLinksRequest,
) -> RusotoFuture<ListOutgoingTypedLinksResponse, ListOutgoingTypedLinksError>;
fn list_policy_attachments(
&self,
input: ListPolicyAttachmentsRequest,
) -> RusotoFuture<ListPolicyAttachmentsResponse, ListPolicyAttachmentsError>;
fn list_published_schema_arns(
&self,
input: ListPublishedSchemaArnsRequest,
) -> RusotoFuture<ListPublishedSchemaArnsResponse, ListPublishedSchemaArnsError>;
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError>;
fn list_typed_link_facet_attributes(
&self,
input: ListTypedLinkFacetAttributesRequest,
) -> RusotoFuture<ListTypedLinkFacetAttributesResponse, ListTypedLinkFacetAttributesError>;
fn list_typed_link_facet_names(
&self,
input: ListTypedLinkFacetNamesRequest,
) -> RusotoFuture<ListTypedLinkFacetNamesResponse, ListTypedLinkFacetNamesError>;
fn lookup_policy(
&self,
input: LookupPolicyRequest,
) -> RusotoFuture<LookupPolicyResponse, LookupPolicyError>;
fn publish_schema(
&self,
input: PublishSchemaRequest,
) -> RusotoFuture<PublishSchemaResponse, PublishSchemaError>;
fn put_schema_from_json(
&self,
input: PutSchemaFromJsonRequest,
) -> RusotoFuture<PutSchemaFromJsonResponse, PutSchemaFromJsonError>;
fn remove_facet_from_object(
&self,
input: RemoveFacetFromObjectRequest,
) -> RusotoFuture<RemoveFacetFromObjectResponse, RemoveFacetFromObjectError>;
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError>;
fn update_facet(
&self,
input: UpdateFacetRequest,
) -> RusotoFuture<UpdateFacetResponse, UpdateFacetError>;
fn update_link_attributes(
&self,
input: UpdateLinkAttributesRequest,
) -> RusotoFuture<UpdateLinkAttributesResponse, UpdateLinkAttributesError>;
fn update_object_attributes(
&self,
input: UpdateObjectAttributesRequest,
) -> RusotoFuture<UpdateObjectAttributesResponse, UpdateObjectAttributesError>;
fn update_schema(
&self,
input: UpdateSchemaRequest,
) -> RusotoFuture<UpdateSchemaResponse, UpdateSchemaError>;
fn update_typed_link_facet(
&self,
input: UpdateTypedLinkFacetRequest,
) -> RusotoFuture<UpdateTypedLinkFacetResponse, UpdateTypedLinkFacetError>;
fn upgrade_applied_schema(
&self,
input: UpgradeAppliedSchemaRequest,
) -> RusotoFuture<UpgradeAppliedSchemaResponse, UpgradeAppliedSchemaError>;
fn upgrade_published_schema(
&self,
input: UpgradePublishedSchemaRequest,
) -> RusotoFuture<UpgradePublishedSchemaResponse, UpgradePublishedSchemaError>;
}
#[derive(Clone)]
pub struct CloudDirectoryClient {
client: Client,
region: region::Region,
}
impl CloudDirectoryClient {
pub fn new(region: region::Region) -> CloudDirectoryClient {
CloudDirectoryClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CloudDirectoryClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CloudDirectoryClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl CloudDirectory for CloudDirectoryClient {
fn add_facet_to_object(
&self,
input: AddFacetToObjectRequest,
) -> RusotoFuture<AddFacetToObjectResponse, AddFacetToObjectError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/facets";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<AddFacetToObjectResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AddFacetToObjectError::from_response(response))),
)
}
})
}
fn apply_schema(
&self,
input: ApplySchemaRequest,
) -> RusotoFuture<ApplySchemaResponse, ApplySchemaError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/apply";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ApplySchemaResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ApplySchemaError::from_response(response))),
)
}
})
}
fn attach_object(
&self,
input: AttachObjectRequest,
) -> RusotoFuture<AttachObjectResponse, AttachObjectError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/attach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<AttachObjectResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AttachObjectError::from_response(response))),
)
}
})
}
fn attach_policy(
&self,
input: AttachPolicyRequest,
) -> RusotoFuture<AttachPolicyResponse, AttachPolicyError> {
let request_uri = "/amazonclouddirectory/2017-01-11/policy/attach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<AttachPolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AttachPolicyError::from_response(response))),
)
}
})
}
fn attach_to_index(
&self,
input: AttachToIndexRequest,
) -> RusotoFuture<AttachToIndexResponse, AttachToIndexError> {
let request_uri = "/amazonclouddirectory/2017-01-11/index/attach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<AttachToIndexResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AttachToIndexError::from_response(response))),
)
}
})
}
fn attach_typed_link(
&self,
input: AttachTypedLinkRequest,
) -> RusotoFuture<AttachTypedLinkResponse, AttachTypedLinkError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/attach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<AttachTypedLinkResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AttachTypedLinkError::from_response(response))),
)
}
})
}
fn batch_read(
&self,
input: BatchReadRequest,
) -> RusotoFuture<BatchReadResponse, BatchReadError> {
let request_uri = "/amazonclouddirectory/2017-01-11/batchread";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<BatchReadResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(BatchReadError::from_response(response))),
)
}
})
}
fn batch_write(
&self,
input: BatchWriteRequest,
) -> RusotoFuture<BatchWriteResponse, BatchWriteError> {
let request_uri = "/amazonclouddirectory/2017-01-11/batchwrite";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<BatchWriteResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(BatchWriteError::from_response(response))),
)
}
})
}
fn create_directory(
&self,
input: CreateDirectoryRequest,
) -> RusotoFuture<CreateDirectoryResponse, CreateDirectoryError> {
let request_uri = "/amazonclouddirectory/2017-01-11/directory/create";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateDirectoryResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDirectoryError::from_response(response))),
)
}
})
}
fn create_facet(
&self,
input: CreateFacetRequest,
) -> RusotoFuture<CreateFacetResponse, CreateFacetError> {
let request_uri = "/amazonclouddirectory/2017-01-11/facet/create";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateFacetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateFacetError::from_response(response))),
)
}
})
}
fn create_index(
&self,
input: CreateIndexRequest,
) -> RusotoFuture<CreateIndexResponse, CreateIndexError> {
let request_uri = "/amazonclouddirectory/2017-01-11/index";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateIndexResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateIndexError::from_response(response))),
)
}
})
}
fn create_object(
&self,
input: CreateObjectRequest,
) -> RusotoFuture<CreateObjectResponse, CreateObjectError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateObjectResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateObjectError::from_response(response))),
)
}
})
}
fn create_schema(
&self,
input: CreateSchemaRequest,
) -> RusotoFuture<CreateSchemaResponse, CreateSchemaError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/create";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateSchemaResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateSchemaError::from_response(response))),
)
}
})
}
fn create_typed_link_facet(
&self,
input: CreateTypedLinkFacetRequest,
) -> RusotoFuture<CreateTypedLinkFacetResponse, CreateTypedLinkFacetError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/facet/create";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateTypedLinkFacetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateTypedLinkFacetError::from_response(response))
}),
)
}
})
}
fn delete_directory(
&self,
input: DeleteDirectoryRequest,
) -> RusotoFuture<DeleteDirectoryResponse, DeleteDirectoryError> {
let request_uri = "/amazonclouddirectory/2017-01-11/directory";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DeleteDirectoryResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteDirectoryError::from_response(response))),
)
}
})
}
fn delete_facet(
&self,
input: DeleteFacetRequest,
) -> RusotoFuture<DeleteFacetResponse, DeleteFacetError> {
let request_uri = "/amazonclouddirectory/2017-01-11/facet/delete";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DeleteFacetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteFacetError::from_response(response))),
)
}
})
}
fn delete_object(
&self,
input: DeleteObjectRequest,
) -> RusotoFuture<DeleteObjectResponse, DeleteObjectError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/delete";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DeleteObjectResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteObjectError::from_response(response))),
)
}
})
}
fn delete_schema(
&self,
input: DeleteSchemaRequest,
) -> RusotoFuture<DeleteSchemaResponse, DeleteSchemaError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DeleteSchemaResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteSchemaError::from_response(response))),
)
}
})
}
fn delete_typed_link_facet(
&self,
input: DeleteTypedLinkFacetRequest,
) -> RusotoFuture<DeleteTypedLinkFacetResponse, DeleteTypedLinkFacetError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/facet/delete";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<DeleteTypedLinkFacetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteTypedLinkFacetError::from_response(response))
}),
)
}
})
}
fn detach_from_index(
&self,
input: DetachFromIndexRequest,
) -> RusotoFuture<DetachFromIndexResponse, DetachFromIndexError> {
let request_uri = "/amazonclouddirectory/2017-01-11/index/detach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DetachFromIndexResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DetachFromIndexError::from_response(response))),
)
}
})
}
fn detach_object(
&self,
input: DetachObjectRequest,
) -> RusotoFuture<DetachObjectResponse, DetachObjectError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/detach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DetachObjectResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DetachObjectError::from_response(response))),
)
}
})
}
fn detach_policy(
&self,
input: DetachPolicyRequest,
) -> RusotoFuture<DetachPolicyResponse, DetachPolicyError> {
let request_uri = "/amazonclouddirectory/2017-01-11/policy/detach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DetachPolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DetachPolicyError::from_response(response))),
)
}
})
}
fn detach_typed_link(
&self,
input: DetachTypedLinkRequest,
) -> RusotoFuture<(), DetachTypedLinkError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/detach";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DetachTypedLinkError::from_response(response))),
)
}
})
}
fn disable_directory(
&self,
input: DisableDirectoryRequest,
) -> RusotoFuture<DisableDirectoryResponse, DisableDirectoryError> {
let request_uri = "/amazonclouddirectory/2017-01-11/directory/disable";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DisableDirectoryResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DisableDirectoryError::from_response(response))),
)
}
})
}
fn enable_directory(
&self,
input: EnableDirectoryRequest,
) -> RusotoFuture<EnableDirectoryResponse, EnableDirectoryError> {
let request_uri = "/amazonclouddirectory/2017-01-11/directory/enable";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<EnableDirectoryResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(EnableDirectoryError::from_response(response))),
)
}
})
}
fn get_applied_schema_version(
&self,
input: GetAppliedSchemaVersionRequest,
) -> RusotoFuture<GetAppliedSchemaVersionResponse, GetAppliedSchemaVersionError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/getappliedschema";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetAppliedSchemaVersionResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetAppliedSchemaVersionError::from_response(response))
}))
}
})
}
fn get_directory(
&self,
input: GetDirectoryRequest,
) -> RusotoFuture<GetDirectoryResponse, GetDirectoryError> {
let request_uri = "/amazonclouddirectory/2017-01-11/directory/get";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetDirectoryResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDirectoryError::from_response(response))),
)
}
})
}
fn get_facet(&self, input: GetFacetRequest) -> RusotoFuture<GetFacetResponse, GetFacetError> {
let request_uri = "/amazonclouddirectory/2017-01-11/facet";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetFacetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetFacetError::from_response(response))),
)
}
})
}
fn get_link_attributes(
&self,
input: GetLinkAttributesRequest,
) -> RusotoFuture<GetLinkAttributesResponse, GetLinkAttributesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/attributes/get";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetLinkAttributesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetLinkAttributesError::from_response(response))),
)
}
})
}
fn get_object_attributes(
&self,
input: GetObjectAttributesRequest,
) -> RusotoFuture<GetObjectAttributesResponse, GetObjectAttributesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/attributes/get";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetObjectAttributesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetObjectAttributesError::from_response(response))
}),
)
}
})
}
fn get_object_information(
&self,
input: GetObjectInformationRequest,
) -> RusotoFuture<GetObjectInformationResponse, GetObjectInformationError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/information";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetObjectInformationResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetObjectInformationError::from_response(response))
}),
)
}
})
}
fn get_schema_as_json(
&self,
input: GetSchemaAsJsonRequest,
) -> RusotoFuture<GetSchemaAsJsonResponse, GetSchemaAsJsonError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/json";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetSchemaAsJsonResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSchemaAsJsonError::from_response(response))),
)
}
})
}
fn get_typed_link_facet_information(
&self,
input: GetTypedLinkFacetInformationRequest,
) -> RusotoFuture<GetTypedLinkFacetInformationResponse, GetTypedLinkFacetInformationError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/facet/get";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetTypedLinkFacetInformationResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetTypedLinkFacetInformationError::from_response(response))
}))
}
})
}
fn list_applied_schema_arns(
&self,
input: ListAppliedSchemaArnsRequest,
) -> RusotoFuture<ListAppliedSchemaArnsResponse, ListAppliedSchemaArnsError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/applied";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListAppliedSchemaArnsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListAppliedSchemaArnsError::from_response(response))
}),
)
}
})
}
fn list_attached_indices(
&self,
input: ListAttachedIndicesRequest,
) -> RusotoFuture<ListAttachedIndicesResponse, ListAttachedIndicesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/indices";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListAttachedIndicesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListAttachedIndicesError::from_response(response))
}),
)
}
})
}
fn list_development_schema_arns(
&self,
input: ListDevelopmentSchemaArnsRequest,
) -> RusotoFuture<ListDevelopmentSchemaArnsResponse, ListDevelopmentSchemaArnsError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/development";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListDevelopmentSchemaArnsResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListDevelopmentSchemaArnsError::from_response(response))
}))
}
})
}
fn list_directories(
&self,
input: ListDirectoriesRequest,
) -> RusotoFuture<ListDirectoriesResponse, ListDirectoriesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/directory/list";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListDirectoriesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListDirectoriesError::from_response(response))),
)
}
})
}
fn list_facet_attributes(
&self,
input: ListFacetAttributesRequest,
) -> RusotoFuture<ListFacetAttributesResponse, ListFacetAttributesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/facet/attributes";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListFacetAttributesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListFacetAttributesError::from_response(response))
}),
)
}
})
}
fn list_facet_names(
&self,
input: ListFacetNamesRequest,
) -> RusotoFuture<ListFacetNamesResponse, ListFacetNamesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/facet/list";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListFacetNamesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListFacetNamesError::from_response(response))),
)
}
})
}
fn list_incoming_typed_links(
&self,
input: ListIncomingTypedLinksRequest,
) -> RusotoFuture<ListIncomingTypedLinksResponse, ListIncomingTypedLinksError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/incoming";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListIncomingTypedLinksResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListIncomingTypedLinksError::from_response(response))
}),
)
}
})
}
fn list_index(
&self,
input: ListIndexRequest,
) -> RusotoFuture<ListIndexResponse, ListIndexError> {
let request_uri = "/amazonclouddirectory/2017-01-11/index/targets";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListIndexResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListIndexError::from_response(response))),
)
}
})
}
fn list_object_attributes(
&self,
input: ListObjectAttributesRequest,
) -> RusotoFuture<ListObjectAttributesResponse, ListObjectAttributesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/attributes";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListObjectAttributesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListObjectAttributesError::from_response(response))
}),
)
}
})
}
fn list_object_children(
&self,
input: ListObjectChildrenRequest,
) -> RusotoFuture<ListObjectChildrenResponse, ListObjectChildrenError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/children";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListObjectChildrenResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListObjectChildrenError::from_response(response))),
)
}
})
}
fn list_object_parent_paths(
&self,
input: ListObjectParentPathsRequest,
) -> RusotoFuture<ListObjectParentPathsResponse, ListObjectParentPathsError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/parentpaths";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListObjectParentPathsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListObjectParentPathsError::from_response(response))
}),
)
}
})
}
fn list_object_parents(
&self,
input: ListObjectParentsRequest,
) -> RusotoFuture<ListObjectParentsResponse, ListObjectParentsError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/parent";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListObjectParentsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListObjectParentsError::from_response(response))),
)
}
})
}
fn list_object_policies(
&self,
input: ListObjectPoliciesRequest,
) -> RusotoFuture<ListObjectPoliciesResponse, ListObjectPoliciesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/policy";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListObjectPoliciesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListObjectPoliciesError::from_response(response))),
)
}
})
}
fn list_outgoing_typed_links(
&self,
input: ListOutgoingTypedLinksRequest,
) -> RusotoFuture<ListOutgoingTypedLinksResponse, ListOutgoingTypedLinksError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/outgoing";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListOutgoingTypedLinksResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListOutgoingTypedLinksError::from_response(response))
}),
)
}
})
}
fn list_policy_attachments(
&self,
input: ListPolicyAttachmentsRequest,
) -> RusotoFuture<ListPolicyAttachmentsResponse, ListPolicyAttachmentsError> {
let request_uri = "/amazonclouddirectory/2017-01-11/policy/attachment";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref consistency_level) = input.consistency_level {
request.add_header("x-amz-consistency-level", &consistency_level.to_string());
}
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListPolicyAttachmentsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListPolicyAttachmentsError::from_response(response))
}),
)
}
})
}
fn list_published_schema_arns(
&self,
input: ListPublishedSchemaArnsRequest,
) -> RusotoFuture<ListPublishedSchemaArnsResponse, ListPublishedSchemaArnsError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/published";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListPublishedSchemaArnsResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListPublishedSchemaArnsError::from_response(response))
}))
}
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError> {
let request_uri = "/amazonclouddirectory/2017-01-11/tags";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListTagsForResourceResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
)
}
})
}
fn list_typed_link_facet_attributes(
&self,
input: ListTypedLinkFacetAttributesRequest,
) -> RusotoFuture<ListTypedLinkFacetAttributesResponse, ListTypedLinkFacetAttributesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/facet/attributes";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListTypedLinkFacetAttributesResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListTypedLinkFacetAttributesError::from_response(response))
}))
}
})
}
fn list_typed_link_facet_names(
&self,
input: ListTypedLinkFacetNamesRequest,
) -> RusotoFuture<ListTypedLinkFacetNamesResponse, ListTypedLinkFacetNamesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/facet/list";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListTypedLinkFacetNamesResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListTypedLinkFacetNamesError::from_response(response))
}))
}
})
}
fn lookup_policy(
&self,
input: LookupPolicyRequest,
) -> RusotoFuture<LookupPolicyResponse, LookupPolicyError> {
let request_uri = "/amazonclouddirectory/2017-01-11/policy/lookup";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<LookupPolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(LookupPolicyError::from_response(response))),
)
}
})
}
fn publish_schema(
&self,
input: PublishSchemaRequest,
) -> RusotoFuture<PublishSchemaResponse, PublishSchemaError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/publish";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.development_schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<PublishSchemaResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PublishSchemaError::from_response(response))),
)
}
})
}
fn put_schema_from_json(
&self,
input: PutSchemaFromJsonRequest,
) -> RusotoFuture<PutSchemaFromJsonResponse, PutSchemaFromJsonError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/json";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<PutSchemaFromJsonResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutSchemaFromJsonError::from_response(response))),
)
}
})
}
fn remove_facet_from_object(
&self,
input: RemoveFacetFromObjectRequest,
) -> RusotoFuture<RemoveFacetFromObjectResponse, RemoveFacetFromObjectError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/facets/delete";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<RemoveFacetFromObjectResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RemoveFacetFromObjectError::from_response(response))
}),
)
}
})
}
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError> {
let request_uri = "/amazonclouddirectory/2017-01-11/tags/add";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<TagResourceResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
)
}
})
}
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError> {
let request_uri = "/amazonclouddirectory/2017-01-11/tags/remove";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<UntagResourceResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
)
}
})
}
fn update_facet(
&self,
input: UpdateFacetRequest,
) -> RusotoFuture<UpdateFacetResponse, UpdateFacetError> {
let request_uri = "/amazonclouddirectory/2017-01-11/facet";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<UpdateFacetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateFacetError::from_response(response))),
)
}
})
}
fn update_link_attributes(
&self,
input: UpdateLinkAttributesRequest,
) -> RusotoFuture<UpdateLinkAttributesResponse, UpdateLinkAttributesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/attributes/update";
let mut request = SignedRequest::new("POST", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<UpdateLinkAttributesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateLinkAttributesError::from_response(response))
}),
)
}
})
}
fn update_object_attributes(
&self,
input: UpdateObjectAttributesRequest,
) -> RusotoFuture<UpdateObjectAttributesResponse, UpdateObjectAttributesError> {
let request_uri = "/amazonclouddirectory/2017-01-11/object/update";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.directory_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<UpdateObjectAttributesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateObjectAttributesError::from_response(response))
}),
)
}
})
}
fn update_schema(
&self,
input: UpdateSchemaRequest,
) -> RusotoFuture<UpdateSchemaResponse, UpdateSchemaError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/update";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<UpdateSchemaResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateSchemaError::from_response(response))),
)
}
})
}
fn update_typed_link_facet(
&self,
input: UpdateTypedLinkFacetRequest,
) -> RusotoFuture<UpdateTypedLinkFacetResponse, UpdateTypedLinkFacetError> {
let request_uri = "/amazonclouddirectory/2017-01-11/typedlink/facet";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
request.add_header("x-amz-data-partition", &input.schema_arn);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<UpdateTypedLinkFacetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateTypedLinkFacetError::from_response(response))
}),
)
}
})
}
fn upgrade_applied_schema(
&self,
input: UpgradeAppliedSchemaRequest,
) -> RusotoFuture<UpgradeAppliedSchemaResponse, UpgradeAppliedSchemaError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/upgradeapplied";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<UpgradeAppliedSchemaResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpgradeAppliedSchemaError::from_response(response))
}),
)
}
})
}
fn upgrade_published_schema(
&self,
input: UpgradePublishedSchemaRequest,
) -> RusotoFuture<UpgradePublishedSchemaResponse, UpgradePublishedSchemaError> {
let request_uri = "/amazonclouddirectory/2017-01-11/schema/upgradepublished";
let mut request = SignedRequest::new("PUT", "clouddirectory", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<UpgradePublishedSchemaResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpgradePublishedSchemaError::from_response(response))
}),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}