use std::error::Error;
use std::fmt;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError, RusotoFuture};
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
use serde_json;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BulkPublishRequest {
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BulkPublishResponse {
#[serde(rename = "IdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CognitoStreams {
#[serde(rename = "RoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
#[serde(rename = "StreamingStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub streaming_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Dataset {
#[serde(rename = "CreationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "DataStorage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_storage: Option<i64>,
#[serde(rename = "DatasetName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_name: Option<String>,
#[serde(rename = "IdentityId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_id: Option<String>,
#[serde(rename = "LastModifiedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_by: Option<String>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "NumRecords")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_records: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDatasetRequest {
#[serde(rename = "DatasetName")]
pub dataset_name: String,
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteDatasetResponse {
#[serde(rename = "Dataset")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset: Option<Dataset>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDatasetRequest {
#[serde(rename = "DatasetName")]
pub dataset_name: String,
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeDatasetResponse {
#[serde(rename = "Dataset")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset: Option<Dataset>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeIdentityPoolUsageRequest {
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeIdentityPoolUsageResponse {
#[serde(rename = "IdentityPoolUsage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_usage: Option<IdentityPoolUsage>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeIdentityUsageRequest {
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeIdentityUsageResponse {
#[serde(rename = "IdentityUsage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_usage: Option<IdentityUsage>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBulkPublishDetailsRequest {
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBulkPublishDetailsResponse {
#[serde(rename = "BulkPublishCompleteTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bulk_publish_complete_time: Option<f64>,
#[serde(rename = "BulkPublishStartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bulk_publish_start_time: Option<f64>,
#[serde(rename = "BulkPublishStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bulk_publish_status: Option<String>,
#[serde(rename = "FailureMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_message: Option<String>,
#[serde(rename = "IdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCognitoEventsRequest {
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCognitoEventsResponse {
#[serde(rename = "Events")]
#[serde(skip_serializing_if = "Option::is_none")]
pub events: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIdentityPoolConfigurationRequest {
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIdentityPoolConfigurationResponse {
#[serde(rename = "CognitoStreams")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cognito_streams: Option<CognitoStreams>,
#[serde(rename = "IdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_id: Option<String>,
#[serde(rename = "PushSync")]
#[serde(skip_serializing_if = "Option::is_none")]
pub push_sync: Option<PushSync>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IdentityPoolUsage {
#[serde(rename = "DataStorage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_storage: Option<i64>,
#[serde(rename = "IdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_id: Option<String>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "SyncSessionsCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_sessions_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IdentityUsage {
#[serde(rename = "DataStorage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_storage: Option<i64>,
#[serde(rename = "DatasetCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_count: Option<i64>,
#[serde(rename = "IdentityId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_id: Option<String>,
#[serde(rename = "IdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_id: Option<String>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDatasetsRequest {
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListDatasetsResponse {
#[serde(rename = "Count")]
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(rename = "Datasets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datasets: Option<Vec<Dataset>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListIdentityPoolUsageRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListIdentityPoolUsageResponse {
#[serde(rename = "Count")]
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(rename = "IdentityPoolUsages")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_usages: Option<Vec<IdentityPoolUsage>>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListRecordsRequest {
#[serde(rename = "DatasetName")]
pub dataset_name: String,
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
#[serde(rename = "LastSyncCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_sync_count: Option<i64>,
#[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 = "SyncSessionToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_session_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListRecordsResponse {
#[serde(rename = "Count")]
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(rename = "DatasetDeletedAfterRequestedSyncCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_deleted_after_requested_sync_count: Option<bool>,
#[serde(rename = "DatasetExists")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_exists: Option<bool>,
#[serde(rename = "DatasetSyncCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_sync_count: Option<i64>,
#[serde(rename = "LastModifiedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_by: Option<String>,
#[serde(rename = "MergedDatasetNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merged_dataset_names: Option<Vec<String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Records")]
#[serde(skip_serializing_if = "Option::is_none")]
pub records: Option<Vec<Record>>,
#[serde(rename = "SyncSessionToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_session_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PushSync {
#[serde(rename = "ApplicationArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub application_arns: Option<Vec<String>>,
#[serde(rename = "RoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Record {
#[serde(rename = "DeviceLastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_last_modified_date: Option<f64>,
#[serde(rename = "Key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "LastModifiedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_by: Option<String>,
#[serde(rename = "LastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "SyncCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_count: Option<i64>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RecordPatch {
#[serde(rename = "DeviceLastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_last_modified_date: Option<f64>,
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Op")]
pub op: String,
#[serde(rename = "SyncCount")]
pub sync_count: i64,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RegisterDeviceRequest {
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
#[serde(rename = "Platform")]
pub platform: String,
#[serde(rename = "Token")]
pub token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RegisterDeviceResponse {
#[serde(rename = "DeviceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetCognitoEventsRequest {
#[serde(rename = "Events")]
pub events: ::std::collections::HashMap<String, String>,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetIdentityPoolConfigurationRequest {
#[serde(rename = "CognitoStreams")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cognito_streams: Option<CognitoStreams>,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
#[serde(rename = "PushSync")]
#[serde(skip_serializing_if = "Option::is_none")]
pub push_sync: Option<PushSync>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SetIdentityPoolConfigurationResponse {
#[serde(rename = "CognitoStreams")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cognito_streams: Option<CognitoStreams>,
#[serde(rename = "IdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_pool_id: Option<String>,
#[serde(rename = "PushSync")]
#[serde(skip_serializing_if = "Option::is_none")]
pub push_sync: Option<PushSync>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SubscribeToDatasetRequest {
#[serde(rename = "DatasetName")]
pub dataset_name: String,
#[serde(rename = "DeviceId")]
pub device_id: String,
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SubscribeToDatasetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UnsubscribeFromDatasetRequest {
#[serde(rename = "DatasetName")]
pub dataset_name: String,
#[serde(rename = "DeviceId")]
pub device_id: String,
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UnsubscribeFromDatasetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRecordsRequest {
#[serde(rename = "ClientContext")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_context: Option<String>,
#[serde(rename = "DatasetName")]
pub dataset_name: String,
#[serde(rename = "DeviceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_id: Option<String>,
#[serde(rename = "IdentityId")]
pub identity_id: String,
#[serde(rename = "IdentityPoolId")]
pub identity_pool_id: String,
#[serde(rename = "RecordPatches")]
#[serde(skip_serializing_if = "Option::is_none")]
pub record_patches: Option<Vec<RecordPatch>>,
#[serde(rename = "SyncSessionToken")]
pub sync_session_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateRecordsResponse {
#[serde(rename = "Records")]
#[serde(skip_serializing_if = "Option::is_none")]
pub records: Option<Vec<Record>>,
}
#[derive(Debug, PartialEq)]
pub enum BulkPublishError {
AlreadyStreamed(String),
DuplicateRequest(String),
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
}
impl BulkPublishError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<BulkPublishError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AlreadyStreamedException" => {
return RusotoError::Service(BulkPublishError::AlreadyStreamed(err.msg))
}
"DuplicateRequestException" => {
return RusotoError::Service(BulkPublishError::DuplicateRequest(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(BulkPublishError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(BulkPublishError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(BulkPublishError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(BulkPublishError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for BulkPublishError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BulkPublishError {
fn description(&self) -> &str {
match *self {
BulkPublishError::AlreadyStreamed(ref cause) => cause,
BulkPublishError::DuplicateRequest(ref cause) => cause,
BulkPublishError::InternalError(ref cause) => cause,
BulkPublishError::InvalidParameter(ref cause) => cause,
BulkPublishError::NotAuthorized(ref cause) => cause,
BulkPublishError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDatasetError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceConflict(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl DeleteDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteDatasetError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeleteDatasetError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DeleteDatasetError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(DeleteDatasetError::NotAuthorized(err.msg))
}
"ResourceConflictException" => {
return RusotoError::Service(DeleteDatasetError::ResourceConflict(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteDatasetError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(DeleteDatasetError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteDatasetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDatasetError {
fn description(&self) -> &str {
match *self {
DeleteDatasetError::InternalError(ref cause) => cause,
DeleteDatasetError::InvalidParameter(ref cause) => cause,
DeleteDatasetError::NotAuthorized(ref cause) => cause,
DeleteDatasetError::ResourceConflict(ref cause) => cause,
DeleteDatasetError::ResourceNotFound(ref cause) => cause,
DeleteDatasetError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDatasetError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl DescribeDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeDatasetError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DescribeDatasetError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DescribeDatasetError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(DescribeDatasetError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeDatasetError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(DescribeDatasetError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeDatasetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDatasetError {
fn description(&self) -> &str {
match *self {
DescribeDatasetError::InternalError(ref cause) => cause,
DescribeDatasetError::InvalidParameter(ref cause) => cause,
DescribeDatasetError::NotAuthorized(ref cause) => cause,
DescribeDatasetError::ResourceNotFound(ref cause) => cause,
DescribeDatasetError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeIdentityPoolUsageError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl DescribeIdentityPoolUsageError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeIdentityPoolUsageError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DescribeIdentityPoolUsageError::InternalError(
err.msg,
))
}
"InvalidParameterException" => {
return RusotoError::Service(DescribeIdentityPoolUsageError::InvalidParameter(
err.msg,
))
}
"NotAuthorizedException" => {
return RusotoError::Service(DescribeIdentityPoolUsageError::NotAuthorized(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeIdentityPoolUsageError::ResourceNotFound(
err.msg,
))
}
"TooManyRequestsException" => {
return RusotoError::Service(DescribeIdentityPoolUsageError::TooManyRequests(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeIdentityPoolUsageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeIdentityPoolUsageError {
fn description(&self) -> &str {
match *self {
DescribeIdentityPoolUsageError::InternalError(ref cause) => cause,
DescribeIdentityPoolUsageError::InvalidParameter(ref cause) => cause,
DescribeIdentityPoolUsageError::NotAuthorized(ref cause) => cause,
DescribeIdentityPoolUsageError::ResourceNotFound(ref cause) => cause,
DescribeIdentityPoolUsageError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeIdentityUsageError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl DescribeIdentityUsageError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeIdentityUsageError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DescribeIdentityUsageError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DescribeIdentityUsageError::InvalidParameter(
err.msg,
))
}
"NotAuthorizedException" => {
return RusotoError::Service(DescribeIdentityUsageError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeIdentityUsageError::ResourceNotFound(
err.msg,
))
}
"TooManyRequestsException" => {
return RusotoError::Service(DescribeIdentityUsageError::TooManyRequests(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeIdentityUsageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeIdentityUsageError {
fn description(&self) -> &str {
match *self {
DescribeIdentityUsageError::InternalError(ref cause) => cause,
DescribeIdentityUsageError::InvalidParameter(ref cause) => cause,
DescribeIdentityUsageError::NotAuthorized(ref cause) => cause,
DescribeIdentityUsageError::ResourceNotFound(ref cause) => cause,
DescribeIdentityUsageError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBulkPublishDetailsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
}
impl GetBulkPublishDetailsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetBulkPublishDetailsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetBulkPublishDetailsError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(GetBulkPublishDetailsError::InvalidParameter(
err.msg,
))
}
"NotAuthorizedException" => {
return RusotoError::Service(GetBulkPublishDetailsError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetBulkPublishDetailsError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for GetBulkPublishDetailsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBulkPublishDetailsError {
fn description(&self) -> &str {
match *self {
GetBulkPublishDetailsError::InternalError(ref cause) => cause,
GetBulkPublishDetailsError::InvalidParameter(ref cause) => cause,
GetBulkPublishDetailsError::NotAuthorized(ref cause) => cause,
GetBulkPublishDetailsError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCognitoEventsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl GetCognitoEventsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetCognitoEventsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetCognitoEventsError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(GetCognitoEventsError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(GetCognitoEventsError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetCognitoEventsError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(GetCognitoEventsError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for GetCognitoEventsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCognitoEventsError {
fn description(&self) -> &str {
match *self {
GetCognitoEventsError::InternalError(ref cause) => cause,
GetCognitoEventsError::InvalidParameter(ref cause) => cause,
GetCognitoEventsError::NotAuthorized(ref cause) => cause,
GetCognitoEventsError::ResourceNotFound(ref cause) => cause,
GetCognitoEventsError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIdentityPoolConfigurationError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl GetIdentityPoolConfigurationError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<GetIdentityPoolConfigurationError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetIdentityPoolConfigurationError::InternalError(
err.msg,
))
}
"InvalidParameterException" => {
return RusotoError::Service(
GetIdentityPoolConfigurationError::InvalidParameter(err.msg),
)
}
"NotAuthorizedException" => {
return RusotoError::Service(GetIdentityPoolConfigurationError::NotAuthorized(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(
GetIdentityPoolConfigurationError::ResourceNotFound(err.msg),
)
}
"TooManyRequestsException" => {
return RusotoError::Service(
GetIdentityPoolConfigurationError::TooManyRequests(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for GetIdentityPoolConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIdentityPoolConfigurationError {
fn description(&self) -> &str {
match *self {
GetIdentityPoolConfigurationError::InternalError(ref cause) => cause,
GetIdentityPoolConfigurationError::InvalidParameter(ref cause) => cause,
GetIdentityPoolConfigurationError::NotAuthorized(ref cause) => cause,
GetIdentityPoolConfigurationError::ResourceNotFound(ref cause) => cause,
GetIdentityPoolConfigurationError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDatasetsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
TooManyRequests(String),
}
impl ListDatasetsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListDatasetsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListDatasetsError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(ListDatasetsError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(ListDatasetsError::NotAuthorized(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(ListDatasetsError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListDatasetsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDatasetsError {
fn description(&self) -> &str {
match *self {
ListDatasetsError::InternalError(ref cause) => cause,
ListDatasetsError::InvalidParameter(ref cause) => cause,
ListDatasetsError::NotAuthorized(ref cause) => cause,
ListDatasetsError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListIdentityPoolUsageError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
TooManyRequests(String),
}
impl ListIdentityPoolUsageError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListIdentityPoolUsageError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListIdentityPoolUsageError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(ListIdentityPoolUsageError::InvalidParameter(
err.msg,
))
}
"NotAuthorizedException" => {
return RusotoError::Service(ListIdentityPoolUsageError::NotAuthorized(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(ListIdentityPoolUsageError::TooManyRequests(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListIdentityPoolUsageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListIdentityPoolUsageError {
fn description(&self) -> &str {
match *self {
ListIdentityPoolUsageError::InternalError(ref cause) => cause,
ListIdentityPoolUsageError::InvalidParameter(ref cause) => cause,
ListIdentityPoolUsageError::NotAuthorized(ref cause) => cause,
ListIdentityPoolUsageError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListRecordsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
TooManyRequests(String),
}
impl ListRecordsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListRecordsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListRecordsError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(ListRecordsError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(ListRecordsError::NotAuthorized(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(ListRecordsError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListRecordsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListRecordsError {
fn description(&self) -> &str {
match *self {
ListRecordsError::InternalError(ref cause) => cause,
ListRecordsError::InvalidParameter(ref cause) => cause,
ListRecordsError::NotAuthorized(ref cause) => cause,
ListRecordsError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum RegisterDeviceError {
InternalError(String),
InvalidConfiguration(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl RegisterDeviceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<RegisterDeviceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(RegisterDeviceError::InternalError(err.msg))
}
"InvalidConfigurationException" => {
return RusotoError::Service(RegisterDeviceError::InvalidConfiguration(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(RegisterDeviceError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(RegisterDeviceError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(RegisterDeviceError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(RegisterDeviceError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for RegisterDeviceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RegisterDeviceError {
fn description(&self) -> &str {
match *self {
RegisterDeviceError::InternalError(ref cause) => cause,
RegisterDeviceError::InvalidConfiguration(ref cause) => cause,
RegisterDeviceError::InvalidParameter(ref cause) => cause,
RegisterDeviceError::NotAuthorized(ref cause) => cause,
RegisterDeviceError::ResourceNotFound(ref cause) => cause,
RegisterDeviceError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetCognitoEventsError {
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl SetCognitoEventsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SetCognitoEventsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(SetCognitoEventsError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(SetCognitoEventsError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(SetCognitoEventsError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(SetCognitoEventsError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(SetCognitoEventsError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for SetCognitoEventsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetCognitoEventsError {
fn description(&self) -> &str {
match *self {
SetCognitoEventsError::InternalError(ref cause) => cause,
SetCognitoEventsError::InvalidParameter(ref cause) => cause,
SetCognitoEventsError::NotAuthorized(ref cause) => cause,
SetCognitoEventsError::ResourceNotFound(ref cause) => cause,
SetCognitoEventsError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetIdentityPoolConfigurationError {
ConcurrentModification(String),
InternalError(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl SetIdentityPoolConfigurationError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<SetIdentityPoolConfigurationError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ConcurrentModificationException" => {
return RusotoError::Service(
SetIdentityPoolConfigurationError::ConcurrentModification(err.msg),
)
}
"InternalErrorException" => {
return RusotoError::Service(SetIdentityPoolConfigurationError::InternalError(
err.msg,
))
}
"InvalidParameterException" => {
return RusotoError::Service(
SetIdentityPoolConfigurationError::InvalidParameter(err.msg),
)
}
"NotAuthorizedException" => {
return RusotoError::Service(SetIdentityPoolConfigurationError::NotAuthorized(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(
SetIdentityPoolConfigurationError::ResourceNotFound(err.msg),
)
}
"TooManyRequestsException" => {
return RusotoError::Service(
SetIdentityPoolConfigurationError::TooManyRequests(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for SetIdentityPoolConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetIdentityPoolConfigurationError {
fn description(&self) -> &str {
match *self {
SetIdentityPoolConfigurationError::ConcurrentModification(ref cause) => cause,
SetIdentityPoolConfigurationError::InternalError(ref cause) => cause,
SetIdentityPoolConfigurationError::InvalidParameter(ref cause) => cause,
SetIdentityPoolConfigurationError::NotAuthorized(ref cause) => cause,
SetIdentityPoolConfigurationError::ResourceNotFound(ref cause) => cause,
SetIdentityPoolConfigurationError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SubscribeToDatasetError {
InternalError(String),
InvalidConfiguration(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl SubscribeToDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SubscribeToDatasetError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(SubscribeToDatasetError::InternalError(err.msg))
}
"InvalidConfigurationException" => {
return RusotoError::Service(SubscribeToDatasetError::InvalidConfiguration(
err.msg,
))
}
"InvalidParameterException" => {
return RusotoError::Service(SubscribeToDatasetError::InvalidParameter(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(SubscribeToDatasetError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(SubscribeToDatasetError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(SubscribeToDatasetError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for SubscribeToDatasetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SubscribeToDatasetError {
fn description(&self) -> &str {
match *self {
SubscribeToDatasetError::InternalError(ref cause) => cause,
SubscribeToDatasetError::InvalidConfiguration(ref cause) => cause,
SubscribeToDatasetError::InvalidParameter(ref cause) => cause,
SubscribeToDatasetError::NotAuthorized(ref cause) => cause,
SubscribeToDatasetError::ResourceNotFound(ref cause) => cause,
SubscribeToDatasetError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UnsubscribeFromDatasetError {
InternalError(String),
InvalidConfiguration(String),
InvalidParameter(String),
NotAuthorized(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl UnsubscribeFromDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UnsubscribeFromDatasetError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(UnsubscribeFromDatasetError::InternalError(
err.msg,
))
}
"InvalidConfigurationException" => {
return RusotoError::Service(UnsubscribeFromDatasetError::InvalidConfiguration(
err.msg,
))
}
"InvalidParameterException" => {
return RusotoError::Service(UnsubscribeFromDatasetError::InvalidParameter(
err.msg,
))
}
"NotAuthorizedException" => {
return RusotoError::Service(UnsubscribeFromDatasetError::NotAuthorized(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UnsubscribeFromDatasetError::ResourceNotFound(
err.msg,
))
}
"TooManyRequestsException" => {
return RusotoError::Service(UnsubscribeFromDatasetError::TooManyRequests(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UnsubscribeFromDatasetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UnsubscribeFromDatasetError {
fn description(&self) -> &str {
match *self {
UnsubscribeFromDatasetError::InternalError(ref cause) => cause,
UnsubscribeFromDatasetError::InvalidConfiguration(ref cause) => cause,
UnsubscribeFromDatasetError::InvalidParameter(ref cause) => cause,
UnsubscribeFromDatasetError::NotAuthorized(ref cause) => cause,
UnsubscribeFromDatasetError::ResourceNotFound(ref cause) => cause,
UnsubscribeFromDatasetError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRecordsError {
InternalError(String),
InvalidLambdaFunctionOutput(String),
InvalidParameter(String),
LambdaThrottled(String),
LimitExceeded(String),
NotAuthorized(String),
ResourceConflict(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl UpdateRecordsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateRecordsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(UpdateRecordsError::InternalError(err.msg))
}
"InvalidLambdaFunctionOutputException" => {
return RusotoError::Service(UpdateRecordsError::InvalidLambdaFunctionOutput(
err.msg,
))
}
"InvalidParameterException" => {
return RusotoError::Service(UpdateRecordsError::InvalidParameter(err.msg))
}
"LambdaThrottledException" => {
return RusotoError::Service(UpdateRecordsError::LambdaThrottled(err.msg))
}
"LimitExceededException" => {
return RusotoError::Service(UpdateRecordsError::LimitExceeded(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(UpdateRecordsError::NotAuthorized(err.msg))
}
"ResourceConflictException" => {
return RusotoError::Service(UpdateRecordsError::ResourceConflict(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateRecordsError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(UpdateRecordsError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateRecordsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRecordsError {
fn description(&self) -> &str {
match *self {
UpdateRecordsError::InternalError(ref cause) => cause,
UpdateRecordsError::InvalidLambdaFunctionOutput(ref cause) => cause,
UpdateRecordsError::InvalidParameter(ref cause) => cause,
UpdateRecordsError::LambdaThrottled(ref cause) => cause,
UpdateRecordsError::LimitExceeded(ref cause) => cause,
UpdateRecordsError::NotAuthorized(ref cause) => cause,
UpdateRecordsError::ResourceConflict(ref cause) => cause,
UpdateRecordsError::ResourceNotFound(ref cause) => cause,
UpdateRecordsError::TooManyRequests(ref cause) => cause,
}
}
}
pub trait CognitoSync {
fn bulk_publish(
&self,
input: BulkPublishRequest,
) -> RusotoFuture<BulkPublishResponse, BulkPublishError>;
fn delete_dataset(
&self,
input: DeleteDatasetRequest,
) -> RusotoFuture<DeleteDatasetResponse, DeleteDatasetError>;
fn describe_dataset(
&self,
input: DescribeDatasetRequest,
) -> RusotoFuture<DescribeDatasetResponse, DescribeDatasetError>;
fn describe_identity_pool_usage(
&self,
input: DescribeIdentityPoolUsageRequest,
) -> RusotoFuture<DescribeIdentityPoolUsageResponse, DescribeIdentityPoolUsageError>;
fn describe_identity_usage(
&self,
input: DescribeIdentityUsageRequest,
) -> RusotoFuture<DescribeIdentityUsageResponse, DescribeIdentityUsageError>;
fn get_bulk_publish_details(
&self,
input: GetBulkPublishDetailsRequest,
) -> RusotoFuture<GetBulkPublishDetailsResponse, GetBulkPublishDetailsError>;
fn get_cognito_events(
&self,
input: GetCognitoEventsRequest,
) -> RusotoFuture<GetCognitoEventsResponse, GetCognitoEventsError>;
fn get_identity_pool_configuration(
&self,
input: GetIdentityPoolConfigurationRequest,
) -> RusotoFuture<GetIdentityPoolConfigurationResponse, GetIdentityPoolConfigurationError>;
fn list_datasets(
&self,
input: ListDatasetsRequest,
) -> RusotoFuture<ListDatasetsResponse, ListDatasetsError>;
fn list_identity_pool_usage(
&self,
input: ListIdentityPoolUsageRequest,
) -> RusotoFuture<ListIdentityPoolUsageResponse, ListIdentityPoolUsageError>;
fn list_records(
&self,
input: ListRecordsRequest,
) -> RusotoFuture<ListRecordsResponse, ListRecordsError>;
fn register_device(
&self,
input: RegisterDeviceRequest,
) -> RusotoFuture<RegisterDeviceResponse, RegisterDeviceError>;
fn set_cognito_events(
&self,
input: SetCognitoEventsRequest,
) -> RusotoFuture<(), SetCognitoEventsError>;
fn set_identity_pool_configuration(
&self,
input: SetIdentityPoolConfigurationRequest,
) -> RusotoFuture<SetIdentityPoolConfigurationResponse, SetIdentityPoolConfigurationError>;
fn subscribe_to_dataset(
&self,
input: SubscribeToDatasetRequest,
) -> RusotoFuture<SubscribeToDatasetResponse, SubscribeToDatasetError>;
fn unsubscribe_from_dataset(
&self,
input: UnsubscribeFromDatasetRequest,
) -> RusotoFuture<UnsubscribeFromDatasetResponse, UnsubscribeFromDatasetError>;
fn update_records(
&self,
input: UpdateRecordsRequest,
) -> RusotoFuture<UpdateRecordsResponse, UpdateRecordsError>;
}
#[derive(Clone)]
pub struct CognitoSyncClient {
client: Client,
region: region::Region,
}
impl CognitoSyncClient {
pub fn new(region: region::Region) -> CognitoSyncClient {
CognitoSyncClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CognitoSyncClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CognitoSyncClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
}
impl CognitoSync for CognitoSyncClient {
fn bulk_publish(
&self,
input: BulkPublishRequest,
) -> RusotoFuture<BulkPublishResponse, BulkPublishError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/bulkpublish",
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("POST", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<BulkPublishResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(BulkPublishError::from_response(response))),
)
}
})
}
fn delete_dataset(
&self,
input: DeleteDatasetRequest,
) -> RusotoFuture<DeleteDatasetResponse, DeleteDatasetError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/identities/{identity_id}/datasets/{dataset_name}",
dataset_name = input.dataset_name,
identity_id = input.identity_id,
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("DELETE", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteDatasetResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteDatasetError::from_response(response))),
)
}
})
}
fn describe_dataset(
&self,
input: DescribeDatasetRequest,
) -> RusotoFuture<DescribeDatasetResponse, DescribeDatasetError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/identities/{identity_id}/datasets/{dataset_name}",
dataset_name = input.dataset_name,
identity_id = input.identity_id,
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeDatasetResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeDatasetError::from_response(response))),
)
}
})
}
fn describe_identity_pool_usage(
&self,
input: DescribeIdentityPoolUsageRequest,
) -> RusotoFuture<DescribeIdentityPoolUsageResponse, DescribeIdentityPoolUsageError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}",
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeIdentityPoolUsageResponse, _>()?;
Ok(result)
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeIdentityPoolUsageError::from_response(response))
}))
}
})
}
fn describe_identity_usage(
&self,
input: DescribeIdentityUsageRequest,
) -> RusotoFuture<DescribeIdentityUsageResponse, DescribeIdentityUsageError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/identities/{identity_id}",
identity_id = input.identity_id,
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeIdentityUsageResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeIdentityUsageError::from_response(response))
}),
)
}
})
}
fn get_bulk_publish_details(
&self,
input: GetBulkPublishDetailsRequest,
) -> RusotoFuture<GetBulkPublishDetailsResponse, GetBulkPublishDetailsError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/getBulkPublishDetails",
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("POST", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetBulkPublishDetailsResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetBulkPublishDetailsError::from_response(response))
}),
)
}
})
}
fn get_cognito_events(
&self,
input: GetCognitoEventsRequest,
) -> RusotoFuture<GetCognitoEventsResponse, GetCognitoEventsError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/events",
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetCognitoEventsResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetCognitoEventsError::from_response(response))),
)
}
})
}
fn get_identity_pool_configuration(
&self,
input: GetIdentityPoolConfigurationRequest,
) -> RusotoFuture<GetIdentityPoolConfigurationResponse, GetIdentityPoolConfigurationError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/configuration",
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetIdentityPoolConfigurationResponse, _>()?;
Ok(result)
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetIdentityPoolConfigurationError::from_response(response))
}))
}
})
}
fn list_datasets(
&self,
input: ListDatasetsRequest,
) -> RusotoFuture<ListDatasetsResponse, ListDatasetsError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/identities/{identity_id}/datasets",
identity_id = input.identity_id,
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListDatasetsResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListDatasetsError::from_response(response))),
)
}
})
}
fn list_identity_pool_usage(
&self,
input: ListIdentityPoolUsageRequest,
) -> RusotoFuture<ListIdentityPoolUsageResponse, ListIdentityPoolUsageError> {
let request_uri = "/identitypools";
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListIdentityPoolUsageResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListIdentityPoolUsageError::from_response(response))
}),
)
}
})
}
fn list_records(
&self,
input: ListRecordsRequest,
) -> RusotoFuture<ListRecordsResponse, ListRecordsError> {
let request_uri = format!("/identitypools/{identity_pool_id}/identities/{identity_id}/datasets/{dataset_name}/records", dataset_name = input.dataset_name, identity_id = input.identity_id, identity_pool_id = input.identity_pool_id);
let mut request = SignedRequest::new("GET", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.last_sync_count {
params.put("lastSyncCount", x);
}
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.sync_session_token {
params.put("syncSessionToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListRecordsResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListRecordsError::from_response(response))),
)
}
})
}
fn register_device(
&self,
input: RegisterDeviceRequest,
) -> RusotoFuture<RegisterDeviceResponse, RegisterDeviceError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/identity/{identity_id}/device",
identity_id = input.identity_id,
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("POST", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<RegisterDeviceResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(RegisterDeviceError::from_response(response))),
)
}
})
}
fn set_cognito_events(
&self,
input: SetCognitoEventsRequest,
) -> RusotoFuture<(), SetCognitoEventsError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/events",
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("POST", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = ::std::mem::drop(response);
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SetCognitoEventsError::from_response(response))),
)
}
})
}
fn set_identity_pool_configuration(
&self,
input: SetIdentityPoolConfigurationRequest,
) -> RusotoFuture<SetIdentityPoolConfigurationResponse, SetIdentityPoolConfigurationError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/configuration",
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("POST", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<SetIdentityPoolConfigurationResponse, _>()?;
Ok(result)
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(SetIdentityPoolConfigurationError::from_response(response))
}))
}
})
}
fn subscribe_to_dataset(
&self,
input: SubscribeToDatasetRequest,
) -> RusotoFuture<SubscribeToDatasetResponse, SubscribeToDatasetError> {
let request_uri = format!("/identitypools/{identity_pool_id}/identities/{identity_id}/datasets/{dataset_name}/subscriptions/{device_id}", dataset_name = input.dataset_name, device_id = input.device_id, identity_id = input.identity_id, identity_pool_id = input.identity_pool_id);
let mut request = SignedRequest::new("POST", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<SubscribeToDatasetResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SubscribeToDatasetError::from_response(response))),
)
}
})
}
fn unsubscribe_from_dataset(
&self,
input: UnsubscribeFromDatasetRequest,
) -> RusotoFuture<UnsubscribeFromDatasetResponse, UnsubscribeFromDatasetError> {
let request_uri = format!("/identitypools/{identity_pool_id}/identities/{identity_id}/datasets/{dataset_name}/subscriptions/{device_id}", dataset_name = input.dataset_name, device_id = input.device_id, identity_id = input.identity_id, identity_pool_id = input.identity_pool_id);
let mut request = SignedRequest::new("DELETE", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UnsubscribeFromDatasetResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UnsubscribeFromDatasetError::from_response(response))
}),
)
}
})
}
fn update_records(
&self,
input: UpdateRecordsRequest,
) -> RusotoFuture<UpdateRecordsResponse, UpdateRecordsError> {
let request_uri = format!(
"/identitypools/{identity_pool_id}/identities/{identity_id}/datasets/{dataset_name}",
dataset_name = input.dataset_name,
identity_id = input.identity_id,
identity_pool_id = input.identity_pool_id
);
let mut request = SignedRequest::new("POST", "cognito-sync", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
if let Some(ref client_context) = input.client_context {
request.add_header("x-amz-Client-Context", &client_context.to_string());
}
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateRecordsResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateRecordsError::from_response(response))),
)
}
})
}
}