use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BotAliasMetadata {
#[serde(rename = "botName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_name: Option<String>,
#[serde(rename = "botVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_version: Option<String>,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BotChannelAssociation {
#[serde(rename = "botAlias")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_alias: Option<String>,
#[serde(rename = "botConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_configuration: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "botName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_name: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "failureReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BotMetadata {
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BuiltinIntentMetadata {
#[serde(rename = "signature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub signature: Option<String>,
#[serde(rename = "supportedLocales")]
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_locales: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BuiltinIntentSlot {
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BuiltinSlotTypeMetadata {
#[serde(rename = "signature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub signature: Option<String>,
#[serde(rename = "supportedLocales")]
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_locales: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeHook {
#[serde(rename = "messageVersion")]
pub message_version: String,
#[serde(rename = "uri")]
pub uri: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateBotVersionRequest {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateBotVersionResponse {
#[serde(rename = "abortStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub abort_statement: Option<Statement>,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "childDirected")]
#[serde(skip_serializing_if = "Option::is_none")]
pub child_directed: Option<bool>,
#[serde(rename = "clarificationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clarification_prompt: Option<Prompt>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "failureReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
#[serde(rename = "idleSessionTTLInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idle_session_ttl_in_seconds: Option<i64>,
#[serde(rename = "intents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<Vec<Intent>>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "locale")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locale: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(rename = "voiceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub voice_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateIntentVersionRequest {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateIntentVersionResponse {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "conclusionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub conclusion_statement: Option<Statement>,
#[serde(rename = "confirmationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confirmation_prompt: Option<Prompt>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "dialogCodeHook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dialog_code_hook: Option<CodeHook>,
#[serde(rename = "followUpPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub follow_up_prompt: Option<FollowUpPrompt>,
#[serde(rename = "fulfillmentActivity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fulfillment_activity: Option<FulfillmentActivity>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "parentIntentSignature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_intent_signature: Option<String>,
#[serde(rename = "rejectionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rejection_statement: Option<Statement>,
#[serde(rename = "sampleUtterances")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_utterances: Option<Vec<String>>,
#[serde(rename = "slots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slots: Option<Vec<Slot>>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSlotTypeVersionRequest {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSlotTypeVersionResponse {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "enumerationValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enumeration_values: Option<Vec<EnumerationValue>>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "valueSelectionStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value_selection_strategy: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBotAliasRequest {
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBotChannelAssociationRequest {
#[serde(rename = "botAlias")]
pub bot_alias: String,
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBotRequest {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBotVersionRequest {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteIntentRequest {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteIntentVersionRequest {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSlotTypeRequest {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSlotTypeVersionRequest {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUtterancesRequest {
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "userId")]
pub user_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EnumerationValue {
#[serde(rename = "synonyms")]
#[serde(skip_serializing_if = "Option::is_none")]
pub synonyms: Option<Vec<String>>,
#[serde(rename = "value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FollowUpPrompt {
#[serde(rename = "prompt")]
pub prompt: Prompt,
#[serde(rename = "rejectionStatement")]
pub rejection_statement: Statement,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FulfillmentActivity {
#[serde(rename = "codeHook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_hook: Option<CodeHook>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBotAliasRequest {
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBotAliasResponse {
#[serde(rename = "botName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_name: Option<String>,
#[serde(rename = "botVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_version: Option<String>,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBotAliasesRequest {
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nameContains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_contains: Option<String>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBotAliasesResponse {
#[serde(rename = "BotAliases")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_aliases: Option<Vec<BotAliasMetadata>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBotChannelAssociationRequest {
#[serde(rename = "botAlias")]
pub bot_alias: String,
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBotChannelAssociationResponse {
#[serde(rename = "botAlias")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_alias: Option<String>,
#[serde(rename = "botConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_configuration: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "botName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_name: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "failureReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBotChannelAssociationsRequest {
#[serde(rename = "botAlias")]
pub bot_alias: String,
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nameContains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_contains: Option<String>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBotChannelAssociationsResponse {
#[serde(rename = "botChannelAssociations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_channel_associations: Option<Vec<BotChannelAssociation>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBotRequest {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "versionOrAlias")]
pub version_or_alias: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBotResponse {
#[serde(rename = "abortStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub abort_statement: Option<Statement>,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "childDirected")]
#[serde(skip_serializing_if = "Option::is_none")]
pub child_directed: Option<bool>,
#[serde(rename = "clarificationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clarification_prompt: Option<Prompt>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "failureReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
#[serde(rename = "idleSessionTTLInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idle_session_ttl_in_seconds: Option<i64>,
#[serde(rename = "intents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<Vec<Intent>>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "locale")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locale: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(rename = "voiceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub voice_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBotVersionsRequest {
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBotVersionsResponse {
#[serde(rename = "bots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bots: Option<Vec<BotMetadata>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBotsRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nameContains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_contains: Option<String>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBotsResponse {
#[serde(rename = "bots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bots: Option<Vec<BotMetadata>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBuiltinIntentRequest {
#[serde(rename = "signature")]
pub signature: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBuiltinIntentResponse {
#[serde(rename = "signature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub signature: Option<String>,
#[serde(rename = "slots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slots: Option<Vec<BuiltinIntentSlot>>,
#[serde(rename = "supportedLocales")]
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_locales: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBuiltinIntentsRequest {
#[serde(rename = "locale")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locale: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "signatureContains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub signature_contains: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBuiltinIntentsResponse {
#[serde(rename = "intents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<Vec<BuiltinIntentMetadata>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBuiltinSlotTypesRequest {
#[serde(rename = "locale")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locale: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "signatureContains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub signature_contains: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBuiltinSlotTypesResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "slotTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slot_types: Option<Vec<BuiltinSlotTypeMetadata>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetExportRequest {
#[serde(rename = "exportType")]
pub export_type: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetExportResponse {
#[serde(rename = "exportStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub export_status: Option<String>,
#[serde(rename = "exportType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub export_type: Option<String>,
#[serde(rename = "failureReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "resourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
#[serde(rename = "url")]
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetImportRequest {
#[serde(rename = "importId")]
pub import_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetImportResponse {
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "failureReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<Vec<String>>,
#[serde(rename = "importId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub import_id: Option<String>,
#[serde(rename = "importStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub import_status: Option<String>,
#[serde(rename = "mergeStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_strategy: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "resourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntentRequest {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIntentResponse {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "conclusionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub conclusion_statement: Option<Statement>,
#[serde(rename = "confirmationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confirmation_prompt: Option<Prompt>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "dialogCodeHook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dialog_code_hook: Option<CodeHook>,
#[serde(rename = "followUpPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub follow_up_prompt: Option<FollowUpPrompt>,
#[serde(rename = "fulfillmentActivity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fulfillment_activity: Option<FulfillmentActivity>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "parentIntentSignature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_intent_signature: Option<String>,
#[serde(rename = "rejectionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rejection_statement: Option<Statement>,
#[serde(rename = "sampleUtterances")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_utterances: Option<Vec<String>>,
#[serde(rename = "slots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slots: Option<Vec<Slot>>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntentVersionsRequest {
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIntentVersionsResponse {
#[serde(rename = "intents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<Vec<IntentMetadata>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIntentsRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nameContains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_contains: Option<String>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIntentsResponse {
#[serde(rename = "intents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<Vec<IntentMetadata>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSlotTypeRequest {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSlotTypeResponse {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "enumerationValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enumeration_values: Option<Vec<EnumerationValue>>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "valueSelectionStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value_selection_strategy: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSlotTypeVersionsRequest {
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSlotTypeVersionsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "slotTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slot_types: Option<Vec<SlotTypeMetadata>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSlotTypesRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nameContains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_contains: Option<String>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSlotTypesResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "slotTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slot_types: Option<Vec<SlotTypeMetadata>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUtterancesViewRequest {
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "botVersions")]
pub bot_versions: Vec<String>,
#[serde(rename = "statusType")]
pub status_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetUtterancesViewResponse {
#[serde(rename = "botName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_name: Option<String>,
#[serde(rename = "utterances")]
#[serde(skip_serializing_if = "Option::is_none")]
pub utterances: Option<Vec<UtteranceList>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Intent {
#[serde(rename = "intentName")]
pub intent_name: String,
#[serde(rename = "intentVersion")]
pub intent_version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IntentMetadata {
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Message {
#[serde(rename = "content")]
pub content: String,
#[serde(rename = "contentType")]
pub content_type: String,
#[serde(rename = "groupNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group_number: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Prompt {
#[serde(rename = "maxAttempts")]
pub max_attempts: i64,
#[serde(rename = "messages")]
pub messages: Vec<Message>,
#[serde(rename = "responseCard")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_card: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutBotAliasRequest {
#[serde(rename = "botName")]
pub bot_name: String,
#[serde(rename = "botVersion")]
pub bot_version: String,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutBotAliasResponse {
#[serde(rename = "botName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_name: Option<String>,
#[serde(rename = "botVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_version: Option<String>,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutBotRequest {
#[serde(rename = "abortStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub abort_statement: Option<Statement>,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "childDirected")]
pub child_directed: bool,
#[serde(rename = "clarificationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clarification_prompt: Option<Prompt>,
#[serde(rename = "createVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_version: Option<bool>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "idleSessionTTLInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idle_session_ttl_in_seconds: Option<i64>,
#[serde(rename = "intents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<Vec<Intent>>,
#[serde(rename = "locale")]
pub locale: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "processBehavior")]
#[serde(skip_serializing_if = "Option::is_none")]
pub process_behavior: Option<String>,
#[serde(rename = "voiceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub voice_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutBotResponse {
#[serde(rename = "abortStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub abort_statement: Option<Statement>,
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "childDirected")]
#[serde(skip_serializing_if = "Option::is_none")]
pub child_directed: Option<bool>,
#[serde(rename = "clarificationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clarification_prompt: Option<Prompt>,
#[serde(rename = "createVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_version: Option<bool>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "failureReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
#[serde(rename = "idleSessionTTLInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idle_session_ttl_in_seconds: Option<i64>,
#[serde(rename = "intents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<Vec<Intent>>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "locale")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locale: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(rename = "voiceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub voice_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutIntentRequest {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "conclusionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub conclusion_statement: Option<Statement>,
#[serde(rename = "confirmationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confirmation_prompt: Option<Prompt>,
#[serde(rename = "createVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_version: Option<bool>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "dialogCodeHook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dialog_code_hook: Option<CodeHook>,
#[serde(rename = "followUpPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub follow_up_prompt: Option<FollowUpPrompt>,
#[serde(rename = "fulfillmentActivity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fulfillment_activity: Option<FulfillmentActivity>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "parentIntentSignature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_intent_signature: Option<String>,
#[serde(rename = "rejectionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rejection_statement: Option<Statement>,
#[serde(rename = "sampleUtterances")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_utterances: Option<Vec<String>>,
#[serde(rename = "slots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slots: Option<Vec<Slot>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutIntentResponse {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "conclusionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub conclusion_statement: Option<Statement>,
#[serde(rename = "confirmationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confirmation_prompt: Option<Prompt>,
#[serde(rename = "createVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_version: Option<bool>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "dialogCodeHook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dialog_code_hook: Option<CodeHook>,
#[serde(rename = "followUpPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub follow_up_prompt: Option<FollowUpPrompt>,
#[serde(rename = "fulfillmentActivity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub fulfillment_activity: Option<FulfillmentActivity>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "parentIntentSignature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_intent_signature: Option<String>,
#[serde(rename = "rejectionStatement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rejection_statement: Option<Statement>,
#[serde(rename = "sampleUtterances")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_utterances: Option<Vec<String>>,
#[serde(rename = "slots")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slots: Option<Vec<Slot>>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutSlotTypeRequest {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "createVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_version: Option<bool>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "enumerationValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enumeration_values: Option<Vec<EnumerationValue>>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "valueSelectionStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value_selection_strategy: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutSlotTypeResponse {
#[serde(rename = "checksum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub checksum: Option<String>,
#[serde(rename = "createVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_version: Option<bool>,
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "enumerationValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enumeration_values: Option<Vec<EnumerationValue>>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "valueSelectionStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value_selection_strategy: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ResourceReference {
pub name: Option<String>,
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Slot {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "priority")]
#[serde(skip_serializing_if = "Option::is_none")]
pub priority: Option<i64>,
#[serde(rename = "responseCard")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_card: Option<String>,
#[serde(rename = "sampleUtterances")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_utterances: Option<Vec<String>>,
#[serde(rename = "slotConstraint")]
pub slot_constraint: String,
#[serde(rename = "slotType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slot_type: Option<String>,
#[serde(rename = "slotTypeVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub slot_type_version: Option<String>,
#[serde(rename = "valueElicitationPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value_elicitation_prompt: Option<Prompt>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SlotTypeMetadata {
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "lastUpdatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_date: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartImportRequest {
#[serde(rename = "mergeStrategy")]
pub merge_strategy: String,
#[serde(rename = "payload")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub payload: Vec<u8>,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartImportResponse {
#[serde(rename = "createdDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_date: Option<f64>,
#[serde(rename = "importId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub import_id: Option<String>,
#[serde(rename = "importStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub import_status: Option<String>,
#[serde(rename = "mergeStrategy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_strategy: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "resourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Statement {
#[serde(rename = "messages")]
pub messages: Vec<Message>,
#[serde(rename = "responseCard")]
#[serde(skip_serializing_if = "Option::is_none")]
pub response_card: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UtteranceData {
#[serde(rename = "count")]
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(rename = "distinctUsers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub distinct_users: Option<i64>,
#[serde(rename = "firstUtteredDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub first_uttered_date: Option<f64>,
#[serde(rename = "lastUtteredDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_uttered_date: Option<f64>,
#[serde(rename = "utteranceString")]
#[serde(skip_serializing_if = "Option::is_none")]
pub utterance_string: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UtteranceList {
#[serde(rename = "botVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bot_version: Option<String>,
#[serde(rename = "utterances")]
#[serde(skip_serializing_if = "Option::is_none")]
pub utterances: Option<Vec<UtteranceData>>,
}
#[derive(Debug, PartialEq)]
pub enum CreateBotVersionError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
PreconditionFailed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateBotVersionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateBotVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return CreateBotVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateBotVersionError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return CreateBotVersionError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return CreateBotVersionError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateBotVersionError::NotFound(String::from(error_message));
}
"PreconditionFailedException" => {
return CreateBotVersionError::PreconditionFailed(String::from(error_message));
}
"ValidationException" => {
return CreateBotVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateBotVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateBotVersionError {
fn from(err: serde_json::error::Error) -> CreateBotVersionError {
CreateBotVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateBotVersionError {
fn from(err: CredentialsError) -> CreateBotVersionError {
CreateBotVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateBotVersionError {
fn from(err: HttpDispatchError) -> CreateBotVersionError {
CreateBotVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateBotVersionError {
fn from(err: io::Error) -> CreateBotVersionError {
CreateBotVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateBotVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateBotVersionError {
fn description(&self) -> &str {
match *self {
CreateBotVersionError::BadRequest(ref cause) => cause,
CreateBotVersionError::Conflict(ref cause) => cause,
CreateBotVersionError::InternalFailure(ref cause) => cause,
CreateBotVersionError::LimitExceeded(ref cause) => cause,
CreateBotVersionError::NotFound(ref cause) => cause,
CreateBotVersionError::PreconditionFailed(ref cause) => cause,
CreateBotVersionError::Validation(ref cause) => cause,
CreateBotVersionError::Credentials(ref err) => err.description(),
CreateBotVersionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateBotVersionError::ParseError(ref cause) => cause,
CreateBotVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateIntentVersionError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
PreconditionFailed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateIntentVersionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateIntentVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return CreateIntentVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateIntentVersionError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return CreateIntentVersionError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return CreateIntentVersionError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateIntentVersionError::NotFound(String::from(error_message));
}
"PreconditionFailedException" => {
return CreateIntentVersionError::PreconditionFailed(String::from(error_message));
}
"ValidationException" => {
return CreateIntentVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateIntentVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateIntentVersionError {
fn from(err: serde_json::error::Error) -> CreateIntentVersionError {
CreateIntentVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateIntentVersionError {
fn from(err: CredentialsError) -> CreateIntentVersionError {
CreateIntentVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateIntentVersionError {
fn from(err: HttpDispatchError) -> CreateIntentVersionError {
CreateIntentVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateIntentVersionError {
fn from(err: io::Error) -> CreateIntentVersionError {
CreateIntentVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateIntentVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateIntentVersionError {
fn description(&self) -> &str {
match *self {
CreateIntentVersionError::BadRequest(ref cause) => cause,
CreateIntentVersionError::Conflict(ref cause) => cause,
CreateIntentVersionError::InternalFailure(ref cause) => cause,
CreateIntentVersionError::LimitExceeded(ref cause) => cause,
CreateIntentVersionError::NotFound(ref cause) => cause,
CreateIntentVersionError::PreconditionFailed(ref cause) => cause,
CreateIntentVersionError::Validation(ref cause) => cause,
CreateIntentVersionError::Credentials(ref err) => err.description(),
CreateIntentVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateIntentVersionError::ParseError(ref cause) => cause,
CreateIntentVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSlotTypeVersionError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
PreconditionFailed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateSlotTypeVersionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateSlotTypeVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return CreateSlotTypeVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return CreateSlotTypeVersionError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return CreateSlotTypeVersionError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return CreateSlotTypeVersionError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return CreateSlotTypeVersionError::NotFound(String::from(error_message));
}
"PreconditionFailedException" => {
return CreateSlotTypeVersionError::PreconditionFailed(String::from(
error_message,
));
}
"ValidationException" => {
return CreateSlotTypeVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateSlotTypeVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateSlotTypeVersionError {
fn from(err: serde_json::error::Error) -> CreateSlotTypeVersionError {
CreateSlotTypeVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateSlotTypeVersionError {
fn from(err: CredentialsError) -> CreateSlotTypeVersionError {
CreateSlotTypeVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateSlotTypeVersionError {
fn from(err: HttpDispatchError) -> CreateSlotTypeVersionError {
CreateSlotTypeVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateSlotTypeVersionError {
fn from(err: io::Error) -> CreateSlotTypeVersionError {
CreateSlotTypeVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateSlotTypeVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSlotTypeVersionError {
fn description(&self) -> &str {
match *self {
CreateSlotTypeVersionError::BadRequest(ref cause) => cause,
CreateSlotTypeVersionError::Conflict(ref cause) => cause,
CreateSlotTypeVersionError::InternalFailure(ref cause) => cause,
CreateSlotTypeVersionError::LimitExceeded(ref cause) => cause,
CreateSlotTypeVersionError::NotFound(ref cause) => cause,
CreateSlotTypeVersionError::PreconditionFailed(ref cause) => cause,
CreateSlotTypeVersionError::Validation(ref cause) => cause,
CreateSlotTypeVersionError::Credentials(ref err) => err.description(),
CreateSlotTypeVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateSlotTypeVersionError::ParseError(ref cause) => cause,
CreateSlotTypeVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBotError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteBotError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteBotError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteBotError::BadRequest(String::from(error_message));
}
"ConflictException" => return DeleteBotError::Conflict(String::from(error_message)),
"InternalFailureException" => {
return DeleteBotError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteBotError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return DeleteBotError::NotFound(String::from(error_message)),
"ResourceInUseException" => {
return DeleteBotError::ResourceInUse(String::from(error_message));
}
"ValidationException" => {
return DeleteBotError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteBotError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteBotError {
fn from(err: serde_json::error::Error) -> DeleteBotError {
DeleteBotError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteBotError {
fn from(err: CredentialsError) -> DeleteBotError {
DeleteBotError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteBotError {
fn from(err: HttpDispatchError) -> DeleteBotError {
DeleteBotError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteBotError {
fn from(err: io::Error) -> DeleteBotError {
DeleteBotError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteBotError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBotError {
fn description(&self) -> &str {
match *self {
DeleteBotError::BadRequest(ref cause) => cause,
DeleteBotError::Conflict(ref cause) => cause,
DeleteBotError::InternalFailure(ref cause) => cause,
DeleteBotError::LimitExceeded(ref cause) => cause,
DeleteBotError::NotFound(ref cause) => cause,
DeleteBotError::ResourceInUse(ref cause) => cause,
DeleteBotError::Validation(ref cause) => cause,
DeleteBotError::Credentials(ref err) => err.description(),
DeleteBotError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteBotError::ParseError(ref cause) => cause,
DeleteBotError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBotAliasError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteBotAliasError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteBotAliasError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteBotAliasError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteBotAliasError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return DeleteBotAliasError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteBotAliasError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return DeleteBotAliasError::NotFound(String::from(error_message));
}
"ResourceInUseException" => {
return DeleteBotAliasError::ResourceInUse(String::from(error_message));
}
"ValidationException" => {
return DeleteBotAliasError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteBotAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteBotAliasError {
fn from(err: serde_json::error::Error) -> DeleteBotAliasError {
DeleteBotAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteBotAliasError {
fn from(err: CredentialsError) -> DeleteBotAliasError {
DeleteBotAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteBotAliasError {
fn from(err: HttpDispatchError) -> DeleteBotAliasError {
DeleteBotAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteBotAliasError {
fn from(err: io::Error) -> DeleteBotAliasError {
DeleteBotAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteBotAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBotAliasError {
fn description(&self) -> &str {
match *self {
DeleteBotAliasError::BadRequest(ref cause) => cause,
DeleteBotAliasError::Conflict(ref cause) => cause,
DeleteBotAliasError::InternalFailure(ref cause) => cause,
DeleteBotAliasError::LimitExceeded(ref cause) => cause,
DeleteBotAliasError::NotFound(ref cause) => cause,
DeleteBotAliasError::ResourceInUse(ref cause) => cause,
DeleteBotAliasError::Validation(ref cause) => cause,
DeleteBotAliasError::Credentials(ref err) => err.description(),
DeleteBotAliasError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteBotAliasError::ParseError(ref cause) => cause,
DeleteBotAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBotChannelAssociationError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteBotChannelAssociationError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteBotChannelAssociationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteBotChannelAssociationError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteBotChannelAssociationError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return DeleteBotChannelAssociationError::InternalFailure(String::from(
error_message,
));
}
"LimitExceededException" => {
return DeleteBotChannelAssociationError::LimitExceeded(String::from(
error_message,
));
}
"NotFoundException" => {
return DeleteBotChannelAssociationError::NotFound(String::from(error_message));
}
"ValidationException" => {
return DeleteBotChannelAssociationError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteBotChannelAssociationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteBotChannelAssociationError {
fn from(err: serde_json::error::Error) -> DeleteBotChannelAssociationError {
DeleteBotChannelAssociationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteBotChannelAssociationError {
fn from(err: CredentialsError) -> DeleteBotChannelAssociationError {
DeleteBotChannelAssociationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteBotChannelAssociationError {
fn from(err: HttpDispatchError) -> DeleteBotChannelAssociationError {
DeleteBotChannelAssociationError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteBotChannelAssociationError {
fn from(err: io::Error) -> DeleteBotChannelAssociationError {
DeleteBotChannelAssociationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteBotChannelAssociationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBotChannelAssociationError {
fn description(&self) -> &str {
match *self {
DeleteBotChannelAssociationError::BadRequest(ref cause) => cause,
DeleteBotChannelAssociationError::Conflict(ref cause) => cause,
DeleteBotChannelAssociationError::InternalFailure(ref cause) => cause,
DeleteBotChannelAssociationError::LimitExceeded(ref cause) => cause,
DeleteBotChannelAssociationError::NotFound(ref cause) => cause,
DeleteBotChannelAssociationError::Validation(ref cause) => cause,
DeleteBotChannelAssociationError::Credentials(ref err) => err.description(),
DeleteBotChannelAssociationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteBotChannelAssociationError::ParseError(ref cause) => cause,
DeleteBotChannelAssociationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBotVersionError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteBotVersionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteBotVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteBotVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteBotVersionError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return DeleteBotVersionError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteBotVersionError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return DeleteBotVersionError::NotFound(String::from(error_message));
}
"ResourceInUseException" => {
return DeleteBotVersionError::ResourceInUse(String::from(error_message));
}
"ValidationException" => {
return DeleteBotVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteBotVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteBotVersionError {
fn from(err: serde_json::error::Error) -> DeleteBotVersionError {
DeleteBotVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteBotVersionError {
fn from(err: CredentialsError) -> DeleteBotVersionError {
DeleteBotVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteBotVersionError {
fn from(err: HttpDispatchError) -> DeleteBotVersionError {
DeleteBotVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteBotVersionError {
fn from(err: io::Error) -> DeleteBotVersionError {
DeleteBotVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteBotVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBotVersionError {
fn description(&self) -> &str {
match *self {
DeleteBotVersionError::BadRequest(ref cause) => cause,
DeleteBotVersionError::Conflict(ref cause) => cause,
DeleteBotVersionError::InternalFailure(ref cause) => cause,
DeleteBotVersionError::LimitExceeded(ref cause) => cause,
DeleteBotVersionError::NotFound(ref cause) => cause,
DeleteBotVersionError::ResourceInUse(ref cause) => cause,
DeleteBotVersionError::Validation(ref cause) => cause,
DeleteBotVersionError::Credentials(ref err) => err.description(),
DeleteBotVersionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteBotVersionError::ParseError(ref cause) => cause,
DeleteBotVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteIntentError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteIntentError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteIntentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteIntentError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteIntentError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return DeleteIntentError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteIntentError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return DeleteIntentError::NotFound(String::from(error_message));
}
"ResourceInUseException" => {
return DeleteIntentError::ResourceInUse(String::from(error_message));
}
"ValidationException" => {
return DeleteIntentError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteIntentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteIntentError {
fn from(err: serde_json::error::Error) -> DeleteIntentError {
DeleteIntentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteIntentError {
fn from(err: CredentialsError) -> DeleteIntentError {
DeleteIntentError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteIntentError {
fn from(err: HttpDispatchError) -> DeleteIntentError {
DeleteIntentError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteIntentError {
fn from(err: io::Error) -> DeleteIntentError {
DeleteIntentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteIntentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteIntentError {
fn description(&self) -> &str {
match *self {
DeleteIntentError::BadRequest(ref cause) => cause,
DeleteIntentError::Conflict(ref cause) => cause,
DeleteIntentError::InternalFailure(ref cause) => cause,
DeleteIntentError::LimitExceeded(ref cause) => cause,
DeleteIntentError::NotFound(ref cause) => cause,
DeleteIntentError::ResourceInUse(ref cause) => cause,
DeleteIntentError::Validation(ref cause) => cause,
DeleteIntentError::Credentials(ref err) => err.description(),
DeleteIntentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteIntentError::ParseError(ref cause) => cause,
DeleteIntentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteIntentVersionError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteIntentVersionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteIntentVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteIntentVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteIntentVersionError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return DeleteIntentVersionError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteIntentVersionError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return DeleteIntentVersionError::NotFound(String::from(error_message));
}
"ResourceInUseException" => {
return DeleteIntentVersionError::ResourceInUse(String::from(error_message));
}
"ValidationException" => {
return DeleteIntentVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteIntentVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteIntentVersionError {
fn from(err: serde_json::error::Error) -> DeleteIntentVersionError {
DeleteIntentVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteIntentVersionError {
fn from(err: CredentialsError) -> DeleteIntentVersionError {
DeleteIntentVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteIntentVersionError {
fn from(err: HttpDispatchError) -> DeleteIntentVersionError {
DeleteIntentVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteIntentVersionError {
fn from(err: io::Error) -> DeleteIntentVersionError {
DeleteIntentVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteIntentVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteIntentVersionError {
fn description(&self) -> &str {
match *self {
DeleteIntentVersionError::BadRequest(ref cause) => cause,
DeleteIntentVersionError::Conflict(ref cause) => cause,
DeleteIntentVersionError::InternalFailure(ref cause) => cause,
DeleteIntentVersionError::LimitExceeded(ref cause) => cause,
DeleteIntentVersionError::NotFound(ref cause) => cause,
DeleteIntentVersionError::ResourceInUse(ref cause) => cause,
DeleteIntentVersionError::Validation(ref cause) => cause,
DeleteIntentVersionError::Credentials(ref err) => err.description(),
DeleteIntentVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteIntentVersionError::ParseError(ref cause) => cause,
DeleteIntentVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSlotTypeError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSlotTypeError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSlotTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteSlotTypeError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteSlotTypeError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return DeleteSlotTypeError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteSlotTypeError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return DeleteSlotTypeError::NotFound(String::from(error_message));
}
"ResourceInUseException" => {
return DeleteSlotTypeError::ResourceInUse(String::from(error_message));
}
"ValidationException" => {
return DeleteSlotTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteSlotTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSlotTypeError {
fn from(err: serde_json::error::Error) -> DeleteSlotTypeError {
DeleteSlotTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSlotTypeError {
fn from(err: CredentialsError) -> DeleteSlotTypeError {
DeleteSlotTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSlotTypeError {
fn from(err: HttpDispatchError) -> DeleteSlotTypeError {
DeleteSlotTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSlotTypeError {
fn from(err: io::Error) -> DeleteSlotTypeError {
DeleteSlotTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSlotTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSlotTypeError {
fn description(&self) -> &str {
match *self {
DeleteSlotTypeError::BadRequest(ref cause) => cause,
DeleteSlotTypeError::Conflict(ref cause) => cause,
DeleteSlotTypeError::InternalFailure(ref cause) => cause,
DeleteSlotTypeError::LimitExceeded(ref cause) => cause,
DeleteSlotTypeError::NotFound(ref cause) => cause,
DeleteSlotTypeError::ResourceInUse(ref cause) => cause,
DeleteSlotTypeError::Validation(ref cause) => cause,
DeleteSlotTypeError::Credentials(ref err) => err.description(),
DeleteSlotTypeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteSlotTypeError::ParseError(ref cause) => cause,
DeleteSlotTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSlotTypeVersionError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSlotTypeVersionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSlotTypeVersionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteSlotTypeVersionError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return DeleteSlotTypeVersionError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return DeleteSlotTypeVersionError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteSlotTypeVersionError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return DeleteSlotTypeVersionError::NotFound(String::from(error_message));
}
"ResourceInUseException" => {
return DeleteSlotTypeVersionError::ResourceInUse(String::from(error_message));
}
"ValidationException" => {
return DeleteSlotTypeVersionError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteSlotTypeVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSlotTypeVersionError {
fn from(err: serde_json::error::Error) -> DeleteSlotTypeVersionError {
DeleteSlotTypeVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSlotTypeVersionError {
fn from(err: CredentialsError) -> DeleteSlotTypeVersionError {
DeleteSlotTypeVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSlotTypeVersionError {
fn from(err: HttpDispatchError) -> DeleteSlotTypeVersionError {
DeleteSlotTypeVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSlotTypeVersionError {
fn from(err: io::Error) -> DeleteSlotTypeVersionError {
DeleteSlotTypeVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSlotTypeVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSlotTypeVersionError {
fn description(&self) -> &str {
match *self {
DeleteSlotTypeVersionError::BadRequest(ref cause) => cause,
DeleteSlotTypeVersionError::Conflict(ref cause) => cause,
DeleteSlotTypeVersionError::InternalFailure(ref cause) => cause,
DeleteSlotTypeVersionError::LimitExceeded(ref cause) => cause,
DeleteSlotTypeVersionError::NotFound(ref cause) => cause,
DeleteSlotTypeVersionError::ResourceInUse(ref cause) => cause,
DeleteSlotTypeVersionError::Validation(ref cause) => cause,
DeleteSlotTypeVersionError::Credentials(ref err) => err.description(),
DeleteSlotTypeVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteSlotTypeVersionError::ParseError(ref cause) => cause,
DeleteSlotTypeVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUtterancesError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUtterancesError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUtterancesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return DeleteUtterancesError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return DeleteUtterancesError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return DeleteUtterancesError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return DeleteUtterancesError::NotFound(String::from(error_message));
}
"ValidationException" => {
return DeleteUtterancesError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUtterancesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUtterancesError {
fn from(err: serde_json::error::Error) -> DeleteUtterancesError {
DeleteUtterancesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUtterancesError {
fn from(err: CredentialsError) -> DeleteUtterancesError {
DeleteUtterancesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUtterancesError {
fn from(err: HttpDispatchError) -> DeleteUtterancesError {
DeleteUtterancesError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUtterancesError {
fn from(err: io::Error) -> DeleteUtterancesError {
DeleteUtterancesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUtterancesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUtterancesError {
fn description(&self) -> &str {
match *self {
DeleteUtterancesError::BadRequest(ref cause) => cause,
DeleteUtterancesError::InternalFailure(ref cause) => cause,
DeleteUtterancesError::LimitExceeded(ref cause) => cause,
DeleteUtterancesError::NotFound(ref cause) => cause,
DeleteUtterancesError::Validation(ref cause) => cause,
DeleteUtterancesError::Credentials(ref err) => err.description(),
DeleteUtterancesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteUtterancesError::ParseError(ref cause) => cause,
DeleteUtterancesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBotError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBotError {
pub fn from_response(res: BufferedHttpResponse) -> GetBotError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBotError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBotError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBotError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return GetBotError::NotFound(String::from(error_message)),
"ValidationException" => return GetBotError::Validation(error_message.to_string()),
_ => {}
}
}
return GetBotError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBotError {
fn from(err: serde_json::error::Error) -> GetBotError {
GetBotError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBotError {
fn from(err: CredentialsError) -> GetBotError {
GetBotError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBotError {
fn from(err: HttpDispatchError) -> GetBotError {
GetBotError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBotError {
fn from(err: io::Error) -> GetBotError {
GetBotError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBotError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBotError {
fn description(&self) -> &str {
match *self {
GetBotError::BadRequest(ref cause) => cause,
GetBotError::InternalFailure(ref cause) => cause,
GetBotError::LimitExceeded(ref cause) => cause,
GetBotError::NotFound(ref cause) => cause,
GetBotError::Validation(ref cause) => cause,
GetBotError::Credentials(ref err) => err.description(),
GetBotError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBotError::ParseError(ref cause) => cause,
GetBotError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBotAliasError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBotAliasError {
pub fn from_response(res: BufferedHttpResponse) -> GetBotAliasError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBotAliasError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBotAliasError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBotAliasError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetBotAliasError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetBotAliasError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBotAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBotAliasError {
fn from(err: serde_json::error::Error) -> GetBotAliasError {
GetBotAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBotAliasError {
fn from(err: CredentialsError) -> GetBotAliasError {
GetBotAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBotAliasError {
fn from(err: HttpDispatchError) -> GetBotAliasError {
GetBotAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBotAliasError {
fn from(err: io::Error) -> GetBotAliasError {
GetBotAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBotAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBotAliasError {
fn description(&self) -> &str {
match *self {
GetBotAliasError::BadRequest(ref cause) => cause,
GetBotAliasError::InternalFailure(ref cause) => cause,
GetBotAliasError::LimitExceeded(ref cause) => cause,
GetBotAliasError::NotFound(ref cause) => cause,
GetBotAliasError::Validation(ref cause) => cause,
GetBotAliasError::Credentials(ref err) => err.description(),
GetBotAliasError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBotAliasError::ParseError(ref cause) => cause,
GetBotAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBotAliasesError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBotAliasesError {
pub fn from_response(res: BufferedHttpResponse) -> GetBotAliasesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBotAliasesError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBotAliasesError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBotAliasesError::LimitExceeded(String::from(error_message));
}
"ValidationException" => {
return GetBotAliasesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBotAliasesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBotAliasesError {
fn from(err: serde_json::error::Error) -> GetBotAliasesError {
GetBotAliasesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBotAliasesError {
fn from(err: CredentialsError) -> GetBotAliasesError {
GetBotAliasesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBotAliasesError {
fn from(err: HttpDispatchError) -> GetBotAliasesError {
GetBotAliasesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBotAliasesError {
fn from(err: io::Error) -> GetBotAliasesError {
GetBotAliasesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBotAliasesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBotAliasesError {
fn description(&self) -> &str {
match *self {
GetBotAliasesError::BadRequest(ref cause) => cause,
GetBotAliasesError::InternalFailure(ref cause) => cause,
GetBotAliasesError::LimitExceeded(ref cause) => cause,
GetBotAliasesError::Validation(ref cause) => cause,
GetBotAliasesError::Credentials(ref err) => err.description(),
GetBotAliasesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBotAliasesError::ParseError(ref cause) => cause,
GetBotAliasesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBotChannelAssociationError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBotChannelAssociationError {
pub fn from_response(res: BufferedHttpResponse) -> GetBotChannelAssociationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBotChannelAssociationError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBotChannelAssociationError::InternalFailure(String::from(
error_message,
));
}
"LimitExceededException" => {
return GetBotChannelAssociationError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetBotChannelAssociationError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetBotChannelAssociationError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBotChannelAssociationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBotChannelAssociationError {
fn from(err: serde_json::error::Error) -> GetBotChannelAssociationError {
GetBotChannelAssociationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBotChannelAssociationError {
fn from(err: CredentialsError) -> GetBotChannelAssociationError {
GetBotChannelAssociationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBotChannelAssociationError {
fn from(err: HttpDispatchError) -> GetBotChannelAssociationError {
GetBotChannelAssociationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBotChannelAssociationError {
fn from(err: io::Error) -> GetBotChannelAssociationError {
GetBotChannelAssociationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBotChannelAssociationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBotChannelAssociationError {
fn description(&self) -> &str {
match *self {
GetBotChannelAssociationError::BadRequest(ref cause) => cause,
GetBotChannelAssociationError::InternalFailure(ref cause) => cause,
GetBotChannelAssociationError::LimitExceeded(ref cause) => cause,
GetBotChannelAssociationError::NotFound(ref cause) => cause,
GetBotChannelAssociationError::Validation(ref cause) => cause,
GetBotChannelAssociationError::Credentials(ref err) => err.description(),
GetBotChannelAssociationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetBotChannelAssociationError::ParseError(ref cause) => cause,
GetBotChannelAssociationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBotChannelAssociationsError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBotChannelAssociationsError {
pub fn from_response(res: BufferedHttpResponse) -> GetBotChannelAssociationsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBotChannelAssociationsError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBotChannelAssociationsError::InternalFailure(String::from(
error_message,
));
}
"LimitExceededException" => {
return GetBotChannelAssociationsError::LimitExceeded(String::from(
error_message,
));
}
"ValidationException" => {
return GetBotChannelAssociationsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBotChannelAssociationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBotChannelAssociationsError {
fn from(err: serde_json::error::Error) -> GetBotChannelAssociationsError {
GetBotChannelAssociationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBotChannelAssociationsError {
fn from(err: CredentialsError) -> GetBotChannelAssociationsError {
GetBotChannelAssociationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBotChannelAssociationsError {
fn from(err: HttpDispatchError) -> GetBotChannelAssociationsError {
GetBotChannelAssociationsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBotChannelAssociationsError {
fn from(err: io::Error) -> GetBotChannelAssociationsError {
GetBotChannelAssociationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBotChannelAssociationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBotChannelAssociationsError {
fn description(&self) -> &str {
match *self {
GetBotChannelAssociationsError::BadRequest(ref cause) => cause,
GetBotChannelAssociationsError::InternalFailure(ref cause) => cause,
GetBotChannelAssociationsError::LimitExceeded(ref cause) => cause,
GetBotChannelAssociationsError::Validation(ref cause) => cause,
GetBotChannelAssociationsError::Credentials(ref err) => err.description(),
GetBotChannelAssociationsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetBotChannelAssociationsError::ParseError(ref cause) => cause,
GetBotChannelAssociationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBotVersionsError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBotVersionsError {
pub fn from_response(res: BufferedHttpResponse) -> GetBotVersionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBotVersionsError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBotVersionsError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBotVersionsError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetBotVersionsError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetBotVersionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBotVersionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBotVersionsError {
fn from(err: serde_json::error::Error) -> GetBotVersionsError {
GetBotVersionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBotVersionsError {
fn from(err: CredentialsError) -> GetBotVersionsError {
GetBotVersionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBotVersionsError {
fn from(err: HttpDispatchError) -> GetBotVersionsError {
GetBotVersionsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBotVersionsError {
fn from(err: io::Error) -> GetBotVersionsError {
GetBotVersionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBotVersionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBotVersionsError {
fn description(&self) -> &str {
match *self {
GetBotVersionsError::BadRequest(ref cause) => cause,
GetBotVersionsError::InternalFailure(ref cause) => cause,
GetBotVersionsError::LimitExceeded(ref cause) => cause,
GetBotVersionsError::NotFound(ref cause) => cause,
GetBotVersionsError::Validation(ref cause) => cause,
GetBotVersionsError::Credentials(ref err) => err.description(),
GetBotVersionsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBotVersionsError::ParseError(ref cause) => cause,
GetBotVersionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBotsError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBotsError {
pub fn from_response(res: BufferedHttpResponse) -> GetBotsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBotsError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBotsError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBotsError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return GetBotsError::NotFound(String::from(error_message)),
"ValidationException" => return GetBotsError::Validation(error_message.to_string()),
_ => {}
}
}
return GetBotsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBotsError {
fn from(err: serde_json::error::Error) -> GetBotsError {
GetBotsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBotsError {
fn from(err: CredentialsError) -> GetBotsError {
GetBotsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBotsError {
fn from(err: HttpDispatchError) -> GetBotsError {
GetBotsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBotsError {
fn from(err: io::Error) -> GetBotsError {
GetBotsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBotsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBotsError {
fn description(&self) -> &str {
match *self {
GetBotsError::BadRequest(ref cause) => cause,
GetBotsError::InternalFailure(ref cause) => cause,
GetBotsError::LimitExceeded(ref cause) => cause,
GetBotsError::NotFound(ref cause) => cause,
GetBotsError::Validation(ref cause) => cause,
GetBotsError::Credentials(ref err) => err.description(),
GetBotsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBotsError::ParseError(ref cause) => cause,
GetBotsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBuiltinIntentError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBuiltinIntentError {
pub fn from_response(res: BufferedHttpResponse) -> GetBuiltinIntentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBuiltinIntentError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBuiltinIntentError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBuiltinIntentError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetBuiltinIntentError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetBuiltinIntentError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBuiltinIntentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBuiltinIntentError {
fn from(err: serde_json::error::Error) -> GetBuiltinIntentError {
GetBuiltinIntentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBuiltinIntentError {
fn from(err: CredentialsError) -> GetBuiltinIntentError {
GetBuiltinIntentError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBuiltinIntentError {
fn from(err: HttpDispatchError) -> GetBuiltinIntentError {
GetBuiltinIntentError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBuiltinIntentError {
fn from(err: io::Error) -> GetBuiltinIntentError {
GetBuiltinIntentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBuiltinIntentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBuiltinIntentError {
fn description(&self) -> &str {
match *self {
GetBuiltinIntentError::BadRequest(ref cause) => cause,
GetBuiltinIntentError::InternalFailure(ref cause) => cause,
GetBuiltinIntentError::LimitExceeded(ref cause) => cause,
GetBuiltinIntentError::NotFound(ref cause) => cause,
GetBuiltinIntentError::Validation(ref cause) => cause,
GetBuiltinIntentError::Credentials(ref err) => err.description(),
GetBuiltinIntentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBuiltinIntentError::ParseError(ref cause) => cause,
GetBuiltinIntentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBuiltinIntentsError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBuiltinIntentsError {
pub fn from_response(res: BufferedHttpResponse) -> GetBuiltinIntentsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBuiltinIntentsError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBuiltinIntentsError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBuiltinIntentsError::LimitExceeded(String::from(error_message));
}
"ValidationException" => {
return GetBuiltinIntentsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBuiltinIntentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBuiltinIntentsError {
fn from(err: serde_json::error::Error) -> GetBuiltinIntentsError {
GetBuiltinIntentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBuiltinIntentsError {
fn from(err: CredentialsError) -> GetBuiltinIntentsError {
GetBuiltinIntentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBuiltinIntentsError {
fn from(err: HttpDispatchError) -> GetBuiltinIntentsError {
GetBuiltinIntentsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBuiltinIntentsError {
fn from(err: io::Error) -> GetBuiltinIntentsError {
GetBuiltinIntentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBuiltinIntentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBuiltinIntentsError {
fn description(&self) -> &str {
match *self {
GetBuiltinIntentsError::BadRequest(ref cause) => cause,
GetBuiltinIntentsError::InternalFailure(ref cause) => cause,
GetBuiltinIntentsError::LimitExceeded(ref cause) => cause,
GetBuiltinIntentsError::Validation(ref cause) => cause,
GetBuiltinIntentsError::Credentials(ref err) => err.description(),
GetBuiltinIntentsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetBuiltinIntentsError::ParseError(ref cause) => cause,
GetBuiltinIntentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBuiltinSlotTypesError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBuiltinSlotTypesError {
pub fn from_response(res: BufferedHttpResponse) -> GetBuiltinSlotTypesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetBuiltinSlotTypesError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetBuiltinSlotTypesError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetBuiltinSlotTypesError::LimitExceeded(String::from(error_message));
}
"ValidationException" => {
return GetBuiltinSlotTypesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBuiltinSlotTypesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBuiltinSlotTypesError {
fn from(err: serde_json::error::Error) -> GetBuiltinSlotTypesError {
GetBuiltinSlotTypesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBuiltinSlotTypesError {
fn from(err: CredentialsError) -> GetBuiltinSlotTypesError {
GetBuiltinSlotTypesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBuiltinSlotTypesError {
fn from(err: HttpDispatchError) -> GetBuiltinSlotTypesError {
GetBuiltinSlotTypesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBuiltinSlotTypesError {
fn from(err: io::Error) -> GetBuiltinSlotTypesError {
GetBuiltinSlotTypesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBuiltinSlotTypesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBuiltinSlotTypesError {
fn description(&self) -> &str {
match *self {
GetBuiltinSlotTypesError::BadRequest(ref cause) => cause,
GetBuiltinSlotTypesError::InternalFailure(ref cause) => cause,
GetBuiltinSlotTypesError::LimitExceeded(ref cause) => cause,
GetBuiltinSlotTypesError::Validation(ref cause) => cause,
GetBuiltinSlotTypesError::Credentials(ref err) => err.description(),
GetBuiltinSlotTypesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetBuiltinSlotTypesError::ParseError(ref cause) => cause,
GetBuiltinSlotTypesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetExportError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetExportError {
pub fn from_response(res: BufferedHttpResponse) -> GetExportError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetExportError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetExportError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetExportError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return GetExportError::NotFound(String::from(error_message)),
"ValidationException" => {
return GetExportError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetExportError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetExportError {
fn from(err: serde_json::error::Error) -> GetExportError {
GetExportError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetExportError {
fn from(err: CredentialsError) -> GetExportError {
GetExportError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetExportError {
fn from(err: HttpDispatchError) -> GetExportError {
GetExportError::HttpDispatch(err)
}
}
impl From<io::Error> for GetExportError {
fn from(err: io::Error) -> GetExportError {
GetExportError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetExportError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetExportError {
fn description(&self) -> &str {
match *self {
GetExportError::BadRequest(ref cause) => cause,
GetExportError::InternalFailure(ref cause) => cause,
GetExportError::LimitExceeded(ref cause) => cause,
GetExportError::NotFound(ref cause) => cause,
GetExportError::Validation(ref cause) => cause,
GetExportError::Credentials(ref err) => err.description(),
GetExportError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetExportError::ParseError(ref cause) => cause,
GetExportError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetImportError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetImportError {
pub fn from_response(res: BufferedHttpResponse) -> GetImportError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetImportError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetImportError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetImportError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return GetImportError::NotFound(String::from(error_message)),
"ValidationException" => {
return GetImportError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetImportError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetImportError {
fn from(err: serde_json::error::Error) -> GetImportError {
GetImportError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetImportError {
fn from(err: CredentialsError) -> GetImportError {
GetImportError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetImportError {
fn from(err: HttpDispatchError) -> GetImportError {
GetImportError::HttpDispatch(err)
}
}
impl From<io::Error> for GetImportError {
fn from(err: io::Error) -> GetImportError {
GetImportError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetImportError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetImportError {
fn description(&self) -> &str {
match *self {
GetImportError::BadRequest(ref cause) => cause,
GetImportError::InternalFailure(ref cause) => cause,
GetImportError::LimitExceeded(ref cause) => cause,
GetImportError::NotFound(ref cause) => cause,
GetImportError::Validation(ref cause) => cause,
GetImportError::Credentials(ref err) => err.description(),
GetImportError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetImportError::ParseError(ref cause) => cause,
GetImportError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIntentError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIntentError {
pub fn from_response(res: BufferedHttpResponse) -> GetIntentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetIntentError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetIntentError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetIntentError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => return GetIntentError::NotFound(String::from(error_message)),
"ValidationException" => {
return GetIntentError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetIntentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIntentError {
fn from(err: serde_json::error::Error) -> GetIntentError {
GetIntentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIntentError {
fn from(err: CredentialsError) -> GetIntentError {
GetIntentError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIntentError {
fn from(err: HttpDispatchError) -> GetIntentError {
GetIntentError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIntentError {
fn from(err: io::Error) -> GetIntentError {
GetIntentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIntentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIntentError {
fn description(&self) -> &str {
match *self {
GetIntentError::BadRequest(ref cause) => cause,
GetIntentError::InternalFailure(ref cause) => cause,
GetIntentError::LimitExceeded(ref cause) => cause,
GetIntentError::NotFound(ref cause) => cause,
GetIntentError::Validation(ref cause) => cause,
GetIntentError::Credentials(ref err) => err.description(),
GetIntentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetIntentError::ParseError(ref cause) => cause,
GetIntentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIntentVersionsError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIntentVersionsError {
pub fn from_response(res: BufferedHttpResponse) -> GetIntentVersionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetIntentVersionsError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetIntentVersionsError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetIntentVersionsError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetIntentVersionsError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetIntentVersionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetIntentVersionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIntentVersionsError {
fn from(err: serde_json::error::Error) -> GetIntentVersionsError {
GetIntentVersionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIntentVersionsError {
fn from(err: CredentialsError) -> GetIntentVersionsError {
GetIntentVersionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIntentVersionsError {
fn from(err: HttpDispatchError) -> GetIntentVersionsError {
GetIntentVersionsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIntentVersionsError {
fn from(err: io::Error) -> GetIntentVersionsError {
GetIntentVersionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIntentVersionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIntentVersionsError {
fn description(&self) -> &str {
match *self {
GetIntentVersionsError::BadRequest(ref cause) => cause,
GetIntentVersionsError::InternalFailure(ref cause) => cause,
GetIntentVersionsError::LimitExceeded(ref cause) => cause,
GetIntentVersionsError::NotFound(ref cause) => cause,
GetIntentVersionsError::Validation(ref cause) => cause,
GetIntentVersionsError::Credentials(ref err) => err.description(),
GetIntentVersionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetIntentVersionsError::ParseError(ref cause) => cause,
GetIntentVersionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIntentsError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIntentsError {
pub fn from_response(res: BufferedHttpResponse) -> GetIntentsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetIntentsError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetIntentsError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetIntentsError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetIntentsError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetIntentsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetIntentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIntentsError {
fn from(err: serde_json::error::Error) -> GetIntentsError {
GetIntentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIntentsError {
fn from(err: CredentialsError) -> GetIntentsError {
GetIntentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIntentsError {
fn from(err: HttpDispatchError) -> GetIntentsError {
GetIntentsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIntentsError {
fn from(err: io::Error) -> GetIntentsError {
GetIntentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIntentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIntentsError {
fn description(&self) -> &str {
match *self {
GetIntentsError::BadRequest(ref cause) => cause,
GetIntentsError::InternalFailure(ref cause) => cause,
GetIntentsError::LimitExceeded(ref cause) => cause,
GetIntentsError::NotFound(ref cause) => cause,
GetIntentsError::Validation(ref cause) => cause,
GetIntentsError::Credentials(ref err) => err.description(),
GetIntentsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetIntentsError::ParseError(ref cause) => cause,
GetIntentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSlotTypeError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSlotTypeError {
pub fn from_response(res: BufferedHttpResponse) -> GetSlotTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetSlotTypeError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetSlotTypeError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetSlotTypeError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetSlotTypeError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetSlotTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSlotTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSlotTypeError {
fn from(err: serde_json::error::Error) -> GetSlotTypeError {
GetSlotTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSlotTypeError {
fn from(err: CredentialsError) -> GetSlotTypeError {
GetSlotTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSlotTypeError {
fn from(err: HttpDispatchError) -> GetSlotTypeError {
GetSlotTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSlotTypeError {
fn from(err: io::Error) -> GetSlotTypeError {
GetSlotTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSlotTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSlotTypeError {
fn description(&self) -> &str {
match *self {
GetSlotTypeError::BadRequest(ref cause) => cause,
GetSlotTypeError::InternalFailure(ref cause) => cause,
GetSlotTypeError::LimitExceeded(ref cause) => cause,
GetSlotTypeError::NotFound(ref cause) => cause,
GetSlotTypeError::Validation(ref cause) => cause,
GetSlotTypeError::Credentials(ref err) => err.description(),
GetSlotTypeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSlotTypeError::ParseError(ref cause) => cause,
GetSlotTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSlotTypeVersionsError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSlotTypeVersionsError {
pub fn from_response(res: BufferedHttpResponse) -> GetSlotTypeVersionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetSlotTypeVersionsError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetSlotTypeVersionsError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetSlotTypeVersionsError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetSlotTypeVersionsError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetSlotTypeVersionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSlotTypeVersionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSlotTypeVersionsError {
fn from(err: serde_json::error::Error) -> GetSlotTypeVersionsError {
GetSlotTypeVersionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSlotTypeVersionsError {
fn from(err: CredentialsError) -> GetSlotTypeVersionsError {
GetSlotTypeVersionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSlotTypeVersionsError {
fn from(err: HttpDispatchError) -> GetSlotTypeVersionsError {
GetSlotTypeVersionsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSlotTypeVersionsError {
fn from(err: io::Error) -> GetSlotTypeVersionsError {
GetSlotTypeVersionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSlotTypeVersionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSlotTypeVersionsError {
fn description(&self) -> &str {
match *self {
GetSlotTypeVersionsError::BadRequest(ref cause) => cause,
GetSlotTypeVersionsError::InternalFailure(ref cause) => cause,
GetSlotTypeVersionsError::LimitExceeded(ref cause) => cause,
GetSlotTypeVersionsError::NotFound(ref cause) => cause,
GetSlotTypeVersionsError::Validation(ref cause) => cause,
GetSlotTypeVersionsError::Credentials(ref err) => err.description(),
GetSlotTypeVersionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetSlotTypeVersionsError::ParseError(ref cause) => cause,
GetSlotTypeVersionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSlotTypesError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSlotTypesError {
pub fn from_response(res: BufferedHttpResponse) -> GetSlotTypesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetSlotTypesError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetSlotTypesError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetSlotTypesError::LimitExceeded(String::from(error_message));
}
"NotFoundException" => {
return GetSlotTypesError::NotFound(String::from(error_message));
}
"ValidationException" => {
return GetSlotTypesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSlotTypesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSlotTypesError {
fn from(err: serde_json::error::Error) -> GetSlotTypesError {
GetSlotTypesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSlotTypesError {
fn from(err: CredentialsError) -> GetSlotTypesError {
GetSlotTypesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSlotTypesError {
fn from(err: HttpDispatchError) -> GetSlotTypesError {
GetSlotTypesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSlotTypesError {
fn from(err: io::Error) -> GetSlotTypesError {
GetSlotTypesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSlotTypesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSlotTypesError {
fn description(&self) -> &str {
match *self {
GetSlotTypesError::BadRequest(ref cause) => cause,
GetSlotTypesError::InternalFailure(ref cause) => cause,
GetSlotTypesError::LimitExceeded(ref cause) => cause,
GetSlotTypesError::NotFound(ref cause) => cause,
GetSlotTypesError::Validation(ref cause) => cause,
GetSlotTypesError::Credentials(ref err) => err.description(),
GetSlotTypesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSlotTypesError::ParseError(ref cause) => cause,
GetSlotTypesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUtterancesViewError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUtterancesViewError {
pub fn from_response(res: BufferedHttpResponse) -> GetUtterancesViewError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return GetUtterancesViewError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return GetUtterancesViewError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return GetUtterancesViewError::LimitExceeded(String::from(error_message));
}
"ValidationException" => {
return GetUtterancesViewError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUtterancesViewError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUtterancesViewError {
fn from(err: serde_json::error::Error) -> GetUtterancesViewError {
GetUtterancesViewError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUtterancesViewError {
fn from(err: CredentialsError) -> GetUtterancesViewError {
GetUtterancesViewError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUtterancesViewError {
fn from(err: HttpDispatchError) -> GetUtterancesViewError {
GetUtterancesViewError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUtterancesViewError {
fn from(err: io::Error) -> GetUtterancesViewError {
GetUtterancesViewError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUtterancesViewError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUtterancesViewError {
fn description(&self) -> &str {
match *self {
GetUtterancesViewError::BadRequest(ref cause) => cause,
GetUtterancesViewError::InternalFailure(ref cause) => cause,
GetUtterancesViewError::LimitExceeded(ref cause) => cause,
GetUtterancesViewError::Validation(ref cause) => cause,
GetUtterancesViewError::Credentials(ref err) => err.description(),
GetUtterancesViewError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetUtterancesViewError::ParseError(ref cause) => cause,
GetUtterancesViewError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutBotError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
PreconditionFailed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutBotError {
pub fn from_response(res: BufferedHttpResponse) -> PutBotError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return PutBotError::BadRequest(String::from(error_message));
}
"ConflictException" => return PutBotError::Conflict(String::from(error_message)),
"InternalFailureException" => {
return PutBotError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return PutBotError::LimitExceeded(String::from(error_message));
}
"PreconditionFailedException" => {
return PutBotError::PreconditionFailed(String::from(error_message));
}
"ValidationException" => return PutBotError::Validation(error_message.to_string()),
_ => {}
}
}
return PutBotError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutBotError {
fn from(err: serde_json::error::Error) -> PutBotError {
PutBotError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutBotError {
fn from(err: CredentialsError) -> PutBotError {
PutBotError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutBotError {
fn from(err: HttpDispatchError) -> PutBotError {
PutBotError::HttpDispatch(err)
}
}
impl From<io::Error> for PutBotError {
fn from(err: io::Error) -> PutBotError {
PutBotError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutBotError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutBotError {
fn description(&self) -> &str {
match *self {
PutBotError::BadRequest(ref cause) => cause,
PutBotError::Conflict(ref cause) => cause,
PutBotError::InternalFailure(ref cause) => cause,
PutBotError::LimitExceeded(ref cause) => cause,
PutBotError::PreconditionFailed(ref cause) => cause,
PutBotError::Validation(ref cause) => cause,
PutBotError::Credentials(ref err) => err.description(),
PutBotError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutBotError::ParseError(ref cause) => cause,
PutBotError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutBotAliasError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
PreconditionFailed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutBotAliasError {
pub fn from_response(res: BufferedHttpResponse) -> PutBotAliasError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return PutBotAliasError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return PutBotAliasError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return PutBotAliasError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return PutBotAliasError::LimitExceeded(String::from(error_message));
}
"PreconditionFailedException" => {
return PutBotAliasError::PreconditionFailed(String::from(error_message));
}
"ValidationException" => {
return PutBotAliasError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutBotAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutBotAliasError {
fn from(err: serde_json::error::Error) -> PutBotAliasError {
PutBotAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutBotAliasError {
fn from(err: CredentialsError) -> PutBotAliasError {
PutBotAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutBotAliasError {
fn from(err: HttpDispatchError) -> PutBotAliasError {
PutBotAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for PutBotAliasError {
fn from(err: io::Error) -> PutBotAliasError {
PutBotAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutBotAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutBotAliasError {
fn description(&self) -> &str {
match *self {
PutBotAliasError::BadRequest(ref cause) => cause,
PutBotAliasError::Conflict(ref cause) => cause,
PutBotAliasError::InternalFailure(ref cause) => cause,
PutBotAliasError::LimitExceeded(ref cause) => cause,
PutBotAliasError::PreconditionFailed(ref cause) => cause,
PutBotAliasError::Validation(ref cause) => cause,
PutBotAliasError::Credentials(ref err) => err.description(),
PutBotAliasError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutBotAliasError::ParseError(ref cause) => cause,
PutBotAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutIntentError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
PreconditionFailed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutIntentError {
pub fn from_response(res: BufferedHttpResponse) -> PutIntentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return PutIntentError::BadRequest(String::from(error_message));
}
"ConflictException" => return PutIntentError::Conflict(String::from(error_message)),
"InternalFailureException" => {
return PutIntentError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return PutIntentError::LimitExceeded(String::from(error_message));
}
"PreconditionFailedException" => {
return PutIntentError::PreconditionFailed(String::from(error_message));
}
"ValidationException" => {
return PutIntentError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutIntentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutIntentError {
fn from(err: serde_json::error::Error) -> PutIntentError {
PutIntentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutIntentError {
fn from(err: CredentialsError) -> PutIntentError {
PutIntentError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutIntentError {
fn from(err: HttpDispatchError) -> PutIntentError {
PutIntentError::HttpDispatch(err)
}
}
impl From<io::Error> for PutIntentError {
fn from(err: io::Error) -> PutIntentError {
PutIntentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutIntentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutIntentError {
fn description(&self) -> &str {
match *self {
PutIntentError::BadRequest(ref cause) => cause,
PutIntentError::Conflict(ref cause) => cause,
PutIntentError::InternalFailure(ref cause) => cause,
PutIntentError::LimitExceeded(ref cause) => cause,
PutIntentError::PreconditionFailed(ref cause) => cause,
PutIntentError::Validation(ref cause) => cause,
PutIntentError::Credentials(ref err) => err.description(),
PutIntentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutIntentError::ParseError(ref cause) => cause,
PutIntentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutSlotTypeError {
BadRequest(String),
Conflict(String),
InternalFailure(String),
LimitExceeded(String),
PreconditionFailed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutSlotTypeError {
pub fn from_response(res: BufferedHttpResponse) -> PutSlotTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return PutSlotTypeError::BadRequest(String::from(error_message));
}
"ConflictException" => {
return PutSlotTypeError::Conflict(String::from(error_message));
}
"InternalFailureException" => {
return PutSlotTypeError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return PutSlotTypeError::LimitExceeded(String::from(error_message));
}
"PreconditionFailedException" => {
return PutSlotTypeError::PreconditionFailed(String::from(error_message));
}
"ValidationException" => {
return PutSlotTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutSlotTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutSlotTypeError {
fn from(err: serde_json::error::Error) -> PutSlotTypeError {
PutSlotTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutSlotTypeError {
fn from(err: CredentialsError) -> PutSlotTypeError {
PutSlotTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutSlotTypeError {
fn from(err: HttpDispatchError) -> PutSlotTypeError {
PutSlotTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for PutSlotTypeError {
fn from(err: io::Error) -> PutSlotTypeError {
PutSlotTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutSlotTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutSlotTypeError {
fn description(&self) -> &str {
match *self {
PutSlotTypeError::BadRequest(ref cause) => cause,
PutSlotTypeError::Conflict(ref cause) => cause,
PutSlotTypeError::InternalFailure(ref cause) => cause,
PutSlotTypeError::LimitExceeded(ref cause) => cause,
PutSlotTypeError::PreconditionFailed(ref cause) => cause,
PutSlotTypeError::Validation(ref cause) => cause,
PutSlotTypeError::Credentials(ref err) => err.description(),
PutSlotTypeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutSlotTypeError::ParseError(ref cause) => cause,
PutSlotTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartImportError {
BadRequest(String),
InternalFailure(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartImportError {
pub fn from_response(res: BufferedHttpResponse) -> StartImportError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"BadRequestException" => {
return StartImportError::BadRequest(String::from(error_message));
}
"InternalFailureException" => {
return StartImportError::InternalFailure(String::from(error_message));
}
"LimitExceededException" => {
return StartImportError::LimitExceeded(String::from(error_message));
}
"ValidationException" => {
return StartImportError::Validation(error_message.to_string());
}
_ => {}
}
}
return StartImportError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartImportError {
fn from(err: serde_json::error::Error) -> StartImportError {
StartImportError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartImportError {
fn from(err: CredentialsError) -> StartImportError {
StartImportError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartImportError {
fn from(err: HttpDispatchError) -> StartImportError {
StartImportError::HttpDispatch(err)
}
}
impl From<io::Error> for StartImportError {
fn from(err: io::Error) -> StartImportError {
StartImportError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartImportError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartImportError {
fn description(&self) -> &str {
match *self {
StartImportError::BadRequest(ref cause) => cause,
StartImportError::InternalFailure(ref cause) => cause,
StartImportError::LimitExceeded(ref cause) => cause,
StartImportError::Validation(ref cause) => cause,
StartImportError::Credentials(ref err) => err.description(),
StartImportError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StartImportError::ParseError(ref cause) => cause,
StartImportError::Unknown(_) => "unknown error",
}
}
}
pub trait LexModels {
fn create_bot_version(
&self,
input: CreateBotVersionRequest,
) -> RusotoFuture<CreateBotVersionResponse, CreateBotVersionError>;
fn create_intent_version(
&self,
input: CreateIntentVersionRequest,
) -> RusotoFuture<CreateIntentVersionResponse, CreateIntentVersionError>;
fn create_slot_type_version(
&self,
input: CreateSlotTypeVersionRequest,
) -> RusotoFuture<CreateSlotTypeVersionResponse, CreateSlotTypeVersionError>;
fn delete_bot(&self, input: DeleteBotRequest) -> RusotoFuture<(), DeleteBotError>;
fn delete_bot_alias(
&self,
input: DeleteBotAliasRequest,
) -> RusotoFuture<(), DeleteBotAliasError>;
fn delete_bot_channel_association(
&self,
input: DeleteBotChannelAssociationRequest,
) -> RusotoFuture<(), DeleteBotChannelAssociationError>;
fn delete_bot_version(
&self,
input: DeleteBotVersionRequest,
) -> RusotoFuture<(), DeleteBotVersionError>;
fn delete_intent(&self, input: DeleteIntentRequest) -> RusotoFuture<(), DeleteIntentError>;
fn delete_intent_version(
&self,
input: DeleteIntentVersionRequest,
) -> RusotoFuture<(), DeleteIntentVersionError>;
fn delete_slot_type(
&self,
input: DeleteSlotTypeRequest,
) -> RusotoFuture<(), DeleteSlotTypeError>;
fn delete_slot_type_version(
&self,
input: DeleteSlotTypeVersionRequest,
) -> RusotoFuture<(), DeleteSlotTypeVersionError>;
fn delete_utterances(
&self,
input: DeleteUtterancesRequest,
) -> RusotoFuture<(), DeleteUtterancesError>;
fn get_bot(&self, input: GetBotRequest) -> RusotoFuture<GetBotResponse, GetBotError>;
fn get_bot_alias(
&self,
input: GetBotAliasRequest,
) -> RusotoFuture<GetBotAliasResponse, GetBotAliasError>;
fn get_bot_aliases(
&self,
input: GetBotAliasesRequest,
) -> RusotoFuture<GetBotAliasesResponse, GetBotAliasesError>;
fn get_bot_channel_association(
&self,
input: GetBotChannelAssociationRequest,
) -> RusotoFuture<GetBotChannelAssociationResponse, GetBotChannelAssociationError>;
fn get_bot_channel_associations(
&self,
input: GetBotChannelAssociationsRequest,
) -> RusotoFuture<GetBotChannelAssociationsResponse, GetBotChannelAssociationsError>;
fn get_bot_versions(
&self,
input: GetBotVersionsRequest,
) -> RusotoFuture<GetBotVersionsResponse, GetBotVersionsError>;
fn get_bots(&self, input: GetBotsRequest) -> RusotoFuture<GetBotsResponse, GetBotsError>;
fn get_builtin_intent(
&self,
input: GetBuiltinIntentRequest,
) -> RusotoFuture<GetBuiltinIntentResponse, GetBuiltinIntentError>;
fn get_builtin_intents(
&self,
input: GetBuiltinIntentsRequest,
) -> RusotoFuture<GetBuiltinIntentsResponse, GetBuiltinIntentsError>;
fn get_builtin_slot_types(
&self,
input: GetBuiltinSlotTypesRequest,
) -> RusotoFuture<GetBuiltinSlotTypesResponse, GetBuiltinSlotTypesError>;
fn get_export(
&self,
input: GetExportRequest,
) -> RusotoFuture<GetExportResponse, GetExportError>;
fn get_import(
&self,
input: GetImportRequest,
) -> RusotoFuture<GetImportResponse, GetImportError>;
fn get_intent(
&self,
input: GetIntentRequest,
) -> RusotoFuture<GetIntentResponse, GetIntentError>;
fn get_intent_versions(
&self,
input: GetIntentVersionsRequest,
) -> RusotoFuture<GetIntentVersionsResponse, GetIntentVersionsError>;
fn get_intents(
&self,
input: GetIntentsRequest,
) -> RusotoFuture<GetIntentsResponse, GetIntentsError>;
fn get_slot_type(
&self,
input: GetSlotTypeRequest,
) -> RusotoFuture<GetSlotTypeResponse, GetSlotTypeError>;
fn get_slot_type_versions(
&self,
input: GetSlotTypeVersionsRequest,
) -> RusotoFuture<GetSlotTypeVersionsResponse, GetSlotTypeVersionsError>;
fn get_slot_types(
&self,
input: GetSlotTypesRequest,
) -> RusotoFuture<GetSlotTypesResponse, GetSlotTypesError>;
fn get_utterances_view(
&self,
input: GetUtterancesViewRequest,
) -> RusotoFuture<GetUtterancesViewResponse, GetUtterancesViewError>;
fn put_bot(&self, input: PutBotRequest) -> RusotoFuture<PutBotResponse, PutBotError>;
fn put_bot_alias(
&self,
input: PutBotAliasRequest,
) -> RusotoFuture<PutBotAliasResponse, PutBotAliasError>;
fn put_intent(
&self,
input: PutIntentRequest,
) -> RusotoFuture<PutIntentResponse, PutIntentError>;
fn put_slot_type(
&self,
input: PutSlotTypeRequest,
) -> RusotoFuture<PutSlotTypeResponse, PutSlotTypeError>;
fn start_import(
&self,
input: StartImportRequest,
) -> RusotoFuture<StartImportResponse, StartImportError>;
}
#[derive(Clone)]
pub struct LexModelsClient {
client: Client,
region: region::Region,
}
impl LexModelsClient {
pub fn new(region: region::Region) -> LexModelsClient {
LexModelsClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> LexModelsClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
LexModelsClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl LexModels for LexModelsClient {
fn create_bot_version(
&self,
input: CreateBotVersionRequest,
) -> RusotoFuture<CreateBotVersionResponse, CreateBotVersionError> {
let request_uri = format!("/bots/{name}/versions", name = input.name);
let mut request = SignedRequest::new("POST", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateBotVersionResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateBotVersionError::from_response(response))),
)
}
})
}
fn create_intent_version(
&self,
input: CreateIntentVersionRequest,
) -> RusotoFuture<CreateIntentVersionResponse, CreateIntentVersionError> {
let request_uri = format!("/intents/{name}/versions", name = input.name);
let mut request = SignedRequest::new("POST", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateIntentVersionResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateIntentVersionError::from_response(response))
}),
)
}
})
}
fn create_slot_type_version(
&self,
input: CreateSlotTypeVersionRequest,
) -> RusotoFuture<CreateSlotTypeVersionResponse, CreateSlotTypeVersionError> {
let request_uri = format!("/slottypes/{name}/versions", name = input.name);
let mut request = SignedRequest::new("POST", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateSlotTypeVersionResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateSlotTypeVersionError::from_response(response))
}),
)
}
})
}
fn delete_bot(&self, input: DeleteBotRequest) -> RusotoFuture<(), DeleteBotError> {
let request_uri = format!("/bots/{name}", name = input.name);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteBotError::from_response(response))),
)
}
})
}
fn delete_bot_alias(
&self,
input: DeleteBotAliasRequest,
) -> RusotoFuture<(), DeleteBotAliasError> {
let request_uri = format!(
"/bots/{bot_name}/aliases/{name}",
bot_name = input.bot_name,
name = input.name
);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteBotAliasError::from_response(response))),
)
}
})
}
fn delete_bot_channel_association(
&self,
input: DeleteBotChannelAssociationRequest,
) -> RusotoFuture<(), DeleteBotChannelAssociationError> {
let request_uri = format!(
"/bots/{bot_name}/aliases/{alias_name}/channels/{name}",
alias_name = input.bot_alias,
bot_name = input.bot_name,
name = input.name
);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteBotChannelAssociationError::from_response(response))
}))
}
})
}
fn delete_bot_version(
&self,
input: DeleteBotVersionRequest,
) -> RusotoFuture<(), DeleteBotVersionError> {
let request_uri = format!(
"/bots/{name}/versions/{version}",
name = input.name,
version = input.version
);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteBotVersionError::from_response(response))),
)
}
})
}
fn delete_intent(&self, input: DeleteIntentRequest) -> RusotoFuture<(), DeleteIntentError> {
let request_uri = format!("/intents/{name}", name = input.name);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteIntentError::from_response(response))),
)
}
})
}
fn delete_intent_version(
&self,
input: DeleteIntentVersionRequest,
) -> RusotoFuture<(), DeleteIntentVersionError> {
let request_uri = format!(
"/intents/{name}/versions/{version}",
name = input.name,
version = input.version
);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteIntentVersionError::from_response(response))
}),
)
}
})
}
fn delete_slot_type(
&self,
input: DeleteSlotTypeRequest,
) -> RusotoFuture<(), DeleteSlotTypeError> {
let request_uri = format!("/slottypes/{name}", name = input.name);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteSlotTypeError::from_response(response))),
)
}
})
}
fn delete_slot_type_version(
&self,
input: DeleteSlotTypeVersionRequest,
) -> RusotoFuture<(), DeleteSlotTypeVersionError> {
let request_uri = format!(
"/slottypes/{name}/version/{version}",
name = input.name,
version = input.version
);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteSlotTypeVersionError::from_response(response))
}),
)
}
})
}
fn delete_utterances(
&self,
input: DeleteUtterancesRequest,
) -> RusotoFuture<(), DeleteUtterancesError> {
let request_uri = format!(
"/bots/{bot_name}/utterances/{user_id}",
bot_name = input.bot_name,
user_id = input.user_id
);
let mut request = SignedRequest::new("DELETE", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteUtterancesError::from_response(response))),
)
}
})
}
fn get_bot(&self, input: GetBotRequest) -> RusotoFuture<GetBotResponse, GetBotError> {
let request_uri = format!(
"/bots/{name}/versions/{versionoralias}",
name = input.name,
versionoralias = input.version_or_alias
);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<GetBotResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBotError::from_response(response))),
)
}
})
}
fn get_bot_alias(
&self,
input: GetBotAliasRequest,
) -> RusotoFuture<GetBotAliasResponse, GetBotAliasError> {
let request_uri = format!(
"/bots/{bot_name}/aliases/{name}",
bot_name = input.bot_name,
name = input.name
);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<GetBotAliasResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBotAliasError::from_response(response))),
)
}
})
}
fn get_bot_aliases(
&self,
input: GetBotAliasesRequest,
) -> RusotoFuture<GetBotAliasesResponse, GetBotAliasesError> {
let request_uri = format!("/bots/{bot_name}/aliases/", bot_name = input.bot_name);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.name_contains {
params.put("nameContains", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetBotAliasesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBotAliasesError::from_response(response))),
)
}
})
}
fn get_bot_channel_association(
&self,
input: GetBotChannelAssociationRequest,
) -> RusotoFuture<GetBotChannelAssociationResponse, GetBotChannelAssociationError> {
let request_uri = format!(
"/bots/{bot_name}/aliases/{alias_name}/channels/{name}",
alias_name = input.bot_alias,
bot_name = input.bot_name,
name = input.name
);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<GetBotChannelAssociationResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetBotChannelAssociationError::from_response(response))
}))
}
})
}
fn get_bot_channel_associations(
&self,
input: GetBotChannelAssociationsRequest,
) -> RusotoFuture<GetBotChannelAssociationsResponse, GetBotChannelAssociationsError> {
let request_uri = format!(
"/bots/{bot_name}/aliases/{alias_name}/channels/",
alias_name = input.bot_alias,
bot_name = input.bot_name
);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.name_contains {
params.put("nameContains", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetBotChannelAssociationsResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetBotChannelAssociationsError::from_response(response))
}))
}
})
}
fn get_bot_versions(
&self,
input: GetBotVersionsRequest,
) -> RusotoFuture<GetBotVersionsResponse, GetBotVersionsError> {
let request_uri = format!("/bots/{name}/versions/", name = input.name);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetBotVersionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBotVersionsError::from_response(response))),
)
}
})
}
fn get_bots(&self, input: GetBotsRequest) -> RusotoFuture<GetBotsResponse, GetBotsError> {
let request_uri = "/bots/";
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.name_contains {
params.put("nameContains", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetBotsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBotsError::from_response(response))),
)
}
})
}
fn get_builtin_intent(
&self,
input: GetBuiltinIntentRequest,
) -> RusotoFuture<GetBuiltinIntentResponse, GetBuiltinIntentError> {
let request_uri = format!("/builtins/intents/{signature}", signature = input.signature);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<GetBuiltinIntentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBuiltinIntentError::from_response(response))),
)
}
})
}
fn get_builtin_intents(
&self,
input: GetBuiltinIntentsRequest,
) -> RusotoFuture<GetBuiltinIntentsResponse, GetBuiltinIntentsError> {
let request_uri = "/builtins/intents/";
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.locale {
params.put("locale", x);
}
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.signature_contains {
params.put("signatureContains", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetBuiltinIntentsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBuiltinIntentsError::from_response(response))),
)
}
})
}
fn get_builtin_slot_types(
&self,
input: GetBuiltinSlotTypesRequest,
) -> RusotoFuture<GetBuiltinSlotTypesResponse, GetBuiltinSlotTypesError> {
let request_uri = "/builtins/slottypes/";
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.locale {
params.put("locale", x);
}
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.signature_contains {
params.put("signatureContains", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetBuiltinSlotTypesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetBuiltinSlotTypesError::from_response(response))
}),
)
}
})
}
fn get_export(
&self,
input: GetExportRequest,
) -> RusotoFuture<GetExportResponse, GetExportError> {
let request_uri = "/exports/";
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
params.put("exportType", &input.export_type);
params.put("name", &input.name);
params.put("resourceType", &input.resource_type);
params.put("version", &input.version);
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetExportResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetExportError::from_response(response))),
)
}
})
}
fn get_import(
&self,
input: GetImportRequest,
) -> RusotoFuture<GetImportResponse, GetImportError> {
let request_uri = format!("/imports/{import_id}", import_id = input.import_id);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<GetImportResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetImportError::from_response(response))),
)
}
})
}
fn get_intent(
&self,
input: GetIntentRequest,
) -> RusotoFuture<GetIntentResponse, GetIntentError> {
let request_uri = format!(
"/intents/{name}/versions/{version}",
name = input.name,
version = input.version
);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<GetIntentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetIntentError::from_response(response))),
)
}
})
}
fn get_intent_versions(
&self,
input: GetIntentVersionsRequest,
) -> RusotoFuture<GetIntentVersionsResponse, GetIntentVersionsError> {
let request_uri = format!("/intents/{name}/versions/", name = input.name);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetIntentVersionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetIntentVersionsError::from_response(response))),
)
}
})
}
fn get_intents(
&self,
input: GetIntentsRequest,
) -> RusotoFuture<GetIntentsResponse, GetIntentsError> {
let request_uri = "/intents/";
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.name_contains {
params.put("nameContains", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetIntentsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetIntentsError::from_response(response))),
)
}
})
}
fn get_slot_type(
&self,
input: GetSlotTypeRequest,
) -> RusotoFuture<GetSlotTypeResponse, GetSlotTypeError> {
let request_uri = format!(
"/slottypes/{name}/versions/{version}",
name = input.name,
version = input.version
);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<GetSlotTypeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSlotTypeError::from_response(response))),
)
}
})
}
fn get_slot_type_versions(
&self,
input: GetSlotTypeVersionsRequest,
) -> RusotoFuture<GetSlotTypeVersionsResponse, GetSlotTypeVersionsError> {
let request_uri = format!("/slottypes/{name}/versions/", name = input.name);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetSlotTypeVersionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetSlotTypeVersionsError::from_response(response))
}),
)
}
})
}
fn get_slot_types(
&self,
input: GetSlotTypesRequest,
) -> RusotoFuture<GetSlotTypesResponse, GetSlotTypesError> {
let request_uri = "/slottypes/";
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.name_contains {
params.put("nameContains", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetSlotTypesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSlotTypesError::from_response(response))),
)
}
})
}
fn get_utterances_view(
&self,
input: GetUtterancesViewRequest,
) -> RusotoFuture<GetUtterancesViewResponse, GetUtterancesViewError> {
let request_uri = format!("/bots/{botname}/utterances", botname = input.bot_name);
let mut request = SignedRequest::new("GET", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let mut params = Params::new();
for item in input.bot_versions.iter() {
params.put("bot_versions", item);
}
params.put("status_type", &input.status_type);
params.put("view", "aggregation");
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetUtterancesViewResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUtterancesViewError::from_response(response))),
)
}
})
}
fn put_bot(&self, input: PutBotRequest) -> RusotoFuture<PutBotResponse, PutBotError> {
let request_uri = format!("/bots/{name}/versions/$LATEST", name = input.name);
let mut request = SignedRequest::new("PUT", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<PutBotResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutBotError::from_response(response))),
)
}
})
}
fn put_bot_alias(
&self,
input: PutBotAliasRequest,
) -> RusotoFuture<PutBotAliasResponse, PutBotAliasError> {
let request_uri = format!(
"/bots/{bot_name}/aliases/{name}",
bot_name = input.bot_name,
name = input.name
);
let mut request = SignedRequest::new("PUT", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<PutBotAliasResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutBotAliasError::from_response(response))),
)
}
})
}
fn put_intent(
&self,
input: PutIntentRequest,
) -> RusotoFuture<PutIntentResponse, PutIntentError> {
let request_uri = format!("/intents/{name}/versions/$LATEST", name = input.name);
let mut request = SignedRequest::new("PUT", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<PutIntentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutIntentError::from_response(response))),
)
}
})
}
fn put_slot_type(
&self,
input: PutSlotTypeRequest,
) -> RusotoFuture<PutSlotTypeResponse, PutSlotTypeError> {
let request_uri = format!("/slottypes/{name}/versions/$LATEST", name = input.name);
let mut request = SignedRequest::new("PUT", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
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::<PutSlotTypeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutSlotTypeError::from_response(response))),
)
}
})
}
fn start_import(
&self,
input: StartImportRequest,
) -> RusotoFuture<StartImportResponse, StartImportError> {
let request_uri = "/imports/";
let mut request = SignedRequest::new("POST", "lex", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("models.lex".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<StartImportResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StartImportError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}