use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AccountTakeoverActionType {
#[serde(rename = "EventAction")]
pub event_action: String,
#[serde(rename = "Notify")]
pub notify: bool,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AccountTakeoverActionsType {
#[serde(rename = "HighAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub high_action: Option<AccountTakeoverActionType>,
#[serde(rename = "LowAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub low_action: Option<AccountTakeoverActionType>,
#[serde(rename = "MediumAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub medium_action: Option<AccountTakeoverActionType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AccountTakeoverRiskConfigurationType {
#[serde(rename = "Actions")]
pub actions: AccountTakeoverActionsType,
#[serde(rename = "NotifyConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notify_configuration: Option<NotifyConfigurationType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AddCustomAttributesRequest {
#[serde(rename = "CustomAttributes")]
pub custom_attributes: Vec<SchemaAttributeType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddCustomAttributesResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminAddUserToGroupRequest {
#[serde(rename = "GroupName")]
pub group_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminConfirmSignUpRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminConfirmSignUpResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AdminCreateUserConfigType {
#[serde(rename = "AllowAdminCreateUserOnly")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_admin_create_user_only: Option<bool>,
#[serde(rename = "InviteMessageTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub invite_message_template: Option<MessageTemplateType>,
#[serde(rename = "UnusedAccountValidityDays")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unused_account_validity_days: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminCreateUserRequest {
#[serde(rename = "DesiredDeliveryMediums")]
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_delivery_mediums: Option<Vec<String>>,
#[serde(rename = "ForceAliasCreation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force_alias_creation: Option<bool>,
#[serde(rename = "MessageAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message_action: Option<String>,
#[serde(rename = "TemporaryPassword")]
#[serde(skip_serializing_if = "Option::is_none")]
pub temporary_password: Option<String>,
#[serde(rename = "UserAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_attributes: Option<Vec<AttributeType>>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
#[serde(rename = "ValidationData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validation_data: Option<Vec<AttributeType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminCreateUserResponse {
#[serde(rename = "User")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user: Option<UserType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminDeleteUserAttributesRequest {
#[serde(rename = "UserAttributeNames")]
pub user_attribute_names: Vec<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminDeleteUserAttributesResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminDeleteUserRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminDisableProviderForUserRequest {
#[serde(rename = "User")]
pub user: ProviderUserIdentifierType,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminDisableProviderForUserResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminDisableUserRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminDisableUserResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminEnableUserRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminEnableUserResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminForgetDeviceRequest {
#[serde(rename = "DeviceKey")]
pub device_key: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminGetDeviceRequest {
#[serde(rename = "DeviceKey")]
pub device_key: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminGetDeviceResponse {
#[serde(rename = "Device")]
pub device: DeviceType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminGetUserRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminGetUserResponse {
#[serde(rename = "Enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "MFAOptions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_options: Option<Vec<MFAOptionType>>,
#[serde(rename = "PreferredMfaSetting")]
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_mfa_setting: Option<String>,
#[serde(rename = "UserAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_attributes: Option<Vec<AttributeType>>,
#[serde(rename = "UserCreateDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_create_date: Option<f64>,
#[serde(rename = "UserLastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_last_modified_date: Option<f64>,
#[serde(rename = "UserMFASettingList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_mfa_setting_list: Option<Vec<String>>,
#[serde(rename = "UserStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_status: Option<String>,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminInitiateAuthRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "AuthFlow")]
pub auth_flow: String,
#[serde(rename = "AuthParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "ClientMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_metadata: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "ContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub context_data: Option<ContextDataType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminInitiateAuthResponse {
#[serde(rename = "AuthenticationResult")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authentication_result: Option<AuthenticationResultType>,
#[serde(rename = "ChallengeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_name: Option<String>,
#[serde(rename = "ChallengeParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminLinkProviderForUserRequest {
#[serde(rename = "DestinationUser")]
pub destination_user: ProviderUserIdentifierType,
#[serde(rename = "SourceUser")]
pub source_user: ProviderUserIdentifierType,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminLinkProviderForUserResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminListDevicesRequest {
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminListDevicesResponse {
#[serde(rename = "Devices")]
#[serde(skip_serializing_if = "Option::is_none")]
pub devices: Option<Vec<DeviceType>>,
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminListGroupsForUserRequest {
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminListGroupsForUserResponse {
#[serde(rename = "Groups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub groups: Option<Vec<GroupType>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminListUserAuthEventsRequest {
#[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 = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminListUserAuthEventsResponse {
#[serde(rename = "AuthEvents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_events: Option<Vec<AuthEventType>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminRemoveUserFromGroupRequest {
#[serde(rename = "GroupName")]
pub group_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminResetUserPasswordRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminResetUserPasswordResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminRespondToAuthChallengeRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "ChallengeName")]
pub challenge_name: String,
#[serde(rename = "ChallengeResponses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_responses: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "ContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub context_data: Option<ContextDataType>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminRespondToAuthChallengeResponse {
#[serde(rename = "AuthenticationResult")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authentication_result: Option<AuthenticationResultType>,
#[serde(rename = "ChallengeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_name: Option<String>,
#[serde(rename = "ChallengeParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminSetUserMFAPreferenceRequest {
#[serde(rename = "SMSMfaSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_mfa_settings: Option<SMSMfaSettingsType>,
#[serde(rename = "SoftwareTokenMfaSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_token_mfa_settings: Option<SoftwareTokenMfaSettingsType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminSetUserMFAPreferenceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminSetUserSettingsRequest {
#[serde(rename = "MFAOptions")]
pub mfa_options: Vec<MFAOptionType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminSetUserSettingsResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminUpdateAuthEventFeedbackRequest {
#[serde(rename = "EventId")]
pub event_id: String,
#[serde(rename = "FeedbackValue")]
pub feedback_value: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminUpdateAuthEventFeedbackResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminUpdateDeviceStatusRequest {
#[serde(rename = "DeviceKey")]
pub device_key: String,
#[serde(rename = "DeviceRememberedStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_remembered_status: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminUpdateDeviceStatusResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminUpdateUserAttributesRequest {
#[serde(rename = "UserAttributes")]
pub user_attributes: Vec<AttributeType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminUpdateUserAttributesResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AdminUserGlobalSignOutRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AdminUserGlobalSignOutResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AnalyticsConfigurationType {
#[serde(rename = "ApplicationId")]
pub application_id: String,
#[serde(rename = "ExternalId")]
pub external_id: String,
#[serde(rename = "RoleArn")]
pub role_arn: String,
#[serde(rename = "UserDataShared")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_data_shared: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AnalyticsMetadataType {
#[serde(rename = "AnalyticsEndpointId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_endpoint_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateSoftwareTokenRequest {
#[serde(rename = "AccessToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_token: Option<String>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateSoftwareTokenResponse {
#[serde(rename = "SecretCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret_code: Option<String>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AttributeType {
#[serde(rename = "Name")]
pub name: 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 AuthEventType {
#[serde(rename = "ChallengeResponses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_responses: Option<Vec<ChallengeResponseType>>,
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "EventContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_context_data: Option<EventContextDataType>,
#[serde(rename = "EventFeedback")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_feedback: Option<EventFeedbackType>,
#[serde(rename = "EventId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_id: Option<String>,
#[serde(rename = "EventResponse")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_response: Option<String>,
#[serde(rename = "EventRisk")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_risk: Option<EventRiskType>,
#[serde(rename = "EventType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AuthenticationResultType {
#[serde(rename = "AccessToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_token: Option<String>,
#[serde(rename = "ExpiresIn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_in: Option<i64>,
#[serde(rename = "IdToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id_token: Option<String>,
#[serde(rename = "NewDeviceMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub new_device_metadata: Option<NewDeviceMetadataType>,
#[serde(rename = "RefreshToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_token: Option<String>,
#[serde(rename = "TokenType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub token_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ChallengeResponseType {
#[serde(rename = "ChallengeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_name: Option<String>,
#[serde(rename = "ChallengeResponse")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_response: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ChangePasswordRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "PreviousPassword")]
pub previous_password: String,
#[serde(rename = "ProposedPassword")]
pub proposed_password: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ChangePasswordResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CodeDeliveryDetailsType {
#[serde(rename = "AttributeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_name: Option<String>,
#[serde(rename = "DeliveryMedium")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delivery_medium: Option<String>,
#[serde(rename = "Destination")]
#[serde(skip_serializing_if = "Option::is_none")]
pub destination: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CompromisedCredentialsActionsType {
#[serde(rename = "EventAction")]
pub event_action: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CompromisedCredentialsRiskConfigurationType {
#[serde(rename = "Actions")]
pub actions: CompromisedCredentialsActionsType,
#[serde(rename = "EventFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_filter: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ConfirmDeviceRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "DeviceKey")]
pub device_key: String,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "DeviceSecretVerifierConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_secret_verifier_config: Option<DeviceSecretVerifierConfigType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ConfirmDeviceResponse {
#[serde(rename = "UserConfirmationNecessary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_confirmation_necessary: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ConfirmForgotPasswordRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "ConfirmationCode")]
pub confirmation_code: String,
#[serde(rename = "Password")]
pub password: String,
#[serde(rename = "SecretHash")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret_hash: Option<String>,
#[serde(rename = "UserContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_context_data: Option<UserContextDataType>,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ConfirmForgotPasswordResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ConfirmSignUpRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "ConfirmationCode")]
pub confirmation_code: String,
#[serde(rename = "ForceAliasCreation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force_alias_creation: Option<bool>,
#[serde(rename = "SecretHash")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret_hash: Option<String>,
#[serde(rename = "UserContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_context_data: Option<UserContextDataType>,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ConfirmSignUpResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ContextDataType {
#[serde(rename = "EncodedData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encoded_data: Option<String>,
#[serde(rename = "HttpHeaders")]
pub http_headers: Vec<HttpHeader>,
#[serde(rename = "IpAddress")]
pub ip_address: String,
#[serde(rename = "ServerName")]
pub server_name: String,
#[serde(rename = "ServerPath")]
pub server_path: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateGroupRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "GroupName")]
pub group_name: String,
#[serde(rename = "Precedence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub precedence: Option<i64>,
#[serde(rename = "RoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateGroupResponse {
#[serde(rename = "Group")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<GroupType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateIdentityProviderRequest {
#[serde(rename = "AttributeMapping")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_mapping: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "IdpIdentifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idp_identifiers: Option<Vec<String>>,
#[serde(rename = "ProviderDetails")]
pub provider_details: ::std::collections::HashMap<String, String>,
#[serde(rename = "ProviderName")]
pub provider_name: String,
#[serde(rename = "ProviderType")]
pub provider_type: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateIdentityProviderResponse {
#[serde(rename = "IdentityProvider")]
pub identity_provider: IdentityProviderType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateResourceServerRequest {
#[serde(rename = "Identifier")]
pub identifier: String,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Scopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scopes: Option<Vec<ResourceServerScopeType>>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateResourceServerResponse {
#[serde(rename = "ResourceServer")]
pub resource_server: ResourceServerType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUserImportJobRequest {
#[serde(rename = "CloudWatchLogsRoleArn")]
pub cloud_watch_logs_role_arn: String,
#[serde(rename = "JobName")]
pub job_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateUserImportJobResponse {
#[serde(rename = "UserImportJob")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_import_job: Option<UserImportJobType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUserPoolClientRequest {
#[serde(rename = "AllowedOAuthFlows")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_flows: Option<Vec<String>>,
#[serde(rename = "AllowedOAuthFlowsUserPoolClient")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_flows_user_pool_client: Option<bool>,
#[serde(rename = "AllowedOAuthScopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_scopes: Option<Vec<String>>,
#[serde(rename = "AnalyticsConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_configuration: Option<AnalyticsConfigurationType>,
#[serde(rename = "CallbackURLs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub callback_ur_ls: Option<Vec<String>>,
#[serde(rename = "ClientName")]
pub client_name: String,
#[serde(rename = "DefaultRedirectURI")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_redirect_uri: Option<String>,
#[serde(rename = "ExplicitAuthFlows")]
#[serde(skip_serializing_if = "Option::is_none")]
pub explicit_auth_flows: Option<Vec<String>>,
#[serde(rename = "GenerateSecret")]
#[serde(skip_serializing_if = "Option::is_none")]
pub generate_secret: Option<bool>,
#[serde(rename = "LogoutURLs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logout_ur_ls: Option<Vec<String>>,
#[serde(rename = "ReadAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub read_attributes: Option<Vec<String>>,
#[serde(rename = "RefreshTokenValidity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_token_validity: Option<i64>,
#[serde(rename = "SupportedIdentityProviders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_identity_providers: Option<Vec<String>>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "WriteAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub write_attributes: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateUserPoolClientResponse {
#[serde(rename = "UserPoolClient")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_client: Option<UserPoolClientType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUserPoolDomainRequest {
#[serde(rename = "CustomDomainConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_domain_config: Option<CustomDomainConfigType>,
#[serde(rename = "Domain")]
pub domain: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateUserPoolDomainResponse {
#[serde(rename = "CloudFrontDomain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_front_domain: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUserPoolRequest {
#[serde(rename = "AdminCreateUserConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub admin_create_user_config: Option<AdminCreateUserConfigType>,
#[serde(rename = "AliasAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alias_attributes: Option<Vec<String>>,
#[serde(rename = "AutoVerifiedAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_verified_attributes: Option<Vec<String>>,
#[serde(rename = "DeviceConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_configuration: Option<DeviceConfigurationType>,
#[serde(rename = "EmailConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_configuration: Option<EmailConfigurationType>,
#[serde(rename = "EmailVerificationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_verification_message: Option<String>,
#[serde(rename = "EmailVerificationSubject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_verification_subject: Option<String>,
#[serde(rename = "LambdaConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_config: Option<LambdaConfigType>,
#[serde(rename = "MfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_configuration: Option<String>,
#[serde(rename = "Policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<UserPoolPolicyType>,
#[serde(rename = "PoolName")]
pub pool_name: String,
#[serde(rename = "Schema")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema: Option<Vec<SchemaAttributeType>>,
#[serde(rename = "SmsAuthenticationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_authentication_message: Option<String>,
#[serde(rename = "SmsConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_configuration: Option<SmsConfigurationType>,
#[serde(rename = "SmsVerificationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_verification_message: Option<String>,
#[serde(rename = "UserPoolAddOns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_add_ons: Option<UserPoolAddOnsType>,
#[serde(rename = "UserPoolTags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "UsernameAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub username_attributes: Option<Vec<String>>,
#[serde(rename = "VerificationMessageTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_message_template: Option<VerificationMessageTemplateType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateUserPoolResponse {
#[serde(rename = "UserPool")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool: Option<UserPoolType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CustomDomainConfigType {
#[serde(rename = "CertificateArn")]
pub certificate_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteGroupRequest {
#[serde(rename = "GroupName")]
pub group_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteIdentityProviderRequest {
#[serde(rename = "ProviderName")]
pub provider_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteResourceServerRequest {
#[serde(rename = "Identifier")]
pub identifier: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUserAttributesRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "UserAttributeNames")]
pub user_attribute_names: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteUserAttributesResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUserPoolClientRequest {
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUserPoolDomainRequest {
#[serde(rename = "Domain")]
pub domain: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteUserPoolDomainResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUserPoolRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUserRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeIdentityProviderRequest {
#[serde(rename = "ProviderName")]
pub provider_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeIdentityProviderResponse {
#[serde(rename = "IdentityProvider")]
pub identity_provider: IdentityProviderType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeResourceServerRequest {
#[serde(rename = "Identifier")]
pub identifier: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeResourceServerResponse {
#[serde(rename = "ResourceServer")]
pub resource_server: ResourceServerType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeRiskConfigurationRequest {
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeRiskConfigurationResponse {
#[serde(rename = "RiskConfiguration")]
pub risk_configuration: RiskConfigurationType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeUserImportJobRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeUserImportJobResponse {
#[serde(rename = "UserImportJob")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_import_job: Option<UserImportJobType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeUserPoolClientRequest {
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeUserPoolClientResponse {
#[serde(rename = "UserPoolClient")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_client: Option<UserPoolClientType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeUserPoolDomainRequest {
#[serde(rename = "Domain")]
pub domain: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeUserPoolDomainResponse {
#[serde(rename = "DomainDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain_description: Option<DomainDescriptionType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeUserPoolRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeUserPoolResponse {
#[serde(rename = "UserPool")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool: Option<UserPoolType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeviceConfigurationType {
#[serde(rename = "ChallengeRequiredOnNewDevice")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_required_on_new_device: Option<bool>,
#[serde(rename = "DeviceOnlyRememberedOnUserPrompt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_only_remembered_on_user_prompt: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeviceSecretVerifierConfigType {
#[serde(rename = "PasswordVerifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub password_verifier: Option<String>,
#[serde(rename = "Salt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub salt: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeviceType {
#[serde(rename = "DeviceAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_attributes: Option<Vec<AttributeType>>,
#[serde(rename = "DeviceCreateDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_create_date: Option<f64>,
#[serde(rename = "DeviceKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_key: Option<String>,
#[serde(rename = "DeviceLastAuthenticatedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_last_authenticated_date: Option<f64>,
#[serde(rename = "DeviceLastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_last_modified_date: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DomainDescriptionType {
#[serde(rename = "AWSAccountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_account_id: Option<String>,
#[serde(rename = "CloudFrontDistribution")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_front_distribution: Option<String>,
#[serde(rename = "CustomDomainConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_domain_config: Option<CustomDomainConfigType>,
#[serde(rename = "Domain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain: Option<String>,
#[serde(rename = "S3Bucket")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s3_bucket: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
#[serde(rename = "Version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EmailConfigurationType {
#[serde(rename = "ReplyToEmailAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_to_email_address: Option<String>,
#[serde(rename = "SourceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EventContextDataType {
#[serde(rename = "City")]
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
#[serde(rename = "Country")]
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "IpAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ip_address: Option<String>,
#[serde(rename = "Timezone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timezone: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EventFeedbackType {
#[serde(rename = "FeedbackDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub feedback_date: Option<f64>,
#[serde(rename = "FeedbackValue")]
pub feedback_value: String,
#[serde(rename = "Provider")]
pub provider: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EventRiskType {
#[serde(rename = "RiskDecision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_decision: Option<String>,
#[serde(rename = "RiskLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_level: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ForgetDeviceRequest {
#[serde(rename = "AccessToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_token: Option<String>,
#[serde(rename = "DeviceKey")]
pub device_key: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ForgotPasswordRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "SecretHash")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret_hash: Option<String>,
#[serde(rename = "UserContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_context_data: Option<UserContextDataType>,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ForgotPasswordResponse {
#[serde(rename = "CodeDeliveryDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_delivery_details: Option<CodeDeliveryDetailsType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCSVHeaderRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCSVHeaderResponse {
#[serde(rename = "CSVHeader")]
#[serde(skip_serializing_if = "Option::is_none")]
pub csv_header: Option<Vec<String>>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDeviceRequest {
#[serde(rename = "AccessToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_token: Option<String>,
#[serde(rename = "DeviceKey")]
pub device_key: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDeviceResponse {
#[serde(rename = "Device")]
pub device: DeviceType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetGroupRequest {
#[serde(rename = "GroupName")]
pub group_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetGroupResponse {
#[serde(rename = "Group")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<GroupType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIdentityProviderByIdentifierRequest {
#[serde(rename = "IdpIdentifier")]
pub idp_identifier: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIdentityProviderByIdentifierResponse {
#[serde(rename = "IdentityProvider")]
pub identity_provider: IdentityProviderType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSigningCertificateRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSigningCertificateResponse {
#[serde(rename = "Certificate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUICustomizationRequest {
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetUICustomizationResponse {
#[serde(rename = "UICustomization")]
pub ui_customization: UICustomizationType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUserAttributeVerificationCodeRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "AttributeName")]
pub attribute_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetUserAttributeVerificationCodeResponse {
#[serde(rename = "CodeDeliveryDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_delivery_details: Option<CodeDeliveryDetailsType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUserPoolMfaConfigRequest {
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetUserPoolMfaConfigResponse {
#[serde(rename = "MfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_configuration: Option<String>,
#[serde(rename = "SmsMfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_mfa_configuration: Option<SmsMfaConfigType>,
#[serde(rename = "SoftwareTokenMfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_token_mfa_configuration: Option<SoftwareTokenMfaConfigType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetUserRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetUserResponse {
#[serde(rename = "MFAOptions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_options: Option<Vec<MFAOptionType>>,
#[serde(rename = "PreferredMfaSetting")]
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_mfa_setting: Option<String>,
#[serde(rename = "UserAttributes")]
pub user_attributes: Vec<AttributeType>,
#[serde(rename = "UserMFASettingList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_mfa_setting_list: Option<Vec<String>>,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GlobalSignOutRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GlobalSignOutResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GroupType {
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "GroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group_name: Option<String>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "Precedence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub precedence: Option<i64>,
#[serde(rename = "RoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct HttpHeader {
#[serde(rename = "headerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub header_name: Option<String>,
#[serde(rename = "headerValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub header_value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IdentityProviderType {
#[serde(rename = "AttributeMapping")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_mapping: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "IdpIdentifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idp_identifiers: Option<Vec<String>>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "ProviderDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_details: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "ProviderName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_name: Option<String>,
#[serde(rename = "ProviderType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_type: Option<String>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct InitiateAuthRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "AuthFlow")]
pub auth_flow: String,
#[serde(rename = "AuthParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "ClientMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_metadata: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "UserContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_context_data: Option<UserContextDataType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct InitiateAuthResponse {
#[serde(rename = "AuthenticationResult")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authentication_result: Option<AuthenticationResultType>,
#[serde(rename = "ChallengeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_name: Option<String>,
#[serde(rename = "ChallengeParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct LambdaConfigType {
#[serde(rename = "CreateAuthChallenge")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_auth_challenge: Option<String>,
#[serde(rename = "CustomMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_message: Option<String>,
#[serde(rename = "DefineAuthChallenge")]
#[serde(skip_serializing_if = "Option::is_none")]
pub define_auth_challenge: Option<String>,
#[serde(rename = "PostAuthentication")]
#[serde(skip_serializing_if = "Option::is_none")]
pub post_authentication: Option<String>,
#[serde(rename = "PostConfirmation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub post_confirmation: Option<String>,
#[serde(rename = "PreAuthentication")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pre_authentication: Option<String>,
#[serde(rename = "PreSignUp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pre_sign_up: Option<String>,
#[serde(rename = "PreTokenGeneration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pre_token_generation: Option<String>,
#[serde(rename = "UserMigration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_migration: Option<String>,
#[serde(rename = "VerifyAuthChallengeResponse")]
#[serde(skip_serializing_if = "Option::is_none")]
pub verify_auth_challenge_response: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDevicesRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListDevicesResponse {
#[serde(rename = "Devices")]
#[serde(skip_serializing_if = "Option::is_none")]
pub devices: Option<Vec<DeviceType>>,
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListGroupsRequest {
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListGroupsResponse {
#[serde(rename = "Groups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub groups: Option<Vec<GroupType>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListIdentityProvidersRequest {
#[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 = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListIdentityProvidersResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Providers")]
pub providers: Vec<ProviderDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListResourceServersRequest {
#[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 = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListResourceServersResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ResourceServers")]
pub resource_servers: Vec<ResourceServerType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListUserImportJobsRequest {
#[serde(rename = "MaxResults")]
pub max_results: i64,
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListUserImportJobsResponse {
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
#[serde(rename = "UserImportJobs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_import_jobs: Option<Vec<UserImportJobType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListUserPoolClientsRequest {
#[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 = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListUserPoolClientsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "UserPoolClients")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_clients: Option<Vec<UserPoolClientDescription>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListUserPoolsRequest {
#[serde(rename = "MaxResults")]
pub max_results: 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 ListUserPoolsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "UserPools")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pools: Option<Vec<UserPoolDescriptionType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListUsersInGroupRequest {
#[serde(rename = "GroupName")]
pub group_name: String,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListUsersInGroupResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Users")]
#[serde(skip_serializing_if = "Option::is_none")]
pub users: Option<Vec<UserType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListUsersRequest {
#[serde(rename = "AttributesToGet")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes_to_get: Option<Vec<String>>,
#[serde(rename = "Filter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter: Option<String>,
#[serde(rename = "Limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListUsersResponse {
#[serde(rename = "PaginationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination_token: Option<String>,
#[serde(rename = "Users")]
#[serde(skip_serializing_if = "Option::is_none")]
pub users: Option<Vec<UserType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MFAOptionType {
#[serde(rename = "AttributeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_name: Option<String>,
#[serde(rename = "DeliveryMedium")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delivery_medium: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MessageTemplateType {
#[serde(rename = "EmailMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_message: Option<String>,
#[serde(rename = "EmailSubject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_subject: Option<String>,
#[serde(rename = "SMSMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct NewDeviceMetadataType {
#[serde(rename = "DeviceGroupKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_group_key: Option<String>,
#[serde(rename = "DeviceKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_key: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct NotifyConfigurationType {
#[serde(rename = "BlockEmail")]
#[serde(skip_serializing_if = "Option::is_none")]
pub block_email: Option<NotifyEmailType>,
#[serde(rename = "From")]
#[serde(skip_serializing_if = "Option::is_none")]
pub from: Option<String>,
#[serde(rename = "MfaEmail")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_email: Option<NotifyEmailType>,
#[serde(rename = "NoActionEmail")]
#[serde(skip_serializing_if = "Option::is_none")]
pub no_action_email: Option<NotifyEmailType>,
#[serde(rename = "ReplyTo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_to: Option<String>,
#[serde(rename = "SourceArn")]
pub source_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct NotifyEmailType {
#[serde(rename = "HtmlBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub html_body: Option<String>,
#[serde(rename = "Subject")]
pub subject: String,
#[serde(rename = "TextBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub text_body: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct NumberAttributeConstraintsType {
#[serde(rename = "MaxValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_value: Option<String>,
#[serde(rename = "MinValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PasswordPolicyType {
#[serde(rename = "MinimumLength")]
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_length: Option<i64>,
#[serde(rename = "RequireLowercase")]
#[serde(skip_serializing_if = "Option::is_none")]
pub require_lowercase: Option<bool>,
#[serde(rename = "RequireNumbers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub require_numbers: Option<bool>,
#[serde(rename = "RequireSymbols")]
#[serde(skip_serializing_if = "Option::is_none")]
pub require_symbols: Option<bool>,
#[serde(rename = "RequireUppercase")]
#[serde(skip_serializing_if = "Option::is_none")]
pub require_uppercase: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ProviderDescription {
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "ProviderName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_name: Option<String>,
#[serde(rename = "ProviderType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ProviderUserIdentifierType {
#[serde(rename = "ProviderAttributeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_attribute_name: Option<String>,
#[serde(rename = "ProviderAttributeValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_attribute_value: Option<String>,
#[serde(rename = "ProviderName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ResendConfirmationCodeRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "SecretHash")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret_hash: Option<String>,
#[serde(rename = "UserContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_context_data: Option<UserContextDataType>,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ResendConfirmationCodeResponse {
#[serde(rename = "CodeDeliveryDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_delivery_details: Option<CodeDeliveryDetailsType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResourceServerScopeType {
#[serde(rename = "ScopeDescription")]
pub scope_description: String,
#[serde(rename = "ScopeName")]
pub scope_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ResourceServerType {
#[serde(rename = "Identifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identifier: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Scopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scopes: Option<Vec<ResourceServerScopeType>>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RespondToAuthChallengeRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "ChallengeName")]
pub challenge_name: String,
#[serde(rename = "ChallengeResponses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_responses: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
#[serde(rename = "UserContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_context_data: Option<UserContextDataType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RespondToAuthChallengeResponse {
#[serde(rename = "AuthenticationResult")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authentication_result: Option<AuthenticationResultType>,
#[serde(rename = "ChallengeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_name: Option<String>,
#[serde(rename = "ChallengeParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub challenge_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RiskConfigurationType {
#[serde(rename = "AccountTakeoverRiskConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub account_takeover_risk_configuration: Option<AccountTakeoverRiskConfigurationType>,
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "CompromisedCredentialsRiskConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub compromised_credentials_risk_configuration:
Option<CompromisedCredentialsRiskConfigurationType>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "RiskExceptionConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_exception_configuration: Option<RiskExceptionConfigurationType>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RiskExceptionConfigurationType {
#[serde(rename = "BlockedIPRangeList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub blocked_ip_range_list: Option<Vec<String>>,
#[serde(rename = "SkippedIPRangeList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skipped_ip_range_list: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SMSMfaSettingsType {
#[serde(rename = "Enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "PreferredMfa")]
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_mfa: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SchemaAttributeType {
#[serde(rename = "AttributeDataType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_data_type: Option<String>,
#[serde(rename = "DeveloperOnlyAttribute")]
#[serde(skip_serializing_if = "Option::is_none")]
pub developer_only_attribute: Option<bool>,
#[serde(rename = "Mutable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mutable: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "NumberAttributeConstraints")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_attribute_constraints: Option<NumberAttributeConstraintsType>,
#[serde(rename = "Required")]
#[serde(skip_serializing_if = "Option::is_none")]
pub required: Option<bool>,
#[serde(rename = "StringAttributeConstraints")]
#[serde(skip_serializing_if = "Option::is_none")]
pub string_attribute_constraints: Option<StringAttributeConstraintsType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetRiskConfigurationRequest {
#[serde(rename = "AccountTakeoverRiskConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub account_takeover_risk_configuration: Option<AccountTakeoverRiskConfigurationType>,
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "CompromisedCredentialsRiskConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub compromised_credentials_risk_configuration:
Option<CompromisedCredentialsRiskConfigurationType>,
#[serde(rename = "RiskExceptionConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_exception_configuration: Option<RiskExceptionConfigurationType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SetRiskConfigurationResponse {
#[serde(rename = "RiskConfiguration")]
pub risk_configuration: RiskConfigurationType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetUICustomizationRequest {
#[serde(rename = "CSS")]
#[serde(skip_serializing_if = "Option::is_none")]
pub css: Option<String>,
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "ImageFile")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub image_file: Option<Vec<u8>>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SetUICustomizationResponse {
#[serde(rename = "UICustomization")]
pub ui_customization: UICustomizationType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetUserMFAPreferenceRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "SMSMfaSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_mfa_settings: Option<SMSMfaSettingsType>,
#[serde(rename = "SoftwareTokenMfaSettings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_token_mfa_settings: Option<SoftwareTokenMfaSettingsType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SetUserMFAPreferenceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetUserPoolMfaConfigRequest {
#[serde(rename = "MfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_configuration: Option<String>,
#[serde(rename = "SmsMfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_mfa_configuration: Option<SmsMfaConfigType>,
#[serde(rename = "SoftwareTokenMfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_token_mfa_configuration: Option<SoftwareTokenMfaConfigType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SetUserPoolMfaConfigResponse {
#[serde(rename = "MfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_configuration: Option<String>,
#[serde(rename = "SmsMfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_mfa_configuration: Option<SmsMfaConfigType>,
#[serde(rename = "SoftwareTokenMfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_token_mfa_configuration: Option<SoftwareTokenMfaConfigType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetUserSettingsRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "MFAOptions")]
pub mfa_options: Vec<MFAOptionType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SetUserSettingsResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SignUpRequest {
#[serde(rename = "AnalyticsMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_metadata: Option<AnalyticsMetadataType>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "Password")]
pub password: String,
#[serde(rename = "SecretHash")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret_hash: Option<String>,
#[serde(rename = "UserAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_attributes: Option<Vec<AttributeType>>,
#[serde(rename = "UserContextData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_context_data: Option<UserContextDataType>,
#[serde(rename = "Username")]
pub username: String,
#[serde(rename = "ValidationData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validation_data: Option<Vec<AttributeType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SignUpResponse {
#[serde(rename = "CodeDeliveryDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_delivery_details: Option<CodeDeliveryDetailsType>,
#[serde(rename = "UserConfirmed")]
pub user_confirmed: bool,
#[serde(rename = "UserSub")]
pub user_sub: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SmsConfigurationType {
#[serde(rename = "ExternalId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(rename = "SnsCallerArn")]
pub sns_caller_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SmsMfaConfigType {
#[serde(rename = "SmsAuthenticationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_authentication_message: Option<String>,
#[serde(rename = "SmsConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_configuration: Option<SmsConfigurationType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SoftwareTokenMfaConfigType {
#[serde(rename = "Enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SoftwareTokenMfaSettingsType {
#[serde(rename = "Enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "PreferredMfa")]
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_mfa: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartUserImportJobRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartUserImportJobResponse {
#[serde(rename = "UserImportJob")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_import_job: Option<UserImportJobType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StopUserImportJobRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StopUserImportJobResponse {
#[serde(rename = "UserImportJob")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_import_job: Option<UserImportJobType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StringAttributeConstraintsType {
#[serde(rename = "MaxLength")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_length: Option<String>,
#[serde(rename = "MinLength")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_length: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UICustomizationType {
#[serde(rename = "CSS")]
#[serde(skip_serializing_if = "Option::is_none")]
pub css: Option<String>,
#[serde(rename = "CSSVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub css_version: Option<String>,
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "ImageUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub image_url: Option<String>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateAuthEventFeedbackRequest {
#[serde(rename = "EventId")]
pub event_id: String,
#[serde(rename = "FeedbackToken")]
pub feedback_token: String,
#[serde(rename = "FeedbackValue")]
pub feedback_value: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "Username")]
pub username: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateAuthEventFeedbackResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDeviceStatusRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "DeviceKey")]
pub device_key: String,
#[serde(rename = "DeviceRememberedStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_remembered_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateDeviceStatusResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateGroupRequest {
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "GroupName")]
pub group_name: String,
#[serde(rename = "Precedence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub precedence: Option<i64>,
#[serde(rename = "RoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateGroupResponse {
#[serde(rename = "Group")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<GroupType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateIdentityProviderRequest {
#[serde(rename = "AttributeMapping")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_mapping: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "IdpIdentifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idp_identifiers: Option<Vec<String>>,
#[serde(rename = "ProviderDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_details: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "ProviderName")]
pub provider_name: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateIdentityProviderResponse {
#[serde(rename = "IdentityProvider")]
pub identity_provider: IdentityProviderType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateResourceServerRequest {
#[serde(rename = "Identifier")]
pub identifier: String,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Scopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scopes: Option<Vec<ResourceServerScopeType>>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateResourceServerResponse {
#[serde(rename = "ResourceServer")]
pub resource_server: ResourceServerType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateUserAttributesRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "UserAttributes")]
pub user_attributes: Vec<AttributeType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateUserAttributesResponse {
#[serde(rename = "CodeDeliveryDetailsList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_delivery_details_list: Option<Vec<CodeDeliveryDetailsType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateUserPoolClientRequest {
#[serde(rename = "AllowedOAuthFlows")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_flows: Option<Vec<String>>,
#[serde(rename = "AllowedOAuthFlowsUserPoolClient")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_flows_user_pool_client: Option<bool>,
#[serde(rename = "AllowedOAuthScopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_scopes: Option<Vec<String>>,
#[serde(rename = "AnalyticsConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_configuration: Option<AnalyticsConfigurationType>,
#[serde(rename = "CallbackURLs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub callback_ur_ls: Option<Vec<String>>,
#[serde(rename = "ClientId")]
pub client_id: String,
#[serde(rename = "ClientName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_name: Option<String>,
#[serde(rename = "DefaultRedirectURI")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_redirect_uri: Option<String>,
#[serde(rename = "ExplicitAuthFlows")]
#[serde(skip_serializing_if = "Option::is_none")]
pub explicit_auth_flows: Option<Vec<String>>,
#[serde(rename = "LogoutURLs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logout_ur_ls: Option<Vec<String>>,
#[serde(rename = "ReadAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub read_attributes: Option<Vec<String>>,
#[serde(rename = "RefreshTokenValidity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_token_validity: Option<i64>,
#[serde(rename = "SupportedIdentityProviders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_identity_providers: Option<Vec<String>>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "WriteAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub write_attributes: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateUserPoolClientResponse {
#[serde(rename = "UserPoolClient")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_client: Option<UserPoolClientType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateUserPoolDomainRequest {
#[serde(rename = "CustomDomainConfig")]
pub custom_domain_config: CustomDomainConfigType,
#[serde(rename = "Domain")]
pub domain: String,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateUserPoolDomainResponse {
#[serde(rename = "CloudFrontDomain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_front_domain: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateUserPoolRequest {
#[serde(rename = "AdminCreateUserConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub admin_create_user_config: Option<AdminCreateUserConfigType>,
#[serde(rename = "AutoVerifiedAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_verified_attributes: Option<Vec<String>>,
#[serde(rename = "DeviceConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_configuration: Option<DeviceConfigurationType>,
#[serde(rename = "EmailConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_configuration: Option<EmailConfigurationType>,
#[serde(rename = "EmailVerificationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_verification_message: Option<String>,
#[serde(rename = "EmailVerificationSubject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_verification_subject: Option<String>,
#[serde(rename = "LambdaConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_config: Option<LambdaConfigType>,
#[serde(rename = "MfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_configuration: Option<String>,
#[serde(rename = "Policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<UserPoolPolicyType>,
#[serde(rename = "SmsAuthenticationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_authentication_message: Option<String>,
#[serde(rename = "SmsConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_configuration: Option<SmsConfigurationType>,
#[serde(rename = "SmsVerificationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_verification_message: Option<String>,
#[serde(rename = "UserPoolAddOns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_add_ons: Option<UserPoolAddOnsType>,
#[serde(rename = "UserPoolId")]
pub user_pool_id: String,
#[serde(rename = "UserPoolTags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "VerificationMessageTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_message_template: Option<VerificationMessageTemplateType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateUserPoolResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UserContextDataType {
#[serde(rename = "EncodedData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encoded_data: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserImportJobType {
#[serde(rename = "CloudWatchLogsRoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_watch_logs_role_arn: Option<String>,
#[serde(rename = "CompletionDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub completion_date: Option<f64>,
#[serde(rename = "CompletionMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub completion_message: Option<String>,
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "FailedUsers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failed_users: Option<i64>,
#[serde(rename = "ImportedUsers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub imported_users: Option<i64>,
#[serde(rename = "JobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
#[serde(rename = "JobName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_name: Option<String>,
#[serde(rename = "PreSignedUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pre_signed_url: Option<String>,
#[serde(rename = "SkippedUsers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub skipped_users: Option<i64>,
#[serde(rename = "StartDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_date: Option<f64>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UserPoolAddOnsType {
#[serde(rename = "AdvancedSecurityMode")]
pub advanced_security_mode: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserPoolClientDescription {
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "ClientName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_name: Option<String>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserPoolClientType {
#[serde(rename = "AllowedOAuthFlows")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_flows: Option<Vec<String>>,
#[serde(rename = "AllowedOAuthFlowsUserPoolClient")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_flows_user_pool_client: Option<bool>,
#[serde(rename = "AllowedOAuthScopes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_o_auth_scopes: Option<Vec<String>>,
#[serde(rename = "AnalyticsConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub analytics_configuration: Option<AnalyticsConfigurationType>,
#[serde(rename = "CallbackURLs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub callback_ur_ls: Option<Vec<String>>,
#[serde(rename = "ClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "ClientName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_name: Option<String>,
#[serde(rename = "ClientSecret")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_secret: Option<String>,
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "DefaultRedirectURI")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_redirect_uri: Option<String>,
#[serde(rename = "ExplicitAuthFlows")]
#[serde(skip_serializing_if = "Option::is_none")]
pub explicit_auth_flows: Option<Vec<String>>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "LogoutURLs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logout_ur_ls: Option<Vec<String>>,
#[serde(rename = "ReadAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub read_attributes: Option<Vec<String>>,
#[serde(rename = "RefreshTokenValidity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_token_validity: Option<i64>,
#[serde(rename = "SupportedIdentityProviders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_identity_providers: Option<Vec<String>>,
#[serde(rename = "UserPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_id: Option<String>,
#[serde(rename = "WriteAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub write_attributes: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserPoolDescriptionType {
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "Id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "LambdaConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_config: Option<LambdaConfigType>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UserPoolPolicyType {
#[serde(rename = "PasswordPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub password_policy: Option<PasswordPolicyType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserPoolType {
#[serde(rename = "AdminCreateUserConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub admin_create_user_config: Option<AdminCreateUserConfigType>,
#[serde(rename = "AliasAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alias_attributes: Option<Vec<String>>,
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "AutoVerifiedAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_verified_attributes: Option<Vec<String>>,
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "CustomDomain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_domain: Option<String>,
#[serde(rename = "DeviceConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_configuration: Option<DeviceConfigurationType>,
#[serde(rename = "Domain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub domain: Option<String>,
#[serde(rename = "EmailConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_configuration: Option<EmailConfigurationType>,
#[serde(rename = "EmailConfigurationFailure")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_configuration_failure: Option<String>,
#[serde(rename = "EmailVerificationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_verification_message: Option<String>,
#[serde(rename = "EmailVerificationSubject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_verification_subject: Option<String>,
#[serde(rename = "EstimatedNumberOfUsers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub estimated_number_of_users: Option<i64>,
#[serde(rename = "Id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "LambdaConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_config: Option<LambdaConfigType>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "MfaConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_configuration: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<UserPoolPolicyType>,
#[serde(rename = "SchemaAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema_attributes: Option<Vec<SchemaAttributeType>>,
#[serde(rename = "SmsAuthenticationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_authentication_message: Option<String>,
#[serde(rename = "SmsConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_configuration: Option<SmsConfigurationType>,
#[serde(rename = "SmsConfigurationFailure")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_configuration_failure: Option<String>,
#[serde(rename = "SmsVerificationMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_verification_message: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "UserPoolAddOns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_add_ons: Option<UserPoolAddOnsType>,
#[serde(rename = "UserPoolTags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_pool_tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "UsernameAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub username_attributes: Option<Vec<String>>,
#[serde(rename = "VerificationMessageTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_message_template: Option<VerificationMessageTemplateType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserType {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<AttributeType>>,
#[serde(rename = "Enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "MFAOptions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mfa_options: Option<Vec<MFAOptionType>>,
#[serde(rename = "UserCreateDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_create_date: Option<f64>,
#[serde(rename = "UserLastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_last_modified_date: Option<f64>,
#[serde(rename = "UserStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_status: Option<String>,
#[serde(rename = "Username")]
#[serde(skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VerificationMessageTemplateType {
#[serde(rename = "DefaultEmailOption")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_email_option: Option<String>,
#[serde(rename = "EmailMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_message: Option<String>,
#[serde(rename = "EmailMessageByLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_message_by_link: Option<String>,
#[serde(rename = "EmailSubject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_subject: Option<String>,
#[serde(rename = "EmailSubjectByLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_subject_by_link: Option<String>,
#[serde(rename = "SmsMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sms_message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct VerifySoftwareTokenRequest {
#[serde(rename = "AccessToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_token: Option<String>,
#[serde(rename = "FriendlyDeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub friendly_device_name: Option<String>,
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
#[serde(rename = "UserCode")]
pub user_code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VerifySoftwareTokenResponse {
#[serde(rename = "Session")]
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct VerifyUserAttributeRequest {
#[serde(rename = "AccessToken")]
pub access_token: String,
#[serde(rename = "AttributeName")]
pub attribute_name: String,
#[serde(rename = "Code")]
pub code: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VerifyUserAttributeResponse {}
#[derive(Debug, PartialEq)]
pub enum AddCustomAttributesError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserImportInProgress(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AddCustomAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> AddCustomAttributesError {
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 {
"InternalErrorException" => {
return AddCustomAttributesError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AddCustomAttributesError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return AddCustomAttributesError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AddCustomAttributesError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AddCustomAttributesError::TooManyRequests(String::from(error_message));
}
"UserImportInProgressException" => {
return AddCustomAttributesError::UserImportInProgress(String::from(
error_message,
));
}
"ValidationException" => {
return AddCustomAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return AddCustomAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AddCustomAttributesError {
fn from(err: serde_json::error::Error) -> AddCustomAttributesError {
AddCustomAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AddCustomAttributesError {
fn from(err: CredentialsError) -> AddCustomAttributesError {
AddCustomAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for AddCustomAttributesError {
fn from(err: HttpDispatchError) -> AddCustomAttributesError {
AddCustomAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for AddCustomAttributesError {
fn from(err: io::Error) -> AddCustomAttributesError {
AddCustomAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AddCustomAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AddCustomAttributesError {
fn description(&self) -> &str {
match *self {
AddCustomAttributesError::InternalError(ref cause) => cause,
AddCustomAttributesError::InvalidParameter(ref cause) => cause,
AddCustomAttributesError::NotAuthorized(ref cause) => cause,
AddCustomAttributesError::ResourceNotFound(ref cause) => cause,
AddCustomAttributesError::TooManyRequests(ref cause) => cause,
AddCustomAttributesError::UserImportInProgress(ref cause) => cause,
AddCustomAttributesError::Validation(ref cause) => cause,
AddCustomAttributesError::Credentials(ref err) => err.description(),
AddCustomAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AddCustomAttributesError::ParseError(ref cause) => cause,
AddCustomAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminAddUserToGroupError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminAddUserToGroupError {
pub fn from_response(res: BufferedHttpResponse) -> AdminAddUserToGroupError {
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 {
"InternalErrorException" => {
return AdminAddUserToGroupError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminAddUserToGroupError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminAddUserToGroupError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminAddUserToGroupError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminAddUserToGroupError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminAddUserToGroupError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminAddUserToGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminAddUserToGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminAddUserToGroupError {
fn from(err: serde_json::error::Error) -> AdminAddUserToGroupError {
AdminAddUserToGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminAddUserToGroupError {
fn from(err: CredentialsError) -> AdminAddUserToGroupError {
AdminAddUserToGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminAddUserToGroupError {
fn from(err: HttpDispatchError) -> AdminAddUserToGroupError {
AdminAddUserToGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminAddUserToGroupError {
fn from(err: io::Error) -> AdminAddUserToGroupError {
AdminAddUserToGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminAddUserToGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminAddUserToGroupError {
fn description(&self) -> &str {
match *self {
AdminAddUserToGroupError::InternalError(ref cause) => cause,
AdminAddUserToGroupError::InvalidParameter(ref cause) => cause,
AdminAddUserToGroupError::NotAuthorized(ref cause) => cause,
AdminAddUserToGroupError::ResourceNotFound(ref cause) => cause,
AdminAddUserToGroupError::TooManyRequests(ref cause) => cause,
AdminAddUserToGroupError::UserNotFound(ref cause) => cause,
AdminAddUserToGroupError::Validation(ref cause) => cause,
AdminAddUserToGroupError::Credentials(ref err) => err.description(),
AdminAddUserToGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminAddUserToGroupError::ParseError(ref cause) => cause,
AdminAddUserToGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminConfirmSignUpError {
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyFailedAttempts(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminConfirmSignUpError {
pub fn from_response(res: BufferedHttpResponse) -> AdminConfirmSignUpError {
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 {
"InternalErrorException" => {
return AdminConfirmSignUpError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return AdminConfirmSignUpError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminConfirmSignUpError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return AdminConfirmSignUpError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminConfirmSignUpError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminConfirmSignUpError::ResourceNotFound(String::from(error_message));
}
"TooManyFailedAttemptsException" => {
return AdminConfirmSignUpError::TooManyFailedAttempts(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminConfirmSignUpError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return AdminConfirmSignUpError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return AdminConfirmSignUpError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminConfirmSignUpError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminConfirmSignUpError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminConfirmSignUpError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminConfirmSignUpError {
fn from(err: serde_json::error::Error) -> AdminConfirmSignUpError {
AdminConfirmSignUpError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminConfirmSignUpError {
fn from(err: CredentialsError) -> AdminConfirmSignUpError {
AdminConfirmSignUpError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminConfirmSignUpError {
fn from(err: HttpDispatchError) -> AdminConfirmSignUpError {
AdminConfirmSignUpError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminConfirmSignUpError {
fn from(err: io::Error) -> AdminConfirmSignUpError {
AdminConfirmSignUpError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminConfirmSignUpError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminConfirmSignUpError {
fn description(&self) -> &str {
match *self {
AdminConfirmSignUpError::InternalError(ref cause) => cause,
AdminConfirmSignUpError::InvalidLambdaResponse(ref cause) => cause,
AdminConfirmSignUpError::InvalidParameter(ref cause) => cause,
AdminConfirmSignUpError::LimitExceeded(ref cause) => cause,
AdminConfirmSignUpError::NotAuthorized(ref cause) => cause,
AdminConfirmSignUpError::ResourceNotFound(ref cause) => cause,
AdminConfirmSignUpError::TooManyFailedAttempts(ref cause) => cause,
AdminConfirmSignUpError::TooManyRequests(ref cause) => cause,
AdminConfirmSignUpError::UnexpectedLambda(ref cause) => cause,
AdminConfirmSignUpError::UserLambdaValidation(ref cause) => cause,
AdminConfirmSignUpError::UserNotFound(ref cause) => cause,
AdminConfirmSignUpError::Validation(ref cause) => cause,
AdminConfirmSignUpError::Credentials(ref err) => err.description(),
AdminConfirmSignUpError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminConfirmSignUpError::ParseError(ref cause) => cause,
AdminConfirmSignUpError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminCreateUserError {
CodeDeliveryFailure(String),
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidPassword(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
NotAuthorized(String),
PreconditionNotMet(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UnsupportedUserState(String),
UserLambdaValidation(String),
UserNotFound(String),
UsernameExists(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminCreateUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminCreateUserError {
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 {
"CodeDeliveryFailureException" => {
return AdminCreateUserError::CodeDeliveryFailure(String::from(error_message));
}
"InternalErrorException" => {
return AdminCreateUserError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return AdminCreateUserError::InvalidLambdaResponse(String::from(error_message));
}
"InvalidParameterException" => {
return AdminCreateUserError::InvalidParameter(String::from(error_message));
}
"InvalidPasswordException" => {
return AdminCreateUserError::InvalidPassword(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return AdminCreateUserError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return AdminCreateUserError::InvalidSmsRoleTrustRelationship(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminCreateUserError::NotAuthorized(String::from(error_message));
}
"PreconditionNotMetException" => {
return AdminCreateUserError::PreconditionNotMet(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminCreateUserError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminCreateUserError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return AdminCreateUserError::UnexpectedLambda(String::from(error_message));
}
"UnsupportedUserStateException" => {
return AdminCreateUserError::UnsupportedUserState(String::from(error_message));
}
"UserLambdaValidationException" => {
return AdminCreateUserError::UserLambdaValidation(String::from(error_message));
}
"UserNotFoundException" => {
return AdminCreateUserError::UserNotFound(String::from(error_message));
}
"UsernameExistsException" => {
return AdminCreateUserError::UsernameExists(String::from(error_message));
}
"ValidationException" => {
return AdminCreateUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminCreateUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminCreateUserError {
fn from(err: serde_json::error::Error) -> AdminCreateUserError {
AdminCreateUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminCreateUserError {
fn from(err: CredentialsError) -> AdminCreateUserError {
AdminCreateUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminCreateUserError {
fn from(err: HttpDispatchError) -> AdminCreateUserError {
AdminCreateUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminCreateUserError {
fn from(err: io::Error) -> AdminCreateUserError {
AdminCreateUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminCreateUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminCreateUserError {
fn description(&self) -> &str {
match *self {
AdminCreateUserError::CodeDeliveryFailure(ref cause) => cause,
AdminCreateUserError::InternalError(ref cause) => cause,
AdminCreateUserError::InvalidLambdaResponse(ref cause) => cause,
AdminCreateUserError::InvalidParameter(ref cause) => cause,
AdminCreateUserError::InvalidPassword(ref cause) => cause,
AdminCreateUserError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
AdminCreateUserError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
AdminCreateUserError::NotAuthorized(ref cause) => cause,
AdminCreateUserError::PreconditionNotMet(ref cause) => cause,
AdminCreateUserError::ResourceNotFound(ref cause) => cause,
AdminCreateUserError::TooManyRequests(ref cause) => cause,
AdminCreateUserError::UnexpectedLambda(ref cause) => cause,
AdminCreateUserError::UnsupportedUserState(ref cause) => cause,
AdminCreateUserError::UserLambdaValidation(ref cause) => cause,
AdminCreateUserError::UserNotFound(ref cause) => cause,
AdminCreateUserError::UsernameExists(ref cause) => cause,
AdminCreateUserError::Validation(ref cause) => cause,
AdminCreateUserError::Credentials(ref err) => err.description(),
AdminCreateUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AdminCreateUserError::ParseError(ref cause) => cause,
AdminCreateUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminDeleteUserError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminDeleteUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminDeleteUserError {
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 {
"InternalErrorException" => {
return AdminDeleteUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminDeleteUserError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminDeleteUserError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminDeleteUserError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminDeleteUserError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminDeleteUserError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminDeleteUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminDeleteUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminDeleteUserError {
fn from(err: serde_json::error::Error) -> AdminDeleteUserError {
AdminDeleteUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminDeleteUserError {
fn from(err: CredentialsError) -> AdminDeleteUserError {
AdminDeleteUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminDeleteUserError {
fn from(err: HttpDispatchError) -> AdminDeleteUserError {
AdminDeleteUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminDeleteUserError {
fn from(err: io::Error) -> AdminDeleteUserError {
AdminDeleteUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminDeleteUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminDeleteUserError {
fn description(&self) -> &str {
match *self {
AdminDeleteUserError::InternalError(ref cause) => cause,
AdminDeleteUserError::InvalidParameter(ref cause) => cause,
AdminDeleteUserError::NotAuthorized(ref cause) => cause,
AdminDeleteUserError::ResourceNotFound(ref cause) => cause,
AdminDeleteUserError::TooManyRequests(ref cause) => cause,
AdminDeleteUserError::UserNotFound(ref cause) => cause,
AdminDeleteUserError::Validation(ref cause) => cause,
AdminDeleteUserError::Credentials(ref err) => err.description(),
AdminDeleteUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AdminDeleteUserError::ParseError(ref cause) => cause,
AdminDeleteUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminDeleteUserAttributesError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminDeleteUserAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> AdminDeleteUserAttributesError {
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 {
"InternalErrorException" => {
return AdminDeleteUserAttributesError::InternalError(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminDeleteUserAttributesError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminDeleteUserAttributesError::NotAuthorized(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return AdminDeleteUserAttributesError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminDeleteUserAttributesError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminDeleteUserAttributesError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminDeleteUserAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminDeleteUserAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminDeleteUserAttributesError {
fn from(err: serde_json::error::Error) -> AdminDeleteUserAttributesError {
AdminDeleteUserAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminDeleteUserAttributesError {
fn from(err: CredentialsError) -> AdminDeleteUserAttributesError {
AdminDeleteUserAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminDeleteUserAttributesError {
fn from(err: HttpDispatchError) -> AdminDeleteUserAttributesError {
AdminDeleteUserAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminDeleteUserAttributesError {
fn from(err: io::Error) -> AdminDeleteUserAttributesError {
AdminDeleteUserAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminDeleteUserAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminDeleteUserAttributesError {
fn description(&self) -> &str {
match *self {
AdminDeleteUserAttributesError::InternalError(ref cause) => cause,
AdminDeleteUserAttributesError::InvalidParameter(ref cause) => cause,
AdminDeleteUserAttributesError::NotAuthorized(ref cause) => cause,
AdminDeleteUserAttributesError::ResourceNotFound(ref cause) => cause,
AdminDeleteUserAttributesError::TooManyRequests(ref cause) => cause,
AdminDeleteUserAttributesError::UserNotFound(ref cause) => cause,
AdminDeleteUserAttributesError::Validation(ref cause) => cause,
AdminDeleteUserAttributesError::Credentials(ref err) => err.description(),
AdminDeleteUserAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminDeleteUserAttributesError::ParseError(ref cause) => cause,
AdminDeleteUserAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminDisableProviderForUserError {
AliasExists(String),
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminDisableProviderForUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminDisableProviderForUserError {
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 {
"AliasExistsException" => {
return AdminDisableProviderForUserError::AliasExists(String::from(
error_message,
));
}
"InternalErrorException" => {
return AdminDisableProviderForUserError::InternalError(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminDisableProviderForUserError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminDisableProviderForUserError::NotAuthorized(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return AdminDisableProviderForUserError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminDisableProviderForUserError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminDisableProviderForUserError::UserNotFound(String::from(
error_message,
));
}
"ValidationException" => {
return AdminDisableProviderForUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminDisableProviderForUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminDisableProviderForUserError {
fn from(err: serde_json::error::Error) -> AdminDisableProviderForUserError {
AdminDisableProviderForUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminDisableProviderForUserError {
fn from(err: CredentialsError) -> AdminDisableProviderForUserError {
AdminDisableProviderForUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminDisableProviderForUserError {
fn from(err: HttpDispatchError) -> AdminDisableProviderForUserError {
AdminDisableProviderForUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminDisableProviderForUserError {
fn from(err: io::Error) -> AdminDisableProviderForUserError {
AdminDisableProviderForUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminDisableProviderForUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminDisableProviderForUserError {
fn description(&self) -> &str {
match *self {
AdminDisableProviderForUserError::AliasExists(ref cause) => cause,
AdminDisableProviderForUserError::InternalError(ref cause) => cause,
AdminDisableProviderForUserError::InvalidParameter(ref cause) => cause,
AdminDisableProviderForUserError::NotAuthorized(ref cause) => cause,
AdminDisableProviderForUserError::ResourceNotFound(ref cause) => cause,
AdminDisableProviderForUserError::TooManyRequests(ref cause) => cause,
AdminDisableProviderForUserError::UserNotFound(ref cause) => cause,
AdminDisableProviderForUserError::Validation(ref cause) => cause,
AdminDisableProviderForUserError::Credentials(ref err) => err.description(),
AdminDisableProviderForUserError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminDisableProviderForUserError::ParseError(ref cause) => cause,
AdminDisableProviderForUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminDisableUserError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminDisableUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminDisableUserError {
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 {
"InternalErrorException" => {
return AdminDisableUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminDisableUserError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminDisableUserError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminDisableUserError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminDisableUserError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminDisableUserError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminDisableUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminDisableUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminDisableUserError {
fn from(err: serde_json::error::Error) -> AdminDisableUserError {
AdminDisableUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminDisableUserError {
fn from(err: CredentialsError) -> AdminDisableUserError {
AdminDisableUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminDisableUserError {
fn from(err: HttpDispatchError) -> AdminDisableUserError {
AdminDisableUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminDisableUserError {
fn from(err: io::Error) -> AdminDisableUserError {
AdminDisableUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminDisableUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminDisableUserError {
fn description(&self) -> &str {
match *self {
AdminDisableUserError::InternalError(ref cause) => cause,
AdminDisableUserError::InvalidParameter(ref cause) => cause,
AdminDisableUserError::NotAuthorized(ref cause) => cause,
AdminDisableUserError::ResourceNotFound(ref cause) => cause,
AdminDisableUserError::TooManyRequests(ref cause) => cause,
AdminDisableUserError::UserNotFound(ref cause) => cause,
AdminDisableUserError::Validation(ref cause) => cause,
AdminDisableUserError::Credentials(ref err) => err.description(),
AdminDisableUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AdminDisableUserError::ParseError(ref cause) => cause,
AdminDisableUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminEnableUserError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminEnableUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminEnableUserError {
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 {
"InternalErrorException" => {
return AdminEnableUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminEnableUserError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminEnableUserError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminEnableUserError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminEnableUserError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminEnableUserError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminEnableUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminEnableUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminEnableUserError {
fn from(err: serde_json::error::Error) -> AdminEnableUserError {
AdminEnableUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminEnableUserError {
fn from(err: CredentialsError) -> AdminEnableUserError {
AdminEnableUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminEnableUserError {
fn from(err: HttpDispatchError) -> AdminEnableUserError {
AdminEnableUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminEnableUserError {
fn from(err: io::Error) -> AdminEnableUserError {
AdminEnableUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminEnableUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminEnableUserError {
fn description(&self) -> &str {
match *self {
AdminEnableUserError::InternalError(ref cause) => cause,
AdminEnableUserError::InvalidParameter(ref cause) => cause,
AdminEnableUserError::NotAuthorized(ref cause) => cause,
AdminEnableUserError::ResourceNotFound(ref cause) => cause,
AdminEnableUserError::TooManyRequests(ref cause) => cause,
AdminEnableUserError::UserNotFound(ref cause) => cause,
AdminEnableUserError::Validation(ref cause) => cause,
AdminEnableUserError::Credentials(ref err) => err.description(),
AdminEnableUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AdminEnableUserError::ParseError(ref cause) => cause,
AdminEnableUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminForgetDeviceError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminForgetDeviceError {
pub fn from_response(res: BufferedHttpResponse) -> AdminForgetDeviceError {
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 {
"InternalErrorException" => {
return AdminForgetDeviceError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminForgetDeviceError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return AdminForgetDeviceError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminForgetDeviceError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminForgetDeviceError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminForgetDeviceError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminForgetDeviceError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminForgetDeviceError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminForgetDeviceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminForgetDeviceError {
fn from(err: serde_json::error::Error) -> AdminForgetDeviceError {
AdminForgetDeviceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminForgetDeviceError {
fn from(err: CredentialsError) -> AdminForgetDeviceError {
AdminForgetDeviceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminForgetDeviceError {
fn from(err: HttpDispatchError) -> AdminForgetDeviceError {
AdminForgetDeviceError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminForgetDeviceError {
fn from(err: io::Error) -> AdminForgetDeviceError {
AdminForgetDeviceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminForgetDeviceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminForgetDeviceError {
fn description(&self) -> &str {
match *self {
AdminForgetDeviceError::InternalError(ref cause) => cause,
AdminForgetDeviceError::InvalidParameter(ref cause) => cause,
AdminForgetDeviceError::InvalidUserPoolConfiguration(ref cause) => cause,
AdminForgetDeviceError::NotAuthorized(ref cause) => cause,
AdminForgetDeviceError::ResourceNotFound(ref cause) => cause,
AdminForgetDeviceError::TooManyRequests(ref cause) => cause,
AdminForgetDeviceError::UserNotFound(ref cause) => cause,
AdminForgetDeviceError::Validation(ref cause) => cause,
AdminForgetDeviceError::Credentials(ref err) => err.description(),
AdminForgetDeviceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminForgetDeviceError::ParseError(ref cause) => cause,
AdminForgetDeviceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminGetDeviceError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminGetDeviceError {
pub fn from_response(res: BufferedHttpResponse) -> AdminGetDeviceError {
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 {
"InternalErrorException" => {
return AdminGetDeviceError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminGetDeviceError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return AdminGetDeviceError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminGetDeviceError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminGetDeviceError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminGetDeviceError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return AdminGetDeviceError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminGetDeviceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminGetDeviceError {
fn from(err: serde_json::error::Error) -> AdminGetDeviceError {
AdminGetDeviceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminGetDeviceError {
fn from(err: CredentialsError) -> AdminGetDeviceError {
AdminGetDeviceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminGetDeviceError {
fn from(err: HttpDispatchError) -> AdminGetDeviceError {
AdminGetDeviceError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminGetDeviceError {
fn from(err: io::Error) -> AdminGetDeviceError {
AdminGetDeviceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminGetDeviceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminGetDeviceError {
fn description(&self) -> &str {
match *self {
AdminGetDeviceError::InternalError(ref cause) => cause,
AdminGetDeviceError::InvalidParameter(ref cause) => cause,
AdminGetDeviceError::InvalidUserPoolConfiguration(ref cause) => cause,
AdminGetDeviceError::NotAuthorized(ref cause) => cause,
AdminGetDeviceError::ResourceNotFound(ref cause) => cause,
AdminGetDeviceError::TooManyRequests(ref cause) => cause,
AdminGetDeviceError::Validation(ref cause) => cause,
AdminGetDeviceError::Credentials(ref err) => err.description(),
AdminGetDeviceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AdminGetDeviceError::ParseError(ref cause) => cause,
AdminGetDeviceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminGetUserError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminGetUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminGetUserError {
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 {
"InternalErrorException" => {
return AdminGetUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminGetUserError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminGetUserError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminGetUserError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminGetUserError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminGetUserError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminGetUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminGetUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminGetUserError {
fn from(err: serde_json::error::Error) -> AdminGetUserError {
AdminGetUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminGetUserError {
fn from(err: CredentialsError) -> AdminGetUserError {
AdminGetUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminGetUserError {
fn from(err: HttpDispatchError) -> AdminGetUserError {
AdminGetUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminGetUserError {
fn from(err: io::Error) -> AdminGetUserError {
AdminGetUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminGetUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminGetUserError {
fn description(&self) -> &str {
match *self {
AdminGetUserError::InternalError(ref cause) => cause,
AdminGetUserError::InvalidParameter(ref cause) => cause,
AdminGetUserError::NotAuthorized(ref cause) => cause,
AdminGetUserError::ResourceNotFound(ref cause) => cause,
AdminGetUserError::TooManyRequests(ref cause) => cause,
AdminGetUserError::UserNotFound(ref cause) => cause,
AdminGetUserError::Validation(ref cause) => cause,
AdminGetUserError::Credentials(ref err) => err.description(),
AdminGetUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AdminGetUserError::ParseError(ref cause) => cause,
AdminGetUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminInitiateAuthError {
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
InvalidUserPoolConfiguration(String),
MFAMethodNotFound(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminInitiateAuthError {
pub fn from_response(res: BufferedHttpResponse) -> AdminInitiateAuthError {
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 {
"InternalErrorException" => {
return AdminInitiateAuthError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return AdminInitiateAuthError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminInitiateAuthError::InvalidParameter(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return AdminInitiateAuthError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return AdminInitiateAuthError::InvalidSmsRoleTrustRelationship(String::from(
error_message,
));
}
"InvalidUserPoolConfigurationException" => {
return AdminInitiateAuthError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"MFAMethodNotFoundException" => {
return AdminInitiateAuthError::MFAMethodNotFound(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminInitiateAuthError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return AdminInitiateAuthError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return AdminInitiateAuthError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminInitiateAuthError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return AdminInitiateAuthError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return AdminInitiateAuthError::UserLambdaValidation(String::from(error_message));
}
"UserNotConfirmedException" => {
return AdminInitiateAuthError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return AdminInitiateAuthError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminInitiateAuthError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminInitiateAuthError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminInitiateAuthError {
fn from(err: serde_json::error::Error) -> AdminInitiateAuthError {
AdminInitiateAuthError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminInitiateAuthError {
fn from(err: CredentialsError) -> AdminInitiateAuthError {
AdminInitiateAuthError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminInitiateAuthError {
fn from(err: HttpDispatchError) -> AdminInitiateAuthError {
AdminInitiateAuthError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminInitiateAuthError {
fn from(err: io::Error) -> AdminInitiateAuthError {
AdminInitiateAuthError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminInitiateAuthError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminInitiateAuthError {
fn description(&self) -> &str {
match *self {
AdminInitiateAuthError::InternalError(ref cause) => cause,
AdminInitiateAuthError::InvalidLambdaResponse(ref cause) => cause,
AdminInitiateAuthError::InvalidParameter(ref cause) => cause,
AdminInitiateAuthError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
AdminInitiateAuthError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
AdminInitiateAuthError::InvalidUserPoolConfiguration(ref cause) => cause,
AdminInitiateAuthError::MFAMethodNotFound(ref cause) => cause,
AdminInitiateAuthError::NotAuthorized(ref cause) => cause,
AdminInitiateAuthError::PasswordResetRequired(ref cause) => cause,
AdminInitiateAuthError::ResourceNotFound(ref cause) => cause,
AdminInitiateAuthError::TooManyRequests(ref cause) => cause,
AdminInitiateAuthError::UnexpectedLambda(ref cause) => cause,
AdminInitiateAuthError::UserLambdaValidation(ref cause) => cause,
AdminInitiateAuthError::UserNotConfirmed(ref cause) => cause,
AdminInitiateAuthError::UserNotFound(ref cause) => cause,
AdminInitiateAuthError::Validation(ref cause) => cause,
AdminInitiateAuthError::Credentials(ref err) => err.description(),
AdminInitiateAuthError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminInitiateAuthError::ParseError(ref cause) => cause,
AdminInitiateAuthError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminLinkProviderForUserError {
AliasExists(String),
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminLinkProviderForUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminLinkProviderForUserError {
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 {
"AliasExistsException" => {
return AdminLinkProviderForUserError::AliasExists(String::from(error_message));
}
"InternalErrorException" => {
return AdminLinkProviderForUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminLinkProviderForUserError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminLinkProviderForUserError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminLinkProviderForUserError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminLinkProviderForUserError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminLinkProviderForUserError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminLinkProviderForUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminLinkProviderForUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminLinkProviderForUserError {
fn from(err: serde_json::error::Error) -> AdminLinkProviderForUserError {
AdminLinkProviderForUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminLinkProviderForUserError {
fn from(err: CredentialsError) -> AdminLinkProviderForUserError {
AdminLinkProviderForUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminLinkProviderForUserError {
fn from(err: HttpDispatchError) -> AdminLinkProviderForUserError {
AdminLinkProviderForUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminLinkProviderForUserError {
fn from(err: io::Error) -> AdminLinkProviderForUserError {
AdminLinkProviderForUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminLinkProviderForUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminLinkProviderForUserError {
fn description(&self) -> &str {
match *self {
AdminLinkProviderForUserError::AliasExists(ref cause) => cause,
AdminLinkProviderForUserError::InternalError(ref cause) => cause,
AdminLinkProviderForUserError::InvalidParameter(ref cause) => cause,
AdminLinkProviderForUserError::NotAuthorized(ref cause) => cause,
AdminLinkProviderForUserError::ResourceNotFound(ref cause) => cause,
AdminLinkProviderForUserError::TooManyRequests(ref cause) => cause,
AdminLinkProviderForUserError::UserNotFound(ref cause) => cause,
AdminLinkProviderForUserError::Validation(ref cause) => cause,
AdminLinkProviderForUserError::Credentials(ref err) => err.description(),
AdminLinkProviderForUserError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminLinkProviderForUserError::ParseError(ref cause) => cause,
AdminLinkProviderForUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminListDevicesError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminListDevicesError {
pub fn from_response(res: BufferedHttpResponse) -> AdminListDevicesError {
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 {
"InternalErrorException" => {
return AdminListDevicesError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminListDevicesError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return AdminListDevicesError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminListDevicesError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminListDevicesError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return AdminListDevicesError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return AdminListDevicesError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminListDevicesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminListDevicesError {
fn from(err: serde_json::error::Error) -> AdminListDevicesError {
AdminListDevicesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminListDevicesError {
fn from(err: CredentialsError) -> AdminListDevicesError {
AdminListDevicesError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminListDevicesError {
fn from(err: HttpDispatchError) -> AdminListDevicesError {
AdminListDevicesError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminListDevicesError {
fn from(err: io::Error) -> AdminListDevicesError {
AdminListDevicesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminListDevicesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminListDevicesError {
fn description(&self) -> &str {
match *self {
AdminListDevicesError::InternalError(ref cause) => cause,
AdminListDevicesError::InvalidParameter(ref cause) => cause,
AdminListDevicesError::InvalidUserPoolConfiguration(ref cause) => cause,
AdminListDevicesError::NotAuthorized(ref cause) => cause,
AdminListDevicesError::ResourceNotFound(ref cause) => cause,
AdminListDevicesError::TooManyRequests(ref cause) => cause,
AdminListDevicesError::Validation(ref cause) => cause,
AdminListDevicesError::Credentials(ref err) => err.description(),
AdminListDevicesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AdminListDevicesError::ParseError(ref cause) => cause,
AdminListDevicesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminListGroupsForUserError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminListGroupsForUserError {
pub fn from_response(res: BufferedHttpResponse) -> AdminListGroupsForUserError {
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 {
"InternalErrorException" => {
return AdminListGroupsForUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminListGroupsForUserError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminListGroupsForUserError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminListGroupsForUserError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminListGroupsForUserError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminListGroupsForUserError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminListGroupsForUserError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminListGroupsForUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminListGroupsForUserError {
fn from(err: serde_json::error::Error) -> AdminListGroupsForUserError {
AdminListGroupsForUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminListGroupsForUserError {
fn from(err: CredentialsError) -> AdminListGroupsForUserError {
AdminListGroupsForUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminListGroupsForUserError {
fn from(err: HttpDispatchError) -> AdminListGroupsForUserError {
AdminListGroupsForUserError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminListGroupsForUserError {
fn from(err: io::Error) -> AdminListGroupsForUserError {
AdminListGroupsForUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminListGroupsForUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminListGroupsForUserError {
fn description(&self) -> &str {
match *self {
AdminListGroupsForUserError::InternalError(ref cause) => cause,
AdminListGroupsForUserError::InvalidParameter(ref cause) => cause,
AdminListGroupsForUserError::NotAuthorized(ref cause) => cause,
AdminListGroupsForUserError::ResourceNotFound(ref cause) => cause,
AdminListGroupsForUserError::TooManyRequests(ref cause) => cause,
AdminListGroupsForUserError::UserNotFound(ref cause) => cause,
AdminListGroupsForUserError::Validation(ref cause) => cause,
AdminListGroupsForUserError::Credentials(ref err) => err.description(),
AdminListGroupsForUserError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminListGroupsForUserError::ParseError(ref cause) => cause,
AdminListGroupsForUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminListUserAuthEventsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
UserPoolAddOnNotEnabled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminListUserAuthEventsError {
pub fn from_response(res: BufferedHttpResponse) -> AdminListUserAuthEventsError {
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 {
"InternalErrorException" => {
return AdminListUserAuthEventsError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminListUserAuthEventsError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminListUserAuthEventsError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminListUserAuthEventsError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminListUserAuthEventsError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminListUserAuthEventsError::UserNotFound(String::from(error_message));
}
"UserPoolAddOnNotEnabledException" => {
return AdminListUserAuthEventsError::UserPoolAddOnNotEnabled(String::from(
error_message,
));
}
"ValidationException" => {
return AdminListUserAuthEventsError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminListUserAuthEventsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminListUserAuthEventsError {
fn from(err: serde_json::error::Error) -> AdminListUserAuthEventsError {
AdminListUserAuthEventsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminListUserAuthEventsError {
fn from(err: CredentialsError) -> AdminListUserAuthEventsError {
AdminListUserAuthEventsError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminListUserAuthEventsError {
fn from(err: HttpDispatchError) -> AdminListUserAuthEventsError {
AdminListUserAuthEventsError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminListUserAuthEventsError {
fn from(err: io::Error) -> AdminListUserAuthEventsError {
AdminListUserAuthEventsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminListUserAuthEventsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminListUserAuthEventsError {
fn description(&self) -> &str {
match *self {
AdminListUserAuthEventsError::InternalError(ref cause) => cause,
AdminListUserAuthEventsError::InvalidParameter(ref cause) => cause,
AdminListUserAuthEventsError::NotAuthorized(ref cause) => cause,
AdminListUserAuthEventsError::ResourceNotFound(ref cause) => cause,
AdminListUserAuthEventsError::TooManyRequests(ref cause) => cause,
AdminListUserAuthEventsError::UserNotFound(ref cause) => cause,
AdminListUserAuthEventsError::UserPoolAddOnNotEnabled(ref cause) => cause,
AdminListUserAuthEventsError::Validation(ref cause) => cause,
AdminListUserAuthEventsError::Credentials(ref err) => err.description(),
AdminListUserAuthEventsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminListUserAuthEventsError::ParseError(ref cause) => cause,
AdminListUserAuthEventsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminRemoveUserFromGroupError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminRemoveUserFromGroupError {
pub fn from_response(res: BufferedHttpResponse) -> AdminRemoveUserFromGroupError {
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 {
"InternalErrorException" => {
return AdminRemoveUserFromGroupError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminRemoveUserFromGroupError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminRemoveUserFromGroupError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminRemoveUserFromGroupError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminRemoveUserFromGroupError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminRemoveUserFromGroupError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminRemoveUserFromGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminRemoveUserFromGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminRemoveUserFromGroupError {
fn from(err: serde_json::error::Error) -> AdminRemoveUserFromGroupError {
AdminRemoveUserFromGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminRemoveUserFromGroupError {
fn from(err: CredentialsError) -> AdminRemoveUserFromGroupError {
AdminRemoveUserFromGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminRemoveUserFromGroupError {
fn from(err: HttpDispatchError) -> AdminRemoveUserFromGroupError {
AdminRemoveUserFromGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminRemoveUserFromGroupError {
fn from(err: io::Error) -> AdminRemoveUserFromGroupError {
AdminRemoveUserFromGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminRemoveUserFromGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminRemoveUserFromGroupError {
fn description(&self) -> &str {
match *self {
AdminRemoveUserFromGroupError::InternalError(ref cause) => cause,
AdminRemoveUserFromGroupError::InvalidParameter(ref cause) => cause,
AdminRemoveUserFromGroupError::NotAuthorized(ref cause) => cause,
AdminRemoveUserFromGroupError::ResourceNotFound(ref cause) => cause,
AdminRemoveUserFromGroupError::TooManyRequests(ref cause) => cause,
AdminRemoveUserFromGroupError::UserNotFound(ref cause) => cause,
AdminRemoveUserFromGroupError::Validation(ref cause) => cause,
AdminRemoveUserFromGroupError::Credentials(ref err) => err.description(),
AdminRemoveUserFromGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminRemoveUserFromGroupError::ParseError(ref cause) => cause,
AdminRemoveUserFromGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminResetUserPasswordError {
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminResetUserPasswordError {
pub fn from_response(res: BufferedHttpResponse) -> AdminResetUserPasswordError {
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 {
"InternalErrorException" => {
return AdminResetUserPasswordError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return AdminResetUserPasswordError::InvalidEmailRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidLambdaResponseException" => {
return AdminResetUserPasswordError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminResetUserPasswordError::InvalidParameter(String::from(
error_message,
));
}
"InvalidSmsRoleAccessPolicyException" => {
return AdminResetUserPasswordError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return AdminResetUserPasswordError::InvalidSmsRoleTrustRelationship(
String::from(error_message),
);
}
"LimitExceededException" => {
return AdminResetUserPasswordError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminResetUserPasswordError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminResetUserPasswordError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminResetUserPasswordError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return AdminResetUserPasswordError::UnexpectedLambda(String::from(
error_message,
));
}
"UserLambdaValidationException" => {
return AdminResetUserPasswordError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminResetUserPasswordError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminResetUserPasswordError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminResetUserPasswordError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminResetUserPasswordError {
fn from(err: serde_json::error::Error) -> AdminResetUserPasswordError {
AdminResetUserPasswordError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminResetUserPasswordError {
fn from(err: CredentialsError) -> AdminResetUserPasswordError {
AdminResetUserPasswordError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminResetUserPasswordError {
fn from(err: HttpDispatchError) -> AdminResetUserPasswordError {
AdminResetUserPasswordError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminResetUserPasswordError {
fn from(err: io::Error) -> AdminResetUserPasswordError {
AdminResetUserPasswordError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminResetUserPasswordError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminResetUserPasswordError {
fn description(&self) -> &str {
match *self {
AdminResetUserPasswordError::InternalError(ref cause) => cause,
AdminResetUserPasswordError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
AdminResetUserPasswordError::InvalidLambdaResponse(ref cause) => cause,
AdminResetUserPasswordError::InvalidParameter(ref cause) => cause,
AdminResetUserPasswordError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
AdminResetUserPasswordError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
AdminResetUserPasswordError::LimitExceeded(ref cause) => cause,
AdminResetUserPasswordError::NotAuthorized(ref cause) => cause,
AdminResetUserPasswordError::ResourceNotFound(ref cause) => cause,
AdminResetUserPasswordError::TooManyRequests(ref cause) => cause,
AdminResetUserPasswordError::UnexpectedLambda(ref cause) => cause,
AdminResetUserPasswordError::UserLambdaValidation(ref cause) => cause,
AdminResetUserPasswordError::UserNotFound(ref cause) => cause,
AdminResetUserPasswordError::Validation(ref cause) => cause,
AdminResetUserPasswordError::Credentials(ref err) => err.description(),
AdminResetUserPasswordError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminResetUserPasswordError::ParseError(ref cause) => cause,
AdminResetUserPasswordError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminRespondToAuthChallengeError {
AliasExists(String),
CodeMismatch(String),
ExpiredCode(String),
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidPassword(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
InvalidUserPoolConfiguration(String),
MFAMethodNotFound(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
SoftwareTokenMFANotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminRespondToAuthChallengeError {
pub fn from_response(res: BufferedHttpResponse) -> AdminRespondToAuthChallengeError {
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 {
"AliasExistsException" => {
return AdminRespondToAuthChallengeError::AliasExists(String::from(
error_message,
));
}
"CodeMismatchException" => {
return AdminRespondToAuthChallengeError::CodeMismatch(String::from(
error_message,
));
}
"ExpiredCodeException" => {
return AdminRespondToAuthChallengeError::ExpiredCode(String::from(
error_message,
));
}
"InternalErrorException" => {
return AdminRespondToAuthChallengeError::InternalError(String::from(
error_message,
));
}
"InvalidLambdaResponseException" => {
return AdminRespondToAuthChallengeError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminRespondToAuthChallengeError::InvalidParameter(String::from(
error_message,
));
}
"InvalidPasswordException" => {
return AdminRespondToAuthChallengeError::InvalidPassword(String::from(
error_message,
));
}
"InvalidSmsRoleAccessPolicyException" => {
return AdminRespondToAuthChallengeError::InvalidSmsRoleAccessPolicy(
String::from(error_message),
);
}
"InvalidSmsRoleTrustRelationshipException" => {
return AdminRespondToAuthChallengeError::InvalidSmsRoleTrustRelationship(
String::from(error_message),
);
}
"InvalidUserPoolConfigurationException" => {
return AdminRespondToAuthChallengeError::InvalidUserPoolConfiguration(
String::from(error_message),
);
}
"MFAMethodNotFoundException" => {
return AdminRespondToAuthChallengeError::MFAMethodNotFound(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminRespondToAuthChallengeError::NotAuthorized(String::from(
error_message,
));
}
"PasswordResetRequiredException" => {
return AdminRespondToAuthChallengeError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return AdminRespondToAuthChallengeError::ResourceNotFound(String::from(
error_message,
));
}
"SoftwareTokenMFANotFoundException" => {
return AdminRespondToAuthChallengeError::SoftwareTokenMFANotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminRespondToAuthChallengeError::TooManyRequests(String::from(
error_message,
));
}
"UnexpectedLambdaException" => {
return AdminRespondToAuthChallengeError::UnexpectedLambda(String::from(
error_message,
));
}
"UserLambdaValidationException" => {
return AdminRespondToAuthChallengeError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotConfirmedException" => {
return AdminRespondToAuthChallengeError::UserNotConfirmed(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminRespondToAuthChallengeError::UserNotFound(String::from(
error_message,
));
}
"ValidationException" => {
return AdminRespondToAuthChallengeError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminRespondToAuthChallengeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminRespondToAuthChallengeError {
fn from(err: serde_json::error::Error) -> AdminRespondToAuthChallengeError {
AdminRespondToAuthChallengeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminRespondToAuthChallengeError {
fn from(err: CredentialsError) -> AdminRespondToAuthChallengeError {
AdminRespondToAuthChallengeError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminRespondToAuthChallengeError {
fn from(err: HttpDispatchError) -> AdminRespondToAuthChallengeError {
AdminRespondToAuthChallengeError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminRespondToAuthChallengeError {
fn from(err: io::Error) -> AdminRespondToAuthChallengeError {
AdminRespondToAuthChallengeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminRespondToAuthChallengeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminRespondToAuthChallengeError {
fn description(&self) -> &str {
match *self {
AdminRespondToAuthChallengeError::AliasExists(ref cause) => cause,
AdminRespondToAuthChallengeError::CodeMismatch(ref cause) => cause,
AdminRespondToAuthChallengeError::ExpiredCode(ref cause) => cause,
AdminRespondToAuthChallengeError::InternalError(ref cause) => cause,
AdminRespondToAuthChallengeError::InvalidLambdaResponse(ref cause) => cause,
AdminRespondToAuthChallengeError::InvalidParameter(ref cause) => cause,
AdminRespondToAuthChallengeError::InvalidPassword(ref cause) => cause,
AdminRespondToAuthChallengeError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
AdminRespondToAuthChallengeError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
AdminRespondToAuthChallengeError::InvalidUserPoolConfiguration(ref cause) => cause,
AdminRespondToAuthChallengeError::MFAMethodNotFound(ref cause) => cause,
AdminRespondToAuthChallengeError::NotAuthorized(ref cause) => cause,
AdminRespondToAuthChallengeError::PasswordResetRequired(ref cause) => cause,
AdminRespondToAuthChallengeError::ResourceNotFound(ref cause) => cause,
AdminRespondToAuthChallengeError::SoftwareTokenMFANotFound(ref cause) => cause,
AdminRespondToAuthChallengeError::TooManyRequests(ref cause) => cause,
AdminRespondToAuthChallengeError::UnexpectedLambda(ref cause) => cause,
AdminRespondToAuthChallengeError::UserLambdaValidation(ref cause) => cause,
AdminRespondToAuthChallengeError::UserNotConfirmed(ref cause) => cause,
AdminRespondToAuthChallengeError::UserNotFound(ref cause) => cause,
AdminRespondToAuthChallengeError::Validation(ref cause) => cause,
AdminRespondToAuthChallengeError::Credentials(ref err) => err.description(),
AdminRespondToAuthChallengeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminRespondToAuthChallengeError::ParseError(ref cause) => cause,
AdminRespondToAuthChallengeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminSetUserMFAPreferenceError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminSetUserMFAPreferenceError {
pub fn from_response(res: BufferedHttpResponse) -> AdminSetUserMFAPreferenceError {
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 {
"InternalErrorException" => {
return AdminSetUserMFAPreferenceError::InternalError(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminSetUserMFAPreferenceError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminSetUserMFAPreferenceError::NotAuthorized(String::from(
error_message,
));
}
"PasswordResetRequiredException" => {
return AdminSetUserMFAPreferenceError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return AdminSetUserMFAPreferenceError::ResourceNotFound(String::from(
error_message,
));
}
"UserNotConfirmedException" => {
return AdminSetUserMFAPreferenceError::UserNotConfirmed(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminSetUserMFAPreferenceError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminSetUserMFAPreferenceError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminSetUserMFAPreferenceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminSetUserMFAPreferenceError {
fn from(err: serde_json::error::Error) -> AdminSetUserMFAPreferenceError {
AdminSetUserMFAPreferenceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminSetUserMFAPreferenceError {
fn from(err: CredentialsError) -> AdminSetUserMFAPreferenceError {
AdminSetUserMFAPreferenceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminSetUserMFAPreferenceError {
fn from(err: HttpDispatchError) -> AdminSetUserMFAPreferenceError {
AdminSetUserMFAPreferenceError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminSetUserMFAPreferenceError {
fn from(err: io::Error) -> AdminSetUserMFAPreferenceError {
AdminSetUserMFAPreferenceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminSetUserMFAPreferenceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminSetUserMFAPreferenceError {
fn description(&self) -> &str {
match *self {
AdminSetUserMFAPreferenceError::InternalError(ref cause) => cause,
AdminSetUserMFAPreferenceError::InvalidParameter(ref cause) => cause,
AdminSetUserMFAPreferenceError::NotAuthorized(ref cause) => cause,
AdminSetUserMFAPreferenceError::PasswordResetRequired(ref cause) => cause,
AdminSetUserMFAPreferenceError::ResourceNotFound(ref cause) => cause,
AdminSetUserMFAPreferenceError::UserNotConfirmed(ref cause) => cause,
AdminSetUserMFAPreferenceError::UserNotFound(ref cause) => cause,
AdminSetUserMFAPreferenceError::Validation(ref cause) => cause,
AdminSetUserMFAPreferenceError::Credentials(ref err) => err.description(),
AdminSetUserMFAPreferenceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminSetUserMFAPreferenceError::ParseError(ref cause) => cause,
AdminSetUserMFAPreferenceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminSetUserSettingsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminSetUserSettingsError {
pub fn from_response(res: BufferedHttpResponse) -> AdminSetUserSettingsError {
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 {
"InternalErrorException" => {
return AdminSetUserSettingsError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminSetUserSettingsError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return AdminSetUserSettingsError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminSetUserSettingsError::ResourceNotFound(String::from(error_message));
}
"UserNotFoundException" => {
return AdminSetUserSettingsError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminSetUserSettingsError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminSetUserSettingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminSetUserSettingsError {
fn from(err: serde_json::error::Error) -> AdminSetUserSettingsError {
AdminSetUserSettingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminSetUserSettingsError {
fn from(err: CredentialsError) -> AdminSetUserSettingsError {
AdminSetUserSettingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminSetUserSettingsError {
fn from(err: HttpDispatchError) -> AdminSetUserSettingsError {
AdminSetUserSettingsError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminSetUserSettingsError {
fn from(err: io::Error) -> AdminSetUserSettingsError {
AdminSetUserSettingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminSetUserSettingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminSetUserSettingsError {
fn description(&self) -> &str {
match *self {
AdminSetUserSettingsError::InternalError(ref cause) => cause,
AdminSetUserSettingsError::InvalidParameter(ref cause) => cause,
AdminSetUserSettingsError::NotAuthorized(ref cause) => cause,
AdminSetUserSettingsError::ResourceNotFound(ref cause) => cause,
AdminSetUserSettingsError::UserNotFound(ref cause) => cause,
AdminSetUserSettingsError::Validation(ref cause) => cause,
AdminSetUserSettingsError::Credentials(ref err) => err.description(),
AdminSetUserSettingsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminSetUserSettingsError::ParseError(ref cause) => cause,
AdminSetUserSettingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminUpdateAuthEventFeedbackError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
UserPoolAddOnNotEnabled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminUpdateAuthEventFeedbackError {
pub fn from_response(res: BufferedHttpResponse) -> AdminUpdateAuthEventFeedbackError {
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 {
"InternalErrorException" => {
return AdminUpdateAuthEventFeedbackError::InternalError(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminUpdateAuthEventFeedbackError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminUpdateAuthEventFeedbackError::NotAuthorized(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return AdminUpdateAuthEventFeedbackError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminUpdateAuthEventFeedbackError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminUpdateAuthEventFeedbackError::UserNotFound(String::from(
error_message,
));
}
"UserPoolAddOnNotEnabledException" => {
return AdminUpdateAuthEventFeedbackError::UserPoolAddOnNotEnabled(String::from(
error_message,
));
}
"ValidationException" => {
return AdminUpdateAuthEventFeedbackError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminUpdateAuthEventFeedbackError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminUpdateAuthEventFeedbackError {
fn from(err: serde_json::error::Error) -> AdminUpdateAuthEventFeedbackError {
AdminUpdateAuthEventFeedbackError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminUpdateAuthEventFeedbackError {
fn from(err: CredentialsError) -> AdminUpdateAuthEventFeedbackError {
AdminUpdateAuthEventFeedbackError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminUpdateAuthEventFeedbackError {
fn from(err: HttpDispatchError) -> AdminUpdateAuthEventFeedbackError {
AdminUpdateAuthEventFeedbackError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminUpdateAuthEventFeedbackError {
fn from(err: io::Error) -> AdminUpdateAuthEventFeedbackError {
AdminUpdateAuthEventFeedbackError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminUpdateAuthEventFeedbackError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminUpdateAuthEventFeedbackError {
fn description(&self) -> &str {
match *self {
AdminUpdateAuthEventFeedbackError::InternalError(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::InvalidParameter(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::NotAuthorized(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::ResourceNotFound(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::TooManyRequests(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::UserNotFound(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::UserPoolAddOnNotEnabled(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::Validation(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::Credentials(ref err) => err.description(),
AdminUpdateAuthEventFeedbackError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminUpdateAuthEventFeedbackError::ParseError(ref cause) => cause,
AdminUpdateAuthEventFeedbackError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminUpdateDeviceStatusError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminUpdateDeviceStatusError {
pub fn from_response(res: BufferedHttpResponse) -> AdminUpdateDeviceStatusError {
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 {
"InternalErrorException" => {
return AdminUpdateDeviceStatusError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminUpdateDeviceStatusError::InvalidParameter(String::from(
error_message,
));
}
"InvalidUserPoolConfigurationException" => {
return AdminUpdateDeviceStatusError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminUpdateDeviceStatusError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminUpdateDeviceStatusError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminUpdateDeviceStatusError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminUpdateDeviceStatusError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminUpdateDeviceStatusError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminUpdateDeviceStatusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminUpdateDeviceStatusError {
fn from(err: serde_json::error::Error) -> AdminUpdateDeviceStatusError {
AdminUpdateDeviceStatusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminUpdateDeviceStatusError {
fn from(err: CredentialsError) -> AdminUpdateDeviceStatusError {
AdminUpdateDeviceStatusError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminUpdateDeviceStatusError {
fn from(err: HttpDispatchError) -> AdminUpdateDeviceStatusError {
AdminUpdateDeviceStatusError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminUpdateDeviceStatusError {
fn from(err: io::Error) -> AdminUpdateDeviceStatusError {
AdminUpdateDeviceStatusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminUpdateDeviceStatusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminUpdateDeviceStatusError {
fn description(&self) -> &str {
match *self {
AdminUpdateDeviceStatusError::InternalError(ref cause) => cause,
AdminUpdateDeviceStatusError::InvalidParameter(ref cause) => cause,
AdminUpdateDeviceStatusError::InvalidUserPoolConfiguration(ref cause) => cause,
AdminUpdateDeviceStatusError::NotAuthorized(ref cause) => cause,
AdminUpdateDeviceStatusError::ResourceNotFound(ref cause) => cause,
AdminUpdateDeviceStatusError::TooManyRequests(ref cause) => cause,
AdminUpdateDeviceStatusError::UserNotFound(ref cause) => cause,
AdminUpdateDeviceStatusError::Validation(ref cause) => cause,
AdminUpdateDeviceStatusError::Credentials(ref err) => err.description(),
AdminUpdateDeviceStatusError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminUpdateDeviceStatusError::ParseError(ref cause) => cause,
AdminUpdateDeviceStatusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminUpdateUserAttributesError {
AliasExists(String),
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminUpdateUserAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> AdminUpdateUserAttributesError {
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 {
"AliasExistsException" => {
return AdminUpdateUserAttributesError::AliasExists(String::from(error_message));
}
"InternalErrorException" => {
return AdminUpdateUserAttributesError::InternalError(String::from(
error_message,
));
}
"InvalidLambdaResponseException" => {
return AdminUpdateUserAttributesError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return AdminUpdateUserAttributesError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminUpdateUserAttributesError::NotAuthorized(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return AdminUpdateUserAttributesError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminUpdateUserAttributesError::TooManyRequests(String::from(
error_message,
));
}
"UnexpectedLambdaException" => {
return AdminUpdateUserAttributesError::UnexpectedLambda(String::from(
error_message,
));
}
"UserLambdaValidationException" => {
return AdminUpdateUserAttributesError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotFoundException" => {
return AdminUpdateUserAttributesError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminUpdateUserAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminUpdateUserAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminUpdateUserAttributesError {
fn from(err: serde_json::error::Error) -> AdminUpdateUserAttributesError {
AdminUpdateUserAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminUpdateUserAttributesError {
fn from(err: CredentialsError) -> AdminUpdateUserAttributesError {
AdminUpdateUserAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminUpdateUserAttributesError {
fn from(err: HttpDispatchError) -> AdminUpdateUserAttributesError {
AdminUpdateUserAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminUpdateUserAttributesError {
fn from(err: io::Error) -> AdminUpdateUserAttributesError {
AdminUpdateUserAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminUpdateUserAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminUpdateUserAttributesError {
fn description(&self) -> &str {
match *self {
AdminUpdateUserAttributesError::AliasExists(ref cause) => cause,
AdminUpdateUserAttributesError::InternalError(ref cause) => cause,
AdminUpdateUserAttributesError::InvalidLambdaResponse(ref cause) => cause,
AdminUpdateUserAttributesError::InvalidParameter(ref cause) => cause,
AdminUpdateUserAttributesError::NotAuthorized(ref cause) => cause,
AdminUpdateUserAttributesError::ResourceNotFound(ref cause) => cause,
AdminUpdateUserAttributesError::TooManyRequests(ref cause) => cause,
AdminUpdateUserAttributesError::UnexpectedLambda(ref cause) => cause,
AdminUpdateUserAttributesError::UserLambdaValidation(ref cause) => cause,
AdminUpdateUserAttributesError::UserNotFound(ref cause) => cause,
AdminUpdateUserAttributesError::Validation(ref cause) => cause,
AdminUpdateUserAttributesError::Credentials(ref err) => err.description(),
AdminUpdateUserAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminUpdateUserAttributesError::ParseError(ref cause) => cause,
AdminUpdateUserAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AdminUserGlobalSignOutError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AdminUserGlobalSignOutError {
pub fn from_response(res: BufferedHttpResponse) -> AdminUserGlobalSignOutError {
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 {
"InternalErrorException" => {
return AdminUserGlobalSignOutError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AdminUserGlobalSignOutError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AdminUserGlobalSignOutError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AdminUserGlobalSignOutError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return AdminUserGlobalSignOutError::TooManyRequests(String::from(error_message));
}
"UserNotFoundException" => {
return AdminUserGlobalSignOutError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return AdminUserGlobalSignOutError::Validation(error_message.to_string());
}
_ => {}
}
}
return AdminUserGlobalSignOutError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AdminUserGlobalSignOutError {
fn from(err: serde_json::error::Error) -> AdminUserGlobalSignOutError {
AdminUserGlobalSignOutError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AdminUserGlobalSignOutError {
fn from(err: CredentialsError) -> AdminUserGlobalSignOutError {
AdminUserGlobalSignOutError::Credentials(err)
}
}
impl From<HttpDispatchError> for AdminUserGlobalSignOutError {
fn from(err: HttpDispatchError) -> AdminUserGlobalSignOutError {
AdminUserGlobalSignOutError::HttpDispatch(err)
}
}
impl From<io::Error> for AdminUserGlobalSignOutError {
fn from(err: io::Error) -> AdminUserGlobalSignOutError {
AdminUserGlobalSignOutError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AdminUserGlobalSignOutError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AdminUserGlobalSignOutError {
fn description(&self) -> &str {
match *self {
AdminUserGlobalSignOutError::InternalError(ref cause) => cause,
AdminUserGlobalSignOutError::InvalidParameter(ref cause) => cause,
AdminUserGlobalSignOutError::NotAuthorized(ref cause) => cause,
AdminUserGlobalSignOutError::ResourceNotFound(ref cause) => cause,
AdminUserGlobalSignOutError::TooManyRequests(ref cause) => cause,
AdminUserGlobalSignOutError::UserNotFound(ref cause) => cause,
AdminUserGlobalSignOutError::Validation(ref cause) => cause,
AdminUserGlobalSignOutError::Credentials(ref err) => err.description(),
AdminUserGlobalSignOutError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AdminUserGlobalSignOutError::ParseError(ref cause) => cause,
AdminUserGlobalSignOutError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateSoftwareTokenError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
SoftwareTokenMFANotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateSoftwareTokenError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateSoftwareTokenError {
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 {
"InternalErrorException" => {
return AssociateSoftwareTokenError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return AssociateSoftwareTokenError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return AssociateSoftwareTokenError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return AssociateSoftwareTokenError::ResourceNotFound(String::from(
error_message,
));
}
"SoftwareTokenMFANotFoundException" => {
return AssociateSoftwareTokenError::SoftwareTokenMFANotFound(String::from(
error_message,
));
}
"ValidationException" => {
return AssociateSoftwareTokenError::Validation(error_message.to_string());
}
_ => {}
}
}
return AssociateSoftwareTokenError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateSoftwareTokenError {
fn from(err: serde_json::error::Error) -> AssociateSoftwareTokenError {
AssociateSoftwareTokenError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateSoftwareTokenError {
fn from(err: CredentialsError) -> AssociateSoftwareTokenError {
AssociateSoftwareTokenError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateSoftwareTokenError {
fn from(err: HttpDispatchError) -> AssociateSoftwareTokenError {
AssociateSoftwareTokenError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateSoftwareTokenError {
fn from(err: io::Error) -> AssociateSoftwareTokenError {
AssociateSoftwareTokenError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateSoftwareTokenError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateSoftwareTokenError {
fn description(&self) -> &str {
match *self {
AssociateSoftwareTokenError::InternalError(ref cause) => cause,
AssociateSoftwareTokenError::InvalidParameter(ref cause) => cause,
AssociateSoftwareTokenError::NotAuthorized(ref cause) => cause,
AssociateSoftwareTokenError::ResourceNotFound(ref cause) => cause,
AssociateSoftwareTokenError::SoftwareTokenMFANotFound(ref cause) => cause,
AssociateSoftwareTokenError::Validation(ref cause) => cause,
AssociateSoftwareTokenError::Credentials(ref err) => err.description(),
AssociateSoftwareTokenError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateSoftwareTokenError::ParseError(ref cause) => cause,
AssociateSoftwareTokenError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ChangePasswordError {
InternalError(String),
InvalidParameter(String),
InvalidPassword(String),
LimitExceeded(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ChangePasswordError {
pub fn from_response(res: BufferedHttpResponse) -> ChangePasswordError {
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 {
"InternalErrorException" => {
return ChangePasswordError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ChangePasswordError::InvalidParameter(String::from(error_message));
}
"InvalidPasswordException" => {
return ChangePasswordError::InvalidPassword(String::from(error_message));
}
"LimitExceededException" => {
return ChangePasswordError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return ChangePasswordError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return ChangePasswordError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return ChangePasswordError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ChangePasswordError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return ChangePasswordError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return ChangePasswordError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return ChangePasswordError::Validation(error_message.to_string());
}
_ => {}
}
}
return ChangePasswordError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ChangePasswordError {
fn from(err: serde_json::error::Error) -> ChangePasswordError {
ChangePasswordError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ChangePasswordError {
fn from(err: CredentialsError) -> ChangePasswordError {
ChangePasswordError::Credentials(err)
}
}
impl From<HttpDispatchError> for ChangePasswordError {
fn from(err: HttpDispatchError) -> ChangePasswordError {
ChangePasswordError::HttpDispatch(err)
}
}
impl From<io::Error> for ChangePasswordError {
fn from(err: io::Error) -> ChangePasswordError {
ChangePasswordError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ChangePasswordError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ChangePasswordError {
fn description(&self) -> &str {
match *self {
ChangePasswordError::InternalError(ref cause) => cause,
ChangePasswordError::InvalidParameter(ref cause) => cause,
ChangePasswordError::InvalidPassword(ref cause) => cause,
ChangePasswordError::LimitExceeded(ref cause) => cause,
ChangePasswordError::NotAuthorized(ref cause) => cause,
ChangePasswordError::PasswordResetRequired(ref cause) => cause,
ChangePasswordError::ResourceNotFound(ref cause) => cause,
ChangePasswordError::TooManyRequests(ref cause) => cause,
ChangePasswordError::UserNotConfirmed(ref cause) => cause,
ChangePasswordError::UserNotFound(ref cause) => cause,
ChangePasswordError::Validation(ref cause) => cause,
ChangePasswordError::Credentials(ref err) => err.description(),
ChangePasswordError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ChangePasswordError::ParseError(ref cause) => cause,
ChangePasswordError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmDeviceError {
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidPassword(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
UsernameExists(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConfirmDeviceError {
pub fn from_response(res: BufferedHttpResponse) -> ConfirmDeviceError {
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 {
"InternalErrorException" => {
return ConfirmDeviceError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return ConfirmDeviceError::InvalidLambdaResponse(String::from(error_message));
}
"InvalidParameterException" => {
return ConfirmDeviceError::InvalidParameter(String::from(error_message));
}
"InvalidPasswordException" => {
return ConfirmDeviceError::InvalidPassword(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return ConfirmDeviceError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return ConfirmDeviceError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return ConfirmDeviceError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return ConfirmDeviceError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ConfirmDeviceError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return ConfirmDeviceError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return ConfirmDeviceError::UserNotFound(String::from(error_message));
}
"UsernameExistsException" => {
return ConfirmDeviceError::UsernameExists(String::from(error_message));
}
"ValidationException" => {
return ConfirmDeviceError::Validation(error_message.to_string());
}
_ => {}
}
}
return ConfirmDeviceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ConfirmDeviceError {
fn from(err: serde_json::error::Error) -> ConfirmDeviceError {
ConfirmDeviceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ConfirmDeviceError {
fn from(err: CredentialsError) -> ConfirmDeviceError {
ConfirmDeviceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConfirmDeviceError {
fn from(err: HttpDispatchError) -> ConfirmDeviceError {
ConfirmDeviceError::HttpDispatch(err)
}
}
impl From<io::Error> for ConfirmDeviceError {
fn from(err: io::Error) -> ConfirmDeviceError {
ConfirmDeviceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConfirmDeviceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConfirmDeviceError {
fn description(&self) -> &str {
match *self {
ConfirmDeviceError::InternalError(ref cause) => cause,
ConfirmDeviceError::InvalidLambdaResponse(ref cause) => cause,
ConfirmDeviceError::InvalidParameter(ref cause) => cause,
ConfirmDeviceError::InvalidPassword(ref cause) => cause,
ConfirmDeviceError::InvalidUserPoolConfiguration(ref cause) => cause,
ConfirmDeviceError::NotAuthorized(ref cause) => cause,
ConfirmDeviceError::PasswordResetRequired(ref cause) => cause,
ConfirmDeviceError::ResourceNotFound(ref cause) => cause,
ConfirmDeviceError::TooManyRequests(ref cause) => cause,
ConfirmDeviceError::UserNotConfirmed(ref cause) => cause,
ConfirmDeviceError::UserNotFound(ref cause) => cause,
ConfirmDeviceError::UsernameExists(ref cause) => cause,
ConfirmDeviceError::Validation(ref cause) => cause,
ConfirmDeviceError::Credentials(ref err) => err.description(),
ConfirmDeviceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ConfirmDeviceError::ParseError(ref cause) => cause,
ConfirmDeviceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmForgotPasswordError {
CodeMismatch(String),
ExpiredCode(String),
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidPassword(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyFailedAttempts(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConfirmForgotPasswordError {
pub fn from_response(res: BufferedHttpResponse) -> ConfirmForgotPasswordError {
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 {
"CodeMismatchException" => {
return ConfirmForgotPasswordError::CodeMismatch(String::from(error_message));
}
"ExpiredCodeException" => {
return ConfirmForgotPasswordError::ExpiredCode(String::from(error_message));
}
"InternalErrorException" => {
return ConfirmForgotPasswordError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return ConfirmForgotPasswordError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return ConfirmForgotPasswordError::InvalidParameter(String::from(error_message));
}
"InvalidPasswordException" => {
return ConfirmForgotPasswordError::InvalidPassword(String::from(error_message));
}
"LimitExceededException" => {
return ConfirmForgotPasswordError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return ConfirmForgotPasswordError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ConfirmForgotPasswordError::ResourceNotFound(String::from(error_message));
}
"TooManyFailedAttemptsException" => {
return ConfirmForgotPasswordError::TooManyFailedAttempts(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return ConfirmForgotPasswordError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return ConfirmForgotPasswordError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return ConfirmForgotPasswordError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotConfirmedException" => {
return ConfirmForgotPasswordError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return ConfirmForgotPasswordError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return ConfirmForgotPasswordError::Validation(error_message.to_string());
}
_ => {}
}
}
return ConfirmForgotPasswordError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ConfirmForgotPasswordError {
fn from(err: serde_json::error::Error) -> ConfirmForgotPasswordError {
ConfirmForgotPasswordError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ConfirmForgotPasswordError {
fn from(err: CredentialsError) -> ConfirmForgotPasswordError {
ConfirmForgotPasswordError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConfirmForgotPasswordError {
fn from(err: HttpDispatchError) -> ConfirmForgotPasswordError {
ConfirmForgotPasswordError::HttpDispatch(err)
}
}
impl From<io::Error> for ConfirmForgotPasswordError {
fn from(err: io::Error) -> ConfirmForgotPasswordError {
ConfirmForgotPasswordError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConfirmForgotPasswordError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConfirmForgotPasswordError {
fn description(&self) -> &str {
match *self {
ConfirmForgotPasswordError::CodeMismatch(ref cause) => cause,
ConfirmForgotPasswordError::ExpiredCode(ref cause) => cause,
ConfirmForgotPasswordError::InternalError(ref cause) => cause,
ConfirmForgotPasswordError::InvalidLambdaResponse(ref cause) => cause,
ConfirmForgotPasswordError::InvalidParameter(ref cause) => cause,
ConfirmForgotPasswordError::InvalidPassword(ref cause) => cause,
ConfirmForgotPasswordError::LimitExceeded(ref cause) => cause,
ConfirmForgotPasswordError::NotAuthorized(ref cause) => cause,
ConfirmForgotPasswordError::ResourceNotFound(ref cause) => cause,
ConfirmForgotPasswordError::TooManyFailedAttempts(ref cause) => cause,
ConfirmForgotPasswordError::TooManyRequests(ref cause) => cause,
ConfirmForgotPasswordError::UnexpectedLambda(ref cause) => cause,
ConfirmForgotPasswordError::UserLambdaValidation(ref cause) => cause,
ConfirmForgotPasswordError::UserNotConfirmed(ref cause) => cause,
ConfirmForgotPasswordError::UserNotFound(ref cause) => cause,
ConfirmForgotPasswordError::Validation(ref cause) => cause,
ConfirmForgotPasswordError::Credentials(ref err) => err.description(),
ConfirmForgotPasswordError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ConfirmForgotPasswordError::ParseError(ref cause) => cause,
ConfirmForgotPasswordError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmSignUpError {
AliasExists(String),
CodeMismatch(String),
ExpiredCode(String),
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyFailedAttempts(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConfirmSignUpError {
pub fn from_response(res: BufferedHttpResponse) -> ConfirmSignUpError {
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 {
"AliasExistsException" => {
return ConfirmSignUpError::AliasExists(String::from(error_message));
}
"CodeMismatchException" => {
return ConfirmSignUpError::CodeMismatch(String::from(error_message));
}
"ExpiredCodeException" => {
return ConfirmSignUpError::ExpiredCode(String::from(error_message));
}
"InternalErrorException" => {
return ConfirmSignUpError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return ConfirmSignUpError::InvalidLambdaResponse(String::from(error_message));
}
"InvalidParameterException" => {
return ConfirmSignUpError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return ConfirmSignUpError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return ConfirmSignUpError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ConfirmSignUpError::ResourceNotFound(String::from(error_message));
}
"TooManyFailedAttemptsException" => {
return ConfirmSignUpError::TooManyFailedAttempts(String::from(error_message));
}
"TooManyRequestsException" => {
return ConfirmSignUpError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return ConfirmSignUpError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return ConfirmSignUpError::UserLambdaValidation(String::from(error_message));
}
"UserNotFoundException" => {
return ConfirmSignUpError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return ConfirmSignUpError::Validation(error_message.to_string());
}
_ => {}
}
}
return ConfirmSignUpError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ConfirmSignUpError {
fn from(err: serde_json::error::Error) -> ConfirmSignUpError {
ConfirmSignUpError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ConfirmSignUpError {
fn from(err: CredentialsError) -> ConfirmSignUpError {
ConfirmSignUpError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConfirmSignUpError {
fn from(err: HttpDispatchError) -> ConfirmSignUpError {
ConfirmSignUpError::HttpDispatch(err)
}
}
impl From<io::Error> for ConfirmSignUpError {
fn from(err: io::Error) -> ConfirmSignUpError {
ConfirmSignUpError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConfirmSignUpError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConfirmSignUpError {
fn description(&self) -> &str {
match *self {
ConfirmSignUpError::AliasExists(ref cause) => cause,
ConfirmSignUpError::CodeMismatch(ref cause) => cause,
ConfirmSignUpError::ExpiredCode(ref cause) => cause,
ConfirmSignUpError::InternalError(ref cause) => cause,
ConfirmSignUpError::InvalidLambdaResponse(ref cause) => cause,
ConfirmSignUpError::InvalidParameter(ref cause) => cause,
ConfirmSignUpError::LimitExceeded(ref cause) => cause,
ConfirmSignUpError::NotAuthorized(ref cause) => cause,
ConfirmSignUpError::ResourceNotFound(ref cause) => cause,
ConfirmSignUpError::TooManyFailedAttempts(ref cause) => cause,
ConfirmSignUpError::TooManyRequests(ref cause) => cause,
ConfirmSignUpError::UnexpectedLambda(ref cause) => cause,
ConfirmSignUpError::UserLambdaValidation(ref cause) => cause,
ConfirmSignUpError::UserNotFound(ref cause) => cause,
ConfirmSignUpError::Validation(ref cause) => cause,
ConfirmSignUpError::Credentials(ref err) => err.description(),
ConfirmSignUpError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ConfirmSignUpError::ParseError(ref cause) => cause,
ConfirmSignUpError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateGroupError {
GroupExists(String),
InternalError(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateGroupError {
pub fn from_response(res: BufferedHttpResponse) -> CreateGroupError {
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 {
"GroupExistsException" => {
return CreateGroupError::GroupExists(String::from(error_message));
}
"InternalErrorException" => {
return CreateGroupError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return CreateGroupError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return CreateGroupError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return CreateGroupError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateGroupError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateGroupError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateGroupError {
fn from(err: serde_json::error::Error) -> CreateGroupError {
CreateGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateGroupError {
fn from(err: CredentialsError) -> CreateGroupError {
CreateGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateGroupError {
fn from(err: HttpDispatchError) -> CreateGroupError {
CreateGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateGroupError {
fn from(err: io::Error) -> CreateGroupError {
CreateGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateGroupError {
fn description(&self) -> &str {
match *self {
CreateGroupError::GroupExists(ref cause) => cause,
CreateGroupError::InternalError(ref cause) => cause,
CreateGroupError::InvalidParameter(ref cause) => cause,
CreateGroupError::LimitExceeded(ref cause) => cause,
CreateGroupError::NotAuthorized(ref cause) => cause,
CreateGroupError::ResourceNotFound(ref cause) => cause,
CreateGroupError::TooManyRequests(ref cause) => cause,
CreateGroupError::Validation(ref cause) => cause,
CreateGroupError::Credentials(ref err) => err.description(),
CreateGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateGroupError::ParseError(ref cause) => cause,
CreateGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateIdentityProviderError {
DuplicateProvider(String),
InternalError(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateIdentityProviderError {
pub fn from_response(res: BufferedHttpResponse) -> CreateIdentityProviderError {
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 {
"DuplicateProviderException" => {
return CreateIdentityProviderError::DuplicateProvider(String::from(
error_message,
));
}
"InternalErrorException" => {
return CreateIdentityProviderError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return CreateIdentityProviderError::InvalidParameter(String::from(
error_message,
));
}
"LimitExceededException" => {
return CreateIdentityProviderError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return CreateIdentityProviderError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateIdentityProviderError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return CreateIdentityProviderError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateIdentityProviderError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateIdentityProviderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateIdentityProviderError {
fn from(err: serde_json::error::Error) -> CreateIdentityProviderError {
CreateIdentityProviderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateIdentityProviderError {
fn from(err: CredentialsError) -> CreateIdentityProviderError {
CreateIdentityProviderError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateIdentityProviderError {
fn from(err: HttpDispatchError) -> CreateIdentityProviderError {
CreateIdentityProviderError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateIdentityProviderError {
fn from(err: io::Error) -> CreateIdentityProviderError {
CreateIdentityProviderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateIdentityProviderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateIdentityProviderError {
fn description(&self) -> &str {
match *self {
CreateIdentityProviderError::DuplicateProvider(ref cause) => cause,
CreateIdentityProviderError::InternalError(ref cause) => cause,
CreateIdentityProviderError::InvalidParameter(ref cause) => cause,
CreateIdentityProviderError::LimitExceeded(ref cause) => cause,
CreateIdentityProviderError::NotAuthorized(ref cause) => cause,
CreateIdentityProviderError::ResourceNotFound(ref cause) => cause,
CreateIdentityProviderError::TooManyRequests(ref cause) => cause,
CreateIdentityProviderError::Validation(ref cause) => cause,
CreateIdentityProviderError::Credentials(ref err) => err.description(),
CreateIdentityProviderError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateIdentityProviderError::ParseError(ref cause) => cause,
CreateIdentityProviderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateResourceServerError {
InternalError(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateResourceServerError {
pub fn from_response(res: BufferedHttpResponse) -> CreateResourceServerError {
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 {
"InternalErrorException" => {
return CreateResourceServerError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return CreateResourceServerError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return CreateResourceServerError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return CreateResourceServerError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateResourceServerError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateResourceServerError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateResourceServerError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateResourceServerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateResourceServerError {
fn from(err: serde_json::error::Error) -> CreateResourceServerError {
CreateResourceServerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateResourceServerError {
fn from(err: CredentialsError) -> CreateResourceServerError {
CreateResourceServerError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateResourceServerError {
fn from(err: HttpDispatchError) -> CreateResourceServerError {
CreateResourceServerError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateResourceServerError {
fn from(err: io::Error) -> CreateResourceServerError {
CreateResourceServerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateResourceServerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateResourceServerError {
fn description(&self) -> &str {
match *self {
CreateResourceServerError::InternalError(ref cause) => cause,
CreateResourceServerError::InvalidParameter(ref cause) => cause,
CreateResourceServerError::LimitExceeded(ref cause) => cause,
CreateResourceServerError::NotAuthorized(ref cause) => cause,
CreateResourceServerError::ResourceNotFound(ref cause) => cause,
CreateResourceServerError::TooManyRequests(ref cause) => cause,
CreateResourceServerError::Validation(ref cause) => cause,
CreateResourceServerError::Credentials(ref err) => err.description(),
CreateResourceServerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateResourceServerError::ParseError(ref cause) => cause,
CreateResourceServerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateUserImportJobError {
InternalError(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
PreconditionNotMet(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUserImportJobError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUserImportJobError {
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 {
"InternalErrorException" => {
return CreateUserImportJobError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return CreateUserImportJobError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return CreateUserImportJobError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return CreateUserImportJobError::NotAuthorized(String::from(error_message));
}
"PreconditionNotMetException" => {
return CreateUserImportJobError::PreconditionNotMet(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateUserImportJobError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateUserImportJobError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateUserImportJobError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateUserImportJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUserImportJobError {
fn from(err: serde_json::error::Error) -> CreateUserImportJobError {
CreateUserImportJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUserImportJobError {
fn from(err: CredentialsError) -> CreateUserImportJobError {
CreateUserImportJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUserImportJobError {
fn from(err: HttpDispatchError) -> CreateUserImportJobError {
CreateUserImportJobError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUserImportJobError {
fn from(err: io::Error) -> CreateUserImportJobError {
CreateUserImportJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUserImportJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUserImportJobError {
fn description(&self) -> &str {
match *self {
CreateUserImportJobError::InternalError(ref cause) => cause,
CreateUserImportJobError::InvalidParameter(ref cause) => cause,
CreateUserImportJobError::LimitExceeded(ref cause) => cause,
CreateUserImportJobError::NotAuthorized(ref cause) => cause,
CreateUserImportJobError::PreconditionNotMet(ref cause) => cause,
CreateUserImportJobError::ResourceNotFound(ref cause) => cause,
CreateUserImportJobError::TooManyRequests(ref cause) => cause,
CreateUserImportJobError::Validation(ref cause) => cause,
CreateUserImportJobError::Credentials(ref err) => err.description(),
CreateUserImportJobError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateUserImportJobError::ParseError(ref cause) => cause,
CreateUserImportJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateUserPoolError {
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
LimitExceeded(String),
NotAuthorized(String),
TooManyRequests(String),
UserPoolTagging(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUserPoolError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUserPoolError {
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 {
"InternalErrorException" => {
return CreateUserPoolError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return CreateUserPoolError::InvalidEmailRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidParameterException" => {
return CreateUserPoolError::InvalidParameter(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return CreateUserPoolError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return CreateUserPoolError::InvalidSmsRoleTrustRelationship(String::from(
error_message,
));
}
"LimitExceededException" => {
return CreateUserPoolError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return CreateUserPoolError::NotAuthorized(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateUserPoolError::TooManyRequests(String::from(error_message));
}
"UserPoolTaggingException" => {
return CreateUserPoolError::UserPoolTagging(String::from(error_message));
}
"ValidationException" => {
return CreateUserPoolError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateUserPoolError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUserPoolError {
fn from(err: serde_json::error::Error) -> CreateUserPoolError {
CreateUserPoolError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUserPoolError {
fn from(err: CredentialsError) -> CreateUserPoolError {
CreateUserPoolError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUserPoolError {
fn from(err: HttpDispatchError) -> CreateUserPoolError {
CreateUserPoolError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUserPoolError {
fn from(err: io::Error) -> CreateUserPoolError {
CreateUserPoolError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUserPoolError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUserPoolError {
fn description(&self) -> &str {
match *self {
CreateUserPoolError::InternalError(ref cause) => cause,
CreateUserPoolError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
CreateUserPoolError::InvalidParameter(ref cause) => cause,
CreateUserPoolError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
CreateUserPoolError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
CreateUserPoolError::LimitExceeded(ref cause) => cause,
CreateUserPoolError::NotAuthorized(ref cause) => cause,
CreateUserPoolError::TooManyRequests(ref cause) => cause,
CreateUserPoolError::UserPoolTagging(ref cause) => cause,
CreateUserPoolError::Validation(ref cause) => cause,
CreateUserPoolError::Credentials(ref err) => err.description(),
CreateUserPoolError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateUserPoolError::ParseError(ref cause) => cause,
CreateUserPoolError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateUserPoolClientError {
InternalError(String),
InvalidOAuthFlow(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
ScopeDoesNotExist(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUserPoolClientError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUserPoolClientError {
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 {
"InternalErrorException" => {
return CreateUserPoolClientError::InternalError(String::from(error_message));
}
"InvalidOAuthFlowException" => {
return CreateUserPoolClientError::InvalidOAuthFlow(String::from(error_message));
}
"InvalidParameterException" => {
return CreateUserPoolClientError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return CreateUserPoolClientError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return CreateUserPoolClientError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateUserPoolClientError::ResourceNotFound(String::from(error_message));
}
"ScopeDoesNotExistException" => {
return CreateUserPoolClientError::ScopeDoesNotExist(String::from(error_message));
}
"TooManyRequestsException" => {
return CreateUserPoolClientError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return CreateUserPoolClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateUserPoolClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUserPoolClientError {
fn from(err: serde_json::error::Error) -> CreateUserPoolClientError {
CreateUserPoolClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUserPoolClientError {
fn from(err: CredentialsError) -> CreateUserPoolClientError {
CreateUserPoolClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUserPoolClientError {
fn from(err: HttpDispatchError) -> CreateUserPoolClientError {
CreateUserPoolClientError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUserPoolClientError {
fn from(err: io::Error) -> CreateUserPoolClientError {
CreateUserPoolClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUserPoolClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUserPoolClientError {
fn description(&self) -> &str {
match *self {
CreateUserPoolClientError::InternalError(ref cause) => cause,
CreateUserPoolClientError::InvalidOAuthFlow(ref cause) => cause,
CreateUserPoolClientError::InvalidParameter(ref cause) => cause,
CreateUserPoolClientError::LimitExceeded(ref cause) => cause,
CreateUserPoolClientError::NotAuthorized(ref cause) => cause,
CreateUserPoolClientError::ResourceNotFound(ref cause) => cause,
CreateUserPoolClientError::ScopeDoesNotExist(ref cause) => cause,
CreateUserPoolClientError::TooManyRequests(ref cause) => cause,
CreateUserPoolClientError::Validation(ref cause) => cause,
CreateUserPoolClientError::Credentials(ref err) => err.description(),
CreateUserPoolClientError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateUserPoolClientError::ParseError(ref cause) => cause,
CreateUserPoolClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateUserPoolDomainError {
InternalError(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUserPoolDomainError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUserPoolDomainError {
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 {
"InternalErrorException" => {
return CreateUserPoolDomainError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return CreateUserPoolDomainError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return CreateUserPoolDomainError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return CreateUserPoolDomainError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateUserPoolDomainError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return CreateUserPoolDomainError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateUserPoolDomainError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUserPoolDomainError {
fn from(err: serde_json::error::Error) -> CreateUserPoolDomainError {
CreateUserPoolDomainError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUserPoolDomainError {
fn from(err: CredentialsError) -> CreateUserPoolDomainError {
CreateUserPoolDomainError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUserPoolDomainError {
fn from(err: HttpDispatchError) -> CreateUserPoolDomainError {
CreateUserPoolDomainError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUserPoolDomainError {
fn from(err: io::Error) -> CreateUserPoolDomainError {
CreateUserPoolDomainError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUserPoolDomainError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUserPoolDomainError {
fn description(&self) -> &str {
match *self {
CreateUserPoolDomainError::InternalError(ref cause) => cause,
CreateUserPoolDomainError::InvalidParameter(ref cause) => cause,
CreateUserPoolDomainError::LimitExceeded(ref cause) => cause,
CreateUserPoolDomainError::NotAuthorized(ref cause) => cause,
CreateUserPoolDomainError::ResourceNotFound(ref cause) => cause,
CreateUserPoolDomainError::Validation(ref cause) => cause,
CreateUserPoolDomainError::Credentials(ref err) => err.description(),
CreateUserPoolDomainError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateUserPoolDomainError::ParseError(ref cause) => cause,
CreateUserPoolDomainError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteGroupError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteGroupError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteGroupError {
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 {
"InternalErrorException" => {
return DeleteGroupError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteGroupError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DeleteGroupError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteGroupError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteGroupError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteGroupError {
fn from(err: serde_json::error::Error) -> DeleteGroupError {
DeleteGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteGroupError {
fn from(err: CredentialsError) -> DeleteGroupError {
DeleteGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteGroupError {
fn from(err: HttpDispatchError) -> DeleteGroupError {
DeleteGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteGroupError {
fn from(err: io::Error) -> DeleteGroupError {
DeleteGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteGroupError {
fn description(&self) -> &str {
match *self {
DeleteGroupError::InternalError(ref cause) => cause,
DeleteGroupError::InvalidParameter(ref cause) => cause,
DeleteGroupError::NotAuthorized(ref cause) => cause,
DeleteGroupError::ResourceNotFound(ref cause) => cause,
DeleteGroupError::TooManyRequests(ref cause) => cause,
DeleteGroupError::Validation(ref cause) => cause,
DeleteGroupError::Credentials(ref err) => err.description(),
DeleteGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteGroupError::ParseError(ref cause) => cause,
DeleteGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteIdentityProviderError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UnsupportedIdentityProvider(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteIdentityProviderError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteIdentityProviderError {
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 {
"InternalErrorException" => {
return DeleteIdentityProviderError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteIdentityProviderError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return DeleteIdentityProviderError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteIdentityProviderError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return DeleteIdentityProviderError::TooManyRequests(String::from(error_message));
}
"UnsupportedIdentityProviderException" => {
return DeleteIdentityProviderError::UnsupportedIdentityProvider(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteIdentityProviderError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteIdentityProviderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteIdentityProviderError {
fn from(err: serde_json::error::Error) -> DeleteIdentityProviderError {
DeleteIdentityProviderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteIdentityProviderError {
fn from(err: CredentialsError) -> DeleteIdentityProviderError {
DeleteIdentityProviderError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteIdentityProviderError {
fn from(err: HttpDispatchError) -> DeleteIdentityProviderError {
DeleteIdentityProviderError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteIdentityProviderError {
fn from(err: io::Error) -> DeleteIdentityProviderError {
DeleteIdentityProviderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteIdentityProviderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteIdentityProviderError {
fn description(&self) -> &str {
match *self {
DeleteIdentityProviderError::InternalError(ref cause) => cause,
DeleteIdentityProviderError::InvalidParameter(ref cause) => cause,
DeleteIdentityProviderError::NotAuthorized(ref cause) => cause,
DeleteIdentityProviderError::ResourceNotFound(ref cause) => cause,
DeleteIdentityProviderError::TooManyRequests(ref cause) => cause,
DeleteIdentityProviderError::UnsupportedIdentityProvider(ref cause) => cause,
DeleteIdentityProviderError::Validation(ref cause) => cause,
DeleteIdentityProviderError::Credentials(ref err) => err.description(),
DeleteIdentityProviderError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteIdentityProviderError::ParseError(ref cause) => cause,
DeleteIdentityProviderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteResourceServerError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteResourceServerError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteResourceServerError {
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 {
"InternalErrorException" => {
return DeleteResourceServerError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteResourceServerError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DeleteResourceServerError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteResourceServerError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteResourceServerError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteResourceServerError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteResourceServerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteResourceServerError {
fn from(err: serde_json::error::Error) -> DeleteResourceServerError {
DeleteResourceServerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteResourceServerError {
fn from(err: CredentialsError) -> DeleteResourceServerError {
DeleteResourceServerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteResourceServerError {
fn from(err: HttpDispatchError) -> DeleteResourceServerError {
DeleteResourceServerError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteResourceServerError {
fn from(err: io::Error) -> DeleteResourceServerError {
DeleteResourceServerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteResourceServerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteResourceServerError {
fn description(&self) -> &str {
match *self {
DeleteResourceServerError::InternalError(ref cause) => cause,
DeleteResourceServerError::InvalidParameter(ref cause) => cause,
DeleteResourceServerError::NotAuthorized(ref cause) => cause,
DeleteResourceServerError::ResourceNotFound(ref cause) => cause,
DeleteResourceServerError::TooManyRequests(ref cause) => cause,
DeleteResourceServerError::Validation(ref cause) => cause,
DeleteResourceServerError::Credentials(ref err) => err.description(),
DeleteResourceServerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteResourceServerError::ParseError(ref cause) => cause,
DeleteResourceServerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUserError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(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 {
"InternalErrorException" => {
return DeleteUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteUserError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DeleteUserError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return DeleteUserError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteUserError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteUserError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return DeleteUserError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return DeleteUserError::UserNotFound(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::InternalError(ref cause) => cause,
DeleteUserError::InvalidParameter(ref cause) => cause,
DeleteUserError::NotAuthorized(ref cause) => cause,
DeleteUserError::PasswordResetRequired(ref cause) => cause,
DeleteUserError::ResourceNotFound(ref cause) => cause,
DeleteUserError::TooManyRequests(ref cause) => cause,
DeleteUserError::UserNotConfirmed(ref cause) => cause,
DeleteUserError::UserNotFound(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 DeleteUserAttributesError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUserAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUserAttributesError {
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 {
"InternalErrorException" => {
return DeleteUserAttributesError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteUserAttributesError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DeleteUserAttributesError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return DeleteUserAttributesError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return DeleteUserAttributesError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteUserAttributesError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return DeleteUserAttributesError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return DeleteUserAttributesError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return DeleteUserAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUserAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUserAttributesError {
fn from(err: serde_json::error::Error) -> DeleteUserAttributesError {
DeleteUserAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUserAttributesError {
fn from(err: CredentialsError) -> DeleteUserAttributesError {
DeleteUserAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUserAttributesError {
fn from(err: HttpDispatchError) -> DeleteUserAttributesError {
DeleteUserAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUserAttributesError {
fn from(err: io::Error) -> DeleteUserAttributesError {
DeleteUserAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUserAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUserAttributesError {
fn description(&self) -> &str {
match *self {
DeleteUserAttributesError::InternalError(ref cause) => cause,
DeleteUserAttributesError::InvalidParameter(ref cause) => cause,
DeleteUserAttributesError::NotAuthorized(ref cause) => cause,
DeleteUserAttributesError::PasswordResetRequired(ref cause) => cause,
DeleteUserAttributesError::ResourceNotFound(ref cause) => cause,
DeleteUserAttributesError::TooManyRequests(ref cause) => cause,
DeleteUserAttributesError::UserNotConfirmed(ref cause) => cause,
DeleteUserAttributesError::UserNotFound(ref cause) => cause,
DeleteUserAttributesError::Validation(ref cause) => cause,
DeleteUserAttributesError::Credentials(ref err) => err.description(),
DeleteUserAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteUserAttributesError::ParseError(ref cause) => cause,
DeleteUserAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUserPoolError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserImportInProgress(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUserPoolError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUserPoolError {
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 {
"InternalErrorException" => {
return DeleteUserPoolError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteUserPoolError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DeleteUserPoolError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteUserPoolError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteUserPoolError::TooManyRequests(String::from(error_message));
}
"UserImportInProgressException" => {
return DeleteUserPoolError::UserImportInProgress(String::from(error_message));
}
"ValidationException" => {
return DeleteUserPoolError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUserPoolError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUserPoolError {
fn from(err: serde_json::error::Error) -> DeleteUserPoolError {
DeleteUserPoolError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUserPoolError {
fn from(err: CredentialsError) -> DeleteUserPoolError {
DeleteUserPoolError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUserPoolError {
fn from(err: HttpDispatchError) -> DeleteUserPoolError {
DeleteUserPoolError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUserPoolError {
fn from(err: io::Error) -> DeleteUserPoolError {
DeleteUserPoolError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUserPoolError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUserPoolError {
fn description(&self) -> &str {
match *self {
DeleteUserPoolError::InternalError(ref cause) => cause,
DeleteUserPoolError::InvalidParameter(ref cause) => cause,
DeleteUserPoolError::NotAuthorized(ref cause) => cause,
DeleteUserPoolError::ResourceNotFound(ref cause) => cause,
DeleteUserPoolError::TooManyRequests(ref cause) => cause,
DeleteUserPoolError::UserImportInProgress(ref cause) => cause,
DeleteUserPoolError::Validation(ref cause) => cause,
DeleteUserPoolError::Credentials(ref err) => err.description(),
DeleteUserPoolError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteUserPoolError::ParseError(ref cause) => cause,
DeleteUserPoolError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUserPoolClientError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUserPoolClientError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUserPoolClientError {
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 {
"InternalErrorException" => {
return DeleteUserPoolClientError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteUserPoolClientError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DeleteUserPoolClientError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteUserPoolClientError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DeleteUserPoolClientError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DeleteUserPoolClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUserPoolClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUserPoolClientError {
fn from(err: serde_json::error::Error) -> DeleteUserPoolClientError {
DeleteUserPoolClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUserPoolClientError {
fn from(err: CredentialsError) -> DeleteUserPoolClientError {
DeleteUserPoolClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUserPoolClientError {
fn from(err: HttpDispatchError) -> DeleteUserPoolClientError {
DeleteUserPoolClientError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUserPoolClientError {
fn from(err: io::Error) -> DeleteUserPoolClientError {
DeleteUserPoolClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUserPoolClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUserPoolClientError {
fn description(&self) -> &str {
match *self {
DeleteUserPoolClientError::InternalError(ref cause) => cause,
DeleteUserPoolClientError::InvalidParameter(ref cause) => cause,
DeleteUserPoolClientError::NotAuthorized(ref cause) => cause,
DeleteUserPoolClientError::ResourceNotFound(ref cause) => cause,
DeleteUserPoolClientError::TooManyRequests(ref cause) => cause,
DeleteUserPoolClientError::Validation(ref cause) => cause,
DeleteUserPoolClientError::Credentials(ref err) => err.description(),
DeleteUserPoolClientError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteUserPoolClientError::ParseError(ref cause) => cause,
DeleteUserPoolClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteUserPoolDomainError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUserPoolDomainError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUserPoolDomainError {
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 {
"InternalErrorException" => {
return DeleteUserPoolDomainError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DeleteUserPoolDomainError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DeleteUserPoolDomainError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteUserPoolDomainError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return DeleteUserPoolDomainError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUserPoolDomainError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUserPoolDomainError {
fn from(err: serde_json::error::Error) -> DeleteUserPoolDomainError {
DeleteUserPoolDomainError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUserPoolDomainError {
fn from(err: CredentialsError) -> DeleteUserPoolDomainError {
DeleteUserPoolDomainError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUserPoolDomainError {
fn from(err: HttpDispatchError) -> DeleteUserPoolDomainError {
DeleteUserPoolDomainError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUserPoolDomainError {
fn from(err: io::Error) -> DeleteUserPoolDomainError {
DeleteUserPoolDomainError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUserPoolDomainError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUserPoolDomainError {
fn description(&self) -> &str {
match *self {
DeleteUserPoolDomainError::InternalError(ref cause) => cause,
DeleteUserPoolDomainError::InvalidParameter(ref cause) => cause,
DeleteUserPoolDomainError::NotAuthorized(ref cause) => cause,
DeleteUserPoolDomainError::ResourceNotFound(ref cause) => cause,
DeleteUserPoolDomainError::Validation(ref cause) => cause,
DeleteUserPoolDomainError::Credentials(ref err) => err.description(),
DeleteUserPoolDomainError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteUserPoolDomainError::ParseError(ref cause) => cause,
DeleteUserPoolDomainError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeIdentityProviderError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeIdentityProviderError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeIdentityProviderError {
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 {
"InternalErrorException" => {
return DescribeIdentityProviderError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeIdentityProviderError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return DescribeIdentityProviderError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeIdentityProviderError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return DescribeIdentityProviderError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeIdentityProviderError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeIdentityProviderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeIdentityProviderError {
fn from(err: serde_json::error::Error) -> DescribeIdentityProviderError {
DescribeIdentityProviderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeIdentityProviderError {
fn from(err: CredentialsError) -> DescribeIdentityProviderError {
DescribeIdentityProviderError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeIdentityProviderError {
fn from(err: HttpDispatchError) -> DescribeIdentityProviderError {
DescribeIdentityProviderError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeIdentityProviderError {
fn from(err: io::Error) -> DescribeIdentityProviderError {
DescribeIdentityProviderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeIdentityProviderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeIdentityProviderError {
fn description(&self) -> &str {
match *self {
DescribeIdentityProviderError::InternalError(ref cause) => cause,
DescribeIdentityProviderError::InvalidParameter(ref cause) => cause,
DescribeIdentityProviderError::NotAuthorized(ref cause) => cause,
DescribeIdentityProviderError::ResourceNotFound(ref cause) => cause,
DescribeIdentityProviderError::TooManyRequests(ref cause) => cause,
DescribeIdentityProviderError::Validation(ref cause) => cause,
DescribeIdentityProviderError::Credentials(ref err) => err.description(),
DescribeIdentityProviderError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeIdentityProviderError::ParseError(ref cause) => cause,
DescribeIdentityProviderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeResourceServerError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeResourceServerError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeResourceServerError {
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 {
"InternalErrorException" => {
return DescribeResourceServerError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeResourceServerError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return DescribeResourceServerError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeResourceServerError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return DescribeResourceServerError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DescribeResourceServerError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeResourceServerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeResourceServerError {
fn from(err: serde_json::error::Error) -> DescribeResourceServerError {
DescribeResourceServerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeResourceServerError {
fn from(err: CredentialsError) -> DescribeResourceServerError {
DescribeResourceServerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeResourceServerError {
fn from(err: HttpDispatchError) -> DescribeResourceServerError {
DescribeResourceServerError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeResourceServerError {
fn from(err: io::Error) -> DescribeResourceServerError {
DescribeResourceServerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeResourceServerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeResourceServerError {
fn description(&self) -> &str {
match *self {
DescribeResourceServerError::InternalError(ref cause) => cause,
DescribeResourceServerError::InvalidParameter(ref cause) => cause,
DescribeResourceServerError::NotAuthorized(ref cause) => cause,
DescribeResourceServerError::ResourceNotFound(ref cause) => cause,
DescribeResourceServerError::TooManyRequests(ref cause) => cause,
DescribeResourceServerError::Validation(ref cause) => cause,
DescribeResourceServerError::Credentials(ref err) => err.description(),
DescribeResourceServerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeResourceServerError::ParseError(ref cause) => cause,
DescribeResourceServerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeRiskConfigurationError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserPoolAddOnNotEnabled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeRiskConfigurationError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeRiskConfigurationError {
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 {
"InternalErrorException" => {
return DescribeRiskConfigurationError::InternalError(String::from(
error_message,
));
}
"InvalidParameterException" => {
return DescribeRiskConfigurationError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return DescribeRiskConfigurationError::NotAuthorized(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return DescribeRiskConfigurationError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return DescribeRiskConfigurationError::TooManyRequests(String::from(
error_message,
));
}
"UserPoolAddOnNotEnabledException" => {
return DescribeRiskConfigurationError::UserPoolAddOnNotEnabled(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeRiskConfigurationError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeRiskConfigurationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeRiskConfigurationError {
fn from(err: serde_json::error::Error) -> DescribeRiskConfigurationError {
DescribeRiskConfigurationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeRiskConfigurationError {
fn from(err: CredentialsError) -> DescribeRiskConfigurationError {
DescribeRiskConfigurationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeRiskConfigurationError {
fn from(err: HttpDispatchError) -> DescribeRiskConfigurationError {
DescribeRiskConfigurationError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeRiskConfigurationError {
fn from(err: io::Error) -> DescribeRiskConfigurationError {
DescribeRiskConfigurationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeRiskConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeRiskConfigurationError {
fn description(&self) -> &str {
match *self {
DescribeRiskConfigurationError::InternalError(ref cause) => cause,
DescribeRiskConfigurationError::InvalidParameter(ref cause) => cause,
DescribeRiskConfigurationError::NotAuthorized(ref cause) => cause,
DescribeRiskConfigurationError::ResourceNotFound(ref cause) => cause,
DescribeRiskConfigurationError::TooManyRequests(ref cause) => cause,
DescribeRiskConfigurationError::UserPoolAddOnNotEnabled(ref cause) => cause,
DescribeRiskConfigurationError::Validation(ref cause) => cause,
DescribeRiskConfigurationError::Credentials(ref err) => err.description(),
DescribeRiskConfigurationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeRiskConfigurationError::ParseError(ref cause) => cause,
DescribeRiskConfigurationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeUserImportJobError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeUserImportJobError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeUserImportJobError {
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 {
"InternalErrorException" => {
return DescribeUserImportJobError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeUserImportJobError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DescribeUserImportJobError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeUserImportJobError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DescribeUserImportJobError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DescribeUserImportJobError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeUserImportJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeUserImportJobError {
fn from(err: serde_json::error::Error) -> DescribeUserImportJobError {
DescribeUserImportJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeUserImportJobError {
fn from(err: CredentialsError) -> DescribeUserImportJobError {
DescribeUserImportJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeUserImportJobError {
fn from(err: HttpDispatchError) -> DescribeUserImportJobError {
DescribeUserImportJobError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeUserImportJobError {
fn from(err: io::Error) -> DescribeUserImportJobError {
DescribeUserImportJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeUserImportJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeUserImportJobError {
fn description(&self) -> &str {
match *self {
DescribeUserImportJobError::InternalError(ref cause) => cause,
DescribeUserImportJobError::InvalidParameter(ref cause) => cause,
DescribeUserImportJobError::NotAuthorized(ref cause) => cause,
DescribeUserImportJobError::ResourceNotFound(ref cause) => cause,
DescribeUserImportJobError::TooManyRequests(ref cause) => cause,
DescribeUserImportJobError::Validation(ref cause) => cause,
DescribeUserImportJobError::Credentials(ref err) => err.description(),
DescribeUserImportJobError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeUserImportJobError::ParseError(ref cause) => cause,
DescribeUserImportJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeUserPoolError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserPoolTagging(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeUserPoolError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeUserPoolError {
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 {
"InternalErrorException" => {
return DescribeUserPoolError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeUserPoolError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return DescribeUserPoolError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeUserPoolError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return DescribeUserPoolError::TooManyRequests(String::from(error_message));
}
"UserPoolTaggingException" => {
return DescribeUserPoolError::UserPoolTagging(String::from(error_message));
}
"ValidationException" => {
return DescribeUserPoolError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeUserPoolError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeUserPoolError {
fn from(err: serde_json::error::Error) -> DescribeUserPoolError {
DescribeUserPoolError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeUserPoolError {
fn from(err: CredentialsError) -> DescribeUserPoolError {
DescribeUserPoolError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeUserPoolError {
fn from(err: HttpDispatchError) -> DescribeUserPoolError {
DescribeUserPoolError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeUserPoolError {
fn from(err: io::Error) -> DescribeUserPoolError {
DescribeUserPoolError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeUserPoolError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeUserPoolError {
fn description(&self) -> &str {
match *self {
DescribeUserPoolError::InternalError(ref cause) => cause,
DescribeUserPoolError::InvalidParameter(ref cause) => cause,
DescribeUserPoolError::NotAuthorized(ref cause) => cause,
DescribeUserPoolError::ResourceNotFound(ref cause) => cause,
DescribeUserPoolError::TooManyRequests(ref cause) => cause,
DescribeUserPoolError::UserPoolTagging(ref cause) => cause,
DescribeUserPoolError::Validation(ref cause) => cause,
DescribeUserPoolError::Credentials(ref err) => err.description(),
DescribeUserPoolError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeUserPoolError::ParseError(ref cause) => cause,
DescribeUserPoolError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeUserPoolClientError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeUserPoolClientError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeUserPoolClientError {
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 {
"InternalErrorException" => {
return DescribeUserPoolClientError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeUserPoolClientError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return DescribeUserPoolClientError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeUserPoolClientError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return DescribeUserPoolClientError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return DescribeUserPoolClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeUserPoolClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeUserPoolClientError {
fn from(err: serde_json::error::Error) -> DescribeUserPoolClientError {
DescribeUserPoolClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeUserPoolClientError {
fn from(err: CredentialsError) -> DescribeUserPoolClientError {
DescribeUserPoolClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeUserPoolClientError {
fn from(err: HttpDispatchError) -> DescribeUserPoolClientError {
DescribeUserPoolClientError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeUserPoolClientError {
fn from(err: io::Error) -> DescribeUserPoolClientError {
DescribeUserPoolClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeUserPoolClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeUserPoolClientError {
fn description(&self) -> &str {
match *self {
DescribeUserPoolClientError::InternalError(ref cause) => cause,
DescribeUserPoolClientError::InvalidParameter(ref cause) => cause,
DescribeUserPoolClientError::NotAuthorized(ref cause) => cause,
DescribeUserPoolClientError::ResourceNotFound(ref cause) => cause,
DescribeUserPoolClientError::TooManyRequests(ref cause) => cause,
DescribeUserPoolClientError::Validation(ref cause) => cause,
DescribeUserPoolClientError::Credentials(ref err) => err.description(),
DescribeUserPoolClientError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeUserPoolClientError::ParseError(ref cause) => cause,
DescribeUserPoolClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeUserPoolDomainError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeUserPoolDomainError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeUserPoolDomainError {
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 {
"InternalErrorException" => {
return DescribeUserPoolDomainError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return DescribeUserPoolDomainError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return DescribeUserPoolDomainError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeUserPoolDomainError::ResourceNotFound(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeUserPoolDomainError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeUserPoolDomainError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeUserPoolDomainError {
fn from(err: serde_json::error::Error) -> DescribeUserPoolDomainError {
DescribeUserPoolDomainError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeUserPoolDomainError {
fn from(err: CredentialsError) -> DescribeUserPoolDomainError {
DescribeUserPoolDomainError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeUserPoolDomainError {
fn from(err: HttpDispatchError) -> DescribeUserPoolDomainError {
DescribeUserPoolDomainError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeUserPoolDomainError {
fn from(err: io::Error) -> DescribeUserPoolDomainError {
DescribeUserPoolDomainError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeUserPoolDomainError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeUserPoolDomainError {
fn description(&self) -> &str {
match *self {
DescribeUserPoolDomainError::InternalError(ref cause) => cause,
DescribeUserPoolDomainError::InvalidParameter(ref cause) => cause,
DescribeUserPoolDomainError::NotAuthorized(ref cause) => cause,
DescribeUserPoolDomainError::ResourceNotFound(ref cause) => cause,
DescribeUserPoolDomainError::Validation(ref cause) => cause,
DescribeUserPoolDomainError::Credentials(ref err) => err.description(),
DescribeUserPoolDomainError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeUserPoolDomainError::ParseError(ref cause) => cause,
DescribeUserPoolDomainError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ForgetDeviceError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ForgetDeviceError {
pub fn from_response(res: BufferedHttpResponse) -> ForgetDeviceError {
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 {
"InternalErrorException" => {
return ForgetDeviceError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ForgetDeviceError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return ForgetDeviceError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return ForgetDeviceError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return ForgetDeviceError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return ForgetDeviceError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ForgetDeviceError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return ForgetDeviceError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return ForgetDeviceError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return ForgetDeviceError::Validation(error_message.to_string());
}
_ => {}
}
}
return ForgetDeviceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ForgetDeviceError {
fn from(err: serde_json::error::Error) -> ForgetDeviceError {
ForgetDeviceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ForgetDeviceError {
fn from(err: CredentialsError) -> ForgetDeviceError {
ForgetDeviceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ForgetDeviceError {
fn from(err: HttpDispatchError) -> ForgetDeviceError {
ForgetDeviceError::HttpDispatch(err)
}
}
impl From<io::Error> for ForgetDeviceError {
fn from(err: io::Error) -> ForgetDeviceError {
ForgetDeviceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ForgetDeviceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ForgetDeviceError {
fn description(&self) -> &str {
match *self {
ForgetDeviceError::InternalError(ref cause) => cause,
ForgetDeviceError::InvalidParameter(ref cause) => cause,
ForgetDeviceError::InvalidUserPoolConfiguration(ref cause) => cause,
ForgetDeviceError::NotAuthorized(ref cause) => cause,
ForgetDeviceError::PasswordResetRequired(ref cause) => cause,
ForgetDeviceError::ResourceNotFound(ref cause) => cause,
ForgetDeviceError::TooManyRequests(ref cause) => cause,
ForgetDeviceError::UserNotConfirmed(ref cause) => cause,
ForgetDeviceError::UserNotFound(ref cause) => cause,
ForgetDeviceError::Validation(ref cause) => cause,
ForgetDeviceError::Credentials(ref err) => err.description(),
ForgetDeviceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ForgetDeviceError::ParseError(ref cause) => cause,
ForgetDeviceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ForgotPasswordError {
CodeDeliveryFailure(String),
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ForgotPasswordError {
pub fn from_response(res: BufferedHttpResponse) -> ForgotPasswordError {
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 {
"CodeDeliveryFailureException" => {
return ForgotPasswordError::CodeDeliveryFailure(String::from(error_message));
}
"InternalErrorException" => {
return ForgotPasswordError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return ForgotPasswordError::InvalidEmailRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidLambdaResponseException" => {
return ForgotPasswordError::InvalidLambdaResponse(String::from(error_message));
}
"InvalidParameterException" => {
return ForgotPasswordError::InvalidParameter(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return ForgotPasswordError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return ForgotPasswordError::InvalidSmsRoleTrustRelationship(String::from(
error_message,
));
}
"LimitExceededException" => {
return ForgotPasswordError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return ForgotPasswordError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ForgotPasswordError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ForgotPasswordError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return ForgotPasswordError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return ForgotPasswordError::UserLambdaValidation(String::from(error_message));
}
"UserNotConfirmedException" => {
return ForgotPasswordError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return ForgotPasswordError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return ForgotPasswordError::Validation(error_message.to_string());
}
_ => {}
}
}
return ForgotPasswordError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ForgotPasswordError {
fn from(err: serde_json::error::Error) -> ForgotPasswordError {
ForgotPasswordError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ForgotPasswordError {
fn from(err: CredentialsError) -> ForgotPasswordError {
ForgotPasswordError::Credentials(err)
}
}
impl From<HttpDispatchError> for ForgotPasswordError {
fn from(err: HttpDispatchError) -> ForgotPasswordError {
ForgotPasswordError::HttpDispatch(err)
}
}
impl From<io::Error> for ForgotPasswordError {
fn from(err: io::Error) -> ForgotPasswordError {
ForgotPasswordError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ForgotPasswordError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ForgotPasswordError {
fn description(&self) -> &str {
match *self {
ForgotPasswordError::CodeDeliveryFailure(ref cause) => cause,
ForgotPasswordError::InternalError(ref cause) => cause,
ForgotPasswordError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
ForgotPasswordError::InvalidLambdaResponse(ref cause) => cause,
ForgotPasswordError::InvalidParameter(ref cause) => cause,
ForgotPasswordError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
ForgotPasswordError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
ForgotPasswordError::LimitExceeded(ref cause) => cause,
ForgotPasswordError::NotAuthorized(ref cause) => cause,
ForgotPasswordError::ResourceNotFound(ref cause) => cause,
ForgotPasswordError::TooManyRequests(ref cause) => cause,
ForgotPasswordError::UnexpectedLambda(ref cause) => cause,
ForgotPasswordError::UserLambdaValidation(ref cause) => cause,
ForgotPasswordError::UserNotConfirmed(ref cause) => cause,
ForgotPasswordError::UserNotFound(ref cause) => cause,
ForgotPasswordError::Validation(ref cause) => cause,
ForgotPasswordError::Credentials(ref err) => err.description(),
ForgotPasswordError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ForgotPasswordError::ParseError(ref cause) => cause,
ForgotPasswordError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCSVHeaderError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCSVHeaderError {
pub fn from_response(res: BufferedHttpResponse) -> GetCSVHeaderError {
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 {
"InternalErrorException" => {
return GetCSVHeaderError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return GetCSVHeaderError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return GetCSVHeaderError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetCSVHeaderError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetCSVHeaderError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetCSVHeaderError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetCSVHeaderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCSVHeaderError {
fn from(err: serde_json::error::Error) -> GetCSVHeaderError {
GetCSVHeaderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCSVHeaderError {
fn from(err: CredentialsError) -> GetCSVHeaderError {
GetCSVHeaderError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCSVHeaderError {
fn from(err: HttpDispatchError) -> GetCSVHeaderError {
GetCSVHeaderError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCSVHeaderError {
fn from(err: io::Error) -> GetCSVHeaderError {
GetCSVHeaderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCSVHeaderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCSVHeaderError {
fn description(&self) -> &str {
match *self {
GetCSVHeaderError::InternalError(ref cause) => cause,
GetCSVHeaderError::InvalidParameter(ref cause) => cause,
GetCSVHeaderError::NotAuthorized(ref cause) => cause,
GetCSVHeaderError::ResourceNotFound(ref cause) => cause,
GetCSVHeaderError::TooManyRequests(ref cause) => cause,
GetCSVHeaderError::Validation(ref cause) => cause,
GetCSVHeaderError::Credentials(ref err) => err.description(),
GetCSVHeaderError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetCSVHeaderError::ParseError(ref cause) => cause,
GetCSVHeaderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDeviceError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(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 {
"InternalErrorException" => {
return GetDeviceError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return GetDeviceError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return GetDeviceError::InvalidUserPoolConfiguration(String::from(error_message));
}
"NotAuthorizedException" => {
return GetDeviceError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return GetDeviceError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetDeviceError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetDeviceError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return GetDeviceError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return GetDeviceError::UserNotFound(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::InternalError(ref cause) => cause,
GetDeviceError::InvalidParameter(ref cause) => cause,
GetDeviceError::InvalidUserPoolConfiguration(ref cause) => cause,
GetDeviceError::NotAuthorized(ref cause) => cause,
GetDeviceError::PasswordResetRequired(ref cause) => cause,
GetDeviceError::ResourceNotFound(ref cause) => cause,
GetDeviceError::TooManyRequests(ref cause) => cause,
GetDeviceError::UserNotConfirmed(ref cause) => cause,
GetDeviceError::UserNotFound(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 GetGroupError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetGroupError {
pub fn from_response(res: BufferedHttpResponse) -> GetGroupError {
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 {
"InternalErrorException" => {
return GetGroupError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return GetGroupError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return GetGroupError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetGroupError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetGroupError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetGroupError {
fn from(err: serde_json::error::Error) -> GetGroupError {
GetGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetGroupError {
fn from(err: CredentialsError) -> GetGroupError {
GetGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetGroupError {
fn from(err: HttpDispatchError) -> GetGroupError {
GetGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for GetGroupError {
fn from(err: io::Error) -> GetGroupError {
GetGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetGroupError {
fn description(&self) -> &str {
match *self {
GetGroupError::InternalError(ref cause) => cause,
GetGroupError::InvalidParameter(ref cause) => cause,
GetGroupError::NotAuthorized(ref cause) => cause,
GetGroupError::ResourceNotFound(ref cause) => cause,
GetGroupError::TooManyRequests(ref cause) => cause,
GetGroupError::Validation(ref cause) => cause,
GetGroupError::Credentials(ref err) => err.description(),
GetGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetGroupError::ParseError(ref cause) => cause,
GetGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIdentityProviderByIdentifierError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIdentityProviderByIdentifierError {
pub fn from_response(res: BufferedHttpResponse) -> GetIdentityProviderByIdentifierError {
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 {
"InternalErrorException" => {
return GetIdentityProviderByIdentifierError::InternalError(String::from(
error_message,
));
}
"InvalidParameterException" => {
return GetIdentityProviderByIdentifierError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return GetIdentityProviderByIdentifierError::NotAuthorized(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return GetIdentityProviderByIdentifierError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return GetIdentityProviderByIdentifierError::TooManyRequests(String::from(
error_message,
));
}
"ValidationException" => {
return GetIdentityProviderByIdentifierError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return GetIdentityProviderByIdentifierError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIdentityProviderByIdentifierError {
fn from(err: serde_json::error::Error) -> GetIdentityProviderByIdentifierError {
GetIdentityProviderByIdentifierError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIdentityProviderByIdentifierError {
fn from(err: CredentialsError) -> GetIdentityProviderByIdentifierError {
GetIdentityProviderByIdentifierError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIdentityProviderByIdentifierError {
fn from(err: HttpDispatchError) -> GetIdentityProviderByIdentifierError {
GetIdentityProviderByIdentifierError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIdentityProviderByIdentifierError {
fn from(err: io::Error) -> GetIdentityProviderByIdentifierError {
GetIdentityProviderByIdentifierError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIdentityProviderByIdentifierError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIdentityProviderByIdentifierError {
fn description(&self) -> &str {
match *self {
GetIdentityProviderByIdentifierError::InternalError(ref cause) => cause,
GetIdentityProviderByIdentifierError::InvalidParameter(ref cause) => cause,
GetIdentityProviderByIdentifierError::NotAuthorized(ref cause) => cause,
GetIdentityProviderByIdentifierError::ResourceNotFound(ref cause) => cause,
GetIdentityProviderByIdentifierError::TooManyRequests(ref cause) => cause,
GetIdentityProviderByIdentifierError::Validation(ref cause) => cause,
GetIdentityProviderByIdentifierError::Credentials(ref err) => err.description(),
GetIdentityProviderByIdentifierError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetIdentityProviderByIdentifierError::ParseError(ref cause) => cause,
GetIdentityProviderByIdentifierError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSigningCertificateError {
InternalError(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSigningCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> GetSigningCertificateError {
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 {
"InternalErrorException" => {
return GetSigningCertificateError::InternalError(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetSigningCertificateError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return GetSigningCertificateError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetSigningCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetSigningCertificateError {
fn from(err: serde_json::error::Error) -> GetSigningCertificateError {
GetSigningCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetSigningCertificateError {
fn from(err: CredentialsError) -> GetSigningCertificateError {
GetSigningCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSigningCertificateError {
fn from(err: HttpDispatchError) -> GetSigningCertificateError {
GetSigningCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSigningCertificateError {
fn from(err: io::Error) -> GetSigningCertificateError {
GetSigningCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSigningCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSigningCertificateError {
fn description(&self) -> &str {
match *self {
GetSigningCertificateError::InternalError(ref cause) => cause,
GetSigningCertificateError::ResourceNotFound(ref cause) => cause,
GetSigningCertificateError::Validation(ref cause) => cause,
GetSigningCertificateError::Credentials(ref err) => err.description(),
GetSigningCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetSigningCertificateError::ParseError(ref cause) => cause,
GetSigningCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUICustomizationError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUICustomizationError {
pub fn from_response(res: BufferedHttpResponse) -> GetUICustomizationError {
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 {
"InternalErrorException" => {
return GetUICustomizationError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return GetUICustomizationError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return GetUICustomizationError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetUICustomizationError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetUICustomizationError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetUICustomizationError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUICustomizationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUICustomizationError {
fn from(err: serde_json::error::Error) -> GetUICustomizationError {
GetUICustomizationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUICustomizationError {
fn from(err: CredentialsError) -> GetUICustomizationError {
GetUICustomizationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUICustomizationError {
fn from(err: HttpDispatchError) -> GetUICustomizationError {
GetUICustomizationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUICustomizationError {
fn from(err: io::Error) -> GetUICustomizationError {
GetUICustomizationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUICustomizationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUICustomizationError {
fn description(&self) -> &str {
match *self {
GetUICustomizationError::InternalError(ref cause) => cause,
GetUICustomizationError::InvalidParameter(ref cause) => cause,
GetUICustomizationError::NotAuthorized(ref cause) => cause,
GetUICustomizationError::ResourceNotFound(ref cause) => cause,
GetUICustomizationError::TooManyRequests(ref cause) => cause,
GetUICustomizationError::Validation(ref cause) => cause,
GetUICustomizationError::Credentials(ref err) => err.description(),
GetUICustomizationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetUICustomizationError::ParseError(ref cause) => cause,
GetUICustomizationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUserError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUserError {
pub fn from_response(res: BufferedHttpResponse) -> GetUserError {
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 {
"InternalErrorException" => {
return GetUserError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return GetUserError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return GetUserError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return GetUserError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetUserError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetUserError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return GetUserError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return GetUserError::UserNotFound(String::from(error_message));
}
"ValidationException" => return GetUserError::Validation(error_message.to_string()),
_ => {}
}
}
return GetUserError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUserError {
fn from(err: serde_json::error::Error) -> GetUserError {
GetUserError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUserError {
fn from(err: CredentialsError) -> GetUserError {
GetUserError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUserError {
fn from(err: HttpDispatchError) -> GetUserError {
GetUserError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUserError {
fn from(err: io::Error) -> GetUserError {
GetUserError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUserError {
fn description(&self) -> &str {
match *self {
GetUserError::InternalError(ref cause) => cause,
GetUserError::InvalidParameter(ref cause) => cause,
GetUserError::NotAuthorized(ref cause) => cause,
GetUserError::PasswordResetRequired(ref cause) => cause,
GetUserError::ResourceNotFound(ref cause) => cause,
GetUserError::TooManyRequests(ref cause) => cause,
GetUserError::UserNotConfirmed(ref cause) => cause,
GetUserError::UserNotFound(ref cause) => cause,
GetUserError::Validation(ref cause) => cause,
GetUserError::Credentials(ref err) => err.description(),
GetUserError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetUserError::ParseError(ref cause) => cause,
GetUserError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUserAttributeVerificationCodeError {
CodeDeliveryFailure(String),
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
LimitExceeded(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUserAttributeVerificationCodeError {
pub fn from_response(res: BufferedHttpResponse) -> GetUserAttributeVerificationCodeError {
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 {
"CodeDeliveryFailureException" => {
return GetUserAttributeVerificationCodeError::CodeDeliveryFailure(String::from(
error_message,
));
}
"InternalErrorException" => {
return GetUserAttributeVerificationCodeError::InternalError(String::from(
error_message,
));
}
"InvalidEmailRoleAccessPolicyException" => {
return GetUserAttributeVerificationCodeError::InvalidEmailRoleAccessPolicy(
String::from(error_message),
);
}
"InvalidLambdaResponseException" => {
return GetUserAttributeVerificationCodeError::InvalidLambdaResponse(
String::from(error_message),
);
}
"InvalidParameterException" => {
return GetUserAttributeVerificationCodeError::InvalidParameter(String::from(
error_message,
));
}
"InvalidSmsRoleAccessPolicyException" => {
return GetUserAttributeVerificationCodeError::InvalidSmsRoleAccessPolicy(
String::from(error_message),
);
}
"InvalidSmsRoleTrustRelationshipException" => {
return GetUserAttributeVerificationCodeError::InvalidSmsRoleTrustRelationship(
String::from(error_message),
);
}
"LimitExceededException" => {
return GetUserAttributeVerificationCodeError::LimitExceeded(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return GetUserAttributeVerificationCodeError::NotAuthorized(String::from(
error_message,
));
}
"PasswordResetRequiredException" => {
return GetUserAttributeVerificationCodeError::PasswordResetRequired(
String::from(error_message),
);
}
"ResourceNotFoundException" => {
return GetUserAttributeVerificationCodeError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return GetUserAttributeVerificationCodeError::TooManyRequests(String::from(
error_message,
));
}
"UnexpectedLambdaException" => {
return GetUserAttributeVerificationCodeError::UnexpectedLambda(String::from(
error_message,
));
}
"UserLambdaValidationException" => {
return GetUserAttributeVerificationCodeError::UserLambdaValidation(
String::from(error_message),
);
}
"UserNotConfirmedException" => {
return GetUserAttributeVerificationCodeError::UserNotConfirmed(String::from(
error_message,
));
}
"UserNotFoundException" => {
return GetUserAttributeVerificationCodeError::UserNotFound(String::from(
error_message,
));
}
"ValidationException" => {
return GetUserAttributeVerificationCodeError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return GetUserAttributeVerificationCodeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUserAttributeVerificationCodeError {
fn from(err: serde_json::error::Error) -> GetUserAttributeVerificationCodeError {
GetUserAttributeVerificationCodeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUserAttributeVerificationCodeError {
fn from(err: CredentialsError) -> GetUserAttributeVerificationCodeError {
GetUserAttributeVerificationCodeError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUserAttributeVerificationCodeError {
fn from(err: HttpDispatchError) -> GetUserAttributeVerificationCodeError {
GetUserAttributeVerificationCodeError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUserAttributeVerificationCodeError {
fn from(err: io::Error) -> GetUserAttributeVerificationCodeError {
GetUserAttributeVerificationCodeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUserAttributeVerificationCodeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUserAttributeVerificationCodeError {
fn description(&self) -> &str {
match *self {
GetUserAttributeVerificationCodeError::CodeDeliveryFailure(ref cause) => cause,
GetUserAttributeVerificationCodeError::InternalError(ref cause) => cause,
GetUserAttributeVerificationCodeError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
GetUserAttributeVerificationCodeError::InvalidLambdaResponse(ref cause) => cause,
GetUserAttributeVerificationCodeError::InvalidParameter(ref cause) => cause,
GetUserAttributeVerificationCodeError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
GetUserAttributeVerificationCodeError::InvalidSmsRoleTrustRelationship(ref cause) => {
cause
}
GetUserAttributeVerificationCodeError::LimitExceeded(ref cause) => cause,
GetUserAttributeVerificationCodeError::NotAuthorized(ref cause) => cause,
GetUserAttributeVerificationCodeError::PasswordResetRequired(ref cause) => cause,
GetUserAttributeVerificationCodeError::ResourceNotFound(ref cause) => cause,
GetUserAttributeVerificationCodeError::TooManyRequests(ref cause) => cause,
GetUserAttributeVerificationCodeError::UnexpectedLambda(ref cause) => cause,
GetUserAttributeVerificationCodeError::UserLambdaValidation(ref cause) => cause,
GetUserAttributeVerificationCodeError::UserNotConfirmed(ref cause) => cause,
GetUserAttributeVerificationCodeError::UserNotFound(ref cause) => cause,
GetUserAttributeVerificationCodeError::Validation(ref cause) => cause,
GetUserAttributeVerificationCodeError::Credentials(ref err) => err.description(),
GetUserAttributeVerificationCodeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetUserAttributeVerificationCodeError::ParseError(ref cause) => cause,
GetUserAttributeVerificationCodeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetUserPoolMfaConfigError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetUserPoolMfaConfigError {
pub fn from_response(res: BufferedHttpResponse) -> GetUserPoolMfaConfigError {
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 {
"InternalErrorException" => {
return GetUserPoolMfaConfigError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return GetUserPoolMfaConfigError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return GetUserPoolMfaConfigError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetUserPoolMfaConfigError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GetUserPoolMfaConfigError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return GetUserPoolMfaConfigError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetUserPoolMfaConfigError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetUserPoolMfaConfigError {
fn from(err: serde_json::error::Error) -> GetUserPoolMfaConfigError {
GetUserPoolMfaConfigError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetUserPoolMfaConfigError {
fn from(err: CredentialsError) -> GetUserPoolMfaConfigError {
GetUserPoolMfaConfigError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetUserPoolMfaConfigError {
fn from(err: HttpDispatchError) -> GetUserPoolMfaConfigError {
GetUserPoolMfaConfigError::HttpDispatch(err)
}
}
impl From<io::Error> for GetUserPoolMfaConfigError {
fn from(err: io::Error) -> GetUserPoolMfaConfigError {
GetUserPoolMfaConfigError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetUserPoolMfaConfigError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetUserPoolMfaConfigError {
fn description(&self) -> &str {
match *self {
GetUserPoolMfaConfigError::InternalError(ref cause) => cause,
GetUserPoolMfaConfigError::InvalidParameter(ref cause) => cause,
GetUserPoolMfaConfigError::NotAuthorized(ref cause) => cause,
GetUserPoolMfaConfigError::ResourceNotFound(ref cause) => cause,
GetUserPoolMfaConfigError::TooManyRequests(ref cause) => cause,
GetUserPoolMfaConfigError::Validation(ref cause) => cause,
GetUserPoolMfaConfigError::Credentials(ref err) => err.description(),
GetUserPoolMfaConfigError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetUserPoolMfaConfigError::ParseError(ref cause) => cause,
GetUserPoolMfaConfigError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GlobalSignOutError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GlobalSignOutError {
pub fn from_response(res: BufferedHttpResponse) -> GlobalSignOutError {
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 {
"InternalErrorException" => {
return GlobalSignOutError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return GlobalSignOutError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return GlobalSignOutError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return GlobalSignOutError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return GlobalSignOutError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return GlobalSignOutError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return GlobalSignOutError::UserNotConfirmed(String::from(error_message));
}
"ValidationException" => {
return GlobalSignOutError::Validation(error_message.to_string());
}
_ => {}
}
}
return GlobalSignOutError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GlobalSignOutError {
fn from(err: serde_json::error::Error) -> GlobalSignOutError {
GlobalSignOutError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GlobalSignOutError {
fn from(err: CredentialsError) -> GlobalSignOutError {
GlobalSignOutError::Credentials(err)
}
}
impl From<HttpDispatchError> for GlobalSignOutError {
fn from(err: HttpDispatchError) -> GlobalSignOutError {
GlobalSignOutError::HttpDispatch(err)
}
}
impl From<io::Error> for GlobalSignOutError {
fn from(err: io::Error) -> GlobalSignOutError {
GlobalSignOutError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GlobalSignOutError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GlobalSignOutError {
fn description(&self) -> &str {
match *self {
GlobalSignOutError::InternalError(ref cause) => cause,
GlobalSignOutError::InvalidParameter(ref cause) => cause,
GlobalSignOutError::NotAuthorized(ref cause) => cause,
GlobalSignOutError::PasswordResetRequired(ref cause) => cause,
GlobalSignOutError::ResourceNotFound(ref cause) => cause,
GlobalSignOutError::TooManyRequests(ref cause) => cause,
GlobalSignOutError::UserNotConfirmed(ref cause) => cause,
GlobalSignOutError::Validation(ref cause) => cause,
GlobalSignOutError::Credentials(ref err) => err.description(),
GlobalSignOutError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GlobalSignOutError::ParseError(ref cause) => cause,
GlobalSignOutError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum InitiateAuthError {
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl InitiateAuthError {
pub fn from_response(res: BufferedHttpResponse) -> InitiateAuthError {
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 {
"InternalErrorException" => {
return InitiateAuthError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return InitiateAuthError::InvalidLambdaResponse(String::from(error_message));
}
"InvalidParameterException" => {
return InitiateAuthError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return InitiateAuthError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return InitiateAuthError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return InitiateAuthError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return InitiateAuthError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return InitiateAuthError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return InitiateAuthError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return InitiateAuthError::UserLambdaValidation(String::from(error_message));
}
"UserNotConfirmedException" => {
return InitiateAuthError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return InitiateAuthError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return InitiateAuthError::Validation(error_message.to_string());
}
_ => {}
}
}
return InitiateAuthError::Unknown(res);
}
}
impl From<serde_json::error::Error> for InitiateAuthError {
fn from(err: serde_json::error::Error) -> InitiateAuthError {
InitiateAuthError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for InitiateAuthError {
fn from(err: CredentialsError) -> InitiateAuthError {
InitiateAuthError::Credentials(err)
}
}
impl From<HttpDispatchError> for InitiateAuthError {
fn from(err: HttpDispatchError) -> InitiateAuthError {
InitiateAuthError::HttpDispatch(err)
}
}
impl From<io::Error> for InitiateAuthError {
fn from(err: io::Error) -> InitiateAuthError {
InitiateAuthError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for InitiateAuthError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for InitiateAuthError {
fn description(&self) -> &str {
match *self {
InitiateAuthError::InternalError(ref cause) => cause,
InitiateAuthError::InvalidLambdaResponse(ref cause) => cause,
InitiateAuthError::InvalidParameter(ref cause) => cause,
InitiateAuthError::InvalidUserPoolConfiguration(ref cause) => cause,
InitiateAuthError::NotAuthorized(ref cause) => cause,
InitiateAuthError::PasswordResetRequired(ref cause) => cause,
InitiateAuthError::ResourceNotFound(ref cause) => cause,
InitiateAuthError::TooManyRequests(ref cause) => cause,
InitiateAuthError::UnexpectedLambda(ref cause) => cause,
InitiateAuthError::UserLambdaValidation(ref cause) => cause,
InitiateAuthError::UserNotConfirmed(ref cause) => cause,
InitiateAuthError::UserNotFound(ref cause) => cause,
InitiateAuthError::Validation(ref cause) => cause,
InitiateAuthError::Credentials(ref err) => err.description(),
InitiateAuthError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
InitiateAuthError::ParseError(ref cause) => cause,
InitiateAuthError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDevicesError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListDevicesError {
pub fn from_response(res: BufferedHttpResponse) -> ListDevicesError {
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 {
"InternalErrorException" => {
return ListDevicesError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListDevicesError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return ListDevicesError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return ListDevicesError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return ListDevicesError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListDevicesError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListDevicesError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return ListDevicesError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return ListDevicesError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return ListDevicesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListDevicesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListDevicesError {
fn from(err: serde_json::error::Error) -> ListDevicesError {
ListDevicesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListDevicesError {
fn from(err: CredentialsError) -> ListDevicesError {
ListDevicesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListDevicesError {
fn from(err: HttpDispatchError) -> ListDevicesError {
ListDevicesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListDevicesError {
fn from(err: io::Error) -> ListDevicesError {
ListDevicesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListDevicesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDevicesError {
fn description(&self) -> &str {
match *self {
ListDevicesError::InternalError(ref cause) => cause,
ListDevicesError::InvalidParameter(ref cause) => cause,
ListDevicesError::InvalidUserPoolConfiguration(ref cause) => cause,
ListDevicesError::NotAuthorized(ref cause) => cause,
ListDevicesError::PasswordResetRequired(ref cause) => cause,
ListDevicesError::ResourceNotFound(ref cause) => cause,
ListDevicesError::TooManyRequests(ref cause) => cause,
ListDevicesError::UserNotConfirmed(ref cause) => cause,
ListDevicesError::UserNotFound(ref cause) => cause,
ListDevicesError::Validation(ref cause) => cause,
ListDevicesError::Credentials(ref err) => err.description(),
ListDevicesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListDevicesError::ParseError(ref cause) => cause,
ListDevicesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListGroupsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListGroupsError {
pub fn from_response(res: BufferedHttpResponse) -> ListGroupsError {
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 {
"InternalErrorException" => {
return ListGroupsError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListGroupsError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListGroupsError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListGroupsError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListGroupsError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListGroupsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListGroupsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListGroupsError {
fn from(err: serde_json::error::Error) -> ListGroupsError {
ListGroupsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListGroupsError {
fn from(err: CredentialsError) -> ListGroupsError {
ListGroupsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListGroupsError {
fn from(err: HttpDispatchError) -> ListGroupsError {
ListGroupsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListGroupsError {
fn from(err: io::Error) -> ListGroupsError {
ListGroupsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListGroupsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListGroupsError {
fn description(&self) -> &str {
match *self {
ListGroupsError::InternalError(ref cause) => cause,
ListGroupsError::InvalidParameter(ref cause) => cause,
ListGroupsError::NotAuthorized(ref cause) => cause,
ListGroupsError::ResourceNotFound(ref cause) => cause,
ListGroupsError::TooManyRequests(ref cause) => cause,
ListGroupsError::Validation(ref cause) => cause,
ListGroupsError::Credentials(ref err) => err.description(),
ListGroupsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListGroupsError::ParseError(ref cause) => cause,
ListGroupsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListIdentityProvidersError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListIdentityProvidersError {
pub fn from_response(res: BufferedHttpResponse) -> ListIdentityProvidersError {
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 {
"InternalErrorException" => {
return ListIdentityProvidersError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListIdentityProvidersError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListIdentityProvidersError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListIdentityProvidersError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListIdentityProvidersError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListIdentityProvidersError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListIdentityProvidersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListIdentityProvidersError {
fn from(err: serde_json::error::Error) -> ListIdentityProvidersError {
ListIdentityProvidersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListIdentityProvidersError {
fn from(err: CredentialsError) -> ListIdentityProvidersError {
ListIdentityProvidersError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListIdentityProvidersError {
fn from(err: HttpDispatchError) -> ListIdentityProvidersError {
ListIdentityProvidersError::HttpDispatch(err)
}
}
impl From<io::Error> for ListIdentityProvidersError {
fn from(err: io::Error) -> ListIdentityProvidersError {
ListIdentityProvidersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListIdentityProvidersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListIdentityProvidersError {
fn description(&self) -> &str {
match *self {
ListIdentityProvidersError::InternalError(ref cause) => cause,
ListIdentityProvidersError::InvalidParameter(ref cause) => cause,
ListIdentityProvidersError::NotAuthorized(ref cause) => cause,
ListIdentityProvidersError::ResourceNotFound(ref cause) => cause,
ListIdentityProvidersError::TooManyRequests(ref cause) => cause,
ListIdentityProvidersError::Validation(ref cause) => cause,
ListIdentityProvidersError::Credentials(ref err) => err.description(),
ListIdentityProvidersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListIdentityProvidersError::ParseError(ref cause) => cause,
ListIdentityProvidersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListResourceServersError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListResourceServersError {
pub fn from_response(res: BufferedHttpResponse) -> ListResourceServersError {
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 {
"InternalErrorException" => {
return ListResourceServersError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListResourceServersError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListResourceServersError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListResourceServersError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListResourceServersError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListResourceServersError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListResourceServersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListResourceServersError {
fn from(err: serde_json::error::Error) -> ListResourceServersError {
ListResourceServersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListResourceServersError {
fn from(err: CredentialsError) -> ListResourceServersError {
ListResourceServersError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListResourceServersError {
fn from(err: HttpDispatchError) -> ListResourceServersError {
ListResourceServersError::HttpDispatch(err)
}
}
impl From<io::Error> for ListResourceServersError {
fn from(err: io::Error) -> ListResourceServersError {
ListResourceServersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListResourceServersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListResourceServersError {
fn description(&self) -> &str {
match *self {
ListResourceServersError::InternalError(ref cause) => cause,
ListResourceServersError::InvalidParameter(ref cause) => cause,
ListResourceServersError::NotAuthorized(ref cause) => cause,
ListResourceServersError::ResourceNotFound(ref cause) => cause,
ListResourceServersError::TooManyRequests(ref cause) => cause,
ListResourceServersError::Validation(ref cause) => cause,
ListResourceServersError::Credentials(ref err) => err.description(),
ListResourceServersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListResourceServersError::ParseError(ref cause) => cause,
ListResourceServersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListUserImportJobsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListUserImportJobsError {
pub fn from_response(res: BufferedHttpResponse) -> ListUserImportJobsError {
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 {
"InternalErrorException" => {
return ListUserImportJobsError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListUserImportJobsError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListUserImportJobsError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListUserImportJobsError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListUserImportJobsError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListUserImportJobsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListUserImportJobsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListUserImportJobsError {
fn from(err: serde_json::error::Error) -> ListUserImportJobsError {
ListUserImportJobsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListUserImportJobsError {
fn from(err: CredentialsError) -> ListUserImportJobsError {
ListUserImportJobsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListUserImportJobsError {
fn from(err: HttpDispatchError) -> ListUserImportJobsError {
ListUserImportJobsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListUserImportJobsError {
fn from(err: io::Error) -> ListUserImportJobsError {
ListUserImportJobsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListUserImportJobsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListUserImportJobsError {
fn description(&self) -> &str {
match *self {
ListUserImportJobsError::InternalError(ref cause) => cause,
ListUserImportJobsError::InvalidParameter(ref cause) => cause,
ListUserImportJobsError::NotAuthorized(ref cause) => cause,
ListUserImportJobsError::ResourceNotFound(ref cause) => cause,
ListUserImportJobsError::TooManyRequests(ref cause) => cause,
ListUserImportJobsError::Validation(ref cause) => cause,
ListUserImportJobsError::Credentials(ref err) => err.description(),
ListUserImportJobsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListUserImportJobsError::ParseError(ref cause) => cause,
ListUserImportJobsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListUserPoolClientsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListUserPoolClientsError {
pub fn from_response(res: BufferedHttpResponse) -> ListUserPoolClientsError {
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 {
"InternalErrorException" => {
return ListUserPoolClientsError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListUserPoolClientsError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListUserPoolClientsError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListUserPoolClientsError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListUserPoolClientsError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListUserPoolClientsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListUserPoolClientsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListUserPoolClientsError {
fn from(err: serde_json::error::Error) -> ListUserPoolClientsError {
ListUserPoolClientsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListUserPoolClientsError {
fn from(err: CredentialsError) -> ListUserPoolClientsError {
ListUserPoolClientsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListUserPoolClientsError {
fn from(err: HttpDispatchError) -> ListUserPoolClientsError {
ListUserPoolClientsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListUserPoolClientsError {
fn from(err: io::Error) -> ListUserPoolClientsError {
ListUserPoolClientsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListUserPoolClientsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListUserPoolClientsError {
fn description(&self) -> &str {
match *self {
ListUserPoolClientsError::InternalError(ref cause) => cause,
ListUserPoolClientsError::InvalidParameter(ref cause) => cause,
ListUserPoolClientsError::NotAuthorized(ref cause) => cause,
ListUserPoolClientsError::ResourceNotFound(ref cause) => cause,
ListUserPoolClientsError::TooManyRequests(ref cause) => cause,
ListUserPoolClientsError::Validation(ref cause) => cause,
ListUserPoolClientsError::Credentials(ref err) => err.description(),
ListUserPoolClientsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListUserPoolClientsError::ParseError(ref cause) => cause,
ListUserPoolClientsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListUserPoolsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListUserPoolsError {
pub fn from_response(res: BufferedHttpResponse) -> ListUserPoolsError {
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 {
"InternalErrorException" => {
return ListUserPoolsError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListUserPoolsError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListUserPoolsError::NotAuthorized(String::from(error_message));
}
"TooManyRequestsException" => {
return ListUserPoolsError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListUserPoolsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListUserPoolsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListUserPoolsError {
fn from(err: serde_json::error::Error) -> ListUserPoolsError {
ListUserPoolsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListUserPoolsError {
fn from(err: CredentialsError) -> ListUserPoolsError {
ListUserPoolsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListUserPoolsError {
fn from(err: HttpDispatchError) -> ListUserPoolsError {
ListUserPoolsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListUserPoolsError {
fn from(err: io::Error) -> ListUserPoolsError {
ListUserPoolsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListUserPoolsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListUserPoolsError {
fn description(&self) -> &str {
match *self {
ListUserPoolsError::InternalError(ref cause) => cause,
ListUserPoolsError::InvalidParameter(ref cause) => cause,
ListUserPoolsError::NotAuthorized(ref cause) => cause,
ListUserPoolsError::TooManyRequests(ref cause) => cause,
ListUserPoolsError::Validation(ref cause) => cause,
ListUserPoolsError::Credentials(ref err) => err.description(),
ListUserPoolsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListUserPoolsError::ParseError(ref cause) => cause,
ListUserPoolsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListUsersError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListUsersError {
pub fn from_response(res: BufferedHttpResponse) -> ListUsersError {
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 {
"InternalErrorException" => {
return ListUsersError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListUsersError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListUsersError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListUsersError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListUsersError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListUsersError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListUsersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListUsersError {
fn from(err: serde_json::error::Error) -> ListUsersError {
ListUsersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListUsersError {
fn from(err: CredentialsError) -> ListUsersError {
ListUsersError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListUsersError {
fn from(err: HttpDispatchError) -> ListUsersError {
ListUsersError::HttpDispatch(err)
}
}
impl From<io::Error> for ListUsersError {
fn from(err: io::Error) -> ListUsersError {
ListUsersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListUsersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListUsersError {
fn description(&self) -> &str {
match *self {
ListUsersError::InternalError(ref cause) => cause,
ListUsersError::InvalidParameter(ref cause) => cause,
ListUsersError::NotAuthorized(ref cause) => cause,
ListUsersError::ResourceNotFound(ref cause) => cause,
ListUsersError::TooManyRequests(ref cause) => cause,
ListUsersError::Validation(ref cause) => cause,
ListUsersError::Credentials(ref err) => err.description(),
ListUsersError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListUsersError::ParseError(ref cause) => cause,
ListUsersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListUsersInGroupError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListUsersInGroupError {
pub fn from_response(res: BufferedHttpResponse) -> ListUsersInGroupError {
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 {
"InternalErrorException" => {
return ListUsersInGroupError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return ListUsersInGroupError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return ListUsersInGroupError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListUsersInGroupError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return ListUsersInGroupError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return ListUsersInGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListUsersInGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListUsersInGroupError {
fn from(err: serde_json::error::Error) -> ListUsersInGroupError {
ListUsersInGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListUsersInGroupError {
fn from(err: CredentialsError) -> ListUsersInGroupError {
ListUsersInGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListUsersInGroupError {
fn from(err: HttpDispatchError) -> ListUsersInGroupError {
ListUsersInGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for ListUsersInGroupError {
fn from(err: io::Error) -> ListUsersInGroupError {
ListUsersInGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListUsersInGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListUsersInGroupError {
fn description(&self) -> &str {
match *self {
ListUsersInGroupError::InternalError(ref cause) => cause,
ListUsersInGroupError::InvalidParameter(ref cause) => cause,
ListUsersInGroupError::NotAuthorized(ref cause) => cause,
ListUsersInGroupError::ResourceNotFound(ref cause) => cause,
ListUsersInGroupError::TooManyRequests(ref cause) => cause,
ListUsersInGroupError::Validation(ref cause) => cause,
ListUsersInGroupError::Credentials(ref err) => err.description(),
ListUsersInGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListUsersInGroupError::ParseError(ref cause) => cause,
ListUsersInGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ResendConfirmationCodeError {
CodeDeliveryFailure(String),
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ResendConfirmationCodeError {
pub fn from_response(res: BufferedHttpResponse) -> ResendConfirmationCodeError {
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 {
"CodeDeliveryFailureException" => {
return ResendConfirmationCodeError::CodeDeliveryFailure(String::from(
error_message,
));
}
"InternalErrorException" => {
return ResendConfirmationCodeError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return ResendConfirmationCodeError::InvalidEmailRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidLambdaResponseException" => {
return ResendConfirmationCodeError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return ResendConfirmationCodeError::InvalidParameter(String::from(
error_message,
));
}
"InvalidSmsRoleAccessPolicyException" => {
return ResendConfirmationCodeError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return ResendConfirmationCodeError::InvalidSmsRoleTrustRelationship(
String::from(error_message),
);
}
"LimitExceededException" => {
return ResendConfirmationCodeError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return ResendConfirmationCodeError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return ResendConfirmationCodeError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return ResendConfirmationCodeError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return ResendConfirmationCodeError::UnexpectedLambda(String::from(
error_message,
));
}
"UserLambdaValidationException" => {
return ResendConfirmationCodeError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotFoundException" => {
return ResendConfirmationCodeError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return ResendConfirmationCodeError::Validation(error_message.to_string());
}
_ => {}
}
}
return ResendConfirmationCodeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ResendConfirmationCodeError {
fn from(err: serde_json::error::Error) -> ResendConfirmationCodeError {
ResendConfirmationCodeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ResendConfirmationCodeError {
fn from(err: CredentialsError) -> ResendConfirmationCodeError {
ResendConfirmationCodeError::Credentials(err)
}
}
impl From<HttpDispatchError> for ResendConfirmationCodeError {
fn from(err: HttpDispatchError) -> ResendConfirmationCodeError {
ResendConfirmationCodeError::HttpDispatch(err)
}
}
impl From<io::Error> for ResendConfirmationCodeError {
fn from(err: io::Error) -> ResendConfirmationCodeError {
ResendConfirmationCodeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ResendConfirmationCodeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ResendConfirmationCodeError {
fn description(&self) -> &str {
match *self {
ResendConfirmationCodeError::CodeDeliveryFailure(ref cause) => cause,
ResendConfirmationCodeError::InternalError(ref cause) => cause,
ResendConfirmationCodeError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
ResendConfirmationCodeError::InvalidLambdaResponse(ref cause) => cause,
ResendConfirmationCodeError::InvalidParameter(ref cause) => cause,
ResendConfirmationCodeError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
ResendConfirmationCodeError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
ResendConfirmationCodeError::LimitExceeded(ref cause) => cause,
ResendConfirmationCodeError::NotAuthorized(ref cause) => cause,
ResendConfirmationCodeError::ResourceNotFound(ref cause) => cause,
ResendConfirmationCodeError::TooManyRequests(ref cause) => cause,
ResendConfirmationCodeError::UnexpectedLambda(ref cause) => cause,
ResendConfirmationCodeError::UserLambdaValidation(ref cause) => cause,
ResendConfirmationCodeError::UserNotFound(ref cause) => cause,
ResendConfirmationCodeError::Validation(ref cause) => cause,
ResendConfirmationCodeError::Credentials(ref err) => err.description(),
ResendConfirmationCodeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ResendConfirmationCodeError::ParseError(ref cause) => cause,
ResendConfirmationCodeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RespondToAuthChallengeError {
AliasExists(String),
CodeMismatch(String),
ExpiredCode(String),
InternalError(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidPassword(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
InvalidUserPoolConfiguration(String),
MFAMethodNotFound(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
SoftwareTokenMFANotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RespondToAuthChallengeError {
pub fn from_response(res: BufferedHttpResponse) -> RespondToAuthChallengeError {
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 {
"AliasExistsException" => {
return RespondToAuthChallengeError::AliasExists(String::from(error_message));
}
"CodeMismatchException" => {
return RespondToAuthChallengeError::CodeMismatch(String::from(error_message));
}
"ExpiredCodeException" => {
return RespondToAuthChallengeError::ExpiredCode(String::from(error_message));
}
"InternalErrorException" => {
return RespondToAuthChallengeError::InternalError(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return RespondToAuthChallengeError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return RespondToAuthChallengeError::InvalidParameter(String::from(
error_message,
));
}
"InvalidPasswordException" => {
return RespondToAuthChallengeError::InvalidPassword(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return RespondToAuthChallengeError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return RespondToAuthChallengeError::InvalidSmsRoleTrustRelationship(
String::from(error_message),
);
}
"InvalidUserPoolConfigurationException" => {
return RespondToAuthChallengeError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"MFAMethodNotFoundException" => {
return RespondToAuthChallengeError::MFAMethodNotFound(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return RespondToAuthChallengeError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return RespondToAuthChallengeError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return RespondToAuthChallengeError::ResourceNotFound(String::from(
error_message,
));
}
"SoftwareTokenMFANotFoundException" => {
return RespondToAuthChallengeError::SoftwareTokenMFANotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return RespondToAuthChallengeError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return RespondToAuthChallengeError::UnexpectedLambda(String::from(
error_message,
));
}
"UserLambdaValidationException" => {
return RespondToAuthChallengeError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotConfirmedException" => {
return RespondToAuthChallengeError::UserNotConfirmed(String::from(
error_message,
));
}
"UserNotFoundException" => {
return RespondToAuthChallengeError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return RespondToAuthChallengeError::Validation(error_message.to_string());
}
_ => {}
}
}
return RespondToAuthChallengeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RespondToAuthChallengeError {
fn from(err: serde_json::error::Error) -> RespondToAuthChallengeError {
RespondToAuthChallengeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RespondToAuthChallengeError {
fn from(err: CredentialsError) -> RespondToAuthChallengeError {
RespondToAuthChallengeError::Credentials(err)
}
}
impl From<HttpDispatchError> for RespondToAuthChallengeError {
fn from(err: HttpDispatchError) -> RespondToAuthChallengeError {
RespondToAuthChallengeError::HttpDispatch(err)
}
}
impl From<io::Error> for RespondToAuthChallengeError {
fn from(err: io::Error) -> RespondToAuthChallengeError {
RespondToAuthChallengeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RespondToAuthChallengeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RespondToAuthChallengeError {
fn description(&self) -> &str {
match *self {
RespondToAuthChallengeError::AliasExists(ref cause) => cause,
RespondToAuthChallengeError::CodeMismatch(ref cause) => cause,
RespondToAuthChallengeError::ExpiredCode(ref cause) => cause,
RespondToAuthChallengeError::InternalError(ref cause) => cause,
RespondToAuthChallengeError::InvalidLambdaResponse(ref cause) => cause,
RespondToAuthChallengeError::InvalidParameter(ref cause) => cause,
RespondToAuthChallengeError::InvalidPassword(ref cause) => cause,
RespondToAuthChallengeError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
RespondToAuthChallengeError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
RespondToAuthChallengeError::InvalidUserPoolConfiguration(ref cause) => cause,
RespondToAuthChallengeError::MFAMethodNotFound(ref cause) => cause,
RespondToAuthChallengeError::NotAuthorized(ref cause) => cause,
RespondToAuthChallengeError::PasswordResetRequired(ref cause) => cause,
RespondToAuthChallengeError::ResourceNotFound(ref cause) => cause,
RespondToAuthChallengeError::SoftwareTokenMFANotFound(ref cause) => cause,
RespondToAuthChallengeError::TooManyRequests(ref cause) => cause,
RespondToAuthChallengeError::UnexpectedLambda(ref cause) => cause,
RespondToAuthChallengeError::UserLambdaValidation(ref cause) => cause,
RespondToAuthChallengeError::UserNotConfirmed(ref cause) => cause,
RespondToAuthChallengeError::UserNotFound(ref cause) => cause,
RespondToAuthChallengeError::Validation(ref cause) => cause,
RespondToAuthChallengeError::Credentials(ref err) => err.description(),
RespondToAuthChallengeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RespondToAuthChallengeError::ParseError(ref cause) => cause,
RespondToAuthChallengeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetRiskConfigurationError {
CodeDeliveryFailure(String),
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserPoolAddOnNotEnabled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetRiskConfigurationError {
pub fn from_response(res: BufferedHttpResponse) -> SetRiskConfigurationError {
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 {
"CodeDeliveryFailureException" => {
return SetRiskConfigurationError::CodeDeliveryFailure(String::from(
error_message,
));
}
"InternalErrorException" => {
return SetRiskConfigurationError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return SetRiskConfigurationError::InvalidEmailRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidParameterException" => {
return SetRiskConfigurationError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return SetRiskConfigurationError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return SetRiskConfigurationError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return SetRiskConfigurationError::TooManyRequests(String::from(error_message));
}
"UserPoolAddOnNotEnabledException" => {
return SetRiskConfigurationError::UserPoolAddOnNotEnabled(String::from(
error_message,
));
}
"ValidationException" => {
return SetRiskConfigurationError::Validation(error_message.to_string());
}
_ => {}
}
}
return SetRiskConfigurationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetRiskConfigurationError {
fn from(err: serde_json::error::Error) -> SetRiskConfigurationError {
SetRiskConfigurationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetRiskConfigurationError {
fn from(err: CredentialsError) -> SetRiskConfigurationError {
SetRiskConfigurationError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetRiskConfigurationError {
fn from(err: HttpDispatchError) -> SetRiskConfigurationError {
SetRiskConfigurationError::HttpDispatch(err)
}
}
impl From<io::Error> for SetRiskConfigurationError {
fn from(err: io::Error) -> SetRiskConfigurationError {
SetRiskConfigurationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetRiskConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetRiskConfigurationError {
fn description(&self) -> &str {
match *self {
SetRiskConfigurationError::CodeDeliveryFailure(ref cause) => cause,
SetRiskConfigurationError::InternalError(ref cause) => cause,
SetRiskConfigurationError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
SetRiskConfigurationError::InvalidParameter(ref cause) => cause,
SetRiskConfigurationError::NotAuthorized(ref cause) => cause,
SetRiskConfigurationError::ResourceNotFound(ref cause) => cause,
SetRiskConfigurationError::TooManyRequests(ref cause) => cause,
SetRiskConfigurationError::UserPoolAddOnNotEnabled(ref cause) => cause,
SetRiskConfigurationError::Validation(ref cause) => cause,
SetRiskConfigurationError::Credentials(ref err) => err.description(),
SetRiskConfigurationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetRiskConfigurationError::ParseError(ref cause) => cause,
SetRiskConfigurationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetUICustomizationError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetUICustomizationError {
pub fn from_response(res: BufferedHttpResponse) -> SetUICustomizationError {
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 {
"InternalErrorException" => {
return SetUICustomizationError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return SetUICustomizationError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return SetUICustomizationError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return SetUICustomizationError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return SetUICustomizationError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return SetUICustomizationError::Validation(error_message.to_string());
}
_ => {}
}
}
return SetUICustomizationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetUICustomizationError {
fn from(err: serde_json::error::Error) -> SetUICustomizationError {
SetUICustomizationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetUICustomizationError {
fn from(err: CredentialsError) -> SetUICustomizationError {
SetUICustomizationError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetUICustomizationError {
fn from(err: HttpDispatchError) -> SetUICustomizationError {
SetUICustomizationError::HttpDispatch(err)
}
}
impl From<io::Error> for SetUICustomizationError {
fn from(err: io::Error) -> SetUICustomizationError {
SetUICustomizationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetUICustomizationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetUICustomizationError {
fn description(&self) -> &str {
match *self {
SetUICustomizationError::InternalError(ref cause) => cause,
SetUICustomizationError::InvalidParameter(ref cause) => cause,
SetUICustomizationError::NotAuthorized(ref cause) => cause,
SetUICustomizationError::ResourceNotFound(ref cause) => cause,
SetUICustomizationError::TooManyRequests(ref cause) => cause,
SetUICustomizationError::Validation(ref cause) => cause,
SetUICustomizationError::Credentials(ref err) => err.description(),
SetUICustomizationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetUICustomizationError::ParseError(ref cause) => cause,
SetUICustomizationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetUserMFAPreferenceError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetUserMFAPreferenceError {
pub fn from_response(res: BufferedHttpResponse) -> SetUserMFAPreferenceError {
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 {
"InternalErrorException" => {
return SetUserMFAPreferenceError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return SetUserMFAPreferenceError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return SetUserMFAPreferenceError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return SetUserMFAPreferenceError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return SetUserMFAPreferenceError::ResourceNotFound(String::from(error_message));
}
"UserNotConfirmedException" => {
return SetUserMFAPreferenceError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return SetUserMFAPreferenceError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return SetUserMFAPreferenceError::Validation(error_message.to_string());
}
_ => {}
}
}
return SetUserMFAPreferenceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetUserMFAPreferenceError {
fn from(err: serde_json::error::Error) -> SetUserMFAPreferenceError {
SetUserMFAPreferenceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetUserMFAPreferenceError {
fn from(err: CredentialsError) -> SetUserMFAPreferenceError {
SetUserMFAPreferenceError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetUserMFAPreferenceError {
fn from(err: HttpDispatchError) -> SetUserMFAPreferenceError {
SetUserMFAPreferenceError::HttpDispatch(err)
}
}
impl From<io::Error> for SetUserMFAPreferenceError {
fn from(err: io::Error) -> SetUserMFAPreferenceError {
SetUserMFAPreferenceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetUserMFAPreferenceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetUserMFAPreferenceError {
fn description(&self) -> &str {
match *self {
SetUserMFAPreferenceError::InternalError(ref cause) => cause,
SetUserMFAPreferenceError::InvalidParameter(ref cause) => cause,
SetUserMFAPreferenceError::NotAuthorized(ref cause) => cause,
SetUserMFAPreferenceError::PasswordResetRequired(ref cause) => cause,
SetUserMFAPreferenceError::ResourceNotFound(ref cause) => cause,
SetUserMFAPreferenceError::UserNotConfirmed(ref cause) => cause,
SetUserMFAPreferenceError::UserNotFound(ref cause) => cause,
SetUserMFAPreferenceError::Validation(ref cause) => cause,
SetUserMFAPreferenceError::Credentials(ref err) => err.description(),
SetUserMFAPreferenceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetUserMFAPreferenceError::ParseError(ref cause) => cause,
SetUserMFAPreferenceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetUserPoolMfaConfigError {
InternalError(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetUserPoolMfaConfigError {
pub fn from_response(res: BufferedHttpResponse) -> SetUserPoolMfaConfigError {
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 {
"InternalErrorException" => {
return SetUserPoolMfaConfigError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return SetUserPoolMfaConfigError::InvalidParameter(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return SetUserPoolMfaConfigError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return SetUserPoolMfaConfigError::InvalidSmsRoleTrustRelationship(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return SetUserPoolMfaConfigError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return SetUserPoolMfaConfigError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return SetUserPoolMfaConfigError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return SetUserPoolMfaConfigError::Validation(error_message.to_string());
}
_ => {}
}
}
return SetUserPoolMfaConfigError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetUserPoolMfaConfigError {
fn from(err: serde_json::error::Error) -> SetUserPoolMfaConfigError {
SetUserPoolMfaConfigError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetUserPoolMfaConfigError {
fn from(err: CredentialsError) -> SetUserPoolMfaConfigError {
SetUserPoolMfaConfigError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetUserPoolMfaConfigError {
fn from(err: HttpDispatchError) -> SetUserPoolMfaConfigError {
SetUserPoolMfaConfigError::HttpDispatch(err)
}
}
impl From<io::Error> for SetUserPoolMfaConfigError {
fn from(err: io::Error) -> SetUserPoolMfaConfigError {
SetUserPoolMfaConfigError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetUserPoolMfaConfigError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetUserPoolMfaConfigError {
fn description(&self) -> &str {
match *self {
SetUserPoolMfaConfigError::InternalError(ref cause) => cause,
SetUserPoolMfaConfigError::InvalidParameter(ref cause) => cause,
SetUserPoolMfaConfigError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
SetUserPoolMfaConfigError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
SetUserPoolMfaConfigError::NotAuthorized(ref cause) => cause,
SetUserPoolMfaConfigError::ResourceNotFound(ref cause) => cause,
SetUserPoolMfaConfigError::TooManyRequests(ref cause) => cause,
SetUserPoolMfaConfigError::Validation(ref cause) => cause,
SetUserPoolMfaConfigError::Credentials(ref err) => err.description(),
SetUserPoolMfaConfigError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetUserPoolMfaConfigError::ParseError(ref cause) => cause,
SetUserPoolMfaConfigError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetUserSettingsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetUserSettingsError {
pub fn from_response(res: BufferedHttpResponse) -> SetUserSettingsError {
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 {
"InternalErrorException" => {
return SetUserSettingsError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return SetUserSettingsError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return SetUserSettingsError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return SetUserSettingsError::PasswordResetRequired(String::from(error_message));
}
"ResourceNotFoundException" => {
return SetUserSettingsError::ResourceNotFound(String::from(error_message));
}
"UserNotConfirmedException" => {
return SetUserSettingsError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return SetUserSettingsError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return SetUserSettingsError::Validation(error_message.to_string());
}
_ => {}
}
}
return SetUserSettingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetUserSettingsError {
fn from(err: serde_json::error::Error) -> SetUserSettingsError {
SetUserSettingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetUserSettingsError {
fn from(err: CredentialsError) -> SetUserSettingsError {
SetUserSettingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetUserSettingsError {
fn from(err: HttpDispatchError) -> SetUserSettingsError {
SetUserSettingsError::HttpDispatch(err)
}
}
impl From<io::Error> for SetUserSettingsError {
fn from(err: io::Error) -> SetUserSettingsError {
SetUserSettingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetUserSettingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetUserSettingsError {
fn description(&self) -> &str {
match *self {
SetUserSettingsError::InternalError(ref cause) => cause,
SetUserSettingsError::InvalidParameter(ref cause) => cause,
SetUserSettingsError::NotAuthorized(ref cause) => cause,
SetUserSettingsError::PasswordResetRequired(ref cause) => cause,
SetUserSettingsError::ResourceNotFound(ref cause) => cause,
SetUserSettingsError::UserNotConfirmed(ref cause) => cause,
SetUserSettingsError::UserNotFound(ref cause) => cause,
SetUserSettingsError::Validation(ref cause) => cause,
SetUserSettingsError::Credentials(ref err) => err.description(),
SetUserSettingsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SetUserSettingsError::ParseError(ref cause) => cause,
SetUserSettingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SignUpError {
CodeDeliveryFailure(String),
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidPassword(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UsernameExists(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SignUpError {
pub fn from_response(res: BufferedHttpResponse) -> SignUpError {
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 {
"CodeDeliveryFailureException" => {
return SignUpError::CodeDeliveryFailure(String::from(error_message));
}
"InternalErrorException" => {
return SignUpError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return SignUpError::InvalidEmailRoleAccessPolicy(String::from(error_message));
}
"InvalidLambdaResponseException" => {
return SignUpError::InvalidLambdaResponse(String::from(error_message));
}
"InvalidParameterException" => {
return SignUpError::InvalidParameter(String::from(error_message));
}
"InvalidPasswordException" => {
return SignUpError::InvalidPassword(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return SignUpError::InvalidSmsRoleAccessPolicy(String::from(error_message));
}
"InvalidSmsRoleTrustRelationshipException" => {
return SignUpError::InvalidSmsRoleTrustRelationship(String::from(error_message));
}
"NotAuthorizedException" => {
return SignUpError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return SignUpError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return SignUpError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return SignUpError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return SignUpError::UserLambdaValidation(String::from(error_message));
}
"UsernameExistsException" => {
return SignUpError::UsernameExists(String::from(error_message));
}
"ValidationException" => return SignUpError::Validation(error_message.to_string()),
_ => {}
}
}
return SignUpError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SignUpError {
fn from(err: serde_json::error::Error) -> SignUpError {
SignUpError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SignUpError {
fn from(err: CredentialsError) -> SignUpError {
SignUpError::Credentials(err)
}
}
impl From<HttpDispatchError> for SignUpError {
fn from(err: HttpDispatchError) -> SignUpError {
SignUpError::HttpDispatch(err)
}
}
impl From<io::Error> for SignUpError {
fn from(err: io::Error) -> SignUpError {
SignUpError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SignUpError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SignUpError {
fn description(&self) -> &str {
match *self {
SignUpError::CodeDeliveryFailure(ref cause) => cause,
SignUpError::InternalError(ref cause) => cause,
SignUpError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
SignUpError::InvalidLambdaResponse(ref cause) => cause,
SignUpError::InvalidParameter(ref cause) => cause,
SignUpError::InvalidPassword(ref cause) => cause,
SignUpError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
SignUpError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
SignUpError::NotAuthorized(ref cause) => cause,
SignUpError::ResourceNotFound(ref cause) => cause,
SignUpError::TooManyRequests(ref cause) => cause,
SignUpError::UnexpectedLambda(ref cause) => cause,
SignUpError::UserLambdaValidation(ref cause) => cause,
SignUpError::UsernameExists(ref cause) => cause,
SignUpError::Validation(ref cause) => cause,
SignUpError::Credentials(ref err) => err.description(),
SignUpError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SignUpError::ParseError(ref cause) => cause,
SignUpError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartUserImportJobError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PreconditionNotMet(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartUserImportJobError {
pub fn from_response(res: BufferedHttpResponse) -> StartUserImportJobError {
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 {
"InternalErrorException" => {
return StartUserImportJobError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return StartUserImportJobError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return StartUserImportJobError::NotAuthorized(String::from(error_message));
}
"PreconditionNotMetException" => {
return StartUserImportJobError::PreconditionNotMet(String::from(error_message));
}
"ResourceNotFoundException" => {
return StartUserImportJobError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return StartUserImportJobError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return StartUserImportJobError::Validation(error_message.to_string());
}
_ => {}
}
}
return StartUserImportJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartUserImportJobError {
fn from(err: serde_json::error::Error) -> StartUserImportJobError {
StartUserImportJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartUserImportJobError {
fn from(err: CredentialsError) -> StartUserImportJobError {
StartUserImportJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartUserImportJobError {
fn from(err: HttpDispatchError) -> StartUserImportJobError {
StartUserImportJobError::HttpDispatch(err)
}
}
impl From<io::Error> for StartUserImportJobError {
fn from(err: io::Error) -> StartUserImportJobError {
StartUserImportJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartUserImportJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartUserImportJobError {
fn description(&self) -> &str {
match *self {
StartUserImportJobError::InternalError(ref cause) => cause,
StartUserImportJobError::InvalidParameter(ref cause) => cause,
StartUserImportJobError::NotAuthorized(ref cause) => cause,
StartUserImportJobError::PreconditionNotMet(ref cause) => cause,
StartUserImportJobError::ResourceNotFound(ref cause) => cause,
StartUserImportJobError::TooManyRequests(ref cause) => cause,
StartUserImportJobError::Validation(ref cause) => cause,
StartUserImportJobError::Credentials(ref err) => err.description(),
StartUserImportJobError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartUserImportJobError::ParseError(ref cause) => cause,
StartUserImportJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StopUserImportJobError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
PreconditionNotMet(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StopUserImportJobError {
pub fn from_response(res: BufferedHttpResponse) -> StopUserImportJobError {
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 {
"InternalErrorException" => {
return StopUserImportJobError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return StopUserImportJobError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return StopUserImportJobError::NotAuthorized(String::from(error_message));
}
"PreconditionNotMetException" => {
return StopUserImportJobError::PreconditionNotMet(String::from(error_message));
}
"ResourceNotFoundException" => {
return StopUserImportJobError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return StopUserImportJobError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return StopUserImportJobError::Validation(error_message.to_string());
}
_ => {}
}
}
return StopUserImportJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StopUserImportJobError {
fn from(err: serde_json::error::Error) -> StopUserImportJobError {
StopUserImportJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StopUserImportJobError {
fn from(err: CredentialsError) -> StopUserImportJobError {
StopUserImportJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for StopUserImportJobError {
fn from(err: HttpDispatchError) -> StopUserImportJobError {
StopUserImportJobError::HttpDispatch(err)
}
}
impl From<io::Error> for StopUserImportJobError {
fn from(err: io::Error) -> StopUserImportJobError {
StopUserImportJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StopUserImportJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StopUserImportJobError {
fn description(&self) -> &str {
match *self {
StopUserImportJobError::InternalError(ref cause) => cause,
StopUserImportJobError::InvalidParameter(ref cause) => cause,
StopUserImportJobError::NotAuthorized(ref cause) => cause,
StopUserImportJobError::PreconditionNotMet(ref cause) => cause,
StopUserImportJobError::ResourceNotFound(ref cause) => cause,
StopUserImportJobError::TooManyRequests(ref cause) => cause,
StopUserImportJobError::Validation(ref cause) => cause,
StopUserImportJobError::Credentials(ref err) => err.description(),
StopUserImportJobError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StopUserImportJobError::ParseError(ref cause) => cause,
StopUserImportJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateAuthEventFeedbackError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotFound(String),
UserPoolAddOnNotEnabled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateAuthEventFeedbackError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateAuthEventFeedbackError {
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 {
"InternalErrorException" => {
return UpdateAuthEventFeedbackError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateAuthEventFeedbackError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return UpdateAuthEventFeedbackError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateAuthEventFeedbackError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return UpdateAuthEventFeedbackError::TooManyRequests(String::from(
error_message,
));
}
"UserNotFoundException" => {
return UpdateAuthEventFeedbackError::UserNotFound(String::from(error_message));
}
"UserPoolAddOnNotEnabledException" => {
return UpdateAuthEventFeedbackError::UserPoolAddOnNotEnabled(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateAuthEventFeedbackError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateAuthEventFeedbackError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateAuthEventFeedbackError {
fn from(err: serde_json::error::Error) -> UpdateAuthEventFeedbackError {
UpdateAuthEventFeedbackError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateAuthEventFeedbackError {
fn from(err: CredentialsError) -> UpdateAuthEventFeedbackError {
UpdateAuthEventFeedbackError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateAuthEventFeedbackError {
fn from(err: HttpDispatchError) -> UpdateAuthEventFeedbackError {
UpdateAuthEventFeedbackError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateAuthEventFeedbackError {
fn from(err: io::Error) -> UpdateAuthEventFeedbackError {
UpdateAuthEventFeedbackError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateAuthEventFeedbackError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateAuthEventFeedbackError {
fn description(&self) -> &str {
match *self {
UpdateAuthEventFeedbackError::InternalError(ref cause) => cause,
UpdateAuthEventFeedbackError::InvalidParameter(ref cause) => cause,
UpdateAuthEventFeedbackError::NotAuthorized(ref cause) => cause,
UpdateAuthEventFeedbackError::ResourceNotFound(ref cause) => cause,
UpdateAuthEventFeedbackError::TooManyRequests(ref cause) => cause,
UpdateAuthEventFeedbackError::UserNotFound(ref cause) => cause,
UpdateAuthEventFeedbackError::UserPoolAddOnNotEnabled(ref cause) => cause,
UpdateAuthEventFeedbackError::Validation(ref cause) => cause,
UpdateAuthEventFeedbackError::Credentials(ref err) => err.description(),
UpdateAuthEventFeedbackError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateAuthEventFeedbackError::ParseError(ref cause) => cause,
UpdateAuthEventFeedbackError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDeviceStatusError {
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDeviceStatusError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDeviceStatusError {
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 {
"InternalErrorException" => {
return UpdateDeviceStatusError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateDeviceStatusError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return UpdateDeviceStatusError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return UpdateDeviceStatusError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return UpdateDeviceStatusError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return UpdateDeviceStatusError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateDeviceStatusError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return UpdateDeviceStatusError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return UpdateDeviceStatusError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return UpdateDeviceStatusError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDeviceStatusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDeviceStatusError {
fn from(err: serde_json::error::Error) -> UpdateDeviceStatusError {
UpdateDeviceStatusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDeviceStatusError {
fn from(err: CredentialsError) -> UpdateDeviceStatusError {
UpdateDeviceStatusError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDeviceStatusError {
fn from(err: HttpDispatchError) -> UpdateDeviceStatusError {
UpdateDeviceStatusError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDeviceStatusError {
fn from(err: io::Error) -> UpdateDeviceStatusError {
UpdateDeviceStatusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDeviceStatusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDeviceStatusError {
fn description(&self) -> &str {
match *self {
UpdateDeviceStatusError::InternalError(ref cause) => cause,
UpdateDeviceStatusError::InvalidParameter(ref cause) => cause,
UpdateDeviceStatusError::InvalidUserPoolConfiguration(ref cause) => cause,
UpdateDeviceStatusError::NotAuthorized(ref cause) => cause,
UpdateDeviceStatusError::PasswordResetRequired(ref cause) => cause,
UpdateDeviceStatusError::ResourceNotFound(ref cause) => cause,
UpdateDeviceStatusError::TooManyRequests(ref cause) => cause,
UpdateDeviceStatusError::UserNotConfirmed(ref cause) => cause,
UpdateDeviceStatusError::UserNotFound(ref cause) => cause,
UpdateDeviceStatusError::Validation(ref cause) => cause,
UpdateDeviceStatusError::Credentials(ref err) => err.description(),
UpdateDeviceStatusError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateDeviceStatusError::ParseError(ref cause) => cause,
UpdateDeviceStatusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateGroupError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateGroupError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateGroupError {
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 {
"InternalErrorException" => {
return UpdateGroupError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateGroupError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return UpdateGroupError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateGroupError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateGroupError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateGroupError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateGroupError {
fn from(err: serde_json::error::Error) -> UpdateGroupError {
UpdateGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateGroupError {
fn from(err: CredentialsError) -> UpdateGroupError {
UpdateGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateGroupError {
fn from(err: HttpDispatchError) -> UpdateGroupError {
UpdateGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateGroupError {
fn from(err: io::Error) -> UpdateGroupError {
UpdateGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateGroupError {
fn description(&self) -> &str {
match *self {
UpdateGroupError::InternalError(ref cause) => cause,
UpdateGroupError::InvalidParameter(ref cause) => cause,
UpdateGroupError::NotAuthorized(ref cause) => cause,
UpdateGroupError::ResourceNotFound(ref cause) => cause,
UpdateGroupError::TooManyRequests(ref cause) => cause,
UpdateGroupError::Validation(ref cause) => cause,
UpdateGroupError::Credentials(ref err) => err.description(),
UpdateGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateGroupError::ParseError(ref cause) => cause,
UpdateGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateIdentityProviderError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UnsupportedIdentityProvider(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateIdentityProviderError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateIdentityProviderError {
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 {
"InternalErrorException" => {
return UpdateIdentityProviderError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateIdentityProviderError::InvalidParameter(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return UpdateIdentityProviderError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateIdentityProviderError::ResourceNotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return UpdateIdentityProviderError::TooManyRequests(String::from(error_message));
}
"UnsupportedIdentityProviderException" => {
return UpdateIdentityProviderError::UnsupportedIdentityProvider(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateIdentityProviderError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateIdentityProviderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateIdentityProviderError {
fn from(err: serde_json::error::Error) -> UpdateIdentityProviderError {
UpdateIdentityProviderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateIdentityProviderError {
fn from(err: CredentialsError) -> UpdateIdentityProviderError {
UpdateIdentityProviderError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateIdentityProviderError {
fn from(err: HttpDispatchError) -> UpdateIdentityProviderError {
UpdateIdentityProviderError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateIdentityProviderError {
fn from(err: io::Error) -> UpdateIdentityProviderError {
UpdateIdentityProviderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateIdentityProviderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateIdentityProviderError {
fn description(&self) -> &str {
match *self {
UpdateIdentityProviderError::InternalError(ref cause) => cause,
UpdateIdentityProviderError::InvalidParameter(ref cause) => cause,
UpdateIdentityProviderError::NotAuthorized(ref cause) => cause,
UpdateIdentityProviderError::ResourceNotFound(ref cause) => cause,
UpdateIdentityProviderError::TooManyRequests(ref cause) => cause,
UpdateIdentityProviderError::UnsupportedIdentityProvider(ref cause) => cause,
UpdateIdentityProviderError::Validation(ref cause) => cause,
UpdateIdentityProviderError::Credentials(ref err) => err.description(),
UpdateIdentityProviderError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateIdentityProviderError::ParseError(ref cause) => cause,
UpdateIdentityProviderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateResourceServerError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateResourceServerError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateResourceServerError {
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 {
"InternalErrorException" => {
return UpdateResourceServerError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateResourceServerError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return UpdateResourceServerError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateResourceServerError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateResourceServerError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateResourceServerError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateResourceServerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateResourceServerError {
fn from(err: serde_json::error::Error) -> UpdateResourceServerError {
UpdateResourceServerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateResourceServerError {
fn from(err: CredentialsError) -> UpdateResourceServerError {
UpdateResourceServerError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateResourceServerError {
fn from(err: HttpDispatchError) -> UpdateResourceServerError {
UpdateResourceServerError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateResourceServerError {
fn from(err: io::Error) -> UpdateResourceServerError {
UpdateResourceServerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateResourceServerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateResourceServerError {
fn description(&self) -> &str {
match *self {
UpdateResourceServerError::InternalError(ref cause) => cause,
UpdateResourceServerError::InvalidParameter(ref cause) => cause,
UpdateResourceServerError::NotAuthorized(ref cause) => cause,
UpdateResourceServerError::ResourceNotFound(ref cause) => cause,
UpdateResourceServerError::TooManyRequests(ref cause) => cause,
UpdateResourceServerError::Validation(ref cause) => cause,
UpdateResourceServerError::Credentials(ref err) => err.description(),
UpdateResourceServerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateResourceServerError::ParseError(ref cause) => cause,
UpdateResourceServerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateUserAttributesError {
AliasExists(String),
CodeDeliveryFailure(String),
CodeMismatch(String),
ExpiredCode(String),
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidLambdaResponse(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UnexpectedLambda(String),
UserLambdaValidation(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateUserAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateUserAttributesError {
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 {
"AliasExistsException" => {
return UpdateUserAttributesError::AliasExists(String::from(error_message));
}
"CodeDeliveryFailureException" => {
return UpdateUserAttributesError::CodeDeliveryFailure(String::from(
error_message,
));
}
"CodeMismatchException" => {
return UpdateUserAttributesError::CodeMismatch(String::from(error_message));
}
"ExpiredCodeException" => {
return UpdateUserAttributesError::ExpiredCode(String::from(error_message));
}
"InternalErrorException" => {
return UpdateUserAttributesError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return UpdateUserAttributesError::InvalidEmailRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidLambdaResponseException" => {
return UpdateUserAttributesError::InvalidLambdaResponse(String::from(
error_message,
));
}
"InvalidParameterException" => {
return UpdateUserAttributesError::InvalidParameter(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return UpdateUserAttributesError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return UpdateUserAttributesError::InvalidSmsRoleTrustRelationship(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return UpdateUserAttributesError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return UpdateUserAttributesError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return UpdateUserAttributesError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateUserAttributesError::TooManyRequests(String::from(error_message));
}
"UnexpectedLambdaException" => {
return UpdateUserAttributesError::UnexpectedLambda(String::from(error_message));
}
"UserLambdaValidationException" => {
return UpdateUserAttributesError::UserLambdaValidation(String::from(
error_message,
));
}
"UserNotConfirmedException" => {
return UpdateUserAttributesError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return UpdateUserAttributesError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return UpdateUserAttributesError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateUserAttributesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateUserAttributesError {
fn from(err: serde_json::error::Error) -> UpdateUserAttributesError {
UpdateUserAttributesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateUserAttributesError {
fn from(err: CredentialsError) -> UpdateUserAttributesError {
UpdateUserAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateUserAttributesError {
fn from(err: HttpDispatchError) -> UpdateUserAttributesError {
UpdateUserAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateUserAttributesError {
fn from(err: io::Error) -> UpdateUserAttributesError {
UpdateUserAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateUserAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateUserAttributesError {
fn description(&self) -> &str {
match *self {
UpdateUserAttributesError::AliasExists(ref cause) => cause,
UpdateUserAttributesError::CodeDeliveryFailure(ref cause) => cause,
UpdateUserAttributesError::CodeMismatch(ref cause) => cause,
UpdateUserAttributesError::ExpiredCode(ref cause) => cause,
UpdateUserAttributesError::InternalError(ref cause) => cause,
UpdateUserAttributesError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
UpdateUserAttributesError::InvalidLambdaResponse(ref cause) => cause,
UpdateUserAttributesError::InvalidParameter(ref cause) => cause,
UpdateUserAttributesError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
UpdateUserAttributesError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
UpdateUserAttributesError::NotAuthorized(ref cause) => cause,
UpdateUserAttributesError::PasswordResetRequired(ref cause) => cause,
UpdateUserAttributesError::ResourceNotFound(ref cause) => cause,
UpdateUserAttributesError::TooManyRequests(ref cause) => cause,
UpdateUserAttributesError::UnexpectedLambda(ref cause) => cause,
UpdateUserAttributesError::UserLambdaValidation(ref cause) => cause,
UpdateUserAttributesError::UserNotConfirmed(ref cause) => cause,
UpdateUserAttributesError::UserNotFound(ref cause) => cause,
UpdateUserAttributesError::Validation(ref cause) => cause,
UpdateUserAttributesError::Credentials(ref err) => err.description(),
UpdateUserAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateUserAttributesError::ParseError(ref cause) => cause,
UpdateUserAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateUserPoolError {
ConcurrentModification(String),
InternalError(String),
InvalidEmailRoleAccessPolicy(String),
InvalidParameter(String),
InvalidSmsRoleAccessPolicy(String),
InvalidSmsRoleTrustRelationship(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
UserImportInProgress(String),
UserPoolTagging(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateUserPoolError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateUserPoolError {
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 {
"ConcurrentModificationException" => {
return UpdateUserPoolError::ConcurrentModification(String::from(error_message));
}
"InternalErrorException" => {
return UpdateUserPoolError::InternalError(String::from(error_message));
}
"InvalidEmailRoleAccessPolicyException" => {
return UpdateUserPoolError::InvalidEmailRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidParameterException" => {
return UpdateUserPoolError::InvalidParameter(String::from(error_message));
}
"InvalidSmsRoleAccessPolicyException" => {
return UpdateUserPoolError::InvalidSmsRoleAccessPolicy(String::from(
error_message,
));
}
"InvalidSmsRoleTrustRelationshipException" => {
return UpdateUserPoolError::InvalidSmsRoleTrustRelationship(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return UpdateUserPoolError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateUserPoolError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateUserPoolError::TooManyRequests(String::from(error_message));
}
"UserImportInProgressException" => {
return UpdateUserPoolError::UserImportInProgress(String::from(error_message));
}
"UserPoolTaggingException" => {
return UpdateUserPoolError::UserPoolTagging(String::from(error_message));
}
"ValidationException" => {
return UpdateUserPoolError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateUserPoolError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateUserPoolError {
fn from(err: serde_json::error::Error) -> UpdateUserPoolError {
UpdateUserPoolError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateUserPoolError {
fn from(err: CredentialsError) -> UpdateUserPoolError {
UpdateUserPoolError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateUserPoolError {
fn from(err: HttpDispatchError) -> UpdateUserPoolError {
UpdateUserPoolError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateUserPoolError {
fn from(err: io::Error) -> UpdateUserPoolError {
UpdateUserPoolError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateUserPoolError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateUserPoolError {
fn description(&self) -> &str {
match *self {
UpdateUserPoolError::ConcurrentModification(ref cause) => cause,
UpdateUserPoolError::InternalError(ref cause) => cause,
UpdateUserPoolError::InvalidEmailRoleAccessPolicy(ref cause) => cause,
UpdateUserPoolError::InvalidParameter(ref cause) => cause,
UpdateUserPoolError::InvalidSmsRoleAccessPolicy(ref cause) => cause,
UpdateUserPoolError::InvalidSmsRoleTrustRelationship(ref cause) => cause,
UpdateUserPoolError::NotAuthorized(ref cause) => cause,
UpdateUserPoolError::ResourceNotFound(ref cause) => cause,
UpdateUserPoolError::TooManyRequests(ref cause) => cause,
UpdateUserPoolError::UserImportInProgress(ref cause) => cause,
UpdateUserPoolError::UserPoolTagging(ref cause) => cause,
UpdateUserPoolError::Validation(ref cause) => cause,
UpdateUserPoolError::Credentials(ref err) => err.description(),
UpdateUserPoolError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateUserPoolError::ParseError(ref cause) => cause,
UpdateUserPoolError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateUserPoolClientError {
ConcurrentModification(String),
InternalError(String),
InvalidOAuthFlow(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
ScopeDoesNotExist(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateUserPoolClientError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateUserPoolClientError {
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 {
"ConcurrentModificationException" => {
return UpdateUserPoolClientError::ConcurrentModification(String::from(
error_message,
));
}
"InternalErrorException" => {
return UpdateUserPoolClientError::InternalError(String::from(error_message));
}
"InvalidOAuthFlowException" => {
return UpdateUserPoolClientError::InvalidOAuthFlow(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateUserPoolClientError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return UpdateUserPoolClientError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateUserPoolClientError::ResourceNotFound(String::from(error_message));
}
"ScopeDoesNotExistException" => {
return UpdateUserPoolClientError::ScopeDoesNotExist(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateUserPoolClientError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateUserPoolClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateUserPoolClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateUserPoolClientError {
fn from(err: serde_json::error::Error) -> UpdateUserPoolClientError {
UpdateUserPoolClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateUserPoolClientError {
fn from(err: CredentialsError) -> UpdateUserPoolClientError {
UpdateUserPoolClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateUserPoolClientError {
fn from(err: HttpDispatchError) -> UpdateUserPoolClientError {
UpdateUserPoolClientError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateUserPoolClientError {
fn from(err: io::Error) -> UpdateUserPoolClientError {
UpdateUserPoolClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateUserPoolClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateUserPoolClientError {
fn description(&self) -> &str {
match *self {
UpdateUserPoolClientError::ConcurrentModification(ref cause) => cause,
UpdateUserPoolClientError::InternalError(ref cause) => cause,
UpdateUserPoolClientError::InvalidOAuthFlow(ref cause) => cause,
UpdateUserPoolClientError::InvalidParameter(ref cause) => cause,
UpdateUserPoolClientError::NotAuthorized(ref cause) => cause,
UpdateUserPoolClientError::ResourceNotFound(ref cause) => cause,
UpdateUserPoolClientError::ScopeDoesNotExist(ref cause) => cause,
UpdateUserPoolClientError::TooManyRequests(ref cause) => cause,
UpdateUserPoolClientError::Validation(ref cause) => cause,
UpdateUserPoolClientError::Credentials(ref err) => err.description(),
UpdateUserPoolClientError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateUserPoolClientError::ParseError(ref cause) => cause,
UpdateUserPoolClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateUserPoolDomainError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateUserPoolDomainError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateUserPoolDomainError {
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 {
"InternalErrorException" => {
return UpdateUserPoolDomainError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return UpdateUserPoolDomainError::InvalidParameter(String::from(error_message));
}
"NotAuthorizedException" => {
return UpdateUserPoolDomainError::NotAuthorized(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateUserPoolDomainError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return UpdateUserPoolDomainError::TooManyRequests(String::from(error_message));
}
"ValidationException" => {
return UpdateUserPoolDomainError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateUserPoolDomainError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateUserPoolDomainError {
fn from(err: serde_json::error::Error) -> UpdateUserPoolDomainError {
UpdateUserPoolDomainError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateUserPoolDomainError {
fn from(err: CredentialsError) -> UpdateUserPoolDomainError {
UpdateUserPoolDomainError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateUserPoolDomainError {
fn from(err: HttpDispatchError) -> UpdateUserPoolDomainError {
UpdateUserPoolDomainError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateUserPoolDomainError {
fn from(err: io::Error) -> UpdateUserPoolDomainError {
UpdateUserPoolDomainError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateUserPoolDomainError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateUserPoolDomainError {
fn description(&self) -> &str {
match *self {
UpdateUserPoolDomainError::InternalError(ref cause) => cause,
UpdateUserPoolDomainError::InvalidParameter(ref cause) => cause,
UpdateUserPoolDomainError::NotAuthorized(ref cause) => cause,
UpdateUserPoolDomainError::ResourceNotFound(ref cause) => cause,
UpdateUserPoolDomainError::TooManyRequests(ref cause) => cause,
UpdateUserPoolDomainError::Validation(ref cause) => cause,
UpdateUserPoolDomainError::Credentials(ref err) => err.description(),
UpdateUserPoolDomainError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateUserPoolDomainError::ParseError(ref cause) => cause,
UpdateUserPoolDomainError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum VerifySoftwareTokenError {
CodeMismatch(String),
EnableSoftwareTokenMFA(String),
InternalError(String),
InvalidParameter(String),
InvalidUserPoolConfiguration(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
SoftwareTokenMFANotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl VerifySoftwareTokenError {
pub fn from_response(res: BufferedHttpResponse) -> VerifySoftwareTokenError {
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 {
"CodeMismatchException" => {
return VerifySoftwareTokenError::CodeMismatch(String::from(error_message));
}
"EnableSoftwareTokenMFAException" => {
return VerifySoftwareTokenError::EnableSoftwareTokenMFA(String::from(
error_message,
));
}
"InternalErrorException" => {
return VerifySoftwareTokenError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return VerifySoftwareTokenError::InvalidParameter(String::from(error_message));
}
"InvalidUserPoolConfigurationException" => {
return VerifySoftwareTokenError::InvalidUserPoolConfiguration(String::from(
error_message,
));
}
"NotAuthorizedException" => {
return VerifySoftwareTokenError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return VerifySoftwareTokenError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return VerifySoftwareTokenError::ResourceNotFound(String::from(error_message));
}
"SoftwareTokenMFANotFoundException" => {
return VerifySoftwareTokenError::SoftwareTokenMFANotFound(String::from(
error_message,
));
}
"TooManyRequestsException" => {
return VerifySoftwareTokenError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return VerifySoftwareTokenError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return VerifySoftwareTokenError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return VerifySoftwareTokenError::Validation(error_message.to_string());
}
_ => {}
}
}
return VerifySoftwareTokenError::Unknown(res);
}
}
impl From<serde_json::error::Error> for VerifySoftwareTokenError {
fn from(err: serde_json::error::Error) -> VerifySoftwareTokenError {
VerifySoftwareTokenError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for VerifySoftwareTokenError {
fn from(err: CredentialsError) -> VerifySoftwareTokenError {
VerifySoftwareTokenError::Credentials(err)
}
}
impl From<HttpDispatchError> for VerifySoftwareTokenError {
fn from(err: HttpDispatchError) -> VerifySoftwareTokenError {
VerifySoftwareTokenError::HttpDispatch(err)
}
}
impl From<io::Error> for VerifySoftwareTokenError {
fn from(err: io::Error) -> VerifySoftwareTokenError {
VerifySoftwareTokenError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for VerifySoftwareTokenError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for VerifySoftwareTokenError {
fn description(&self) -> &str {
match *self {
VerifySoftwareTokenError::CodeMismatch(ref cause) => cause,
VerifySoftwareTokenError::EnableSoftwareTokenMFA(ref cause) => cause,
VerifySoftwareTokenError::InternalError(ref cause) => cause,
VerifySoftwareTokenError::InvalidParameter(ref cause) => cause,
VerifySoftwareTokenError::InvalidUserPoolConfiguration(ref cause) => cause,
VerifySoftwareTokenError::NotAuthorized(ref cause) => cause,
VerifySoftwareTokenError::PasswordResetRequired(ref cause) => cause,
VerifySoftwareTokenError::ResourceNotFound(ref cause) => cause,
VerifySoftwareTokenError::SoftwareTokenMFANotFound(ref cause) => cause,
VerifySoftwareTokenError::TooManyRequests(ref cause) => cause,
VerifySoftwareTokenError::UserNotConfirmed(ref cause) => cause,
VerifySoftwareTokenError::UserNotFound(ref cause) => cause,
VerifySoftwareTokenError::Validation(ref cause) => cause,
VerifySoftwareTokenError::Credentials(ref err) => err.description(),
VerifySoftwareTokenError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
VerifySoftwareTokenError::ParseError(ref cause) => cause,
VerifySoftwareTokenError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum VerifyUserAttributeError {
CodeMismatch(String),
ExpiredCode(String),
InternalError(String),
InvalidParameter(String),
LimitExceeded(String),
NotAuthorized(String),
PasswordResetRequired(String),
ResourceNotFound(String),
TooManyRequests(String),
UserNotConfirmed(String),
UserNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl VerifyUserAttributeError {
pub fn from_response(res: BufferedHttpResponse) -> VerifyUserAttributeError {
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 {
"CodeMismatchException" => {
return VerifyUserAttributeError::CodeMismatch(String::from(error_message));
}
"ExpiredCodeException" => {
return VerifyUserAttributeError::ExpiredCode(String::from(error_message));
}
"InternalErrorException" => {
return VerifyUserAttributeError::InternalError(String::from(error_message));
}
"InvalidParameterException" => {
return VerifyUserAttributeError::InvalidParameter(String::from(error_message));
}
"LimitExceededException" => {
return VerifyUserAttributeError::LimitExceeded(String::from(error_message));
}
"NotAuthorizedException" => {
return VerifyUserAttributeError::NotAuthorized(String::from(error_message));
}
"PasswordResetRequiredException" => {
return VerifyUserAttributeError::PasswordResetRequired(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return VerifyUserAttributeError::ResourceNotFound(String::from(error_message));
}
"TooManyRequestsException" => {
return VerifyUserAttributeError::TooManyRequests(String::from(error_message));
}
"UserNotConfirmedException" => {
return VerifyUserAttributeError::UserNotConfirmed(String::from(error_message));
}
"UserNotFoundException" => {
return VerifyUserAttributeError::UserNotFound(String::from(error_message));
}
"ValidationException" => {
return VerifyUserAttributeError::Validation(error_message.to_string());
}
_ => {}
}
}
return VerifyUserAttributeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for VerifyUserAttributeError {
fn from(err: serde_json::error::Error) -> VerifyUserAttributeError {
VerifyUserAttributeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for VerifyUserAttributeError {
fn from(err: CredentialsError) -> VerifyUserAttributeError {
VerifyUserAttributeError::Credentials(err)
}
}
impl From<HttpDispatchError> for VerifyUserAttributeError {
fn from(err: HttpDispatchError) -> VerifyUserAttributeError {
VerifyUserAttributeError::HttpDispatch(err)
}
}
impl From<io::Error> for VerifyUserAttributeError {
fn from(err: io::Error) -> VerifyUserAttributeError {
VerifyUserAttributeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for VerifyUserAttributeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for VerifyUserAttributeError {
fn description(&self) -> &str {
match *self {
VerifyUserAttributeError::CodeMismatch(ref cause) => cause,
VerifyUserAttributeError::ExpiredCode(ref cause) => cause,
VerifyUserAttributeError::InternalError(ref cause) => cause,
VerifyUserAttributeError::InvalidParameter(ref cause) => cause,
VerifyUserAttributeError::LimitExceeded(ref cause) => cause,
VerifyUserAttributeError::NotAuthorized(ref cause) => cause,
VerifyUserAttributeError::PasswordResetRequired(ref cause) => cause,
VerifyUserAttributeError::ResourceNotFound(ref cause) => cause,
VerifyUserAttributeError::TooManyRequests(ref cause) => cause,
VerifyUserAttributeError::UserNotConfirmed(ref cause) => cause,
VerifyUserAttributeError::UserNotFound(ref cause) => cause,
VerifyUserAttributeError::Validation(ref cause) => cause,
VerifyUserAttributeError::Credentials(ref err) => err.description(),
VerifyUserAttributeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
VerifyUserAttributeError::ParseError(ref cause) => cause,
VerifyUserAttributeError::Unknown(_) => "unknown error",
}
}
}
pub trait CognitoIdentityProvider {
fn add_custom_attributes(
&self,
input: AddCustomAttributesRequest,
) -> RusotoFuture<AddCustomAttributesResponse, AddCustomAttributesError>;
fn admin_add_user_to_group(
&self,
input: AdminAddUserToGroupRequest,
) -> RusotoFuture<(), AdminAddUserToGroupError>;
fn admin_confirm_sign_up(
&self,
input: AdminConfirmSignUpRequest,
) -> RusotoFuture<AdminConfirmSignUpResponse, AdminConfirmSignUpError>;
fn admin_create_user(
&self,
input: AdminCreateUserRequest,
) -> RusotoFuture<AdminCreateUserResponse, AdminCreateUserError>;
fn admin_delete_user(
&self,
input: AdminDeleteUserRequest,
) -> RusotoFuture<(), AdminDeleteUserError>;
fn admin_delete_user_attributes(
&self,
input: AdminDeleteUserAttributesRequest,
) -> RusotoFuture<AdminDeleteUserAttributesResponse, AdminDeleteUserAttributesError>;
fn admin_disable_provider_for_user(
&self,
input: AdminDisableProviderForUserRequest,
) -> RusotoFuture<AdminDisableProviderForUserResponse, AdminDisableProviderForUserError>;
fn admin_disable_user(
&self,
input: AdminDisableUserRequest,
) -> RusotoFuture<AdminDisableUserResponse, AdminDisableUserError>;
fn admin_enable_user(
&self,
input: AdminEnableUserRequest,
) -> RusotoFuture<AdminEnableUserResponse, AdminEnableUserError>;
fn admin_forget_device(
&self,
input: AdminForgetDeviceRequest,
) -> RusotoFuture<(), AdminForgetDeviceError>;
fn admin_get_device(
&self,
input: AdminGetDeviceRequest,
) -> RusotoFuture<AdminGetDeviceResponse, AdminGetDeviceError>;
fn admin_get_user(
&self,
input: AdminGetUserRequest,
) -> RusotoFuture<AdminGetUserResponse, AdminGetUserError>;
fn admin_initiate_auth(
&self,
input: AdminInitiateAuthRequest,
) -> RusotoFuture<AdminInitiateAuthResponse, AdminInitiateAuthError>;
fn admin_link_provider_for_user(
&self,
input: AdminLinkProviderForUserRequest,
) -> RusotoFuture<AdminLinkProviderForUserResponse, AdminLinkProviderForUserError>;
fn admin_list_devices(
&self,
input: AdminListDevicesRequest,
) -> RusotoFuture<AdminListDevicesResponse, AdminListDevicesError>;
fn admin_list_groups_for_user(
&self,
input: AdminListGroupsForUserRequest,
) -> RusotoFuture<AdminListGroupsForUserResponse, AdminListGroupsForUserError>;
fn admin_list_user_auth_events(
&self,
input: AdminListUserAuthEventsRequest,
) -> RusotoFuture<AdminListUserAuthEventsResponse, AdminListUserAuthEventsError>;
fn admin_remove_user_from_group(
&self,
input: AdminRemoveUserFromGroupRequest,
) -> RusotoFuture<(), AdminRemoveUserFromGroupError>;
fn admin_reset_user_password(
&self,
input: AdminResetUserPasswordRequest,
) -> RusotoFuture<AdminResetUserPasswordResponse, AdminResetUserPasswordError>;
fn admin_respond_to_auth_challenge(
&self,
input: AdminRespondToAuthChallengeRequest,
) -> RusotoFuture<AdminRespondToAuthChallengeResponse, AdminRespondToAuthChallengeError>;
fn admin_set_user_mfa_preference(
&self,
input: AdminSetUserMFAPreferenceRequest,
) -> RusotoFuture<AdminSetUserMFAPreferenceResponse, AdminSetUserMFAPreferenceError>;
fn admin_set_user_settings(
&self,
input: AdminSetUserSettingsRequest,
) -> RusotoFuture<AdminSetUserSettingsResponse, AdminSetUserSettingsError>;
fn admin_update_auth_event_feedback(
&self,
input: AdminUpdateAuthEventFeedbackRequest,
) -> RusotoFuture<AdminUpdateAuthEventFeedbackResponse, AdminUpdateAuthEventFeedbackError>;
fn admin_update_device_status(
&self,
input: AdminUpdateDeviceStatusRequest,
) -> RusotoFuture<AdminUpdateDeviceStatusResponse, AdminUpdateDeviceStatusError>;
fn admin_update_user_attributes(
&self,
input: AdminUpdateUserAttributesRequest,
) -> RusotoFuture<AdminUpdateUserAttributesResponse, AdminUpdateUserAttributesError>;
fn admin_user_global_sign_out(
&self,
input: AdminUserGlobalSignOutRequest,
) -> RusotoFuture<AdminUserGlobalSignOutResponse, AdminUserGlobalSignOutError>;
fn associate_software_token(
&self,
input: AssociateSoftwareTokenRequest,
) -> RusotoFuture<AssociateSoftwareTokenResponse, AssociateSoftwareTokenError>;
fn change_password(
&self,
input: ChangePasswordRequest,
) -> RusotoFuture<ChangePasswordResponse, ChangePasswordError>;
fn confirm_device(
&self,
input: ConfirmDeviceRequest,
) -> RusotoFuture<ConfirmDeviceResponse, ConfirmDeviceError>;
fn confirm_forgot_password(
&self,
input: ConfirmForgotPasswordRequest,
) -> RusotoFuture<ConfirmForgotPasswordResponse, ConfirmForgotPasswordError>;
fn confirm_sign_up(
&self,
input: ConfirmSignUpRequest,
) -> RusotoFuture<ConfirmSignUpResponse, ConfirmSignUpError>;
fn create_group(
&self,
input: CreateGroupRequest,
) -> RusotoFuture<CreateGroupResponse, CreateGroupError>;
fn create_identity_provider(
&self,
input: CreateIdentityProviderRequest,
) -> RusotoFuture<CreateIdentityProviderResponse, CreateIdentityProviderError>;
fn create_resource_server(
&self,
input: CreateResourceServerRequest,
) -> RusotoFuture<CreateResourceServerResponse, CreateResourceServerError>;
fn create_user_import_job(
&self,
input: CreateUserImportJobRequest,
) -> RusotoFuture<CreateUserImportJobResponse, CreateUserImportJobError>;
fn create_user_pool(
&self,
input: CreateUserPoolRequest,
) -> RusotoFuture<CreateUserPoolResponse, CreateUserPoolError>;
fn create_user_pool_client(
&self,
input: CreateUserPoolClientRequest,
) -> RusotoFuture<CreateUserPoolClientResponse, CreateUserPoolClientError>;
fn create_user_pool_domain(
&self,
input: CreateUserPoolDomainRequest,
) -> RusotoFuture<CreateUserPoolDomainResponse, CreateUserPoolDomainError>;
fn delete_group(&self, input: DeleteGroupRequest) -> RusotoFuture<(), DeleteGroupError>;
fn delete_identity_provider(
&self,
input: DeleteIdentityProviderRequest,
) -> RusotoFuture<(), DeleteIdentityProviderError>;
fn delete_resource_server(
&self,
input: DeleteResourceServerRequest,
) -> RusotoFuture<(), DeleteResourceServerError>;
fn delete_user(&self, input: DeleteUserRequest) -> RusotoFuture<(), DeleteUserError>;
fn delete_user_attributes(
&self,
input: DeleteUserAttributesRequest,
) -> RusotoFuture<DeleteUserAttributesResponse, DeleteUserAttributesError>;
fn delete_user_pool(
&self,
input: DeleteUserPoolRequest,
) -> RusotoFuture<(), DeleteUserPoolError>;
fn delete_user_pool_client(
&self,
input: DeleteUserPoolClientRequest,
) -> RusotoFuture<(), DeleteUserPoolClientError>;
fn delete_user_pool_domain(
&self,
input: DeleteUserPoolDomainRequest,
) -> RusotoFuture<DeleteUserPoolDomainResponse, DeleteUserPoolDomainError>;
fn describe_identity_provider(
&self,
input: DescribeIdentityProviderRequest,
) -> RusotoFuture<DescribeIdentityProviderResponse, DescribeIdentityProviderError>;
fn describe_resource_server(
&self,
input: DescribeResourceServerRequest,
) -> RusotoFuture<DescribeResourceServerResponse, DescribeResourceServerError>;
fn describe_risk_configuration(
&self,
input: DescribeRiskConfigurationRequest,
) -> RusotoFuture<DescribeRiskConfigurationResponse, DescribeRiskConfigurationError>;
fn describe_user_import_job(
&self,
input: DescribeUserImportJobRequest,
) -> RusotoFuture<DescribeUserImportJobResponse, DescribeUserImportJobError>;
fn describe_user_pool(
&self,
input: DescribeUserPoolRequest,
) -> RusotoFuture<DescribeUserPoolResponse, DescribeUserPoolError>;
fn describe_user_pool_client(
&self,
input: DescribeUserPoolClientRequest,
) -> RusotoFuture<DescribeUserPoolClientResponse, DescribeUserPoolClientError>;
fn describe_user_pool_domain(
&self,
input: DescribeUserPoolDomainRequest,
) -> RusotoFuture<DescribeUserPoolDomainResponse, DescribeUserPoolDomainError>;
fn forget_device(&self, input: ForgetDeviceRequest) -> RusotoFuture<(), ForgetDeviceError>;
fn forgot_password(
&self,
input: ForgotPasswordRequest,
) -> RusotoFuture<ForgotPasswordResponse, ForgotPasswordError>;
fn get_csv_header(
&self,
input: GetCSVHeaderRequest,
) -> RusotoFuture<GetCSVHeaderResponse, GetCSVHeaderError>;
fn get_device(
&self,
input: GetDeviceRequest,
) -> RusotoFuture<GetDeviceResponse, GetDeviceError>;
fn get_group(&self, input: GetGroupRequest) -> RusotoFuture<GetGroupResponse, GetGroupError>;
fn get_identity_provider_by_identifier(
&self,
input: GetIdentityProviderByIdentifierRequest,
) -> RusotoFuture<GetIdentityProviderByIdentifierResponse, GetIdentityProviderByIdentifierError>;
fn get_signing_certificate(
&self,
input: GetSigningCertificateRequest,
) -> RusotoFuture<GetSigningCertificateResponse, GetSigningCertificateError>;
fn get_ui_customization(
&self,
input: GetUICustomizationRequest,
) -> RusotoFuture<GetUICustomizationResponse, GetUICustomizationError>;
fn get_user(&self, input: GetUserRequest) -> RusotoFuture<GetUserResponse, GetUserError>;
fn get_user_attribute_verification_code(
&self,
input: GetUserAttributeVerificationCodeRequest,
) -> RusotoFuture<GetUserAttributeVerificationCodeResponse, GetUserAttributeVerificationCodeError>;
fn get_user_pool_mfa_config(
&self,
input: GetUserPoolMfaConfigRequest,
) -> RusotoFuture<GetUserPoolMfaConfigResponse, GetUserPoolMfaConfigError>;
fn global_sign_out(
&self,
input: GlobalSignOutRequest,
) -> RusotoFuture<GlobalSignOutResponse, GlobalSignOutError>;
fn initiate_auth(
&self,
input: InitiateAuthRequest,
) -> RusotoFuture<InitiateAuthResponse, InitiateAuthError>;
fn list_devices(
&self,
input: ListDevicesRequest,
) -> RusotoFuture<ListDevicesResponse, ListDevicesError>;
fn list_groups(
&self,
input: ListGroupsRequest,
) -> RusotoFuture<ListGroupsResponse, ListGroupsError>;
fn list_identity_providers(
&self,
input: ListIdentityProvidersRequest,
) -> RusotoFuture<ListIdentityProvidersResponse, ListIdentityProvidersError>;
fn list_resource_servers(
&self,
input: ListResourceServersRequest,
) -> RusotoFuture<ListResourceServersResponse, ListResourceServersError>;
fn list_user_import_jobs(
&self,
input: ListUserImportJobsRequest,
) -> RusotoFuture<ListUserImportJobsResponse, ListUserImportJobsError>;
fn list_user_pool_clients(
&self,
input: ListUserPoolClientsRequest,
) -> RusotoFuture<ListUserPoolClientsResponse, ListUserPoolClientsError>;
fn list_user_pools(
&self,
input: ListUserPoolsRequest,
) -> RusotoFuture<ListUserPoolsResponse, ListUserPoolsError>;
fn list_users(
&self,
input: ListUsersRequest,
) -> RusotoFuture<ListUsersResponse, ListUsersError>;
fn list_users_in_group(
&self,
input: ListUsersInGroupRequest,
) -> RusotoFuture<ListUsersInGroupResponse, ListUsersInGroupError>;
fn resend_confirmation_code(
&self,
input: ResendConfirmationCodeRequest,
) -> RusotoFuture<ResendConfirmationCodeResponse, ResendConfirmationCodeError>;
fn respond_to_auth_challenge(
&self,
input: RespondToAuthChallengeRequest,
) -> RusotoFuture<RespondToAuthChallengeResponse, RespondToAuthChallengeError>;
fn set_risk_configuration(
&self,
input: SetRiskConfigurationRequest,
) -> RusotoFuture<SetRiskConfigurationResponse, SetRiskConfigurationError>;
fn set_ui_customization(
&self,
input: SetUICustomizationRequest,
) -> RusotoFuture<SetUICustomizationResponse, SetUICustomizationError>;
fn set_user_mfa_preference(
&self,
input: SetUserMFAPreferenceRequest,
) -> RusotoFuture<SetUserMFAPreferenceResponse, SetUserMFAPreferenceError>;
fn set_user_pool_mfa_config(
&self,
input: SetUserPoolMfaConfigRequest,
) -> RusotoFuture<SetUserPoolMfaConfigResponse, SetUserPoolMfaConfigError>;
fn set_user_settings(
&self,
input: SetUserSettingsRequest,
) -> RusotoFuture<SetUserSettingsResponse, SetUserSettingsError>;
fn sign_up(&self, input: SignUpRequest) -> RusotoFuture<SignUpResponse, SignUpError>;
fn start_user_import_job(
&self,
input: StartUserImportJobRequest,
) -> RusotoFuture<StartUserImportJobResponse, StartUserImportJobError>;
fn stop_user_import_job(
&self,
input: StopUserImportJobRequest,
) -> RusotoFuture<StopUserImportJobResponse, StopUserImportJobError>;
fn update_auth_event_feedback(
&self,
input: UpdateAuthEventFeedbackRequest,
) -> RusotoFuture<UpdateAuthEventFeedbackResponse, UpdateAuthEventFeedbackError>;
fn update_device_status(
&self,
input: UpdateDeviceStatusRequest,
) -> RusotoFuture<UpdateDeviceStatusResponse, UpdateDeviceStatusError>;
fn update_group(
&self,
input: UpdateGroupRequest,
) -> RusotoFuture<UpdateGroupResponse, UpdateGroupError>;
fn update_identity_provider(
&self,
input: UpdateIdentityProviderRequest,
) -> RusotoFuture<UpdateIdentityProviderResponse, UpdateIdentityProviderError>;
fn update_resource_server(
&self,
input: UpdateResourceServerRequest,
) -> RusotoFuture<UpdateResourceServerResponse, UpdateResourceServerError>;
fn update_user_attributes(
&self,
input: UpdateUserAttributesRequest,
) -> RusotoFuture<UpdateUserAttributesResponse, UpdateUserAttributesError>;
fn update_user_pool(
&self,
input: UpdateUserPoolRequest,
) -> RusotoFuture<UpdateUserPoolResponse, UpdateUserPoolError>;
fn update_user_pool_client(
&self,
input: UpdateUserPoolClientRequest,
) -> RusotoFuture<UpdateUserPoolClientResponse, UpdateUserPoolClientError>;
fn update_user_pool_domain(
&self,
input: UpdateUserPoolDomainRequest,
) -> RusotoFuture<UpdateUserPoolDomainResponse, UpdateUserPoolDomainError>;
fn verify_software_token(
&self,
input: VerifySoftwareTokenRequest,
) -> RusotoFuture<VerifySoftwareTokenResponse, VerifySoftwareTokenError>;
fn verify_user_attribute(
&self,
input: VerifyUserAttributeRequest,
) -> RusotoFuture<VerifyUserAttributeResponse, VerifyUserAttributeError>;
}
#[derive(Clone)]
pub struct CognitoIdentityProviderClient {
client: Client,
region: region::Region,
}
impl CognitoIdentityProviderClient {
pub fn new(region: region::Region) -> CognitoIdentityProviderClient {
CognitoIdentityProviderClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CognitoIdentityProviderClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CognitoIdentityProviderClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl CognitoIdentityProvider for CognitoIdentityProviderClient {
fn add_custom_attributes(
&self,
input: AddCustomAttributesRequest,
) -> RusotoFuture<AddCustomAttributesResponse, AddCustomAttributesError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AddCustomAttributes",
);
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::<AddCustomAttributesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AddCustomAttributesError::from_response(response))
}),
)
}
})
}
fn admin_add_user_to_group(
&self,
input: AdminAddUserToGroupRequest,
) -> RusotoFuture<(), AdminAddUserToGroupError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminAddUserToGroup",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AdminAddUserToGroupError::from_response(response))
}),
)
}
})
}
fn admin_confirm_sign_up(
&self,
input: AdminConfirmSignUpRequest,
) -> RusotoFuture<AdminConfirmSignUpResponse, AdminConfirmSignUpError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminConfirmSignUp",
);
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::<AdminConfirmSignUpResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminConfirmSignUpError::from_response(response))),
)
}
})
}
fn admin_create_user(
&self,
input: AdminCreateUserRequest,
) -> RusotoFuture<AdminCreateUserResponse, AdminCreateUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminCreateUser",
);
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::<AdminCreateUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminCreateUserError::from_response(response))),
)
}
})
}
fn admin_delete_user(
&self,
input: AdminDeleteUserRequest,
) -> RusotoFuture<(), AdminDeleteUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminDeleteUser",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminDeleteUserError::from_response(response))),
)
}
})
}
fn admin_delete_user_attributes(
&self,
input: AdminDeleteUserAttributesRequest,
) -> RusotoFuture<AdminDeleteUserAttributesResponse, AdminDeleteUserAttributesError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminDeleteUserAttributes",
);
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::<AdminDeleteUserAttributesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminDeleteUserAttributesError::from_response(response))
}))
}
})
}
fn admin_disable_provider_for_user(
&self,
input: AdminDisableProviderForUserRequest,
) -> RusotoFuture<AdminDisableProviderForUserResponse, AdminDisableProviderForUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminDisableProviderForUser",
);
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::<AdminDisableProviderForUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminDisableProviderForUserError::from_response(response))
}))
}
})
}
fn admin_disable_user(
&self,
input: AdminDisableUserRequest,
) -> RusotoFuture<AdminDisableUserResponse, AdminDisableUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminDisableUser",
);
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::<AdminDisableUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminDisableUserError::from_response(response))),
)
}
})
}
fn admin_enable_user(
&self,
input: AdminEnableUserRequest,
) -> RusotoFuture<AdminEnableUserResponse, AdminEnableUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminEnableUser",
);
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::<AdminEnableUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminEnableUserError::from_response(response))),
)
}
})
}
fn admin_forget_device(
&self,
input: AdminForgetDeviceRequest,
) -> RusotoFuture<(), AdminForgetDeviceError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminForgetDevice",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminForgetDeviceError::from_response(response))),
)
}
})
}
fn admin_get_device(
&self,
input: AdminGetDeviceRequest,
) -> RusotoFuture<AdminGetDeviceResponse, AdminGetDeviceError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminGetDevice",
);
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::<AdminGetDeviceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminGetDeviceError::from_response(response))),
)
}
})
}
fn admin_get_user(
&self,
input: AdminGetUserRequest,
) -> RusotoFuture<AdminGetUserResponse, AdminGetUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminGetUser",
);
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::<AdminGetUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminGetUserError::from_response(response))),
)
}
})
}
fn admin_initiate_auth(
&self,
input: AdminInitiateAuthRequest,
) -> RusotoFuture<AdminInitiateAuthResponse, AdminInitiateAuthError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminInitiateAuth",
);
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::<AdminInitiateAuthResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminInitiateAuthError::from_response(response))),
)
}
})
}
fn admin_link_provider_for_user(
&self,
input: AdminLinkProviderForUserRequest,
) -> RusotoFuture<AdminLinkProviderForUserResponse, AdminLinkProviderForUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminLinkProviderForUser",
);
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::<AdminLinkProviderForUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminLinkProviderForUserError::from_response(response))
}))
}
})
}
fn admin_list_devices(
&self,
input: AdminListDevicesRequest,
) -> RusotoFuture<AdminListDevicesResponse, AdminListDevicesError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminListDevices",
);
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::<AdminListDevicesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AdminListDevicesError::from_response(response))),
)
}
})
}
fn admin_list_groups_for_user(
&self,
input: AdminListGroupsForUserRequest,
) -> RusotoFuture<AdminListGroupsForUserResponse, AdminListGroupsForUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminListGroupsForUser",
);
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::<AdminListGroupsForUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AdminListGroupsForUserError::from_response(response))
}),
)
}
})
}
fn admin_list_user_auth_events(
&self,
input: AdminListUserAuthEventsRequest,
) -> RusotoFuture<AdminListUserAuthEventsResponse, AdminListUserAuthEventsError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminListUserAuthEvents",
);
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::<AdminListUserAuthEventsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminListUserAuthEventsError::from_response(response))
}))
}
})
}
fn admin_remove_user_from_group(
&self,
input: AdminRemoveUserFromGroupRequest,
) -> RusotoFuture<(), AdminRemoveUserFromGroupError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminRemoveUserFromGroup",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminRemoveUserFromGroupError::from_response(response))
}))
}
})
}
fn admin_reset_user_password(
&self,
input: AdminResetUserPasswordRequest,
) -> RusotoFuture<AdminResetUserPasswordResponse, AdminResetUserPasswordError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminResetUserPassword",
);
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::<AdminResetUserPasswordResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AdminResetUserPasswordError::from_response(response))
}),
)
}
})
}
fn admin_respond_to_auth_challenge(
&self,
input: AdminRespondToAuthChallengeRequest,
) -> RusotoFuture<AdminRespondToAuthChallengeResponse, AdminRespondToAuthChallengeError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminRespondToAuthChallenge",
);
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::<AdminRespondToAuthChallengeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminRespondToAuthChallengeError::from_response(response))
}))
}
})
}
fn admin_set_user_mfa_preference(
&self,
input: AdminSetUserMFAPreferenceRequest,
) -> RusotoFuture<AdminSetUserMFAPreferenceResponse, AdminSetUserMFAPreferenceError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminSetUserMFAPreference",
);
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::<AdminSetUserMFAPreferenceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminSetUserMFAPreferenceError::from_response(response))
}))
}
})
}
fn admin_set_user_settings(
&self,
input: AdminSetUserSettingsRequest,
) -> RusotoFuture<AdminSetUserSettingsResponse, AdminSetUserSettingsError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminSetUserSettings",
);
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::<AdminSetUserSettingsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AdminSetUserSettingsError::from_response(response))
}),
)
}
})
}
fn admin_update_auth_event_feedback(
&self,
input: AdminUpdateAuthEventFeedbackRequest,
) -> RusotoFuture<AdminUpdateAuthEventFeedbackResponse, AdminUpdateAuthEventFeedbackError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminUpdateAuthEventFeedback",
);
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::<AdminUpdateAuthEventFeedbackResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminUpdateAuthEventFeedbackError::from_response(response))
}))
}
})
}
fn admin_update_device_status(
&self,
input: AdminUpdateDeviceStatusRequest,
) -> RusotoFuture<AdminUpdateDeviceStatusResponse, AdminUpdateDeviceStatusError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminUpdateDeviceStatus",
);
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::<AdminUpdateDeviceStatusResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminUpdateDeviceStatusError::from_response(response))
}))
}
})
}
fn admin_update_user_attributes(
&self,
input: AdminUpdateUserAttributesRequest,
) -> RusotoFuture<AdminUpdateUserAttributesResponse, AdminUpdateUserAttributesError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminUpdateUserAttributes",
);
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::<AdminUpdateUserAttributesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AdminUpdateUserAttributesError::from_response(response))
}))
}
})
}
fn admin_user_global_sign_out(
&self,
input: AdminUserGlobalSignOutRequest,
) -> RusotoFuture<AdminUserGlobalSignOutResponse, AdminUserGlobalSignOutError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AdminUserGlobalSignOut",
);
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::<AdminUserGlobalSignOutResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AdminUserGlobalSignOutError::from_response(response))
}),
)
}
})
}
fn associate_software_token(
&self,
input: AssociateSoftwareTokenRequest,
) -> RusotoFuture<AssociateSoftwareTokenResponse, AssociateSoftwareTokenError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.AssociateSoftwareToken",
);
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::<AssociateSoftwareTokenResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AssociateSoftwareTokenError::from_response(response))
}),
)
}
})
}
fn change_password(
&self,
input: ChangePasswordRequest,
) -> RusotoFuture<ChangePasswordResponse, ChangePasswordError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ChangePassword",
);
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::<ChangePasswordResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ChangePasswordError::from_response(response))),
)
}
})
}
fn confirm_device(
&self,
input: ConfirmDeviceRequest,
) -> RusotoFuture<ConfirmDeviceResponse, ConfirmDeviceError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ConfirmDevice",
);
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::<ConfirmDeviceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ConfirmDeviceError::from_response(response))),
)
}
})
}
fn confirm_forgot_password(
&self,
input: ConfirmForgotPasswordRequest,
) -> RusotoFuture<ConfirmForgotPasswordResponse, ConfirmForgotPasswordError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ConfirmForgotPassword",
);
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::<ConfirmForgotPasswordResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ConfirmForgotPasswordError::from_response(response))
}),
)
}
})
}
fn confirm_sign_up(
&self,
input: ConfirmSignUpRequest,
) -> RusotoFuture<ConfirmSignUpResponse, ConfirmSignUpError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ConfirmSignUp",
);
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::<ConfirmSignUpResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ConfirmSignUpError::from_response(response))),
)
}
})
}
fn create_group(
&self,
input: CreateGroupRequest,
) -> RusotoFuture<CreateGroupResponse, CreateGroupError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.CreateGroup",
);
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::<CreateGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateGroupError::from_response(response))),
)
}
})
}
fn create_identity_provider(
&self,
input: CreateIdentityProviderRequest,
) -> RusotoFuture<CreateIdentityProviderResponse, CreateIdentityProviderError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.CreateIdentityProvider",
);
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::<CreateIdentityProviderResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateIdentityProviderError::from_response(response))
}),
)
}
})
}
fn create_resource_server(
&self,
input: CreateResourceServerRequest,
) -> RusotoFuture<CreateResourceServerResponse, CreateResourceServerError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.CreateResourceServer",
);
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::<CreateResourceServerResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateResourceServerError::from_response(response))
}),
)
}
})
}
fn create_user_import_job(
&self,
input: CreateUserImportJobRequest,
) -> RusotoFuture<CreateUserImportJobResponse, CreateUserImportJobError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.CreateUserImportJob",
);
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::<CreateUserImportJobResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateUserImportJobError::from_response(response))
}),
)
}
})
}
fn create_user_pool(
&self,
input: CreateUserPoolRequest,
) -> RusotoFuture<CreateUserPoolResponse, CreateUserPoolError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.CreateUserPool",
);
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::<CreateUserPoolResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateUserPoolError::from_response(response))),
)
}
})
}
fn create_user_pool_client(
&self,
input: CreateUserPoolClientRequest,
) -> RusotoFuture<CreateUserPoolClientResponse, CreateUserPoolClientError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.CreateUserPoolClient",
);
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::<CreateUserPoolClientResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateUserPoolClientError::from_response(response))
}),
)
}
})
}
fn create_user_pool_domain(
&self,
input: CreateUserPoolDomainRequest,
) -> RusotoFuture<CreateUserPoolDomainResponse, CreateUserPoolDomainError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.CreateUserPoolDomain",
);
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::<CreateUserPoolDomainResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateUserPoolDomainError::from_response(response))
}),
)
}
})
}
fn delete_group(&self, input: DeleteGroupRequest) -> RusotoFuture<(), DeleteGroupError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DeleteGroup",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteGroupError::from_response(response))),
)
}
})
}
fn delete_identity_provider(
&self,
input: DeleteIdentityProviderRequest,
) -> RusotoFuture<(), DeleteIdentityProviderError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DeleteIdentityProvider",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteIdentityProviderError::from_response(response))
}),
)
}
})
}
fn delete_resource_server(
&self,
input: DeleteResourceServerRequest,
) -> RusotoFuture<(), DeleteResourceServerError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DeleteResourceServer",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteResourceServerError::from_response(response))
}),
)
}
})
}
fn delete_user(&self, input: DeleteUserRequest) -> RusotoFuture<(), DeleteUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteUserError::from_response(response))),
)
}
})
}
fn delete_user_attributes(
&self,
input: DeleteUserAttributesRequest,
) -> RusotoFuture<DeleteUserAttributesResponse, DeleteUserAttributesError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DeleteUserAttributes",
);
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::<DeleteUserAttributesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteUserAttributesError::from_response(response))
}),
)
}
})
}
fn delete_user_pool(
&self,
input: DeleteUserPoolRequest,
) -> RusotoFuture<(), DeleteUserPoolError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DeleteUserPool",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteUserPoolError::from_response(response))),
)
}
})
}
fn delete_user_pool_client(
&self,
input: DeleteUserPoolClientRequest,
) -> RusotoFuture<(), DeleteUserPoolClientError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DeleteUserPoolClient",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteUserPoolClientError::from_response(response))
}),
)
}
})
}
fn delete_user_pool_domain(
&self,
input: DeleteUserPoolDomainRequest,
) -> RusotoFuture<DeleteUserPoolDomainResponse, DeleteUserPoolDomainError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DeleteUserPoolDomain",
);
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::<DeleteUserPoolDomainResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteUserPoolDomainError::from_response(response))
}),
)
}
})
}
fn describe_identity_provider(
&self,
input: DescribeIdentityProviderRequest,
) -> RusotoFuture<DescribeIdentityProviderResponse, DescribeIdentityProviderError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DescribeIdentityProvider",
);
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::<DescribeIdentityProviderResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeIdentityProviderError::from_response(response))
}))
}
})
}
fn describe_resource_server(
&self,
input: DescribeResourceServerRequest,
) -> RusotoFuture<DescribeResourceServerResponse, DescribeResourceServerError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DescribeResourceServer",
);
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::<DescribeResourceServerResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeResourceServerError::from_response(response))
}),
)
}
})
}
fn describe_risk_configuration(
&self,
input: DescribeRiskConfigurationRequest,
) -> RusotoFuture<DescribeRiskConfigurationResponse, DescribeRiskConfigurationError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DescribeRiskConfiguration",
);
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::<DescribeRiskConfigurationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeRiskConfigurationError::from_response(response))
}))
}
})
}
fn describe_user_import_job(
&self,
input: DescribeUserImportJobRequest,
) -> RusotoFuture<DescribeUserImportJobResponse, DescribeUserImportJobError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DescribeUserImportJob",
);
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::<DescribeUserImportJobResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeUserImportJobError::from_response(response))
}),
)
}
})
}
fn describe_user_pool(
&self,
input: DescribeUserPoolRequest,
) -> RusotoFuture<DescribeUserPoolResponse, DescribeUserPoolError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DescribeUserPool",
);
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::<DescribeUserPoolResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeUserPoolError::from_response(response))),
)
}
})
}
fn describe_user_pool_client(
&self,
input: DescribeUserPoolClientRequest,
) -> RusotoFuture<DescribeUserPoolClientResponse, DescribeUserPoolClientError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DescribeUserPoolClient",
);
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::<DescribeUserPoolClientResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeUserPoolClientError::from_response(response))
}),
)
}
})
}
fn describe_user_pool_domain(
&self,
input: DescribeUserPoolDomainRequest,
) -> RusotoFuture<DescribeUserPoolDomainResponse, DescribeUserPoolDomainError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.DescribeUserPoolDomain",
);
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::<DescribeUserPoolDomainResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeUserPoolDomainError::from_response(response))
}),
)
}
})
}
fn forget_device(&self, input: ForgetDeviceRequest) -> RusotoFuture<(), ForgetDeviceError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ForgetDevice",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ForgetDeviceError::from_response(response))),
)
}
})
}
fn forgot_password(
&self,
input: ForgotPasswordRequest,
) -> RusotoFuture<ForgotPasswordResponse, ForgotPasswordError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ForgotPassword",
);
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::<ForgotPasswordResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ForgotPasswordError::from_response(response))),
)
}
})
}
fn get_csv_header(
&self,
input: GetCSVHeaderRequest,
) -> RusotoFuture<GetCSVHeaderResponse, GetCSVHeaderError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.GetCSVHeader",
);
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::<GetCSVHeaderResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetCSVHeaderError::from_response(response))),
)
}
})
}
fn get_device(
&self,
input: GetDeviceRequest,
) -> RusotoFuture<GetDeviceResponse, GetDeviceError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.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_group(&self, input: GetGroupRequest) -> RusotoFuture<GetGroupResponse, GetGroupError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSCognitoIdentityProviderService.GetGroup");
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::<GetGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetGroupError::from_response(response))),
)
}
})
}
fn get_identity_provider_by_identifier(
&self,
input: GetIdentityProviderByIdentifierRequest,
) -> RusotoFuture<GetIdentityProviderByIdentifierResponse, GetIdentityProviderByIdentifierError>
{
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.GetIdentityProviderByIdentifier",
);
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::<GetIdentityProviderByIdentifierResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetIdentityProviderByIdentifierError::from_response(
response,
))
}))
}
})
}
fn get_signing_certificate(
&self,
input: GetSigningCertificateRequest,
) -> RusotoFuture<GetSigningCertificateResponse, GetSigningCertificateError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.GetSigningCertificate",
);
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::<GetSigningCertificateResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetSigningCertificateError::from_response(response))
}),
)
}
})
}
fn get_ui_customization(
&self,
input: GetUICustomizationRequest,
) -> RusotoFuture<GetUICustomizationResponse, GetUICustomizationError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.GetUICustomization",
);
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::<GetUICustomizationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUICustomizationError::from_response(response))),
)
}
})
}
fn get_user(&self, input: GetUserRequest) -> RusotoFuture<GetUserResponse, GetUserError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSCognitoIdentityProviderService.GetUser");
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::<GetUserResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetUserError::from_response(response))),
)
}
})
}
fn get_user_attribute_verification_code(
&self,
input: GetUserAttributeVerificationCodeRequest,
) -> RusotoFuture<GetUserAttributeVerificationCodeResponse, GetUserAttributeVerificationCodeError>
{
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.GetUserAttributeVerificationCode",
);
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::<GetUserAttributeVerificationCodeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetUserAttributeVerificationCodeError::from_response(
response,
))
}))
}
})
}
fn get_user_pool_mfa_config(
&self,
input: GetUserPoolMfaConfigRequest,
) -> RusotoFuture<GetUserPoolMfaConfigResponse, GetUserPoolMfaConfigError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.GetUserPoolMfaConfig",
);
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::<GetUserPoolMfaConfigResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetUserPoolMfaConfigError::from_response(response))
}),
)
}
})
}
fn global_sign_out(
&self,
input: GlobalSignOutRequest,
) -> RusotoFuture<GlobalSignOutResponse, GlobalSignOutError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.GlobalSignOut",
);
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::<GlobalSignOutResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GlobalSignOutError::from_response(response))),
)
}
})
}
fn initiate_auth(
&self,
input: InitiateAuthRequest,
) -> RusotoFuture<InitiateAuthResponse, InitiateAuthError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.InitiateAuth",
);
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::<InitiateAuthResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(InitiateAuthError::from_response(response))),
)
}
})
}
fn list_devices(
&self,
input: ListDevicesRequest,
) -> RusotoFuture<ListDevicesResponse, ListDevicesError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListDevices",
);
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::<ListDevicesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListDevicesError::from_response(response))),
)
}
})
}
fn list_groups(
&self,
input: ListGroupsRequest,
) -> RusotoFuture<ListGroupsResponse, ListGroupsError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListGroups",
);
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::<ListGroupsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListGroupsError::from_response(response))),
)
}
})
}
fn list_identity_providers(
&self,
input: ListIdentityProvidersRequest,
) -> RusotoFuture<ListIdentityProvidersResponse, ListIdentityProvidersError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListIdentityProviders",
);
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::<ListIdentityProvidersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListIdentityProvidersError::from_response(response))
}),
)
}
})
}
fn list_resource_servers(
&self,
input: ListResourceServersRequest,
) -> RusotoFuture<ListResourceServersResponse, ListResourceServersError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListResourceServers",
);
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::<ListResourceServersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListResourceServersError::from_response(response))
}),
)
}
})
}
fn list_user_import_jobs(
&self,
input: ListUserImportJobsRequest,
) -> RusotoFuture<ListUserImportJobsResponse, ListUserImportJobsError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListUserImportJobs",
);
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::<ListUserImportJobsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListUserImportJobsError::from_response(response))),
)
}
})
}
fn list_user_pool_clients(
&self,
input: ListUserPoolClientsRequest,
) -> RusotoFuture<ListUserPoolClientsResponse, ListUserPoolClientsError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListUserPoolClients",
);
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::<ListUserPoolClientsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListUserPoolClientsError::from_response(response))
}),
)
}
})
}
fn list_user_pools(
&self,
input: ListUserPoolsRequest,
) -> RusotoFuture<ListUserPoolsResponse, ListUserPoolsError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListUserPools",
);
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::<ListUserPoolsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListUserPoolsError::from_response(response))),
)
}
})
}
fn list_users(
&self,
input: ListUsersRequest,
) -> RusotoFuture<ListUsersResponse, ListUsersError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListUsers",
);
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::<ListUsersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListUsersError::from_response(response))),
)
}
})
}
fn list_users_in_group(
&self,
input: ListUsersInGroupRequest,
) -> RusotoFuture<ListUsersInGroupResponse, ListUsersInGroupError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ListUsersInGroup",
);
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::<ListUsersInGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListUsersInGroupError::from_response(response))),
)
}
})
}
fn resend_confirmation_code(
&self,
input: ResendConfirmationCodeRequest,
) -> RusotoFuture<ResendConfirmationCodeResponse, ResendConfirmationCodeError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.ResendConfirmationCode",
);
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::<ResendConfirmationCodeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ResendConfirmationCodeError::from_response(response))
}),
)
}
})
}
fn respond_to_auth_challenge(
&self,
input: RespondToAuthChallengeRequest,
) -> RusotoFuture<RespondToAuthChallengeResponse, RespondToAuthChallengeError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.RespondToAuthChallenge",
);
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::<RespondToAuthChallengeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RespondToAuthChallengeError::from_response(response))
}),
)
}
})
}
fn set_risk_configuration(
&self,
input: SetRiskConfigurationRequest,
) -> RusotoFuture<SetRiskConfigurationResponse, SetRiskConfigurationError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.SetRiskConfiguration",
);
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::<SetRiskConfigurationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(SetRiskConfigurationError::from_response(response))
}),
)
}
})
}
fn set_ui_customization(
&self,
input: SetUICustomizationRequest,
) -> RusotoFuture<SetUICustomizationResponse, SetUICustomizationError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.SetUICustomization",
);
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::<SetUICustomizationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SetUICustomizationError::from_response(response))),
)
}
})
}
fn set_user_mfa_preference(
&self,
input: SetUserMFAPreferenceRequest,
) -> RusotoFuture<SetUserMFAPreferenceResponse, SetUserMFAPreferenceError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.SetUserMFAPreference",
);
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::<SetUserMFAPreferenceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(SetUserMFAPreferenceError::from_response(response))
}),
)
}
})
}
fn set_user_pool_mfa_config(
&self,
input: SetUserPoolMfaConfigRequest,
) -> RusotoFuture<SetUserPoolMfaConfigResponse, SetUserPoolMfaConfigError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.SetUserPoolMfaConfig",
);
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::<SetUserPoolMfaConfigResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(SetUserPoolMfaConfigError::from_response(response))
}),
)
}
})
}
fn set_user_settings(
&self,
input: SetUserSettingsRequest,
) -> RusotoFuture<SetUserSettingsResponse, SetUserSettingsError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.SetUserSettings",
);
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::<SetUserSettingsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SetUserSettingsError::from_response(response))),
)
}
})
}
fn sign_up(&self, input: SignUpRequest) -> RusotoFuture<SignUpResponse, SignUpError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSCognitoIdentityProviderService.SignUp");
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::<SignUpResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SignUpError::from_response(response))),
)
}
})
}
fn start_user_import_job(
&self,
input: StartUserImportJobRequest,
) -> RusotoFuture<StartUserImportJobResponse, StartUserImportJobError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.StartUserImportJob",
);
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::<StartUserImportJobResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StartUserImportJobError::from_response(response))),
)
}
})
}
fn stop_user_import_job(
&self,
input: StopUserImportJobRequest,
) -> RusotoFuture<StopUserImportJobResponse, StopUserImportJobError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.StopUserImportJob",
);
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::<StopUserImportJobResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StopUserImportJobError::from_response(response))),
)
}
})
}
fn update_auth_event_feedback(
&self,
input: UpdateAuthEventFeedbackRequest,
) -> RusotoFuture<UpdateAuthEventFeedbackResponse, UpdateAuthEventFeedbackError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateAuthEventFeedback",
);
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::<UpdateAuthEventFeedbackResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateAuthEventFeedbackError::from_response(response))
}))
}
})
}
fn update_device_status(
&self,
input: UpdateDeviceStatusRequest,
) -> RusotoFuture<UpdateDeviceStatusResponse, UpdateDeviceStatusError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateDeviceStatus",
);
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::<UpdateDeviceStatusResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDeviceStatusError::from_response(response))),
)
}
})
}
fn update_group(
&self,
input: UpdateGroupRequest,
) -> RusotoFuture<UpdateGroupResponse, UpdateGroupError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateGroup",
);
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::<UpdateGroupResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateGroupError::from_response(response))),
)
}
})
}
fn update_identity_provider(
&self,
input: UpdateIdentityProviderRequest,
) -> RusotoFuture<UpdateIdentityProviderResponse, UpdateIdentityProviderError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateIdentityProvider",
);
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::<UpdateIdentityProviderResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateIdentityProviderError::from_response(response))
}),
)
}
})
}
fn update_resource_server(
&self,
input: UpdateResourceServerRequest,
) -> RusotoFuture<UpdateResourceServerResponse, UpdateResourceServerError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateResourceServer",
);
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::<UpdateResourceServerResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateResourceServerError::from_response(response))
}),
)
}
})
}
fn update_user_attributes(
&self,
input: UpdateUserAttributesRequest,
) -> RusotoFuture<UpdateUserAttributesResponse, UpdateUserAttributesError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateUserAttributes",
);
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::<UpdateUserAttributesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateUserAttributesError::from_response(response))
}),
)
}
})
}
fn update_user_pool(
&self,
input: UpdateUserPoolRequest,
) -> RusotoFuture<UpdateUserPoolResponse, UpdateUserPoolError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateUserPool",
);
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::<UpdateUserPoolResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateUserPoolError::from_response(response))),
)
}
})
}
fn update_user_pool_client(
&self,
input: UpdateUserPoolClientRequest,
) -> RusotoFuture<UpdateUserPoolClientResponse, UpdateUserPoolClientError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateUserPoolClient",
);
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::<UpdateUserPoolClientResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateUserPoolClientError::from_response(response))
}),
)
}
})
}
fn update_user_pool_domain(
&self,
input: UpdateUserPoolDomainRequest,
) -> RusotoFuture<UpdateUserPoolDomainResponse, UpdateUserPoolDomainError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.UpdateUserPoolDomain",
);
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::<UpdateUserPoolDomainResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateUserPoolDomainError::from_response(response))
}),
)
}
})
}
fn verify_software_token(
&self,
input: VerifySoftwareTokenRequest,
) -> RusotoFuture<VerifySoftwareTokenResponse, VerifySoftwareTokenError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.VerifySoftwareToken",
);
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::<VerifySoftwareTokenResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(VerifySoftwareTokenError::from_response(response))
}),
)
}
})
}
fn verify_user_attribute(
&self,
input: VerifyUserAttributeRequest,
) -> RusotoFuture<VerifyUserAttributeResponse, VerifyUserAttributeError> {
let mut request = SignedRequest::new("POST", "cognito-idp", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSCognitoIdentityProviderService.VerifyUserAttribute",
);
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::<VerifyUserAttributeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(VerifyUserAttributeError::from_response(response))
}),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}