use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddressBook {
#[serde(rename = "AddressBookArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_book_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddressBookData {
#[serde(rename = "AddressBookArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_book_arn: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateContactWithAddressBookRequest {
#[serde(rename = "AddressBookArn")]
pub address_book_arn: String,
#[serde(rename = "ContactArn")]
pub contact_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateContactWithAddressBookResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateDeviceWithRoomRequest {
#[serde(rename = "DeviceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_arn: Option<String>,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateDeviceWithRoomResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateSkillGroupWithRoomRequest {
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateSkillGroupWithRoomResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Contact {
#[serde(rename = "ContactArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub contact_arn: Option<String>,
#[serde(rename = "DisplayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "FirstName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[serde(rename = "LastName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(rename = "PhoneNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub phone_number: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ContactData {
#[serde(rename = "ContactArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub contact_arn: Option<String>,
#[serde(rename = "DisplayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "FirstName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[serde(rename = "LastName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(rename = "PhoneNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub phone_number: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateAddressBookRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: 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 CreateAddressBookResponse {
#[serde(rename = "AddressBookArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_book_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateContactRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "DisplayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "FirstName")]
pub first_name: String,
#[serde(rename = "LastName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(rename = "PhoneNumber")]
pub phone_number: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateContactResponse {
#[serde(rename = "ContactArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub contact_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateProfileRequest {
#[serde(rename = "Address")]
pub address: String,
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "DistanceUnit")]
pub distance_unit: String,
#[serde(rename = "MaxVolumeLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_volume_limit: Option<i64>,
#[serde(rename = "PSTNEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pstn_enabled: Option<bool>,
#[serde(rename = "ProfileName")]
pub profile_name: String,
#[serde(rename = "SetupModeDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_mode_disabled: Option<bool>,
#[serde(rename = "TemperatureUnit")]
pub temperature_unit: String,
#[serde(rename = "Timezone")]
pub timezone: String,
#[serde(rename = "WakeWord")]
pub wake_word: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateProfileResponse {
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateRoomRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
#[serde(rename = "ProviderCalendarId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_calendar_id: Option<String>,
#[serde(rename = "RoomName")]
pub room_name: String,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateRoomResponse {
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSkillGroupRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "SkillGroupName")]
pub skill_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSkillGroupResponse {
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUserRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "Email")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[serde(rename = "FirstName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[serde(rename = "LastName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "UserId")]
pub user_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateUserResponse {
#[serde(rename = "UserArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteAddressBookRequest {
#[serde(rename = "AddressBookArn")]
pub address_book_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteAddressBookResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteContactRequest {
#[serde(rename = "ContactArn")]
pub contact_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteContactResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteProfileRequest {
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteProfileResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRoomRequest {
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteRoomResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRoomSkillParameterRequest {
#[serde(rename = "ParameterKey")]
pub parameter_key: String,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "SkillId")]
pub skill_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteRoomSkillParameterResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSkillGroupRequest {
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSkillGroupResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUserRequest {
#[serde(rename = "EnrollmentId")]
pub enrollment_id: String,
#[serde(rename = "UserArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteUserResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Device {
#[serde(rename = "DeviceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_arn: Option<String>,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "DeviceSerialNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_serial_number: Option<String>,
#[serde(rename = "DeviceStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_status: Option<String>,
#[serde(rename = "DeviceStatusInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_status_info: Option<DeviceStatusInfo>,
#[serde(rename = "DeviceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_type: Option<String>,
#[serde(rename = "MacAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mac_address: Option<String>,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "SoftwareVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeviceData {
#[serde(rename = "DeviceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_arn: Option<String>,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "DeviceSerialNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_serial_number: Option<String>,
#[serde(rename = "DeviceStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_status: Option<String>,
#[serde(rename = "DeviceStatusInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_status_info: Option<DeviceStatusInfo>,
#[serde(rename = "DeviceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_type: Option<String>,
#[serde(rename = "MacAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mac_address: Option<String>,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "RoomName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_name: Option<String>,
#[serde(rename = "SoftwareVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeviceEvent {
#[serde(rename = "Timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<f64>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeviceStatusDetail {
#[serde(rename = "Code")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeviceStatusInfo {
#[serde(rename = "ConnectionStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub connection_status: Option<String>,
#[serde(rename = "DeviceStatusDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_status_details: Option<Vec<DeviceStatusDetail>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateContactFromAddressBookRequest {
#[serde(rename = "AddressBookArn")]
pub address_book_arn: String,
#[serde(rename = "ContactArn")]
pub contact_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateContactFromAddressBookResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateDeviceFromRoomRequest {
#[serde(rename = "DeviceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateDeviceFromRoomResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateSkillGroupFromRoomRequest {
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateSkillGroupFromRoomResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Filter {
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Values")]
pub values: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAddressBookRequest {
#[serde(rename = "AddressBookArn")]
pub address_book_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetAddressBookResponse {
#[serde(rename = "AddressBook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_book: Option<AddressBook>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetContactRequest {
#[serde(rename = "ContactArn")]
pub contact_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetContactResponse {
#[serde(rename = "Contact")]
#[serde(skip_serializing_if = "Option::is_none")]
pub contact: Option<Contact>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDeviceRequest {
#[serde(rename = "DeviceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDeviceResponse {
#[serde(rename = "Device")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device: Option<Device>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetProfileRequest {
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetProfileResponse {
#[serde(rename = "Profile")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile: Option<Profile>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRoomRequest {
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRoomResponse {
#[serde(rename = "Room")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room: Option<Room>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRoomSkillParameterRequest {
#[serde(rename = "ParameterKey")]
pub parameter_key: String,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "SkillId")]
pub skill_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRoomSkillParameterResponse {
#[serde(rename = "RoomSkillParameter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_skill_parameter: Option<RoomSkillParameter>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSkillGroupRequest {
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSkillGroupResponse {
#[serde(rename = "SkillGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group: Option<SkillGroup>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDeviceEventsRequest {
#[serde(rename = "DeviceArn")]
pub device_arn: String,
#[serde(rename = "EventType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_type: Option<String>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListDeviceEventsResponse {
#[serde(rename = "DeviceEvents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_events: Option<Vec<DeviceEvent>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListSkillsRequest {
#[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 = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListSkillsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SkillSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_summaries: Option<Vec<SkillSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsRequest {
#[serde(rename = "Arn")]
pub arn: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Profile {
#[serde(rename = "Address")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(rename = "DistanceUnit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub distance_unit: Option<String>,
#[serde(rename = "MaxVolumeLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_volume_limit: Option<i64>,
#[serde(rename = "PSTNEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pstn_enabled: Option<bool>,
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
#[serde(rename = "ProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_name: Option<String>,
#[serde(rename = "SetupModeDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_mode_disabled: Option<bool>,
#[serde(rename = "TemperatureUnit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature_unit: Option<String>,
#[serde(rename = "Timezone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timezone: Option<String>,
#[serde(rename = "WakeWord")]
#[serde(skip_serializing_if = "Option::is_none")]
pub wake_word: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ProfileData {
#[serde(rename = "Address")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(rename = "DistanceUnit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub distance_unit: Option<String>,
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
#[serde(rename = "ProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_name: Option<String>,
#[serde(rename = "TemperatureUnit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature_unit: Option<String>,
#[serde(rename = "Timezone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timezone: Option<String>,
#[serde(rename = "WakeWord")]
#[serde(skip_serializing_if = "Option::is_none")]
pub wake_word: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutRoomSkillParameterRequest {
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "RoomSkillParameter")]
pub room_skill_parameter: RoomSkillParameter,
#[serde(rename = "SkillId")]
pub skill_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutRoomSkillParameterResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ResolveRoomRequest {
#[serde(rename = "SkillId")]
pub skill_id: String,
#[serde(rename = "UserId")]
pub user_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ResolveRoomResponse {
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "RoomName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_name: Option<String>,
#[serde(rename = "RoomSkillParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_skill_parameters: Option<Vec<RoomSkillParameter>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RevokeInvitationRequest {
#[serde(rename = "EnrollmentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enrollment_id: Option<String>,
#[serde(rename = "UserArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RevokeInvitationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Room {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
#[serde(rename = "ProviderCalendarId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_calendar_id: Option<String>,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "RoomName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RoomData {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
#[serde(rename = "ProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_name: Option<String>,
#[serde(rename = "ProviderCalendarId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_calendar_id: Option<String>,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "RoomName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RoomSkillParameter {
#[serde(rename = "ParameterKey")]
pub parameter_key: String,
#[serde(rename = "ParameterValue")]
pub parameter_value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchAddressBooksRequest {
#[serde(rename = "Filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<Filter>>,
#[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 = "SortCriteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_criteria: Option<Vec<Sort>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchAddressBooksResponse {
#[serde(rename = "AddressBooks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address_books: Option<Vec<AddressBookData>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TotalCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchContactsRequest {
#[serde(rename = "Filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<Filter>>,
#[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 = "SortCriteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_criteria: Option<Vec<Sort>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchContactsResponse {
#[serde(rename = "Contacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub contacts: Option<Vec<ContactData>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TotalCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchDevicesRequest {
#[serde(rename = "Filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<Filter>>,
#[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 = "SortCriteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_criteria: Option<Vec<Sort>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchDevicesResponse {
#[serde(rename = "Devices")]
#[serde(skip_serializing_if = "Option::is_none")]
pub devices: Option<Vec<DeviceData>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TotalCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchProfilesRequest {
#[serde(rename = "Filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<Filter>>,
#[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 = "SortCriteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_criteria: Option<Vec<Sort>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchProfilesResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Profiles")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profiles: Option<Vec<ProfileData>>,
#[serde(rename = "TotalCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchRoomsRequest {
#[serde(rename = "Filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<Filter>>,
#[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 = "SortCriteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_criteria: Option<Vec<Sort>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchRoomsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Rooms")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rooms: Option<Vec<RoomData>>,
#[serde(rename = "TotalCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchSkillGroupsRequest {
#[serde(rename = "Filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<Filter>>,
#[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 = "SortCriteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_criteria: Option<Vec<Sort>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchSkillGroupsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "SkillGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_groups: Option<Vec<SkillGroupData>>,
#[serde(rename = "TotalCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchUsersRequest {
#[serde(rename = "Filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<Filter>>,
#[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 = "SortCriteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_criteria: Option<Vec<Sort>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchUsersResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "TotalCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
#[serde(rename = "Users")]
#[serde(skip_serializing_if = "Option::is_none")]
pub users: Option<Vec<UserData>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SendInvitationRequest {
#[serde(rename = "UserArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SendInvitationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SkillGroup {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
#[serde(rename = "SkillGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SkillGroupData {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
#[serde(rename = "SkillGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SkillSummary {
#[serde(rename = "SkillId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_id: Option<String>,
#[serde(rename = "SkillName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_name: Option<String>,
#[serde(rename = "SupportsLinking")]
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_linking: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Sort {
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartDeviceSyncRequest {
#[serde(rename = "DeviceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_arn: Option<String>,
#[serde(rename = "Features")]
pub features: Vec<String>,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartDeviceSyncResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "Key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagResourceRequest {
#[serde(rename = "Arn")]
pub arn: String,
#[serde(rename = "Tags")]
pub tags: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceRequest {
#[serde(rename = "Arn")]
pub arn: String,
#[serde(rename = "TagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateAddressBookRequest {
#[serde(rename = "AddressBookArn")]
pub address_book_arn: String,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateAddressBookResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateContactRequest {
#[serde(rename = "ContactArn")]
pub contact_arn: String,
#[serde(rename = "DisplayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "FirstName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[serde(rename = "LastName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(rename = "PhoneNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub phone_number: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateContactResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDeviceRequest {
#[serde(rename = "DeviceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_arn: Option<String>,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateDeviceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateProfileRequest {
#[serde(rename = "Address")]
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(rename = "DistanceUnit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub distance_unit: Option<String>,
#[serde(rename = "MaxVolumeLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_volume_limit: Option<i64>,
#[serde(rename = "PSTNEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pstn_enabled: Option<bool>,
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
#[serde(rename = "ProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_name: Option<String>,
#[serde(rename = "SetupModeDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_mode_disabled: Option<bool>,
#[serde(rename = "TemperatureUnit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature_unit: Option<String>,
#[serde(rename = "Timezone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timezone: Option<String>,
#[serde(rename = "WakeWord")]
#[serde(skip_serializing_if = "Option::is_none")]
pub wake_word: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateProfileResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRoomRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "ProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_arn: Option<String>,
#[serde(rename = "ProviderCalendarId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_calendar_id: Option<String>,
#[serde(rename = "RoomArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_arn: Option<String>,
#[serde(rename = "RoomName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub room_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateRoomResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateSkillGroupRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "SkillGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_arn: Option<String>,
#[serde(rename = "SkillGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skill_group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateSkillGroupResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserData {
#[serde(rename = "Email")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[serde(rename = "EnrollmentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enrollment_id: Option<String>,
#[serde(rename = "EnrollmentStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enrollment_status: Option<String>,
#[serde(rename = "FirstName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[serde(rename = "LastName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(rename = "UserArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_arn: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum AssociateContactWithAddressBookError {
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateContactWithAddressBookError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateContactWithAddressBookError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"LimitExceededException" => {
return AssociateContactWithAddressBookError::LimitExceeded(String::from(
error_message,
))
}
"ValidationException" => {
return AssociateContactWithAddressBookError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return AssociateContactWithAddressBookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateContactWithAddressBookError {
fn from(err: serde_json::error::Error) -> AssociateContactWithAddressBookError {
AssociateContactWithAddressBookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateContactWithAddressBookError {
fn from(err: CredentialsError) -> AssociateContactWithAddressBookError {
AssociateContactWithAddressBookError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateContactWithAddressBookError {
fn from(err: HttpDispatchError) -> AssociateContactWithAddressBookError {
AssociateContactWithAddressBookError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateContactWithAddressBookError {
fn from(err: io::Error) -> AssociateContactWithAddressBookError {
AssociateContactWithAddressBookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateContactWithAddressBookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateContactWithAddressBookError {
fn description(&self) -> &str {
match *self {
AssociateContactWithAddressBookError::LimitExceeded(ref cause) => cause,
AssociateContactWithAddressBookError::Validation(ref cause) => cause,
AssociateContactWithAddressBookError::Credentials(ref err) => err.description(),
AssociateContactWithAddressBookError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateContactWithAddressBookError::ParseError(ref cause) => cause,
AssociateContactWithAddressBookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateDeviceWithRoomError {
DeviceNotRegistered(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateDeviceWithRoomError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateDeviceWithRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DeviceNotRegisteredException" => {
return AssociateDeviceWithRoomError::DeviceNotRegistered(String::from(
error_message,
))
}
"LimitExceededException" => {
return AssociateDeviceWithRoomError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return AssociateDeviceWithRoomError::Validation(error_message.to_string())
}
_ => {}
}
}
return AssociateDeviceWithRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateDeviceWithRoomError {
fn from(err: serde_json::error::Error) -> AssociateDeviceWithRoomError {
AssociateDeviceWithRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateDeviceWithRoomError {
fn from(err: CredentialsError) -> AssociateDeviceWithRoomError {
AssociateDeviceWithRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateDeviceWithRoomError {
fn from(err: HttpDispatchError) -> AssociateDeviceWithRoomError {
AssociateDeviceWithRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateDeviceWithRoomError {
fn from(err: io::Error) -> AssociateDeviceWithRoomError {
AssociateDeviceWithRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateDeviceWithRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateDeviceWithRoomError {
fn description(&self) -> &str {
match *self {
AssociateDeviceWithRoomError::DeviceNotRegistered(ref cause) => cause,
AssociateDeviceWithRoomError::LimitExceeded(ref cause) => cause,
AssociateDeviceWithRoomError::Validation(ref cause) => cause,
AssociateDeviceWithRoomError::Credentials(ref err) => err.description(),
AssociateDeviceWithRoomError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateDeviceWithRoomError::ParseError(ref cause) => cause,
AssociateDeviceWithRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateSkillGroupWithRoomError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateSkillGroupWithRoomError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateSkillGroupWithRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return AssociateSkillGroupWithRoomError::Validation(error_message.to_string())
}
_ => {}
}
}
return AssociateSkillGroupWithRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateSkillGroupWithRoomError {
fn from(err: serde_json::error::Error) -> AssociateSkillGroupWithRoomError {
AssociateSkillGroupWithRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateSkillGroupWithRoomError {
fn from(err: CredentialsError) -> AssociateSkillGroupWithRoomError {
AssociateSkillGroupWithRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateSkillGroupWithRoomError {
fn from(err: HttpDispatchError) -> AssociateSkillGroupWithRoomError {
AssociateSkillGroupWithRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateSkillGroupWithRoomError {
fn from(err: io::Error) -> AssociateSkillGroupWithRoomError {
AssociateSkillGroupWithRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateSkillGroupWithRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateSkillGroupWithRoomError {
fn description(&self) -> &str {
match *self {
AssociateSkillGroupWithRoomError::Validation(ref cause) => cause,
AssociateSkillGroupWithRoomError::Credentials(ref err) => err.description(),
AssociateSkillGroupWithRoomError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateSkillGroupWithRoomError::ParseError(ref cause) => cause,
AssociateSkillGroupWithRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateAddressBookError {
AlreadyExists(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateAddressBookError {
pub fn from_response(res: BufferedHttpResponse) -> CreateAddressBookError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AlreadyExistsException" => {
return CreateAddressBookError::AlreadyExists(String::from(error_message))
}
"LimitExceededException" => {
return CreateAddressBookError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return CreateAddressBookError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateAddressBookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateAddressBookError {
fn from(err: serde_json::error::Error) -> CreateAddressBookError {
CreateAddressBookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateAddressBookError {
fn from(err: CredentialsError) -> CreateAddressBookError {
CreateAddressBookError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateAddressBookError {
fn from(err: HttpDispatchError) -> CreateAddressBookError {
CreateAddressBookError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateAddressBookError {
fn from(err: io::Error) -> CreateAddressBookError {
CreateAddressBookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateAddressBookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateAddressBookError {
fn description(&self) -> &str {
match *self {
CreateAddressBookError::AlreadyExists(ref cause) => cause,
CreateAddressBookError::LimitExceeded(ref cause) => cause,
CreateAddressBookError::Validation(ref cause) => cause,
CreateAddressBookError::Credentials(ref err) => err.description(),
CreateAddressBookError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateAddressBookError::ParseError(ref cause) => cause,
CreateAddressBookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateContactError {
AlreadyExists(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateContactError {
pub fn from_response(res: BufferedHttpResponse) -> CreateContactError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AlreadyExistsException" => {
return CreateContactError::AlreadyExists(String::from(error_message))
}
"LimitExceededException" => {
return CreateContactError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return CreateContactError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateContactError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateContactError {
fn from(err: serde_json::error::Error) -> CreateContactError {
CreateContactError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateContactError {
fn from(err: CredentialsError) -> CreateContactError {
CreateContactError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateContactError {
fn from(err: HttpDispatchError) -> CreateContactError {
CreateContactError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateContactError {
fn from(err: io::Error) -> CreateContactError {
CreateContactError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateContactError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateContactError {
fn description(&self) -> &str {
match *self {
CreateContactError::AlreadyExists(ref cause) => cause,
CreateContactError::LimitExceeded(ref cause) => cause,
CreateContactError::Validation(ref cause) => cause,
CreateContactError::Credentials(ref err) => err.description(),
CreateContactError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateContactError::ParseError(ref cause) => cause,
CreateContactError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateProfileError {
AlreadyExists(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateProfileError {
pub fn from_response(res: BufferedHttpResponse) -> CreateProfileError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AlreadyExistsException" => {
return CreateProfileError::AlreadyExists(String::from(error_message))
}
"LimitExceededException" => {
return CreateProfileError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return CreateProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateProfileError {
fn from(err: serde_json::error::Error) -> CreateProfileError {
CreateProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateProfileError {
fn from(err: CredentialsError) -> CreateProfileError {
CreateProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateProfileError {
fn from(err: HttpDispatchError) -> CreateProfileError {
CreateProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateProfileError {
fn from(err: io::Error) -> CreateProfileError {
CreateProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateProfileError {
fn description(&self) -> &str {
match *self {
CreateProfileError::AlreadyExists(ref cause) => cause,
CreateProfileError::LimitExceeded(ref cause) => cause,
CreateProfileError::Validation(ref cause) => cause,
CreateProfileError::Credentials(ref err) => err.description(),
CreateProfileError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateProfileError::ParseError(ref cause) => cause,
CreateProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateRoomError {
AlreadyExists(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateRoomError {
pub fn from_response(res: BufferedHttpResponse) -> CreateRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AlreadyExistsException" => {
return CreateRoomError::AlreadyExists(String::from(error_message))
}
"LimitExceededException" => {
return CreateRoomError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return CreateRoomError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateRoomError {
fn from(err: serde_json::error::Error) -> CreateRoomError {
CreateRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateRoomError {
fn from(err: CredentialsError) -> CreateRoomError {
CreateRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateRoomError {
fn from(err: HttpDispatchError) -> CreateRoomError {
CreateRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateRoomError {
fn from(err: io::Error) -> CreateRoomError {
CreateRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateRoomError {
fn description(&self) -> &str {
match *self {
CreateRoomError::AlreadyExists(ref cause) => cause,
CreateRoomError::LimitExceeded(ref cause) => cause,
CreateRoomError::Validation(ref cause) => cause,
CreateRoomError::Credentials(ref err) => err.description(),
CreateRoomError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateRoomError::ParseError(ref cause) => cause,
CreateRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSkillGroupError {
AlreadyExists(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateSkillGroupError {
pub fn from_response(res: BufferedHttpResponse) -> CreateSkillGroupError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AlreadyExistsException" => {
return CreateSkillGroupError::AlreadyExists(String::from(error_message))
}
"LimitExceededException" => {
return CreateSkillGroupError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return CreateSkillGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateSkillGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateSkillGroupError {
fn from(err: serde_json::error::Error) -> CreateSkillGroupError {
CreateSkillGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateSkillGroupError {
fn from(err: CredentialsError) -> CreateSkillGroupError {
CreateSkillGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateSkillGroupError {
fn from(err: HttpDispatchError) -> CreateSkillGroupError {
CreateSkillGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateSkillGroupError {
fn from(err: io::Error) -> CreateSkillGroupError {
CreateSkillGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateSkillGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSkillGroupError {
fn description(&self) -> &str {
match *self {
CreateSkillGroupError::AlreadyExists(ref cause) => cause,
CreateSkillGroupError::LimitExceeded(ref cause) => cause,
CreateSkillGroupError::Validation(ref cause) => cause,
CreateSkillGroupError::Credentials(ref err) => err.description(),
CreateSkillGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateSkillGroupError::ParseError(ref cause) => cause,
CreateSkillGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateUserError {
LimitExceeded(String),
ResourceInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUserError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUserError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"LimitExceededException" => {
return CreateUserError::LimitExceeded(String::from(error_message))
}
"ResourceInUseException" => {
return CreateUserError::ResourceInUse(String::from(error_message))
}
"ValidationException" => {
return CreateUserError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUserError {
fn from(err: serde_json::error::Error) -> CreateUserError {
CreateUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUserError {
fn from(err: CredentialsError) -> CreateUserError {
CreateUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUserError {
fn from(err: HttpDispatchError) -> CreateUserError {
CreateUserError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUserError {
fn from(err: io::Error) -> CreateUserError {
CreateUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUserError {
fn description(&self) -> &str {
match *self {
CreateUserError::LimitExceeded(ref cause) => cause,
CreateUserError::ResourceInUse(ref cause) => cause,
CreateUserError::Validation(ref cause) => cause,
CreateUserError::Credentials(ref err) => err.description(),
CreateUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateUserError::ParseError(ref cause) => cause,
CreateUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteAddressBookError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteAddressBookError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteAddressBookError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return DeleteAddressBookError::NotFound(String::from(error_message))
}
"ValidationException" => {
return DeleteAddressBookError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteAddressBookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteAddressBookError {
fn from(err: serde_json::error::Error) -> DeleteAddressBookError {
DeleteAddressBookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteAddressBookError {
fn from(err: CredentialsError) -> DeleteAddressBookError {
DeleteAddressBookError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteAddressBookError {
fn from(err: HttpDispatchError) -> DeleteAddressBookError {
DeleteAddressBookError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteAddressBookError {
fn from(err: io::Error) -> DeleteAddressBookError {
DeleteAddressBookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteAddressBookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteAddressBookError {
fn description(&self) -> &str {
match *self {
DeleteAddressBookError::NotFound(ref cause) => cause,
DeleteAddressBookError::Validation(ref cause) => cause,
DeleteAddressBookError::Credentials(ref err) => err.description(),
DeleteAddressBookError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteAddressBookError::ParseError(ref cause) => cause,
DeleteAddressBookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteContactError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteContactError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteContactError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return DeleteContactError::NotFound(String::from(error_message))
}
"ValidationException" => {
return DeleteContactError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteContactError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteContactError {
fn from(err: serde_json::error::Error) -> DeleteContactError {
DeleteContactError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteContactError {
fn from(err: CredentialsError) -> DeleteContactError {
DeleteContactError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteContactError {
fn from(err: HttpDispatchError) -> DeleteContactError {
DeleteContactError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteContactError {
fn from(err: io::Error) -> DeleteContactError {
DeleteContactError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteContactError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteContactError {
fn description(&self) -> &str {
match *self {
DeleteContactError::NotFound(ref cause) => cause,
DeleteContactError::Validation(ref cause) => cause,
DeleteContactError::Credentials(ref err) => err.description(),
DeleteContactError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteContactError::ParseError(ref cause) => cause,
DeleteContactError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteProfileError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteProfileError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteProfileError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return DeleteProfileError::NotFound(String::from(error_message))
}
"ValidationException" => {
return DeleteProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteProfileError {
fn from(err: serde_json::error::Error) -> DeleteProfileError {
DeleteProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteProfileError {
fn from(err: CredentialsError) -> DeleteProfileError {
DeleteProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteProfileError {
fn from(err: HttpDispatchError) -> DeleteProfileError {
DeleteProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteProfileError {
fn from(err: io::Error) -> DeleteProfileError {
DeleteProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteProfileError {
fn description(&self) -> &str {
match *self {
DeleteProfileError::NotFound(ref cause) => cause,
DeleteProfileError::Validation(ref cause) => cause,
DeleteProfileError::Credentials(ref err) => err.description(),
DeleteProfileError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteProfileError::ParseError(ref cause) => cause,
DeleteProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRoomError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRoomError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return DeleteRoomError::NotFound(String::from(error_message))
}
"ValidationException" => {
return DeleteRoomError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRoomError {
fn from(err: serde_json::error::Error) -> DeleteRoomError {
DeleteRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRoomError {
fn from(err: CredentialsError) -> DeleteRoomError {
DeleteRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRoomError {
fn from(err: HttpDispatchError) -> DeleteRoomError {
DeleteRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRoomError {
fn from(err: io::Error) -> DeleteRoomError {
DeleteRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRoomError {
fn description(&self) -> &str {
match *self {
DeleteRoomError::NotFound(ref cause) => cause,
DeleteRoomError::Validation(ref cause) => cause,
DeleteRoomError::Credentials(ref err) => err.description(),
DeleteRoomError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteRoomError::ParseError(ref cause) => cause,
DeleteRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRoomSkillParameterError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRoomSkillParameterError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRoomSkillParameterError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return DeleteRoomSkillParameterError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteRoomSkillParameterError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRoomSkillParameterError {
fn from(err: serde_json::error::Error) -> DeleteRoomSkillParameterError {
DeleteRoomSkillParameterError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRoomSkillParameterError {
fn from(err: CredentialsError) -> DeleteRoomSkillParameterError {
DeleteRoomSkillParameterError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRoomSkillParameterError {
fn from(err: HttpDispatchError) -> DeleteRoomSkillParameterError {
DeleteRoomSkillParameterError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRoomSkillParameterError {
fn from(err: io::Error) -> DeleteRoomSkillParameterError {
DeleteRoomSkillParameterError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRoomSkillParameterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRoomSkillParameterError {
fn description(&self) -> &str {
match *self {
DeleteRoomSkillParameterError::Validation(ref cause) => cause,
DeleteRoomSkillParameterError::Credentials(ref err) => err.description(),
DeleteRoomSkillParameterError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteRoomSkillParameterError::ParseError(ref cause) => cause,
DeleteRoomSkillParameterError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSkillGroupError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSkillGroupError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSkillGroupError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return DeleteSkillGroupError::NotFound(String::from(error_message))
}
"ValidationException" => {
return DeleteSkillGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteSkillGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSkillGroupError {
fn from(err: serde_json::error::Error) -> DeleteSkillGroupError {
DeleteSkillGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSkillGroupError {
fn from(err: CredentialsError) -> DeleteSkillGroupError {
DeleteSkillGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSkillGroupError {
fn from(err: HttpDispatchError) -> DeleteSkillGroupError {
DeleteSkillGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSkillGroupError {
fn from(err: io::Error) -> DeleteSkillGroupError {
DeleteSkillGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSkillGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSkillGroupError {
fn description(&self) -> &str {
match *self {
DeleteSkillGroupError::NotFound(ref cause) => cause,
DeleteSkillGroupError::Validation(ref cause) => cause,
DeleteSkillGroupError::Credentials(ref err) => err.description(),
DeleteSkillGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteSkillGroupError::ParseError(ref cause) => cause,
DeleteSkillGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUserError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUserError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUserError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return DeleteUserError::NotFound(String::from(error_message))
}
"ValidationException" => {
return DeleteUserError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUserError {
fn from(err: serde_json::error::Error) -> DeleteUserError {
DeleteUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUserError {
fn from(err: CredentialsError) -> DeleteUserError {
DeleteUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUserError {
fn from(err: HttpDispatchError) -> DeleteUserError {
DeleteUserError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUserError {
fn from(err: io::Error) -> DeleteUserError {
DeleteUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUserError {
fn description(&self) -> &str {
match *self {
DeleteUserError::NotFound(ref cause) => cause,
DeleteUserError::Validation(ref cause) => cause,
DeleteUserError::Credentials(ref err) => err.description(),
DeleteUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteUserError::ParseError(ref cause) => cause,
DeleteUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateContactFromAddressBookError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisassociateContactFromAddressBookError {
pub fn from_response(res: BufferedHttpResponse) -> DisassociateContactFromAddressBookError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return DisassociateContactFromAddressBookError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return DisassociateContactFromAddressBookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisassociateContactFromAddressBookError {
fn from(err: serde_json::error::Error) -> DisassociateContactFromAddressBookError {
DisassociateContactFromAddressBookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisassociateContactFromAddressBookError {
fn from(err: CredentialsError) -> DisassociateContactFromAddressBookError {
DisassociateContactFromAddressBookError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisassociateContactFromAddressBookError {
fn from(err: HttpDispatchError) -> DisassociateContactFromAddressBookError {
DisassociateContactFromAddressBookError::HttpDispatch(err)
}
}
impl From<io::Error> for DisassociateContactFromAddressBookError {
fn from(err: io::Error) -> DisassociateContactFromAddressBookError {
DisassociateContactFromAddressBookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisassociateContactFromAddressBookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateContactFromAddressBookError {
fn description(&self) -> &str {
match *self {
DisassociateContactFromAddressBookError::Validation(ref cause) => cause,
DisassociateContactFromAddressBookError::Credentials(ref err) => err.description(),
DisassociateContactFromAddressBookError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DisassociateContactFromAddressBookError::ParseError(ref cause) => cause,
DisassociateContactFromAddressBookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateDeviceFromRoomError {
DeviceNotRegistered(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisassociateDeviceFromRoomError {
pub fn from_response(res: BufferedHttpResponse) -> DisassociateDeviceFromRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DeviceNotRegisteredException" => {
return DisassociateDeviceFromRoomError::DeviceNotRegistered(String::from(
error_message,
))
}
"ValidationException" => {
return DisassociateDeviceFromRoomError::Validation(error_message.to_string())
}
_ => {}
}
}
return DisassociateDeviceFromRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisassociateDeviceFromRoomError {
fn from(err: serde_json::error::Error) -> DisassociateDeviceFromRoomError {
DisassociateDeviceFromRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisassociateDeviceFromRoomError {
fn from(err: CredentialsError) -> DisassociateDeviceFromRoomError {
DisassociateDeviceFromRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisassociateDeviceFromRoomError {
fn from(err: HttpDispatchError) -> DisassociateDeviceFromRoomError {
DisassociateDeviceFromRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for DisassociateDeviceFromRoomError {
fn from(err: io::Error) -> DisassociateDeviceFromRoomError {
DisassociateDeviceFromRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisassociateDeviceFromRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateDeviceFromRoomError {
fn description(&self) -> &str {
match *self {
DisassociateDeviceFromRoomError::DeviceNotRegistered(ref cause) => cause,
DisassociateDeviceFromRoomError::Validation(ref cause) => cause,
DisassociateDeviceFromRoomError::Credentials(ref err) => err.description(),
DisassociateDeviceFromRoomError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DisassociateDeviceFromRoomError::ParseError(ref cause) => cause,
DisassociateDeviceFromRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateSkillGroupFromRoomError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisassociateSkillGroupFromRoomError {
pub fn from_response(res: BufferedHttpResponse) -> DisassociateSkillGroupFromRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return DisassociateSkillGroupFromRoomError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return DisassociateSkillGroupFromRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisassociateSkillGroupFromRoomError {
fn from(err: serde_json::error::Error) -> DisassociateSkillGroupFromRoomError {
DisassociateSkillGroupFromRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisassociateSkillGroupFromRoomError {
fn from(err: CredentialsError) -> DisassociateSkillGroupFromRoomError {
DisassociateSkillGroupFromRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisassociateSkillGroupFromRoomError {
fn from(err: HttpDispatchError) -> DisassociateSkillGroupFromRoomError {
DisassociateSkillGroupFromRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for DisassociateSkillGroupFromRoomError {
fn from(err: io::Error) -> DisassociateSkillGroupFromRoomError {
DisassociateSkillGroupFromRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisassociateSkillGroupFromRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateSkillGroupFromRoomError {
fn description(&self) -> &str {
match *self {
DisassociateSkillGroupFromRoomError::Validation(ref cause) => cause,
DisassociateSkillGroupFromRoomError::Credentials(ref err) => err.description(),
DisassociateSkillGroupFromRoomError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DisassociateSkillGroupFromRoomError::ParseError(ref cause) => cause,
DisassociateSkillGroupFromRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAddressBookError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetAddressBookError {
pub fn from_response(res: BufferedHttpResponse) -> GetAddressBookError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return GetAddressBookError::NotFound(String::from(error_message))
}
"ValidationException" => {
return GetAddressBookError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetAddressBookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetAddressBookError {
fn from(err: serde_json::error::Error) -> GetAddressBookError {
GetAddressBookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetAddressBookError {
fn from(err: CredentialsError) -> GetAddressBookError {
GetAddressBookError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetAddressBookError {
fn from(err: HttpDispatchError) -> GetAddressBookError {
GetAddressBookError::HttpDispatch(err)
}
}
impl From<io::Error> for GetAddressBookError {
fn from(err: io::Error) -> GetAddressBookError {
GetAddressBookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetAddressBookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetAddressBookError {
fn description(&self) -> &str {
match *self {
GetAddressBookError::NotFound(ref cause) => cause,
GetAddressBookError::Validation(ref cause) => cause,
GetAddressBookError::Credentials(ref err) => err.description(),
GetAddressBookError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetAddressBookError::ParseError(ref cause) => cause,
GetAddressBookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetContactError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetContactError {
pub fn from_response(res: BufferedHttpResponse) -> GetContactError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return GetContactError::NotFound(String::from(error_message))
}
"ValidationException" => {
return GetContactError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetContactError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetContactError {
fn from(err: serde_json::error::Error) -> GetContactError {
GetContactError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetContactError {
fn from(err: CredentialsError) -> GetContactError {
GetContactError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetContactError {
fn from(err: HttpDispatchError) -> GetContactError {
GetContactError::HttpDispatch(err)
}
}
impl From<io::Error> for GetContactError {
fn from(err: io::Error) -> GetContactError {
GetContactError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetContactError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetContactError {
fn description(&self) -> &str {
match *self {
GetContactError::NotFound(ref cause) => cause,
GetContactError::Validation(ref cause) => cause,
GetContactError::Credentials(ref err) => err.description(),
GetContactError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetContactError::ParseError(ref cause) => cause,
GetContactError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDeviceError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDeviceError {
pub fn from_response(res: BufferedHttpResponse) -> GetDeviceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => return GetDeviceError::NotFound(String::from(error_message)),
"ValidationException" => {
return GetDeviceError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetDeviceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDeviceError {
fn from(err: serde_json::error::Error) -> GetDeviceError {
GetDeviceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDeviceError {
fn from(err: CredentialsError) -> GetDeviceError {
GetDeviceError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDeviceError {
fn from(err: HttpDispatchError) -> GetDeviceError {
GetDeviceError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDeviceError {
fn from(err: io::Error) -> GetDeviceError {
GetDeviceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDeviceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDeviceError {
fn description(&self) -> &str {
match *self {
GetDeviceError::NotFound(ref cause) => cause,
GetDeviceError::Validation(ref cause) => cause,
GetDeviceError::Credentials(ref err) => err.description(),
GetDeviceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetDeviceError::ParseError(ref cause) => cause,
GetDeviceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetProfileError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetProfileError {
pub fn from_response(res: BufferedHttpResponse) -> GetProfileError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return GetProfileError::NotFound(String::from(error_message))
}
"ValidationException" => {
return GetProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetProfileError {
fn from(err: serde_json::error::Error) -> GetProfileError {
GetProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetProfileError {
fn from(err: CredentialsError) -> GetProfileError {
GetProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetProfileError {
fn from(err: HttpDispatchError) -> GetProfileError {
GetProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for GetProfileError {
fn from(err: io::Error) -> GetProfileError {
GetProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetProfileError {
fn description(&self) -> &str {
match *self {
GetProfileError::NotFound(ref cause) => cause,
GetProfileError::Validation(ref cause) => cause,
GetProfileError::Credentials(ref err) => err.description(),
GetProfileError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetProfileError::ParseError(ref cause) => cause,
GetProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRoomError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRoomError {
pub fn from_response(res: BufferedHttpResponse) -> GetRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => return GetRoomError::NotFound(String::from(error_message)),
"ValidationException" => return GetRoomError::Validation(error_message.to_string()),
_ => {}
}
}
return GetRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRoomError {
fn from(err: serde_json::error::Error) -> GetRoomError {
GetRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRoomError {
fn from(err: CredentialsError) -> GetRoomError {
GetRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRoomError {
fn from(err: HttpDispatchError) -> GetRoomError {
GetRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRoomError {
fn from(err: io::Error) -> GetRoomError {
GetRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRoomError {
fn description(&self) -> &str {
match *self {
GetRoomError::NotFound(ref cause) => cause,
GetRoomError::Validation(ref cause) => cause,
GetRoomError::Credentials(ref err) => err.description(),
GetRoomError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetRoomError::ParseError(ref cause) => cause,
GetRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRoomSkillParameterError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRoomSkillParameterError {
pub fn from_response(res: BufferedHttpResponse) -> GetRoomSkillParameterError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return GetRoomSkillParameterError::NotFound(String::from(error_message))
}
"ValidationException" => {
return GetRoomSkillParameterError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetRoomSkillParameterError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRoomSkillParameterError {
fn from(err: serde_json::error::Error) -> GetRoomSkillParameterError {
GetRoomSkillParameterError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRoomSkillParameterError {
fn from(err: CredentialsError) -> GetRoomSkillParameterError {
GetRoomSkillParameterError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRoomSkillParameterError {
fn from(err: HttpDispatchError) -> GetRoomSkillParameterError {
GetRoomSkillParameterError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRoomSkillParameterError {
fn from(err: io::Error) -> GetRoomSkillParameterError {
GetRoomSkillParameterError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRoomSkillParameterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRoomSkillParameterError {
fn description(&self) -> &str {
match *self {
GetRoomSkillParameterError::NotFound(ref cause) => cause,
GetRoomSkillParameterError::Validation(ref cause) => cause,
GetRoomSkillParameterError::Credentials(ref err) => err.description(),
GetRoomSkillParameterError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetRoomSkillParameterError::ParseError(ref cause) => cause,
GetRoomSkillParameterError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSkillGroupError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSkillGroupError {
pub fn from_response(res: BufferedHttpResponse) -> GetSkillGroupError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return GetSkillGroupError::NotFound(String::from(error_message))
}
"ValidationException" => {
return GetSkillGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetSkillGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSkillGroupError {
fn from(err: serde_json::error::Error) -> GetSkillGroupError {
GetSkillGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSkillGroupError {
fn from(err: CredentialsError) -> GetSkillGroupError {
GetSkillGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSkillGroupError {
fn from(err: HttpDispatchError) -> GetSkillGroupError {
GetSkillGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSkillGroupError {
fn from(err: io::Error) -> GetSkillGroupError {
GetSkillGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSkillGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSkillGroupError {
fn description(&self) -> &str {
match *self {
GetSkillGroupError::NotFound(ref cause) => cause,
GetSkillGroupError::Validation(ref cause) => cause,
GetSkillGroupError::Credentials(ref err) => err.description(),
GetSkillGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSkillGroupError::ParseError(ref cause) => cause,
GetSkillGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDeviceEventsError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListDeviceEventsError {
pub fn from_response(res: BufferedHttpResponse) -> ListDeviceEventsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return ListDeviceEventsError::NotFound(String::from(error_message))
}
"ValidationException" => {
return ListDeviceEventsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListDeviceEventsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListDeviceEventsError {
fn from(err: serde_json::error::Error) -> ListDeviceEventsError {
ListDeviceEventsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListDeviceEventsError {
fn from(err: CredentialsError) -> ListDeviceEventsError {
ListDeviceEventsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListDeviceEventsError {
fn from(err: HttpDispatchError) -> ListDeviceEventsError {
ListDeviceEventsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListDeviceEventsError {
fn from(err: io::Error) -> ListDeviceEventsError {
ListDeviceEventsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListDeviceEventsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDeviceEventsError {
fn description(&self) -> &str {
match *self {
ListDeviceEventsError::NotFound(ref cause) => cause,
ListDeviceEventsError::Validation(ref cause) => cause,
ListDeviceEventsError::Credentials(ref err) => err.description(),
ListDeviceEventsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListDeviceEventsError::ParseError(ref cause) => cause,
ListDeviceEventsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSkillsError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListSkillsError {
pub fn from_response(res: BufferedHttpResponse) -> ListSkillsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return ListSkillsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListSkillsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListSkillsError {
fn from(err: serde_json::error::Error) -> ListSkillsError {
ListSkillsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListSkillsError {
fn from(err: CredentialsError) -> ListSkillsError {
ListSkillsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListSkillsError {
fn from(err: HttpDispatchError) -> ListSkillsError {
ListSkillsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListSkillsError {
fn from(err: io::Error) -> ListSkillsError {
ListSkillsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListSkillsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListSkillsError {
fn description(&self) -> &str {
match *self {
ListSkillsError::Validation(ref cause) => cause,
ListSkillsError::Credentials(ref err) => err.description(),
ListSkillsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListSkillsError::ParseError(ref cause) => cause,
ListSkillsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTagsError {
pub fn from_response(res: BufferedHttpResponse) -> ListTagsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => return ListTagsError::NotFound(String::from(error_message)),
"ValidationException" => {
return ListTagsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListTagsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTagsError {
fn from(err: serde_json::error::Error) -> ListTagsError {
ListTagsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTagsError {
fn from(err: CredentialsError) -> ListTagsError {
ListTagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTagsError {
fn from(err: HttpDispatchError) -> ListTagsError {
ListTagsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTagsError {
fn from(err: io::Error) -> ListTagsError {
ListTagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsError {
fn description(&self) -> &str {
match *self {
ListTagsError::NotFound(ref cause) => cause,
ListTagsError::Validation(ref cause) => cause,
ListTagsError::Credentials(ref err) => err.description(),
ListTagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListTagsError::ParseError(ref cause) => cause,
ListTagsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutRoomSkillParameterError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutRoomSkillParameterError {
pub fn from_response(res: BufferedHttpResponse) -> PutRoomSkillParameterError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return PutRoomSkillParameterError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutRoomSkillParameterError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutRoomSkillParameterError {
fn from(err: serde_json::error::Error) -> PutRoomSkillParameterError {
PutRoomSkillParameterError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutRoomSkillParameterError {
fn from(err: CredentialsError) -> PutRoomSkillParameterError {
PutRoomSkillParameterError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutRoomSkillParameterError {
fn from(err: HttpDispatchError) -> PutRoomSkillParameterError {
PutRoomSkillParameterError::HttpDispatch(err)
}
}
impl From<io::Error> for PutRoomSkillParameterError {
fn from(err: io::Error) -> PutRoomSkillParameterError {
PutRoomSkillParameterError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutRoomSkillParameterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutRoomSkillParameterError {
fn description(&self) -> &str {
match *self {
PutRoomSkillParameterError::Validation(ref cause) => cause,
PutRoomSkillParameterError::Credentials(ref err) => err.description(),
PutRoomSkillParameterError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutRoomSkillParameterError::ParseError(ref cause) => cause,
PutRoomSkillParameterError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ResolveRoomError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ResolveRoomError {
pub fn from_response(res: BufferedHttpResponse) -> ResolveRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return ResolveRoomError::NotFound(String::from(error_message))
}
"ValidationException" => {
return ResolveRoomError::Validation(error_message.to_string())
}
_ => {}
}
}
return ResolveRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ResolveRoomError {
fn from(err: serde_json::error::Error) -> ResolveRoomError {
ResolveRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ResolveRoomError {
fn from(err: CredentialsError) -> ResolveRoomError {
ResolveRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for ResolveRoomError {
fn from(err: HttpDispatchError) -> ResolveRoomError {
ResolveRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for ResolveRoomError {
fn from(err: io::Error) -> ResolveRoomError {
ResolveRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ResolveRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ResolveRoomError {
fn description(&self) -> &str {
match *self {
ResolveRoomError::NotFound(ref cause) => cause,
ResolveRoomError::Validation(ref cause) => cause,
ResolveRoomError::Credentials(ref err) => err.description(),
ResolveRoomError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ResolveRoomError::ParseError(ref cause) => cause,
ResolveRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RevokeInvitationError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RevokeInvitationError {
pub fn from_response(res: BufferedHttpResponse) -> RevokeInvitationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return RevokeInvitationError::NotFound(String::from(error_message))
}
"ValidationException" => {
return RevokeInvitationError::Validation(error_message.to_string())
}
_ => {}
}
}
return RevokeInvitationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RevokeInvitationError {
fn from(err: serde_json::error::Error) -> RevokeInvitationError {
RevokeInvitationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RevokeInvitationError {
fn from(err: CredentialsError) -> RevokeInvitationError {
RevokeInvitationError::Credentials(err)
}
}
impl From<HttpDispatchError> for RevokeInvitationError {
fn from(err: HttpDispatchError) -> RevokeInvitationError {
RevokeInvitationError::HttpDispatch(err)
}
}
impl From<io::Error> for RevokeInvitationError {
fn from(err: io::Error) -> RevokeInvitationError {
RevokeInvitationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RevokeInvitationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RevokeInvitationError {
fn description(&self) -> &str {
match *self {
RevokeInvitationError::NotFound(ref cause) => cause,
RevokeInvitationError::Validation(ref cause) => cause,
RevokeInvitationError::Credentials(ref err) => err.description(),
RevokeInvitationError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
RevokeInvitationError::ParseError(ref cause) => cause,
RevokeInvitationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchAddressBooksError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchAddressBooksError {
pub fn from_response(res: BufferedHttpResponse) -> SearchAddressBooksError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return SearchAddressBooksError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchAddressBooksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchAddressBooksError {
fn from(err: serde_json::error::Error) -> SearchAddressBooksError {
SearchAddressBooksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchAddressBooksError {
fn from(err: CredentialsError) -> SearchAddressBooksError {
SearchAddressBooksError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchAddressBooksError {
fn from(err: HttpDispatchError) -> SearchAddressBooksError {
SearchAddressBooksError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchAddressBooksError {
fn from(err: io::Error) -> SearchAddressBooksError {
SearchAddressBooksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchAddressBooksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchAddressBooksError {
fn description(&self) -> &str {
match *self {
SearchAddressBooksError::Validation(ref cause) => cause,
SearchAddressBooksError::Credentials(ref err) => err.description(),
SearchAddressBooksError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SearchAddressBooksError::ParseError(ref cause) => cause,
SearchAddressBooksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchContactsError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchContactsError {
pub fn from_response(res: BufferedHttpResponse) -> SearchContactsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return SearchContactsError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchContactsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchContactsError {
fn from(err: serde_json::error::Error) -> SearchContactsError {
SearchContactsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchContactsError {
fn from(err: CredentialsError) -> SearchContactsError {
SearchContactsError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchContactsError {
fn from(err: HttpDispatchError) -> SearchContactsError {
SearchContactsError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchContactsError {
fn from(err: io::Error) -> SearchContactsError {
SearchContactsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchContactsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchContactsError {
fn description(&self) -> &str {
match *self {
SearchContactsError::Validation(ref cause) => cause,
SearchContactsError::Credentials(ref err) => err.description(),
SearchContactsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchContactsError::ParseError(ref cause) => cause,
SearchContactsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchDevicesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchDevicesError {
pub fn from_response(res: BufferedHttpResponse) -> SearchDevicesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return SearchDevicesError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchDevicesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchDevicesError {
fn from(err: serde_json::error::Error) -> SearchDevicesError {
SearchDevicesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchDevicesError {
fn from(err: CredentialsError) -> SearchDevicesError {
SearchDevicesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchDevicesError {
fn from(err: HttpDispatchError) -> SearchDevicesError {
SearchDevicesError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchDevicesError {
fn from(err: io::Error) -> SearchDevicesError {
SearchDevicesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchDevicesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchDevicesError {
fn description(&self) -> &str {
match *self {
SearchDevicesError::Validation(ref cause) => cause,
SearchDevicesError::Credentials(ref err) => err.description(),
SearchDevicesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchDevicesError::ParseError(ref cause) => cause,
SearchDevicesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchProfilesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchProfilesError {
pub fn from_response(res: BufferedHttpResponse) -> SearchProfilesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return SearchProfilesError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchProfilesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchProfilesError {
fn from(err: serde_json::error::Error) -> SearchProfilesError {
SearchProfilesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchProfilesError {
fn from(err: CredentialsError) -> SearchProfilesError {
SearchProfilesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchProfilesError {
fn from(err: HttpDispatchError) -> SearchProfilesError {
SearchProfilesError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchProfilesError {
fn from(err: io::Error) -> SearchProfilesError {
SearchProfilesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchProfilesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchProfilesError {
fn description(&self) -> &str {
match *self {
SearchProfilesError::Validation(ref cause) => cause,
SearchProfilesError::Credentials(ref err) => err.description(),
SearchProfilesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchProfilesError::ParseError(ref cause) => cause,
SearchProfilesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchRoomsError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchRoomsError {
pub fn from_response(res: BufferedHttpResponse) -> SearchRoomsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return SearchRoomsError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchRoomsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchRoomsError {
fn from(err: serde_json::error::Error) -> SearchRoomsError {
SearchRoomsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchRoomsError {
fn from(err: CredentialsError) -> SearchRoomsError {
SearchRoomsError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchRoomsError {
fn from(err: HttpDispatchError) -> SearchRoomsError {
SearchRoomsError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchRoomsError {
fn from(err: io::Error) -> SearchRoomsError {
SearchRoomsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchRoomsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchRoomsError {
fn description(&self) -> &str {
match *self {
SearchRoomsError::Validation(ref cause) => cause,
SearchRoomsError::Credentials(ref err) => err.description(),
SearchRoomsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchRoomsError::ParseError(ref cause) => cause,
SearchRoomsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchSkillGroupsError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchSkillGroupsError {
pub fn from_response(res: BufferedHttpResponse) -> SearchSkillGroupsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return SearchSkillGroupsError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchSkillGroupsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchSkillGroupsError {
fn from(err: serde_json::error::Error) -> SearchSkillGroupsError {
SearchSkillGroupsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchSkillGroupsError {
fn from(err: CredentialsError) -> SearchSkillGroupsError {
SearchSkillGroupsError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchSkillGroupsError {
fn from(err: HttpDispatchError) -> SearchSkillGroupsError {
SearchSkillGroupsError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchSkillGroupsError {
fn from(err: io::Error) -> SearchSkillGroupsError {
SearchSkillGroupsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchSkillGroupsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchSkillGroupsError {
fn description(&self) -> &str {
match *self {
SearchSkillGroupsError::Validation(ref cause) => cause,
SearchSkillGroupsError::Credentials(ref err) => err.description(),
SearchSkillGroupsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SearchSkillGroupsError::ParseError(ref cause) => cause,
SearchSkillGroupsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchUsersError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchUsersError {
pub fn from_response(res: BufferedHttpResponse) -> SearchUsersError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
return SearchUsersError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchUsersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchUsersError {
fn from(err: serde_json::error::Error) -> SearchUsersError {
SearchUsersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchUsersError {
fn from(err: CredentialsError) -> SearchUsersError {
SearchUsersError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchUsersError {
fn from(err: HttpDispatchError) -> SearchUsersError {
SearchUsersError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchUsersError {
fn from(err: io::Error) -> SearchUsersError {
SearchUsersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchUsersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchUsersError {
fn description(&self) -> &str {
match *self {
SearchUsersError::Validation(ref cause) => cause,
SearchUsersError::Credentials(ref err) => err.description(),
SearchUsersError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchUsersError::ParseError(ref cause) => cause,
SearchUsersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SendInvitationError {
InvalidUserStatus(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SendInvitationError {
pub fn from_response(res: BufferedHttpResponse) -> SendInvitationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidUserStatusException" => {
return SendInvitationError::InvalidUserStatus(String::from(error_message))
}
"NotFoundException" => {
return SendInvitationError::NotFound(String::from(error_message))
}
"ValidationException" => {
return SendInvitationError::Validation(error_message.to_string())
}
_ => {}
}
}
return SendInvitationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SendInvitationError {
fn from(err: serde_json::error::Error) -> SendInvitationError {
SendInvitationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SendInvitationError {
fn from(err: CredentialsError) -> SendInvitationError {
SendInvitationError::Credentials(err)
}
}
impl From<HttpDispatchError> for SendInvitationError {
fn from(err: HttpDispatchError) -> SendInvitationError {
SendInvitationError::HttpDispatch(err)
}
}
impl From<io::Error> for SendInvitationError {
fn from(err: io::Error) -> SendInvitationError {
SendInvitationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SendInvitationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SendInvitationError {
fn description(&self) -> &str {
match *self {
SendInvitationError::InvalidUserStatus(ref cause) => cause,
SendInvitationError::NotFound(ref cause) => cause,
SendInvitationError::Validation(ref cause) => cause,
SendInvitationError::Credentials(ref err) => err.description(),
SendInvitationError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SendInvitationError::ParseError(ref cause) => cause,
SendInvitationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartDeviceSyncError {
DeviceNotRegistered(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartDeviceSyncError {
pub fn from_response(res: BufferedHttpResponse) -> StartDeviceSyncError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DeviceNotRegisteredException" => {
return StartDeviceSyncError::DeviceNotRegistered(String::from(error_message))
}
"ValidationException" => {
return StartDeviceSyncError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartDeviceSyncError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartDeviceSyncError {
fn from(err: serde_json::error::Error) -> StartDeviceSyncError {
StartDeviceSyncError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartDeviceSyncError {
fn from(err: CredentialsError) -> StartDeviceSyncError {
StartDeviceSyncError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartDeviceSyncError {
fn from(err: HttpDispatchError) -> StartDeviceSyncError {
StartDeviceSyncError::HttpDispatch(err)
}
}
impl From<io::Error> for StartDeviceSyncError {
fn from(err: io::Error) -> StartDeviceSyncError {
StartDeviceSyncError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartDeviceSyncError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartDeviceSyncError {
fn description(&self) -> &str {
match *self {
StartDeviceSyncError::DeviceNotRegistered(ref cause) => cause,
StartDeviceSyncError::Validation(ref cause) => cause,
StartDeviceSyncError::Credentials(ref err) => err.description(),
StartDeviceSyncError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StartDeviceSyncError::ParseError(ref cause) => cause,
StartDeviceSyncError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> TagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return TagResourceError::NotFound(String::from(error_message))
}
"ValidationException" => {
return TagResourceError::Validation(error_message.to_string())
}
_ => {}
}
}
return TagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TagResourceError {
fn from(err: serde_json::error::Error) -> TagResourceError {
TagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TagResourceError {
fn from(err: CredentialsError) -> TagResourceError {
TagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for TagResourceError {
fn from(err: HttpDispatchError) -> TagResourceError {
TagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for TagResourceError {
fn from(err: io::Error) -> TagResourceError {
TagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::NotFound(ref cause) => cause,
TagResourceError::Validation(ref cause) => cause,
TagResourceError::Credentials(ref err) => err.description(),
TagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TagResourceError::ParseError(ref cause) => cause,
TagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> UntagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return UntagResourceError::NotFound(String::from(error_message))
}
"ValidationException" => {
return UntagResourceError::Validation(error_message.to_string())
}
_ => {}
}
}
return UntagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UntagResourceError {
fn from(err: serde_json::error::Error) -> UntagResourceError {
UntagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UntagResourceError {
fn from(err: CredentialsError) -> UntagResourceError {
UntagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UntagResourceError {
fn from(err: HttpDispatchError) -> UntagResourceError {
UntagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for UntagResourceError {
fn from(err: io::Error) -> UntagResourceError {
UntagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::NotFound(ref cause) => cause,
UntagResourceError::Validation(ref cause) => cause,
UntagResourceError::Credentials(ref err) => err.description(),
UntagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UntagResourceError::ParseError(ref cause) => cause,
UntagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateAddressBookError {
NameInUse(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateAddressBookError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateAddressBookError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NameInUseException" => {
return UpdateAddressBookError::NameInUse(String::from(error_message))
}
"NotFoundException" => {
return UpdateAddressBookError::NotFound(String::from(error_message))
}
"ValidationException" => {
return UpdateAddressBookError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateAddressBookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateAddressBookError {
fn from(err: serde_json::error::Error) -> UpdateAddressBookError {
UpdateAddressBookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateAddressBookError {
fn from(err: CredentialsError) -> UpdateAddressBookError {
UpdateAddressBookError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateAddressBookError {
fn from(err: HttpDispatchError) -> UpdateAddressBookError {
UpdateAddressBookError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateAddressBookError {
fn from(err: io::Error) -> UpdateAddressBookError {
UpdateAddressBookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateAddressBookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateAddressBookError {
fn description(&self) -> &str {
match *self {
UpdateAddressBookError::NameInUse(ref cause) => cause,
UpdateAddressBookError::NotFound(ref cause) => cause,
UpdateAddressBookError::Validation(ref cause) => cause,
UpdateAddressBookError::Credentials(ref err) => err.description(),
UpdateAddressBookError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateAddressBookError::ParseError(ref cause) => cause,
UpdateAddressBookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateContactError {
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateContactError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateContactError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NotFoundException" => {
return UpdateContactError::NotFound(String::from(error_message))
}
"ValidationException" => {
return UpdateContactError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateContactError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateContactError {
fn from(err: serde_json::error::Error) -> UpdateContactError {
UpdateContactError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateContactError {
fn from(err: CredentialsError) -> UpdateContactError {
UpdateContactError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateContactError {
fn from(err: HttpDispatchError) -> UpdateContactError {
UpdateContactError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateContactError {
fn from(err: io::Error) -> UpdateContactError {
UpdateContactError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateContactError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateContactError {
fn description(&self) -> &str {
match *self {
UpdateContactError::NotFound(ref cause) => cause,
UpdateContactError::Validation(ref cause) => cause,
UpdateContactError::Credentials(ref err) => err.description(),
UpdateContactError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateContactError::ParseError(ref cause) => cause,
UpdateContactError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDeviceError {
DeviceNotRegistered(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDeviceError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDeviceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"DeviceNotRegisteredException" => {
return UpdateDeviceError::DeviceNotRegistered(String::from(error_message))
}
"NotFoundException" => {
return UpdateDeviceError::NotFound(String::from(error_message))
}
"ValidationException" => {
return UpdateDeviceError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateDeviceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDeviceError {
fn from(err: serde_json::error::Error) -> UpdateDeviceError {
UpdateDeviceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDeviceError {
fn from(err: CredentialsError) -> UpdateDeviceError {
UpdateDeviceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDeviceError {
fn from(err: HttpDispatchError) -> UpdateDeviceError {
UpdateDeviceError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDeviceError {
fn from(err: io::Error) -> UpdateDeviceError {
UpdateDeviceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDeviceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDeviceError {
fn description(&self) -> &str {
match *self {
UpdateDeviceError::DeviceNotRegistered(ref cause) => cause,
UpdateDeviceError::NotFound(ref cause) => cause,
UpdateDeviceError::Validation(ref cause) => cause,
UpdateDeviceError::Credentials(ref err) => err.description(),
UpdateDeviceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateDeviceError::ParseError(ref cause) => cause,
UpdateDeviceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateProfileError {
NameInUse(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateProfileError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateProfileError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NameInUseException" => {
return UpdateProfileError::NameInUse(String::from(error_message))
}
"NotFoundException" => {
return UpdateProfileError::NotFound(String::from(error_message))
}
"ValidationException" => {
return UpdateProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateProfileError {
fn from(err: serde_json::error::Error) -> UpdateProfileError {
UpdateProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateProfileError {
fn from(err: CredentialsError) -> UpdateProfileError {
UpdateProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateProfileError {
fn from(err: HttpDispatchError) -> UpdateProfileError {
UpdateProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateProfileError {
fn from(err: io::Error) -> UpdateProfileError {
UpdateProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateProfileError {
fn description(&self) -> &str {
match *self {
UpdateProfileError::NameInUse(ref cause) => cause,
UpdateProfileError::NotFound(ref cause) => cause,
UpdateProfileError::Validation(ref cause) => cause,
UpdateProfileError::Credentials(ref err) => err.description(),
UpdateProfileError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateProfileError::ParseError(ref cause) => cause,
UpdateProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRoomError {
NameInUse(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRoomError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRoomError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NameInUseException" => {
return UpdateRoomError::NameInUse(String::from(error_message))
}
"NotFoundException" => {
return UpdateRoomError::NotFound(String::from(error_message))
}
"ValidationException" => {
return UpdateRoomError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateRoomError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRoomError {
fn from(err: serde_json::error::Error) -> UpdateRoomError {
UpdateRoomError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRoomError {
fn from(err: CredentialsError) -> UpdateRoomError {
UpdateRoomError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRoomError {
fn from(err: HttpDispatchError) -> UpdateRoomError {
UpdateRoomError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRoomError {
fn from(err: io::Error) -> UpdateRoomError {
UpdateRoomError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRoomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRoomError {
fn description(&self) -> &str {
match *self {
UpdateRoomError::NameInUse(ref cause) => cause,
UpdateRoomError::NotFound(ref cause) => cause,
UpdateRoomError::Validation(ref cause) => cause,
UpdateRoomError::Credentials(ref err) => err.description(),
UpdateRoomError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateRoomError::ParseError(ref cause) => cause,
UpdateRoomError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateSkillGroupError {
NameInUse(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateSkillGroupError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateSkillGroupError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"NameInUseException" => {
return UpdateSkillGroupError::NameInUse(String::from(error_message))
}
"NotFoundException" => {
return UpdateSkillGroupError::NotFound(String::from(error_message))
}
"ValidationException" => {
return UpdateSkillGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateSkillGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateSkillGroupError {
fn from(err: serde_json::error::Error) -> UpdateSkillGroupError {
UpdateSkillGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateSkillGroupError {
fn from(err: CredentialsError) -> UpdateSkillGroupError {
UpdateSkillGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateSkillGroupError {
fn from(err: HttpDispatchError) -> UpdateSkillGroupError {
UpdateSkillGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateSkillGroupError {
fn from(err: io::Error) -> UpdateSkillGroupError {
UpdateSkillGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateSkillGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateSkillGroupError {
fn description(&self) -> &str {
match *self {
UpdateSkillGroupError::NameInUse(ref cause) => cause,
UpdateSkillGroupError::NotFound(ref cause) => cause,
UpdateSkillGroupError::Validation(ref cause) => cause,
UpdateSkillGroupError::Credentials(ref err) => err.description(),
UpdateSkillGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateSkillGroupError::ParseError(ref cause) => cause,
UpdateSkillGroupError::Unknown(_) => "unknown error",
}
}
}
pub trait AlexaForBusiness {
fn associate_contact_with_address_book(
&self,
input: AssociateContactWithAddressBookRequest,
) -> RusotoFuture<AssociateContactWithAddressBookResponse, AssociateContactWithAddressBookError>;
fn associate_device_with_room(
&self,
input: AssociateDeviceWithRoomRequest,
) -> RusotoFuture<AssociateDeviceWithRoomResponse, AssociateDeviceWithRoomError>;
fn associate_skill_group_with_room(
&self,
input: AssociateSkillGroupWithRoomRequest,
) -> RusotoFuture<AssociateSkillGroupWithRoomResponse, AssociateSkillGroupWithRoomError>;
fn create_address_book(
&self,
input: CreateAddressBookRequest,
) -> RusotoFuture<CreateAddressBookResponse, CreateAddressBookError>;
fn create_contact(
&self,
input: CreateContactRequest,
) -> RusotoFuture<CreateContactResponse, CreateContactError>;
fn create_profile(
&self,
input: CreateProfileRequest,
) -> RusotoFuture<CreateProfileResponse, CreateProfileError>;
fn create_room(
&self,
input: CreateRoomRequest,
) -> RusotoFuture<CreateRoomResponse, CreateRoomError>;
fn create_skill_group(
&self,
input: CreateSkillGroupRequest,
) -> RusotoFuture<CreateSkillGroupResponse, CreateSkillGroupError>;
fn create_user(
&self,
input: CreateUserRequest,
) -> RusotoFuture<CreateUserResponse, CreateUserError>;
fn delete_address_book(
&self,
input: DeleteAddressBookRequest,
) -> RusotoFuture<DeleteAddressBookResponse, DeleteAddressBookError>;
fn delete_contact(
&self,
input: DeleteContactRequest,
) -> RusotoFuture<DeleteContactResponse, DeleteContactError>;
fn delete_profile(
&self,
input: DeleteProfileRequest,
) -> RusotoFuture<DeleteProfileResponse, DeleteProfileError>;
fn delete_room(
&self,
input: DeleteRoomRequest,
) -> RusotoFuture<DeleteRoomResponse, DeleteRoomError>;
fn delete_room_skill_parameter(
&self,
input: DeleteRoomSkillParameterRequest,
) -> RusotoFuture<DeleteRoomSkillParameterResponse, DeleteRoomSkillParameterError>;
fn delete_skill_group(
&self,
input: DeleteSkillGroupRequest,
) -> RusotoFuture<DeleteSkillGroupResponse, DeleteSkillGroupError>;
fn delete_user(
&self,
input: DeleteUserRequest,
) -> RusotoFuture<DeleteUserResponse, DeleteUserError>;
fn disassociate_contact_from_address_book(
&self,
input: DisassociateContactFromAddressBookRequest,
) -> RusotoFuture<
DisassociateContactFromAddressBookResponse,
DisassociateContactFromAddressBookError,
>;
fn disassociate_device_from_room(
&self,
input: DisassociateDeviceFromRoomRequest,
) -> RusotoFuture<DisassociateDeviceFromRoomResponse, DisassociateDeviceFromRoomError>;
fn disassociate_skill_group_from_room(
&self,
input: DisassociateSkillGroupFromRoomRequest,
) -> RusotoFuture<DisassociateSkillGroupFromRoomResponse, DisassociateSkillGroupFromRoomError>;
fn get_address_book(
&self,
input: GetAddressBookRequest,
) -> RusotoFuture<GetAddressBookResponse, GetAddressBookError>;
fn get_contact(
&self,
input: GetContactRequest,
) -> RusotoFuture<GetContactResponse, GetContactError>;
fn get_device(
&self,
input: GetDeviceRequest,
) -> RusotoFuture<GetDeviceResponse, GetDeviceError>;
fn get_profile(
&self,
input: GetProfileRequest,
) -> RusotoFuture<GetProfileResponse, GetProfileError>;
fn get_room(&self, input: GetRoomRequest) -> RusotoFuture<GetRoomResponse, GetRoomError>;
fn get_room_skill_parameter(
&self,
input: GetRoomSkillParameterRequest,
) -> RusotoFuture<GetRoomSkillParameterResponse, GetRoomSkillParameterError>;
fn get_skill_group(
&self,
input: GetSkillGroupRequest,
) -> RusotoFuture<GetSkillGroupResponse, GetSkillGroupError>;
fn list_device_events(
&self,
input: ListDeviceEventsRequest,
) -> RusotoFuture<ListDeviceEventsResponse, ListDeviceEventsError>;
fn list_skills(
&self,
input: ListSkillsRequest,
) -> RusotoFuture<ListSkillsResponse, ListSkillsError>;
fn list_tags(&self, input: ListTagsRequest) -> RusotoFuture<ListTagsResponse, ListTagsError>;
fn put_room_skill_parameter(
&self,
input: PutRoomSkillParameterRequest,
) -> RusotoFuture<PutRoomSkillParameterResponse, PutRoomSkillParameterError>;
fn resolve_room(
&self,
input: ResolveRoomRequest,
) -> RusotoFuture<ResolveRoomResponse, ResolveRoomError>;
fn revoke_invitation(
&self,
input: RevokeInvitationRequest,
) -> RusotoFuture<RevokeInvitationResponse, RevokeInvitationError>;
fn search_address_books(
&self,
input: SearchAddressBooksRequest,
) -> RusotoFuture<SearchAddressBooksResponse, SearchAddressBooksError>;
fn search_contacts(
&self,
input: SearchContactsRequest,
) -> RusotoFuture<SearchContactsResponse, SearchContactsError>;
fn search_devices(
&self,
input: SearchDevicesRequest,
) -> RusotoFuture<SearchDevicesResponse, SearchDevicesError>;
fn search_profiles(
&self,
input: SearchProfilesRequest,
) -> RusotoFuture<SearchProfilesResponse, SearchProfilesError>;
fn search_rooms(
&self,
input: SearchRoomsRequest,
) -> RusotoFuture<SearchRoomsResponse, SearchRoomsError>;
fn search_skill_groups(
&self,
input: SearchSkillGroupsRequest,
) -> RusotoFuture<SearchSkillGroupsResponse, SearchSkillGroupsError>;
fn search_users(
&self,
input: SearchUsersRequest,
) -> RusotoFuture<SearchUsersResponse, SearchUsersError>;
fn send_invitation(
&self,
input: SendInvitationRequest,
) -> RusotoFuture<SendInvitationResponse, SendInvitationError>;
fn start_device_sync(
&self,
input: StartDeviceSyncRequest,
) -> RusotoFuture<StartDeviceSyncResponse, StartDeviceSyncError>;
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError>;
fn update_address_book(
&self,
input: UpdateAddressBookRequest,
) -> RusotoFuture<UpdateAddressBookResponse, UpdateAddressBookError>;
fn update_contact(
&self,
input: UpdateContactRequest,
) -> RusotoFuture<UpdateContactResponse, UpdateContactError>;
fn update_device(
&self,
input: UpdateDeviceRequest,
) -> RusotoFuture<UpdateDeviceResponse, UpdateDeviceError>;
fn update_profile(
&self,
input: UpdateProfileRequest,
) -> RusotoFuture<UpdateProfileResponse, UpdateProfileError>;
fn update_room(
&self,
input: UpdateRoomRequest,
) -> RusotoFuture<UpdateRoomResponse, UpdateRoomError>;
fn update_skill_group(
&self,
input: UpdateSkillGroupRequest,
) -> RusotoFuture<UpdateSkillGroupResponse, UpdateSkillGroupError>;
}
pub struct AlexaForBusinessClient {
client: Client,
region: region::Region,
}
impl AlexaForBusinessClient {
pub fn new(region: region::Region) -> AlexaForBusinessClient {
AlexaForBusinessClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> AlexaForBusinessClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
AlexaForBusinessClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl AlexaForBusiness for AlexaForBusinessClient {
fn associate_contact_with_address_book(
&self,
input: AssociateContactWithAddressBookRequest,
) -> RusotoFuture<AssociateContactWithAddressBookResponse, AssociateContactWithAddressBookError>
{
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AlexaForBusiness.AssociateContactWithAddressBook",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<AssociateContactWithAddressBookResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateContactWithAddressBookError::from_response(
response,
))
}))
}
})
}
fn associate_device_with_room(
&self,
input: AssociateDeviceWithRoomRequest,
) -> RusotoFuture<AssociateDeviceWithRoomResponse, AssociateDeviceWithRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.AssociateDeviceWithRoom");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<AssociateDeviceWithRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateDeviceWithRoomError::from_response(response))
}))
}
})
}
fn associate_skill_group_with_room(
&self,
input: AssociateSkillGroupWithRoomRequest,
) -> RusotoFuture<AssociateSkillGroupWithRoomResponse, AssociateSkillGroupWithRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AlexaForBusiness.AssociateSkillGroupWithRoom",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<AssociateSkillGroupWithRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateSkillGroupWithRoomError::from_response(response))
}))
}
})
}
fn create_address_book(
&self,
input: CreateAddressBookRequest,
) -> RusotoFuture<CreateAddressBookResponse, CreateAddressBookError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.CreateAddressBook");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateAddressBookResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateAddressBookError::from_response(response))),
)
}
})
}
fn create_contact(
&self,
input: CreateContactRequest,
) -> RusotoFuture<CreateContactResponse, CreateContactError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.CreateContact");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateContactResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateContactError::from_response(response))),
)
}
})
}
fn create_profile(
&self,
input: CreateProfileRequest,
) -> RusotoFuture<CreateProfileResponse, CreateProfileError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.CreateProfile");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateProfileResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateProfileError::from_response(response))),
)
}
})
}
fn create_room(
&self,
input: CreateRoomRequest,
) -> RusotoFuture<CreateRoomResponse, CreateRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.CreateRoom");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateRoomError::from_response(response))),
)
}
})
}
fn create_skill_group(
&self,
input: CreateSkillGroupRequest,
) -> RusotoFuture<CreateSkillGroupResponse, CreateSkillGroupError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.CreateSkillGroup");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateSkillGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateSkillGroupError::from_response(response))),
)
}
})
}
fn create_user(
&self,
input: CreateUserRequest,
) -> RusotoFuture<CreateUserResponse, CreateUserError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.CreateUser");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateUserError::from_response(response))),
)
}
})
}
fn delete_address_book(
&self,
input: DeleteAddressBookRequest,
) -> RusotoFuture<DeleteAddressBookResponse, DeleteAddressBookError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.DeleteAddressBook");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteAddressBookResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteAddressBookError::from_response(response))),
)
}
})
}
fn delete_contact(
&self,
input: DeleteContactRequest,
) -> RusotoFuture<DeleteContactResponse, DeleteContactError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.DeleteContact");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteContactResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteContactError::from_response(response))),
)
}
})
}
fn delete_profile(
&self,
input: DeleteProfileRequest,
) -> RusotoFuture<DeleteProfileResponse, DeleteProfileError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.DeleteProfile");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteProfileResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteProfileError::from_response(response))),
)
}
})
}
fn delete_room(
&self,
input: DeleteRoomRequest,
) -> RusotoFuture<DeleteRoomResponse, DeleteRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.DeleteRoom");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteRoomError::from_response(response))),
)
}
})
}
fn delete_room_skill_parameter(
&self,
input: DeleteRoomSkillParameterRequest,
) -> RusotoFuture<DeleteRoomSkillParameterResponse, DeleteRoomSkillParameterError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.DeleteRoomSkillParameter");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteRoomSkillParameterResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteRoomSkillParameterError::from_response(response))
}))
}
})
}
fn delete_skill_group(
&self,
input: DeleteSkillGroupRequest,
) -> RusotoFuture<DeleteSkillGroupResponse, DeleteSkillGroupError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.DeleteSkillGroup");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteSkillGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteSkillGroupError::from_response(response))),
)
}
})
}
fn delete_user(
&self,
input: DeleteUserRequest,
) -> RusotoFuture<DeleteUserResponse, DeleteUserError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.DeleteUser");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteUserError::from_response(response))),
)
}
})
}
fn disassociate_contact_from_address_book(
&self,
input: DisassociateContactFromAddressBookRequest,
) -> RusotoFuture<
DisassociateContactFromAddressBookResponse,
DisassociateContactFromAddressBookError,
> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AlexaForBusiness.DisassociateContactFromAddressBook",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DisassociateContactFromAddressBookResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DisassociateContactFromAddressBookError::from_response(
response,
))
}))
}
})
}
fn disassociate_device_from_room(
&self,
input: DisassociateDeviceFromRoomRequest,
) -> RusotoFuture<DisassociateDeviceFromRoomResponse, DisassociateDeviceFromRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AlexaForBusiness.DisassociateDeviceFromRoom",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DisassociateDeviceFromRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DisassociateDeviceFromRoomError::from_response(response))
}))
}
})
}
fn disassociate_skill_group_from_room(
&self,
input: DisassociateSkillGroupFromRoomRequest,
) -> RusotoFuture<DisassociateSkillGroupFromRoomResponse, DisassociateSkillGroupFromRoomError>
{
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AlexaForBusiness.DisassociateSkillGroupFromRoom",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DisassociateSkillGroupFromRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DisassociateSkillGroupFromRoomError::from_response(response))
}))
}
})
}
fn get_address_book(
&self,
input: GetAddressBookRequest,
) -> RusotoFuture<GetAddressBookResponse, GetAddressBookError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.GetAddressBook");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetAddressBookResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetAddressBookError::from_response(response))),
)
}
})
}
fn get_contact(
&self,
input: GetContactRequest,
) -> RusotoFuture<GetContactResponse, GetContactError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.GetContact");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetContactResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetContactError::from_response(response))),
)
}
})
}
fn get_device(
&self,
input: GetDeviceRequest,
) -> RusotoFuture<GetDeviceResponse, GetDeviceError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.GetDevice");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetDeviceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDeviceError::from_response(response))),
)
}
})
}
fn get_profile(
&self,
input: GetProfileRequest,
) -> RusotoFuture<GetProfileResponse, GetProfileError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.GetProfile");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetProfileResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetProfileError::from_response(response))),
)
}
})
}
fn get_room(&self, input: GetRoomRequest) -> RusotoFuture<GetRoomResponse, GetRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.GetRoom");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRoomError::from_response(response))),
)
}
})
}
fn get_room_skill_parameter(
&self,
input: GetRoomSkillParameterRequest,
) -> RusotoFuture<GetRoomSkillParameterResponse, GetRoomSkillParameterError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.GetRoomSkillParameter");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetRoomSkillParameterResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetRoomSkillParameterError::from_response(response))
}),
)
}
})
}
fn get_skill_group(
&self,
input: GetSkillGroupRequest,
) -> RusotoFuture<GetSkillGroupResponse, GetSkillGroupError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.GetSkillGroup");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetSkillGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetSkillGroupError::from_response(response))),
)
}
})
}
fn list_device_events(
&self,
input: ListDeviceEventsRequest,
) -> RusotoFuture<ListDeviceEventsResponse, ListDeviceEventsError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.ListDeviceEvents");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListDeviceEventsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListDeviceEventsError::from_response(response))),
)
}
})
}
fn list_skills(
&self,
input: ListSkillsRequest,
) -> RusotoFuture<ListSkillsResponse, ListSkillsError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.ListSkills");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListSkillsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListSkillsError::from_response(response))),
)
}
})
}
fn list_tags(&self, input: ListTagsRequest) -> RusotoFuture<ListTagsResponse, ListTagsError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.ListTags");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListTagsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListTagsError::from_response(response))),
)
}
})
}
fn put_room_skill_parameter(
&self,
input: PutRoomSkillParameterRequest,
) -> RusotoFuture<PutRoomSkillParameterResponse, PutRoomSkillParameterError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.PutRoomSkillParameter");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<PutRoomSkillParameterResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(PutRoomSkillParameterError::from_response(response))
}),
)
}
})
}
fn resolve_room(
&self,
input: ResolveRoomRequest,
) -> RusotoFuture<ResolveRoomResponse, ResolveRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.ResolveRoom");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ResolveRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ResolveRoomError::from_response(response))),
)
}
})
}
fn revoke_invitation(
&self,
input: RevokeInvitationRequest,
) -> RusotoFuture<RevokeInvitationResponse, RevokeInvitationError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.RevokeInvitation");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<RevokeInvitationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(RevokeInvitationError::from_response(response))),
)
}
})
}
fn search_address_books(
&self,
input: SearchAddressBooksRequest,
) -> RusotoFuture<SearchAddressBooksResponse, SearchAddressBooksError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SearchAddressBooks");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchAddressBooksResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchAddressBooksError::from_response(response))),
)
}
})
}
fn search_contacts(
&self,
input: SearchContactsRequest,
) -> RusotoFuture<SearchContactsResponse, SearchContactsError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SearchContacts");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchContactsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchContactsError::from_response(response))),
)
}
})
}
fn search_devices(
&self,
input: SearchDevicesRequest,
) -> RusotoFuture<SearchDevicesResponse, SearchDevicesError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SearchDevices");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchDevicesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchDevicesError::from_response(response))),
)
}
})
}
fn search_profiles(
&self,
input: SearchProfilesRequest,
) -> RusotoFuture<SearchProfilesResponse, SearchProfilesError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SearchProfiles");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchProfilesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchProfilesError::from_response(response))),
)
}
})
}
fn search_rooms(
&self,
input: SearchRoomsRequest,
) -> RusotoFuture<SearchRoomsResponse, SearchRoomsError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SearchRooms");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchRoomsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchRoomsError::from_response(response))),
)
}
})
}
fn search_skill_groups(
&self,
input: SearchSkillGroupsRequest,
) -> RusotoFuture<SearchSkillGroupsResponse, SearchSkillGroupsError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SearchSkillGroups");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchSkillGroupsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchSkillGroupsError::from_response(response))),
)
}
})
}
fn search_users(
&self,
input: SearchUsersRequest,
) -> RusotoFuture<SearchUsersResponse, SearchUsersError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SearchUsers");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchUsersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchUsersError::from_response(response))),
)
}
})
}
fn send_invitation(
&self,
input: SendInvitationRequest,
) -> RusotoFuture<SendInvitationResponse, SendInvitationError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.SendInvitation");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SendInvitationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SendInvitationError::from_response(response))),
)
}
})
}
fn start_device_sync(
&self,
input: StartDeviceSyncRequest,
) -> RusotoFuture<StartDeviceSyncResponse, StartDeviceSyncError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.StartDeviceSync");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartDeviceSyncResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StartDeviceSyncError::from_response(response))),
)
}
})
}
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.TagResource");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<TagResourceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
)
}
})
}
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.UntagResource");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UntagResourceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
)
}
})
}
fn update_address_book(
&self,
input: UpdateAddressBookRequest,
) -> RusotoFuture<UpdateAddressBookResponse, UpdateAddressBookError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.UpdateAddressBook");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateAddressBookResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateAddressBookError::from_response(response))),
)
}
})
}
fn update_contact(
&self,
input: UpdateContactRequest,
) -> RusotoFuture<UpdateContactResponse, UpdateContactError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.UpdateContact");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateContactResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateContactError::from_response(response))),
)
}
})
}
fn update_device(
&self,
input: UpdateDeviceRequest,
) -> RusotoFuture<UpdateDeviceResponse, UpdateDeviceError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.UpdateDevice");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateDeviceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDeviceError::from_response(response))),
)
}
})
}
fn update_profile(
&self,
input: UpdateProfileRequest,
) -> RusotoFuture<UpdateProfileResponse, UpdateProfileError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.UpdateProfile");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateProfileResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateProfileError::from_response(response))),
)
}
})
}
fn update_room(
&self,
input: UpdateRoomRequest,
) -> RusotoFuture<UpdateRoomResponse, UpdateRoomError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.UpdateRoom");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateRoomResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateRoomError::from_response(response))),
)
}
})
}
fn update_skill_group(
&self,
input: UpdateSkillGroupRequest,
) -> RusotoFuture<UpdateSkillGroupResponse, UpdateSkillGroupError> {
let mut request = SignedRequest::new("POST", "a4b", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AlexaForBusiness.UpdateSkillGroup");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateSkillGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateSkillGroupError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}