use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AddAttributesActivity {
#[serde(rename = "attributes")]
pub attributes: ::std::collections::HashMap<String, String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchPutMessageErrorEntry {
#[serde(rename = "errorCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_code: Option<String>,
#[serde(rename = "errorMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
#[serde(rename = "messageId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchPutMessageRequest {
#[serde(rename = "channelName")]
pub channel_name: String,
#[serde(rename = "messages")]
pub messages: Vec<Message>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchPutMessageResponse {
#[serde(rename = "batchPutMessageErrorEntries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub batch_put_message_error_entries: Option<Vec<BatchPutMessageErrorEntry>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CancelPipelineReprocessingRequest {
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "reprocessingId")]
pub reprocessing_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CancelPipelineReprocessingResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Channel {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ChannelActivity {
#[serde(rename = "channelName")]
pub channel_name: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ChannelStatistics {
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<EstimatedResourceSize>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ChannelSummary {
#[serde(rename = "channelName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_name: Option<String>,
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ContainerDatasetAction {
#[serde(rename = "executionRoleArn")]
pub execution_role_arn: String,
#[serde(rename = "image")]
pub image: String,
#[serde(rename = "resourceConfiguration")]
pub resource_configuration: ResourceConfiguration,
#[serde(rename = "variables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub variables: Option<Vec<Variable>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateChannelRequest {
#[serde(rename = "channelName")]
pub channel_name: String,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateChannelResponse {
#[serde(rename = "channelArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_arn: Option<String>,
#[serde(rename = "channelName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_name: Option<String>,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDatasetContentRequest {
#[serde(rename = "datasetName")]
pub dataset_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDatasetContentResponse {
#[serde(rename = "versionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDatasetRequest {
#[serde(rename = "actions")]
pub actions: Vec<DatasetAction>,
#[serde(rename = "contentDeliveryRules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_delivery_rules: Option<Vec<DatasetContentDeliveryRule>>,
#[serde(rename = "datasetName")]
pub dataset_name: String,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "triggers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub triggers: Option<Vec<DatasetTrigger>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDatasetResponse {
#[serde(rename = "datasetArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_arn: Option<String>,
#[serde(rename = "datasetName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_name: Option<String>,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateDatastoreRequest {
#[serde(rename = "datastoreName")]
pub datastore_name: String,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateDatastoreResponse {
#[serde(rename = "datastoreArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datastore_arn: Option<String>,
#[serde(rename = "datastoreName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datastore_name: Option<String>,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePipelineRequest {
#[serde(rename = "pipelineActivities")]
pub pipeline_activities: Vec<PipelineActivity>,
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreatePipelineResponse {
#[serde(rename = "pipelineArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_arn: Option<String>,
#[serde(rename = "pipelineName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Dataset {
#[serde(rename = "actions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actions: Option<Vec<DatasetAction>>,
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "contentDeliveryRules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_delivery_rules: Option<Vec<DatasetContentDeliveryRule>>,
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "triggers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub triggers: Option<Vec<DatasetTrigger>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DatasetAction {
#[serde(rename = "actionName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_name: Option<String>,
#[serde(rename = "containerAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub container_action: Option<ContainerDatasetAction>,
#[serde(rename = "queryAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub query_action: Option<SqlQueryDatasetAction>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DatasetActionSummary {
#[serde(rename = "actionName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_name: Option<String>,
#[serde(rename = "actionType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DatasetContentDeliveryDestination {
#[serde(rename = "iotEventsDestinationConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub iot_events_destination_configuration: Option<IotEventsDestinationConfiguration>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DatasetContentDeliveryRule {
#[serde(rename = "destination")]
pub destination: DatasetContentDeliveryDestination,
#[serde(rename = "entryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DatasetContentStatus {
#[serde(rename = "reason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(rename = "state")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DatasetContentSummary {
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "scheduleTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schedule_time: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<DatasetContentStatus>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DatasetContentVersionValue {
#[serde(rename = "datasetName")]
pub dataset_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DatasetEntry {
#[serde(rename = "dataURI")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_uri: Option<String>,
#[serde(rename = "entryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DatasetSummary {
#[serde(rename = "actions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actions: Option<Vec<DatasetActionSummary>>,
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "datasetName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_name: Option<String>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "triggers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub triggers: Option<Vec<DatasetTrigger>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DatasetTrigger {
#[serde(rename = "dataset")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset: Option<TriggeringDataset>,
#[serde(rename = "schedule")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schedule: Option<Schedule>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Datastore {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DatastoreActivity {
#[serde(rename = "datastoreName")]
pub datastore_name: String,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DatastoreStatistics {
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<EstimatedResourceSize>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DatastoreSummary {
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "datastoreName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datastore_name: Option<String>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteChannelRequest {
#[serde(rename = "channelName")]
pub channel_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDatasetContentRequest {
#[serde(rename = "datasetName")]
pub dataset_name: String,
#[serde(rename = "versionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDatasetRequest {
#[serde(rename = "datasetName")]
pub dataset_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteDatastoreRequest {
#[serde(rename = "datastoreName")]
pub datastore_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeletePipelineRequest {
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeltaTime {
#[serde(rename = "offsetSeconds")]
pub offset_seconds: i64,
#[serde(rename = "timeExpression")]
pub time_expression: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeChannelRequest {
#[serde(rename = "channelName")]
pub channel_name: String,
#[serde(rename = "includeStatistics")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_statistics: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeChannelResponse {
#[serde(rename = "channel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub channel: Option<Channel>,
#[serde(rename = "statistics")]
#[serde(skip_serializing_if = "Option::is_none")]
pub statistics: Option<ChannelStatistics>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDatasetRequest {
#[serde(rename = "datasetName")]
pub dataset_name: 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 DescribeDatastoreRequest {
#[serde(rename = "datastoreName")]
pub datastore_name: String,
#[serde(rename = "includeStatistics")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_statistics: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeDatastoreResponse {
#[serde(rename = "datastore")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datastore: Option<Datastore>,
#[serde(rename = "statistics")]
#[serde(skip_serializing_if = "Option::is_none")]
pub statistics: Option<DatastoreStatistics>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeLoggingOptionsRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeLoggingOptionsResponse {
#[serde(rename = "loggingOptions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logging_options: Option<LoggingOptions>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribePipelineRequest {
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribePipelineResponse {
#[serde(rename = "pipeline")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline: Option<Pipeline>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeviceRegistryEnrichActivity {
#[serde(rename = "attribute")]
pub attribute: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeviceShadowEnrichActivity {
#[serde(rename = "attribute")]
pub attribute: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EstimatedResourceSize {
#[serde(rename = "estimatedOn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub estimated_on: Option<f64>,
#[serde(rename = "estimatedSizeInBytes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub estimated_size_in_bytes: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FilterActivity {
#[serde(rename = "filter")]
pub filter: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDatasetContentRequest {
#[serde(rename = "datasetName")]
pub dataset_name: String,
#[serde(rename = "versionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDatasetContentResponse {
#[serde(rename = "entries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub entries: Option<Vec<DatasetEntry>>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<DatasetContentStatus>,
#[serde(rename = "timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct IotEventsDestinationConfiguration {
#[serde(rename = "inputName")]
pub input_name: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct LambdaActivity {
#[serde(rename = "batchSize")]
pub batch_size: i64,
#[serde(rename = "lambdaName")]
pub lambda_name: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListChannelsRequest {
#[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 ListChannelsResponse {
#[serde(rename = "channelSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_summaries: Option<Vec<ChannelSummary>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDatasetContentsRequest {
#[serde(rename = "datasetName")]
pub dataset_name: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "scheduledBefore")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_before: Option<f64>,
#[serde(rename = "scheduledOnOrAfter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_on_or_after: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListDatasetContentsResponse {
#[serde(rename = "datasetContentSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_content_summaries: Option<Vec<DatasetContentSummary>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDatasetsRequest {
#[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 = "datasetSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_summaries: Option<Vec<DatasetSummary>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListDatastoresRequest {
#[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 ListDatastoresResponse {
#[serde(rename = "datastoreSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datastore_summaries: Option<Vec<DatastoreSummary>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPipelinesRequest {
#[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 ListPipelinesResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pipelineSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_summaries: Option<Vec<PipelineSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsForResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForResourceResponse {
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct LoggingOptions {
#[serde(rename = "enabled")]
pub enabled: bool,
#[serde(rename = "level")]
pub level: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MathActivity {
#[serde(rename = "attribute")]
pub attribute: String,
#[serde(rename = "math")]
pub math: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Message {
#[serde(rename = "messageId")]
pub message_id: String,
#[serde(rename = "payload")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub payload: Vec<u8>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct OutputFileUriValue {
#[serde(rename = "fileName")]
pub file_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Pipeline {
#[serde(rename = "activities")]
#[serde(skip_serializing_if = "Option::is_none")]
pub activities: Option<Vec<PipelineActivity>>,
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "reprocessingSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reprocessing_summaries: Option<Vec<ReprocessingSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PipelineActivity {
#[serde(rename = "addAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub add_attributes: Option<AddAttributesActivity>,
#[serde(rename = "channel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub channel: Option<ChannelActivity>,
#[serde(rename = "datastore")]
#[serde(skip_serializing_if = "Option::is_none")]
pub datastore: Option<DatastoreActivity>,
#[serde(rename = "deviceRegistryEnrich")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_registry_enrich: Option<DeviceRegistryEnrichActivity>,
#[serde(rename = "deviceShadowEnrich")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_shadow_enrich: Option<DeviceShadowEnrichActivity>,
#[serde(rename = "filter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter: Option<FilterActivity>,
#[serde(rename = "lambda")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda: Option<LambdaActivity>,
#[serde(rename = "math")]
#[serde(skip_serializing_if = "Option::is_none")]
pub math: Option<MathActivity>,
#[serde(rename = "removeAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_attributes: Option<RemoveAttributesActivity>,
#[serde(rename = "selectAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub select_attributes: Option<SelectAttributesActivity>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PipelineSummary {
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "pipelineName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_name: Option<String>,
#[serde(rename = "reprocessingSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reprocessing_summaries: Option<Vec<ReprocessingSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutLoggingOptionsRequest {
#[serde(rename = "loggingOptions")]
pub logging_options: LoggingOptions,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct QueryFilter {
#[serde(rename = "deltaTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delta_time: Option<DeltaTime>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RemoveAttributesActivity {
#[serde(rename = "attributes")]
pub attributes: Vec<String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ReprocessingSummary {
#[serde(rename = "creationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: 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 ResourceConfiguration {
#[serde(rename = "computeType")]
pub compute_type: String,
#[serde(rename = "volumeSizeInGB")]
pub volume_size_in_gb: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RetentionPeriod {
#[serde(rename = "numberOfDays")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_days: Option<i64>,
#[serde(rename = "unlimited")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unlimited: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RunPipelineActivityRequest {
#[serde(rename = "payloads")]
pub payloads: Vec<Vec<u8>>,
#[serde(rename = "pipelineActivity")]
pub pipeline_activity: PipelineActivity,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RunPipelineActivityResponse {
#[serde(rename = "logResult")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_result: Option<String>,
#[serde(rename = "payloads")]
#[serde(skip_serializing_if = "Option::is_none")]
pub payloads: Option<Vec<Vec<u8>>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SampleChannelDataRequest {
#[serde(rename = "channelName")]
pub channel_name: String,
#[serde(rename = "endTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "maxMessages")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_messages: Option<i64>,
#[serde(rename = "startTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SampleChannelDataResponse {
#[serde(rename = "payloads")]
#[serde(skip_serializing_if = "Option::is_none")]
pub payloads: Option<Vec<Vec<u8>>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Schedule {
#[serde(rename = "expression")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expression: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SelectAttributesActivity {
#[serde(rename = "attributes")]
pub attributes: Vec<String>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "next")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SqlQueryDatasetAction {
#[serde(rename = "filters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<QueryFilter>>,
#[serde(rename = "sqlQuery")]
pub sql_query: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartPipelineReprocessingRequest {
#[serde(rename = "endTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "startTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartPipelineReprocessingResponse {
#[serde(rename = "reprocessingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reprocessing_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "key")]
pub key: String,
#[serde(rename = "value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tags")]
pub tags: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TriggeringDataset {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateChannelRequest {
#[serde(rename = "channelName")]
pub channel_name: String,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDatasetRequest {
#[serde(rename = "actions")]
pub actions: Vec<DatasetAction>,
#[serde(rename = "contentDeliveryRules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_delivery_rules: Option<Vec<DatasetContentDeliveryRule>>,
#[serde(rename = "datasetName")]
pub dataset_name: String,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
#[serde(rename = "triggers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub triggers: Option<Vec<DatasetTrigger>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDatastoreRequest {
#[serde(rename = "datastoreName")]
pub datastore_name: String,
#[serde(rename = "retentionPeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retention_period: Option<RetentionPeriod>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdatePipelineRequest {
#[serde(rename = "pipelineActivities")]
pub pipeline_activities: Vec<PipelineActivity>,
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Variable {
#[serde(rename = "datasetContentVersionValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dataset_content_version_value: Option<DatasetContentVersionValue>,
#[serde(rename = "doubleValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub double_value: Option<f64>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "outputFileUriValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output_file_uri_value: Option<OutputFileUriValue>,
#[serde(rename = "stringValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub string_value: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum BatchPutMessageError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl BatchPutMessageError {
pub fn from_response(res: BufferedHttpResponse) -> BatchPutMessageError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return BatchPutMessageError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return BatchPutMessageError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return BatchPutMessageError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return BatchPutMessageError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return BatchPutMessageError::Throttling(String::from(error_message));
}
"ValidationException" => {
return BatchPutMessageError::Validation(error_message.to_string());
}
_ => {}
}
}
return BatchPutMessageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for BatchPutMessageError {
fn from(err: serde_json::error::Error) -> BatchPutMessageError {
BatchPutMessageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for BatchPutMessageError {
fn from(err: CredentialsError) -> BatchPutMessageError {
BatchPutMessageError::Credentials(err)
}
}
impl From<HttpDispatchError> for BatchPutMessageError {
fn from(err: HttpDispatchError) -> BatchPutMessageError {
BatchPutMessageError::HttpDispatch(err)
}
}
impl From<io::Error> for BatchPutMessageError {
fn from(err: io::Error) -> BatchPutMessageError {
BatchPutMessageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for BatchPutMessageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BatchPutMessageError {
fn description(&self) -> &str {
match *self {
BatchPutMessageError::InternalFailure(ref cause) => cause,
BatchPutMessageError::InvalidRequest(ref cause) => cause,
BatchPutMessageError::ResourceNotFound(ref cause) => cause,
BatchPutMessageError::ServiceUnavailable(ref cause) => cause,
BatchPutMessageError::Throttling(ref cause) => cause,
BatchPutMessageError::Validation(ref cause) => cause,
BatchPutMessageError::Credentials(ref err) => err.description(),
BatchPutMessageError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
BatchPutMessageError::ParseError(ref cause) => cause,
BatchPutMessageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CancelPipelineReprocessingError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CancelPipelineReprocessingError {
pub fn from_response(res: BufferedHttpResponse) -> CancelPipelineReprocessingError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return CancelPipelineReprocessingError::InternalFailure(String::from(
error_message,
));
}
"InvalidRequestException" => {
return CancelPipelineReprocessingError::InvalidRequest(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return CancelPipelineReprocessingError::ResourceNotFound(String::from(
error_message,
));
}
"ServiceUnavailableException" => {
return CancelPipelineReprocessingError::ServiceUnavailable(String::from(
error_message,
));
}
"ThrottlingException" => {
return CancelPipelineReprocessingError::Throttling(String::from(error_message));
}
"ValidationException" => {
return CancelPipelineReprocessingError::Validation(error_message.to_string());
}
_ => {}
}
}
return CancelPipelineReprocessingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CancelPipelineReprocessingError {
fn from(err: serde_json::error::Error) -> CancelPipelineReprocessingError {
CancelPipelineReprocessingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CancelPipelineReprocessingError {
fn from(err: CredentialsError) -> CancelPipelineReprocessingError {
CancelPipelineReprocessingError::Credentials(err)
}
}
impl From<HttpDispatchError> for CancelPipelineReprocessingError {
fn from(err: HttpDispatchError) -> CancelPipelineReprocessingError {
CancelPipelineReprocessingError::HttpDispatch(err)
}
}
impl From<io::Error> for CancelPipelineReprocessingError {
fn from(err: io::Error) -> CancelPipelineReprocessingError {
CancelPipelineReprocessingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CancelPipelineReprocessingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CancelPipelineReprocessingError {
fn description(&self) -> &str {
match *self {
CancelPipelineReprocessingError::InternalFailure(ref cause) => cause,
CancelPipelineReprocessingError::InvalidRequest(ref cause) => cause,
CancelPipelineReprocessingError::ResourceNotFound(ref cause) => cause,
CancelPipelineReprocessingError::ServiceUnavailable(ref cause) => cause,
CancelPipelineReprocessingError::Throttling(ref cause) => cause,
CancelPipelineReprocessingError::Validation(ref cause) => cause,
CancelPipelineReprocessingError::Credentials(ref err) => err.description(),
CancelPipelineReprocessingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CancelPipelineReprocessingError::ParseError(ref cause) => cause,
CancelPipelineReprocessingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateChannelError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateChannelError {
pub fn from_response(res: BufferedHttpResponse) -> CreateChannelError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return CreateChannelError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return CreateChannelError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return CreateChannelError::LimitExceeded(String::from(error_message));
}
"ResourceAlreadyExistsException" => {
return CreateChannelError::ResourceAlreadyExists(String::from(error_message));
}
"ServiceUnavailableException" => {
return CreateChannelError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return CreateChannelError::Throttling(String::from(error_message));
}
"ValidationException" => {
return CreateChannelError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateChannelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateChannelError {
fn from(err: serde_json::error::Error) -> CreateChannelError {
CreateChannelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateChannelError {
fn from(err: CredentialsError) -> CreateChannelError {
CreateChannelError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateChannelError {
fn from(err: HttpDispatchError) -> CreateChannelError {
CreateChannelError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateChannelError {
fn from(err: io::Error) -> CreateChannelError {
CreateChannelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateChannelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateChannelError {
fn description(&self) -> &str {
match *self {
CreateChannelError::InternalFailure(ref cause) => cause,
CreateChannelError::InvalidRequest(ref cause) => cause,
CreateChannelError::LimitExceeded(ref cause) => cause,
CreateChannelError::ResourceAlreadyExists(ref cause) => cause,
CreateChannelError::ServiceUnavailable(ref cause) => cause,
CreateChannelError::Throttling(ref cause) => cause,
CreateChannelError::Validation(ref cause) => cause,
CreateChannelError::Credentials(ref err) => err.description(),
CreateChannelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateChannelError::ParseError(ref cause) => cause,
CreateChannelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDatasetError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDatasetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return CreateDatasetError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return CreateDatasetError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return CreateDatasetError::LimitExceeded(String::from(error_message));
}
"ResourceAlreadyExistsException" => {
return CreateDatasetError::ResourceAlreadyExists(String::from(error_message));
}
"ServiceUnavailableException" => {
return CreateDatasetError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return CreateDatasetError::Throttling(String::from(error_message));
}
"ValidationException" => {
return CreateDatasetError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDatasetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDatasetError {
fn from(err: serde_json::error::Error) -> CreateDatasetError {
CreateDatasetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDatasetError {
fn from(err: CredentialsError) -> CreateDatasetError {
CreateDatasetError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDatasetError {
fn from(err: HttpDispatchError) -> CreateDatasetError {
CreateDatasetError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDatasetError {
fn from(err: io::Error) -> CreateDatasetError {
CreateDatasetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDatasetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDatasetError {
fn description(&self) -> &str {
match *self {
CreateDatasetError::InternalFailure(ref cause) => cause,
CreateDatasetError::InvalidRequest(ref cause) => cause,
CreateDatasetError::LimitExceeded(ref cause) => cause,
CreateDatasetError::ResourceAlreadyExists(ref cause) => cause,
CreateDatasetError::ServiceUnavailable(ref cause) => cause,
CreateDatasetError::Throttling(ref cause) => cause,
CreateDatasetError::Validation(ref cause) => cause,
CreateDatasetError::Credentials(ref err) => err.description(),
CreateDatasetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateDatasetError::ParseError(ref cause) => cause,
CreateDatasetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDatasetContentError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDatasetContentError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDatasetContentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return CreateDatasetContentError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return CreateDatasetContentError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateDatasetContentError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return CreateDatasetContentError::ServiceUnavailable(String::from(
error_message,
));
}
"ThrottlingException" => {
return CreateDatasetContentError::Throttling(String::from(error_message));
}
"ValidationException" => {
return CreateDatasetContentError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDatasetContentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDatasetContentError {
fn from(err: serde_json::error::Error) -> CreateDatasetContentError {
CreateDatasetContentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDatasetContentError {
fn from(err: CredentialsError) -> CreateDatasetContentError {
CreateDatasetContentError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDatasetContentError {
fn from(err: HttpDispatchError) -> CreateDatasetContentError {
CreateDatasetContentError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDatasetContentError {
fn from(err: io::Error) -> CreateDatasetContentError {
CreateDatasetContentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDatasetContentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDatasetContentError {
fn description(&self) -> &str {
match *self {
CreateDatasetContentError::InternalFailure(ref cause) => cause,
CreateDatasetContentError::InvalidRequest(ref cause) => cause,
CreateDatasetContentError::ResourceNotFound(ref cause) => cause,
CreateDatasetContentError::ServiceUnavailable(ref cause) => cause,
CreateDatasetContentError::Throttling(ref cause) => cause,
CreateDatasetContentError::Validation(ref cause) => cause,
CreateDatasetContentError::Credentials(ref err) => err.description(),
CreateDatasetContentError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateDatasetContentError::ParseError(ref cause) => cause,
CreateDatasetContentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateDatastoreError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateDatastoreError {
pub fn from_response(res: BufferedHttpResponse) -> CreateDatastoreError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return CreateDatastoreError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return CreateDatastoreError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return CreateDatastoreError::LimitExceeded(String::from(error_message));
}
"ResourceAlreadyExistsException" => {
return CreateDatastoreError::ResourceAlreadyExists(String::from(error_message));
}
"ServiceUnavailableException" => {
return CreateDatastoreError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return CreateDatastoreError::Throttling(String::from(error_message));
}
"ValidationException" => {
return CreateDatastoreError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateDatastoreError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateDatastoreError {
fn from(err: serde_json::error::Error) -> CreateDatastoreError {
CreateDatastoreError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateDatastoreError {
fn from(err: CredentialsError) -> CreateDatastoreError {
CreateDatastoreError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateDatastoreError {
fn from(err: HttpDispatchError) -> CreateDatastoreError {
CreateDatastoreError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateDatastoreError {
fn from(err: io::Error) -> CreateDatastoreError {
CreateDatastoreError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateDatastoreError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateDatastoreError {
fn description(&self) -> &str {
match *self {
CreateDatastoreError::InternalFailure(ref cause) => cause,
CreateDatastoreError::InvalidRequest(ref cause) => cause,
CreateDatastoreError::LimitExceeded(ref cause) => cause,
CreateDatastoreError::ResourceAlreadyExists(ref cause) => cause,
CreateDatastoreError::ServiceUnavailable(ref cause) => cause,
CreateDatastoreError::Throttling(ref cause) => cause,
CreateDatastoreError::Validation(ref cause) => cause,
CreateDatastoreError::Credentials(ref err) => err.description(),
CreateDatastoreError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateDatastoreError::ParseError(ref cause) => cause,
CreateDatastoreError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePipelineError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePipelineError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePipelineError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return CreatePipelineError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return CreatePipelineError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return CreatePipelineError::LimitExceeded(String::from(error_message));
}
"ResourceAlreadyExistsException" => {
return CreatePipelineError::ResourceAlreadyExists(String::from(error_message));
}
"ServiceUnavailableException" => {
return CreatePipelineError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return CreatePipelineError::Throttling(String::from(error_message));
}
"ValidationException" => {
return CreatePipelineError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreatePipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreatePipelineError {
fn from(err: serde_json::error::Error) -> CreatePipelineError {
CreatePipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreatePipelineError {
fn from(err: CredentialsError) -> CreatePipelineError {
CreatePipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePipelineError {
fn from(err: HttpDispatchError) -> CreatePipelineError {
CreatePipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePipelineError {
fn from(err: io::Error) -> CreatePipelineError {
CreatePipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePipelineError {
fn description(&self) -> &str {
match *self {
CreatePipelineError::InternalFailure(ref cause) => cause,
CreatePipelineError::InvalidRequest(ref cause) => cause,
CreatePipelineError::LimitExceeded(ref cause) => cause,
CreatePipelineError::ResourceAlreadyExists(ref cause) => cause,
CreatePipelineError::ServiceUnavailable(ref cause) => cause,
CreatePipelineError::Throttling(ref cause) => cause,
CreatePipelineError::Validation(ref cause) => cause,
CreatePipelineError::Credentials(ref err) => err.description(),
CreatePipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreatePipelineError::ParseError(ref cause) => cause,
CreatePipelineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteChannelError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteChannelError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteChannelError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DeleteChannelError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DeleteChannelError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteChannelError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DeleteChannelError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DeleteChannelError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DeleteChannelError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteChannelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteChannelError {
fn from(err: serde_json::error::Error) -> DeleteChannelError {
DeleteChannelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteChannelError {
fn from(err: CredentialsError) -> DeleteChannelError {
DeleteChannelError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteChannelError {
fn from(err: HttpDispatchError) -> DeleteChannelError {
DeleteChannelError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteChannelError {
fn from(err: io::Error) -> DeleteChannelError {
DeleteChannelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteChannelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteChannelError {
fn description(&self) -> &str {
match *self {
DeleteChannelError::InternalFailure(ref cause) => cause,
DeleteChannelError::InvalidRequest(ref cause) => cause,
DeleteChannelError::ResourceNotFound(ref cause) => cause,
DeleteChannelError::ServiceUnavailable(ref cause) => cause,
DeleteChannelError::Throttling(ref cause) => cause,
DeleteChannelError::Validation(ref cause) => cause,
DeleteChannelError::Credentials(ref err) => err.description(),
DeleteChannelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteChannelError::ParseError(ref cause) => cause,
DeleteChannelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDatasetError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDatasetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DeleteDatasetError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DeleteDatasetError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteDatasetError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DeleteDatasetError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DeleteDatasetError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DeleteDatasetError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDatasetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDatasetError {
fn from(err: serde_json::error::Error) -> DeleteDatasetError {
DeleteDatasetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDatasetError {
fn from(err: CredentialsError) -> DeleteDatasetError {
DeleteDatasetError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDatasetError {
fn from(err: HttpDispatchError) -> DeleteDatasetError {
DeleteDatasetError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDatasetError {
fn from(err: io::Error) -> DeleteDatasetError {
DeleteDatasetError::HttpDispatch(HttpDispatchError::from(err))
}
}
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::InternalFailure(ref cause) => cause,
DeleteDatasetError::InvalidRequest(ref cause) => cause,
DeleteDatasetError::ResourceNotFound(ref cause) => cause,
DeleteDatasetError::ServiceUnavailable(ref cause) => cause,
DeleteDatasetError::Throttling(ref cause) => cause,
DeleteDatasetError::Validation(ref cause) => cause,
DeleteDatasetError::Credentials(ref err) => err.description(),
DeleteDatasetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteDatasetError::ParseError(ref cause) => cause,
DeleteDatasetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDatasetContentError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDatasetContentError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDatasetContentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DeleteDatasetContentError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DeleteDatasetContentError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteDatasetContentError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DeleteDatasetContentError::ServiceUnavailable(String::from(
error_message,
));
}
"ThrottlingException" => {
return DeleteDatasetContentError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DeleteDatasetContentError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDatasetContentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDatasetContentError {
fn from(err: serde_json::error::Error) -> DeleteDatasetContentError {
DeleteDatasetContentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDatasetContentError {
fn from(err: CredentialsError) -> DeleteDatasetContentError {
DeleteDatasetContentError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDatasetContentError {
fn from(err: HttpDispatchError) -> DeleteDatasetContentError {
DeleteDatasetContentError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDatasetContentError {
fn from(err: io::Error) -> DeleteDatasetContentError {
DeleteDatasetContentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDatasetContentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDatasetContentError {
fn description(&self) -> &str {
match *self {
DeleteDatasetContentError::InternalFailure(ref cause) => cause,
DeleteDatasetContentError::InvalidRequest(ref cause) => cause,
DeleteDatasetContentError::ResourceNotFound(ref cause) => cause,
DeleteDatasetContentError::ServiceUnavailable(ref cause) => cause,
DeleteDatasetContentError::Throttling(ref cause) => cause,
DeleteDatasetContentError::Validation(ref cause) => cause,
DeleteDatasetContentError::Credentials(ref err) => err.description(),
DeleteDatasetContentError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteDatasetContentError::ParseError(ref cause) => cause,
DeleteDatasetContentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDatastoreError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteDatastoreError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteDatastoreError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DeleteDatastoreError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DeleteDatastoreError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteDatastoreError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DeleteDatastoreError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DeleteDatastoreError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DeleteDatastoreError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteDatastoreError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteDatastoreError {
fn from(err: serde_json::error::Error) -> DeleteDatastoreError {
DeleteDatastoreError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteDatastoreError {
fn from(err: CredentialsError) -> DeleteDatastoreError {
DeleteDatastoreError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteDatastoreError {
fn from(err: HttpDispatchError) -> DeleteDatastoreError {
DeleteDatastoreError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteDatastoreError {
fn from(err: io::Error) -> DeleteDatastoreError {
DeleteDatastoreError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteDatastoreError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDatastoreError {
fn description(&self) -> &str {
match *self {
DeleteDatastoreError::InternalFailure(ref cause) => cause,
DeleteDatastoreError::InvalidRequest(ref cause) => cause,
DeleteDatastoreError::ResourceNotFound(ref cause) => cause,
DeleteDatastoreError::ServiceUnavailable(ref cause) => cause,
DeleteDatastoreError::Throttling(ref cause) => cause,
DeleteDatastoreError::Validation(ref cause) => cause,
DeleteDatastoreError::Credentials(ref err) => err.description(),
DeleteDatastoreError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteDatastoreError::ParseError(ref cause) => cause,
DeleteDatastoreError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeletePipelineError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeletePipelineError {
pub fn from_response(res: BufferedHttpResponse) -> DeletePipelineError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DeletePipelineError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DeletePipelineError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeletePipelineError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DeletePipelineError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DeletePipelineError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DeletePipelineError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeletePipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeletePipelineError {
fn from(err: serde_json::error::Error) -> DeletePipelineError {
DeletePipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeletePipelineError {
fn from(err: CredentialsError) -> DeletePipelineError {
DeletePipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeletePipelineError {
fn from(err: HttpDispatchError) -> DeletePipelineError {
DeletePipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for DeletePipelineError {
fn from(err: io::Error) -> DeletePipelineError {
DeletePipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeletePipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeletePipelineError {
fn description(&self) -> &str {
match *self {
DeletePipelineError::InternalFailure(ref cause) => cause,
DeletePipelineError::InvalidRequest(ref cause) => cause,
DeletePipelineError::ResourceNotFound(ref cause) => cause,
DeletePipelineError::ServiceUnavailable(ref cause) => cause,
DeletePipelineError::Throttling(ref cause) => cause,
DeletePipelineError::Validation(ref cause) => cause,
DeletePipelineError::Credentials(ref err) => err.description(),
DeletePipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeletePipelineError::ParseError(ref cause) => cause,
DeletePipelineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeChannelError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeChannelError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeChannelError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DescribeChannelError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DescribeChannelError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeChannelError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DescribeChannelError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DescribeChannelError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DescribeChannelError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeChannelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeChannelError {
fn from(err: serde_json::error::Error) -> DescribeChannelError {
DescribeChannelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeChannelError {
fn from(err: CredentialsError) -> DescribeChannelError {
DescribeChannelError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeChannelError {
fn from(err: HttpDispatchError) -> DescribeChannelError {
DescribeChannelError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeChannelError {
fn from(err: io::Error) -> DescribeChannelError {
DescribeChannelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeChannelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeChannelError {
fn description(&self) -> &str {
match *self {
DescribeChannelError::InternalFailure(ref cause) => cause,
DescribeChannelError::InvalidRequest(ref cause) => cause,
DescribeChannelError::ResourceNotFound(ref cause) => cause,
DescribeChannelError::ServiceUnavailable(ref cause) => cause,
DescribeChannelError::Throttling(ref cause) => cause,
DescribeChannelError::Validation(ref cause) => cause,
DescribeChannelError::Credentials(ref err) => err.description(),
DescribeChannelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeChannelError::ParseError(ref cause) => cause,
DescribeChannelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDatasetError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeDatasetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DescribeDatasetError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DescribeDatasetError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeDatasetError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DescribeDatasetError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DescribeDatasetError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DescribeDatasetError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeDatasetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDatasetError {
fn from(err: serde_json::error::Error) -> DescribeDatasetError {
DescribeDatasetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDatasetError {
fn from(err: CredentialsError) -> DescribeDatasetError {
DescribeDatasetError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDatasetError {
fn from(err: HttpDispatchError) -> DescribeDatasetError {
DescribeDatasetError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDatasetError {
fn from(err: io::Error) -> DescribeDatasetError {
DescribeDatasetError::HttpDispatch(HttpDispatchError::from(err))
}
}
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::InternalFailure(ref cause) => cause,
DescribeDatasetError::InvalidRequest(ref cause) => cause,
DescribeDatasetError::ResourceNotFound(ref cause) => cause,
DescribeDatasetError::ServiceUnavailable(ref cause) => cause,
DescribeDatasetError::Throttling(ref cause) => cause,
DescribeDatasetError::Validation(ref cause) => cause,
DescribeDatasetError::Credentials(ref err) => err.description(),
DescribeDatasetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeDatasetError::ParseError(ref cause) => cause,
DescribeDatasetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDatastoreError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDatastoreError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeDatastoreError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DescribeDatastoreError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DescribeDatastoreError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeDatastoreError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DescribeDatastoreError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DescribeDatastoreError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DescribeDatastoreError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeDatastoreError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDatastoreError {
fn from(err: serde_json::error::Error) -> DescribeDatastoreError {
DescribeDatastoreError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDatastoreError {
fn from(err: CredentialsError) -> DescribeDatastoreError {
DescribeDatastoreError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDatastoreError {
fn from(err: HttpDispatchError) -> DescribeDatastoreError {
DescribeDatastoreError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDatastoreError {
fn from(err: io::Error) -> DescribeDatastoreError {
DescribeDatastoreError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDatastoreError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDatastoreError {
fn description(&self) -> &str {
match *self {
DescribeDatastoreError::InternalFailure(ref cause) => cause,
DescribeDatastoreError::InvalidRequest(ref cause) => cause,
DescribeDatastoreError::ResourceNotFound(ref cause) => cause,
DescribeDatastoreError::ServiceUnavailable(ref cause) => cause,
DescribeDatastoreError::Throttling(ref cause) => cause,
DescribeDatastoreError::Validation(ref cause) => cause,
DescribeDatastoreError::Credentials(ref err) => err.description(),
DescribeDatastoreError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDatastoreError::ParseError(ref cause) => cause,
DescribeDatastoreError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeLoggingOptionsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeLoggingOptionsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeLoggingOptionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DescribeLoggingOptionsError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DescribeLoggingOptionsError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribeLoggingOptionsError::ResourceNotFound(String::from(
error_message,
));
}
"ServiceUnavailableException" => {
return DescribeLoggingOptionsError::ServiceUnavailable(String::from(
error_message,
));
}
"ThrottlingException" => {
return DescribeLoggingOptionsError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DescribeLoggingOptionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeLoggingOptionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeLoggingOptionsError {
fn from(err: serde_json::error::Error) -> DescribeLoggingOptionsError {
DescribeLoggingOptionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeLoggingOptionsError {
fn from(err: CredentialsError) -> DescribeLoggingOptionsError {
DescribeLoggingOptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeLoggingOptionsError {
fn from(err: HttpDispatchError) -> DescribeLoggingOptionsError {
DescribeLoggingOptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeLoggingOptionsError {
fn from(err: io::Error) -> DescribeLoggingOptionsError {
DescribeLoggingOptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeLoggingOptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeLoggingOptionsError {
fn description(&self) -> &str {
match *self {
DescribeLoggingOptionsError::InternalFailure(ref cause) => cause,
DescribeLoggingOptionsError::InvalidRequest(ref cause) => cause,
DescribeLoggingOptionsError::ResourceNotFound(ref cause) => cause,
DescribeLoggingOptionsError::ServiceUnavailable(ref cause) => cause,
DescribeLoggingOptionsError::Throttling(ref cause) => cause,
DescribeLoggingOptionsError::Validation(ref cause) => cause,
DescribeLoggingOptionsError::Credentials(ref err) => err.description(),
DescribeLoggingOptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeLoggingOptionsError::ParseError(ref cause) => cause,
DescribeLoggingOptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribePipelineError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribePipelineError {
pub fn from_response(res: BufferedHttpResponse) -> DescribePipelineError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return DescribePipelineError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return DescribePipelineError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return DescribePipelineError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return DescribePipelineError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return DescribePipelineError::Throttling(String::from(error_message));
}
"ValidationException" => {
return DescribePipelineError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribePipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribePipelineError {
fn from(err: serde_json::error::Error) -> DescribePipelineError {
DescribePipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribePipelineError {
fn from(err: CredentialsError) -> DescribePipelineError {
DescribePipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribePipelineError {
fn from(err: HttpDispatchError) -> DescribePipelineError {
DescribePipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribePipelineError {
fn from(err: io::Error) -> DescribePipelineError {
DescribePipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribePipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribePipelineError {
fn description(&self) -> &str {
match *self {
DescribePipelineError::InternalFailure(ref cause) => cause,
DescribePipelineError::InvalidRequest(ref cause) => cause,
DescribePipelineError::ResourceNotFound(ref cause) => cause,
DescribePipelineError::ServiceUnavailable(ref cause) => cause,
DescribePipelineError::Throttling(ref cause) => cause,
DescribePipelineError::Validation(ref cause) => cause,
DescribePipelineError::Credentials(ref err) => err.description(),
DescribePipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribePipelineError::ParseError(ref cause) => cause,
DescribePipelineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDatasetContentError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDatasetContentError {
pub fn from_response(res: BufferedHttpResponse) -> GetDatasetContentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return GetDatasetContentError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return GetDatasetContentError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return GetDatasetContentError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return GetDatasetContentError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return GetDatasetContentError::Throttling(String::from(error_message));
}
"ValidationException" => {
return GetDatasetContentError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDatasetContentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDatasetContentError {
fn from(err: serde_json::error::Error) -> GetDatasetContentError {
GetDatasetContentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDatasetContentError {
fn from(err: CredentialsError) -> GetDatasetContentError {
GetDatasetContentError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDatasetContentError {
fn from(err: HttpDispatchError) -> GetDatasetContentError {
GetDatasetContentError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDatasetContentError {
fn from(err: io::Error) -> GetDatasetContentError {
GetDatasetContentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDatasetContentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDatasetContentError {
fn description(&self) -> &str {
match *self {
GetDatasetContentError::InternalFailure(ref cause) => cause,
GetDatasetContentError::InvalidRequest(ref cause) => cause,
GetDatasetContentError::ResourceNotFound(ref cause) => cause,
GetDatasetContentError::ServiceUnavailable(ref cause) => cause,
GetDatasetContentError::Throttling(ref cause) => cause,
GetDatasetContentError::Validation(ref cause) => cause,
GetDatasetContentError::Credentials(ref err) => err.description(),
GetDatasetContentError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetDatasetContentError::ParseError(ref cause) => cause,
GetDatasetContentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListChannelsError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListChannelsError {
pub fn from_response(res: BufferedHttpResponse) -> ListChannelsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return ListChannelsError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return ListChannelsError::InvalidRequest(String::from(error_message));
}
"ServiceUnavailableException" => {
return ListChannelsError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return ListChannelsError::Throttling(String::from(error_message));
}
"ValidationException" => {
return ListChannelsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListChannelsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListChannelsError {
fn from(err: serde_json::error::Error) -> ListChannelsError {
ListChannelsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListChannelsError {
fn from(err: CredentialsError) -> ListChannelsError {
ListChannelsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListChannelsError {
fn from(err: HttpDispatchError) -> ListChannelsError {
ListChannelsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListChannelsError {
fn from(err: io::Error) -> ListChannelsError {
ListChannelsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListChannelsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListChannelsError {
fn description(&self) -> &str {
match *self {
ListChannelsError::InternalFailure(ref cause) => cause,
ListChannelsError::InvalidRequest(ref cause) => cause,
ListChannelsError::ServiceUnavailable(ref cause) => cause,
ListChannelsError::Throttling(ref cause) => cause,
ListChannelsError::Validation(ref cause) => cause,
ListChannelsError::Credentials(ref err) => err.description(),
ListChannelsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListChannelsError::ParseError(ref cause) => cause,
ListChannelsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDatasetContentsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListDatasetContentsError {
pub fn from_response(res: BufferedHttpResponse) -> ListDatasetContentsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return ListDatasetContentsError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return ListDatasetContentsError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListDatasetContentsError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return ListDatasetContentsError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return ListDatasetContentsError::Throttling(String::from(error_message));
}
"ValidationException" => {
return ListDatasetContentsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListDatasetContentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListDatasetContentsError {
fn from(err: serde_json::error::Error) -> ListDatasetContentsError {
ListDatasetContentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListDatasetContentsError {
fn from(err: CredentialsError) -> ListDatasetContentsError {
ListDatasetContentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListDatasetContentsError {
fn from(err: HttpDispatchError) -> ListDatasetContentsError {
ListDatasetContentsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListDatasetContentsError {
fn from(err: io::Error) -> ListDatasetContentsError {
ListDatasetContentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListDatasetContentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDatasetContentsError {
fn description(&self) -> &str {
match *self {
ListDatasetContentsError::InternalFailure(ref cause) => cause,
ListDatasetContentsError::InvalidRequest(ref cause) => cause,
ListDatasetContentsError::ResourceNotFound(ref cause) => cause,
ListDatasetContentsError::ServiceUnavailable(ref cause) => cause,
ListDatasetContentsError::Throttling(ref cause) => cause,
ListDatasetContentsError::Validation(ref cause) => cause,
ListDatasetContentsError::Credentials(ref err) => err.description(),
ListDatasetContentsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListDatasetContentsError::ParseError(ref cause) => cause,
ListDatasetContentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDatasetsError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListDatasetsError {
pub fn from_response(res: BufferedHttpResponse) -> ListDatasetsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return ListDatasetsError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return ListDatasetsError::InvalidRequest(String::from(error_message));
}
"ServiceUnavailableException" => {
return ListDatasetsError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return ListDatasetsError::Throttling(String::from(error_message));
}
"ValidationException" => {
return ListDatasetsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListDatasetsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListDatasetsError {
fn from(err: serde_json::error::Error) -> ListDatasetsError {
ListDatasetsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListDatasetsError {
fn from(err: CredentialsError) -> ListDatasetsError {
ListDatasetsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListDatasetsError {
fn from(err: HttpDispatchError) -> ListDatasetsError {
ListDatasetsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListDatasetsError {
fn from(err: io::Error) -> ListDatasetsError {
ListDatasetsError::HttpDispatch(HttpDispatchError::from(err))
}
}
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::InternalFailure(ref cause) => cause,
ListDatasetsError::InvalidRequest(ref cause) => cause,
ListDatasetsError::ServiceUnavailable(ref cause) => cause,
ListDatasetsError::Throttling(ref cause) => cause,
ListDatasetsError::Validation(ref cause) => cause,
ListDatasetsError::Credentials(ref err) => err.description(),
ListDatasetsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListDatasetsError::ParseError(ref cause) => cause,
ListDatasetsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDatastoresError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListDatastoresError {
pub fn from_response(res: BufferedHttpResponse) -> ListDatastoresError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return ListDatastoresError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return ListDatastoresError::InvalidRequest(String::from(error_message));
}
"ServiceUnavailableException" => {
return ListDatastoresError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return ListDatastoresError::Throttling(String::from(error_message));
}
"ValidationException" => {
return ListDatastoresError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListDatastoresError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListDatastoresError {
fn from(err: serde_json::error::Error) -> ListDatastoresError {
ListDatastoresError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListDatastoresError {
fn from(err: CredentialsError) -> ListDatastoresError {
ListDatastoresError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListDatastoresError {
fn from(err: HttpDispatchError) -> ListDatastoresError {
ListDatastoresError::HttpDispatch(err)
}
}
impl From<io::Error> for ListDatastoresError {
fn from(err: io::Error) -> ListDatastoresError {
ListDatastoresError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListDatastoresError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDatastoresError {
fn description(&self) -> &str {
match *self {
ListDatastoresError::InternalFailure(ref cause) => cause,
ListDatastoresError::InvalidRequest(ref cause) => cause,
ListDatastoresError::ServiceUnavailable(ref cause) => cause,
ListDatastoresError::Throttling(ref cause) => cause,
ListDatastoresError::Validation(ref cause) => cause,
ListDatastoresError::Credentials(ref err) => err.description(),
ListDatastoresError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListDatastoresError::ParseError(ref cause) => cause,
ListDatastoresError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPipelinesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPipelinesError {
pub fn from_response(res: BufferedHttpResponse) -> ListPipelinesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return ListPipelinesError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return ListPipelinesError::InvalidRequest(String::from(error_message));
}
"ServiceUnavailableException" => {
return ListPipelinesError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return ListPipelinesError::Throttling(String::from(error_message));
}
"ValidationException" => {
return ListPipelinesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListPipelinesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPipelinesError {
fn from(err: serde_json::error::Error) -> ListPipelinesError {
ListPipelinesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPipelinesError {
fn from(err: CredentialsError) -> ListPipelinesError {
ListPipelinesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPipelinesError {
fn from(err: HttpDispatchError) -> ListPipelinesError {
ListPipelinesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPipelinesError {
fn from(err: io::Error) -> ListPipelinesError {
ListPipelinesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPipelinesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPipelinesError {
fn description(&self) -> &str {
match *self {
ListPipelinesError::InternalFailure(ref cause) => cause,
ListPipelinesError::InvalidRequest(ref cause) => cause,
ListPipelinesError::ServiceUnavailable(ref cause) => cause,
ListPipelinesError::Throttling(ref cause) => cause,
ListPipelinesError::Validation(ref cause) => cause,
ListPipelinesError::Credentials(ref err) => err.description(),
ListPipelinesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListPipelinesError::ParseError(ref cause) => cause,
ListPipelinesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> ListTagsForResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return ListTagsForResourceError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return ListTagsForResourceError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return ListTagsForResourceError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListTagsForResourceError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return ListTagsForResourceError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return ListTagsForResourceError::Throttling(String::from(error_message));
}
"ValidationException" => {
return ListTagsForResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTagsForResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTagsForResourceError {
fn from(err: serde_json::error::Error) -> ListTagsForResourceError {
ListTagsForResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTagsForResourceError {
fn from(err: CredentialsError) -> ListTagsForResourceError {
ListTagsForResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTagsForResourceError {
fn from(err: HttpDispatchError) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTagsForResourceError {
fn from(err: io::Error) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTagsForResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForResourceError {
fn description(&self) -> &str {
match *self {
ListTagsForResourceError::InternalFailure(ref cause) => cause,
ListTagsForResourceError::InvalidRequest(ref cause) => cause,
ListTagsForResourceError::LimitExceeded(ref cause) => cause,
ListTagsForResourceError::ResourceNotFound(ref cause) => cause,
ListTagsForResourceError::ServiceUnavailable(ref cause) => cause,
ListTagsForResourceError::Throttling(ref cause) => cause,
ListTagsForResourceError::Validation(ref cause) => cause,
ListTagsForResourceError::Credentials(ref err) => err.description(),
ListTagsForResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTagsForResourceError::ParseError(ref cause) => cause,
ListTagsForResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutLoggingOptionsError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutLoggingOptionsError {
pub fn from_response(res: BufferedHttpResponse) -> PutLoggingOptionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return PutLoggingOptionsError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return PutLoggingOptionsError::InvalidRequest(String::from(error_message));
}
"ServiceUnavailableException" => {
return PutLoggingOptionsError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return PutLoggingOptionsError::Throttling(String::from(error_message));
}
"ValidationException" => {
return PutLoggingOptionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutLoggingOptionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutLoggingOptionsError {
fn from(err: serde_json::error::Error) -> PutLoggingOptionsError {
PutLoggingOptionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutLoggingOptionsError {
fn from(err: CredentialsError) -> PutLoggingOptionsError {
PutLoggingOptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutLoggingOptionsError {
fn from(err: HttpDispatchError) -> PutLoggingOptionsError {
PutLoggingOptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for PutLoggingOptionsError {
fn from(err: io::Error) -> PutLoggingOptionsError {
PutLoggingOptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutLoggingOptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutLoggingOptionsError {
fn description(&self) -> &str {
match *self {
PutLoggingOptionsError::InternalFailure(ref cause) => cause,
PutLoggingOptionsError::InvalidRequest(ref cause) => cause,
PutLoggingOptionsError::ServiceUnavailable(ref cause) => cause,
PutLoggingOptionsError::Throttling(ref cause) => cause,
PutLoggingOptionsError::Validation(ref cause) => cause,
PutLoggingOptionsError::Credentials(ref err) => err.description(),
PutLoggingOptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutLoggingOptionsError::ParseError(ref cause) => cause,
PutLoggingOptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RunPipelineActivityError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RunPipelineActivityError {
pub fn from_response(res: BufferedHttpResponse) -> RunPipelineActivityError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return RunPipelineActivityError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return RunPipelineActivityError::InvalidRequest(String::from(error_message));
}
"ServiceUnavailableException" => {
return RunPipelineActivityError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return RunPipelineActivityError::Throttling(String::from(error_message));
}
"ValidationException" => {
return RunPipelineActivityError::Validation(error_message.to_string());
}
_ => {}
}
}
return RunPipelineActivityError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RunPipelineActivityError {
fn from(err: serde_json::error::Error) -> RunPipelineActivityError {
RunPipelineActivityError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RunPipelineActivityError {
fn from(err: CredentialsError) -> RunPipelineActivityError {
RunPipelineActivityError::Credentials(err)
}
}
impl From<HttpDispatchError> for RunPipelineActivityError {
fn from(err: HttpDispatchError) -> RunPipelineActivityError {
RunPipelineActivityError::HttpDispatch(err)
}
}
impl From<io::Error> for RunPipelineActivityError {
fn from(err: io::Error) -> RunPipelineActivityError {
RunPipelineActivityError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RunPipelineActivityError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RunPipelineActivityError {
fn description(&self) -> &str {
match *self {
RunPipelineActivityError::InternalFailure(ref cause) => cause,
RunPipelineActivityError::InvalidRequest(ref cause) => cause,
RunPipelineActivityError::ServiceUnavailable(ref cause) => cause,
RunPipelineActivityError::Throttling(ref cause) => cause,
RunPipelineActivityError::Validation(ref cause) => cause,
RunPipelineActivityError::Credentials(ref err) => err.description(),
RunPipelineActivityError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RunPipelineActivityError::ParseError(ref cause) => cause,
RunPipelineActivityError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SampleChannelDataError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SampleChannelDataError {
pub fn from_response(res: BufferedHttpResponse) -> SampleChannelDataError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return SampleChannelDataError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return SampleChannelDataError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return SampleChannelDataError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return SampleChannelDataError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return SampleChannelDataError::Throttling(String::from(error_message));
}
"ValidationException" => {
return SampleChannelDataError::Validation(error_message.to_string());
}
_ => {}
}
}
return SampleChannelDataError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SampleChannelDataError {
fn from(err: serde_json::error::Error) -> SampleChannelDataError {
SampleChannelDataError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SampleChannelDataError {
fn from(err: CredentialsError) -> SampleChannelDataError {
SampleChannelDataError::Credentials(err)
}
}
impl From<HttpDispatchError> for SampleChannelDataError {
fn from(err: HttpDispatchError) -> SampleChannelDataError {
SampleChannelDataError::HttpDispatch(err)
}
}
impl From<io::Error> for SampleChannelDataError {
fn from(err: io::Error) -> SampleChannelDataError {
SampleChannelDataError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SampleChannelDataError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SampleChannelDataError {
fn description(&self) -> &str {
match *self {
SampleChannelDataError::InternalFailure(ref cause) => cause,
SampleChannelDataError::InvalidRequest(ref cause) => cause,
SampleChannelDataError::ResourceNotFound(ref cause) => cause,
SampleChannelDataError::ServiceUnavailable(ref cause) => cause,
SampleChannelDataError::Throttling(ref cause) => cause,
SampleChannelDataError::Validation(ref cause) => cause,
SampleChannelDataError::Credentials(ref err) => err.description(),
SampleChannelDataError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SampleChannelDataError::ParseError(ref cause) => cause,
SampleChannelDataError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartPipelineReprocessingError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartPipelineReprocessingError {
pub fn from_response(res: BufferedHttpResponse) -> StartPipelineReprocessingError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return StartPipelineReprocessingError::InternalFailure(String::from(
error_message,
));
}
"InvalidRequestException" => {
return StartPipelineReprocessingError::InvalidRequest(String::from(
error_message,
));
}
"ResourceAlreadyExistsException" => {
return StartPipelineReprocessingError::ResourceAlreadyExists(String::from(
error_message,
));
}
"ResourceNotFoundException" => {
return StartPipelineReprocessingError::ResourceNotFound(String::from(
error_message,
));
}
"ServiceUnavailableException" => {
return StartPipelineReprocessingError::ServiceUnavailable(String::from(
error_message,
));
}
"ThrottlingException" => {
return StartPipelineReprocessingError::Throttling(String::from(error_message));
}
"ValidationException" => {
return StartPipelineReprocessingError::Validation(error_message.to_string());
}
_ => {}
}
}
return StartPipelineReprocessingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartPipelineReprocessingError {
fn from(err: serde_json::error::Error) -> StartPipelineReprocessingError {
StartPipelineReprocessingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartPipelineReprocessingError {
fn from(err: CredentialsError) -> StartPipelineReprocessingError {
StartPipelineReprocessingError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartPipelineReprocessingError {
fn from(err: HttpDispatchError) -> StartPipelineReprocessingError {
StartPipelineReprocessingError::HttpDispatch(err)
}
}
impl From<io::Error> for StartPipelineReprocessingError {
fn from(err: io::Error) -> StartPipelineReprocessingError {
StartPipelineReprocessingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartPipelineReprocessingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartPipelineReprocessingError {
fn description(&self) -> &str {
match *self {
StartPipelineReprocessingError::InternalFailure(ref cause) => cause,
StartPipelineReprocessingError::InvalidRequest(ref cause) => cause,
StartPipelineReprocessingError::ResourceAlreadyExists(ref cause) => cause,
StartPipelineReprocessingError::ResourceNotFound(ref cause) => cause,
StartPipelineReprocessingError::ServiceUnavailable(ref cause) => cause,
StartPipelineReprocessingError::Throttling(ref cause) => cause,
StartPipelineReprocessingError::Validation(ref cause) => cause,
StartPipelineReprocessingError::Credentials(ref err) => err.description(),
StartPipelineReprocessingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartPipelineReprocessingError::ParseError(ref cause) => cause,
StartPipelineReprocessingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> TagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return TagResourceError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return TagResourceError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return TagResourceError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return TagResourceError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return TagResourceError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return TagResourceError::Throttling(String::from(error_message));
}
"ValidationException" => {
return TagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return TagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TagResourceError {
fn from(err: serde_json::error::Error) -> TagResourceError {
TagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TagResourceError {
fn from(err: CredentialsError) -> TagResourceError {
TagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for TagResourceError {
fn from(err: HttpDispatchError) -> TagResourceError {
TagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for TagResourceError {
fn from(err: io::Error) -> TagResourceError {
TagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::InternalFailure(ref cause) => cause,
TagResourceError::InvalidRequest(ref cause) => cause,
TagResourceError::LimitExceeded(ref cause) => cause,
TagResourceError::ResourceNotFound(ref cause) => cause,
TagResourceError::ServiceUnavailable(ref cause) => cause,
TagResourceError::Throttling(ref cause) => cause,
TagResourceError::Validation(ref cause) => cause,
TagResourceError::Credentials(ref err) => err.description(),
TagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TagResourceError::ParseError(ref cause) => cause,
TagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> UntagResourceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return UntagResourceError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return UntagResourceError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return UntagResourceError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UntagResourceError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return UntagResourceError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return UntagResourceError::Throttling(String::from(error_message));
}
"ValidationException" => {
return UntagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return UntagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UntagResourceError {
fn from(err: serde_json::error::Error) -> UntagResourceError {
UntagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UntagResourceError {
fn from(err: CredentialsError) -> UntagResourceError {
UntagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UntagResourceError {
fn from(err: HttpDispatchError) -> UntagResourceError {
UntagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for UntagResourceError {
fn from(err: io::Error) -> UntagResourceError {
UntagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::InternalFailure(ref cause) => cause,
UntagResourceError::InvalidRequest(ref cause) => cause,
UntagResourceError::LimitExceeded(ref cause) => cause,
UntagResourceError::ResourceNotFound(ref cause) => cause,
UntagResourceError::ServiceUnavailable(ref cause) => cause,
UntagResourceError::Throttling(ref cause) => cause,
UntagResourceError::Validation(ref cause) => cause,
UntagResourceError::Credentials(ref err) => err.description(),
UntagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UntagResourceError::ParseError(ref cause) => cause,
UntagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateChannelError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateChannelError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateChannelError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return UpdateChannelError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return UpdateChannelError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateChannelError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return UpdateChannelError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return UpdateChannelError::Throttling(String::from(error_message));
}
"ValidationException" => {
return UpdateChannelError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateChannelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateChannelError {
fn from(err: serde_json::error::Error) -> UpdateChannelError {
UpdateChannelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateChannelError {
fn from(err: CredentialsError) -> UpdateChannelError {
UpdateChannelError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateChannelError {
fn from(err: HttpDispatchError) -> UpdateChannelError {
UpdateChannelError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateChannelError {
fn from(err: io::Error) -> UpdateChannelError {
UpdateChannelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateChannelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateChannelError {
fn description(&self) -> &str {
match *self {
UpdateChannelError::InternalFailure(ref cause) => cause,
UpdateChannelError::InvalidRequest(ref cause) => cause,
UpdateChannelError::ResourceNotFound(ref cause) => cause,
UpdateChannelError::ServiceUnavailable(ref cause) => cause,
UpdateChannelError::Throttling(ref cause) => cause,
UpdateChannelError::Validation(ref cause) => cause,
UpdateChannelError::Credentials(ref err) => err.description(),
UpdateChannelError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateChannelError::ParseError(ref cause) => cause,
UpdateChannelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDatasetError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDatasetError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDatasetError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return UpdateDatasetError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return UpdateDatasetError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateDatasetError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return UpdateDatasetError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return UpdateDatasetError::Throttling(String::from(error_message));
}
"ValidationException" => {
return UpdateDatasetError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDatasetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDatasetError {
fn from(err: serde_json::error::Error) -> UpdateDatasetError {
UpdateDatasetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDatasetError {
fn from(err: CredentialsError) -> UpdateDatasetError {
UpdateDatasetError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDatasetError {
fn from(err: HttpDispatchError) -> UpdateDatasetError {
UpdateDatasetError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDatasetError {
fn from(err: io::Error) -> UpdateDatasetError {
UpdateDatasetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDatasetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDatasetError {
fn description(&self) -> &str {
match *self {
UpdateDatasetError::InternalFailure(ref cause) => cause,
UpdateDatasetError::InvalidRequest(ref cause) => cause,
UpdateDatasetError::ResourceNotFound(ref cause) => cause,
UpdateDatasetError::ServiceUnavailable(ref cause) => cause,
UpdateDatasetError::Throttling(ref cause) => cause,
UpdateDatasetError::Validation(ref cause) => cause,
UpdateDatasetError::Credentials(ref err) => err.description(),
UpdateDatasetError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateDatasetError::ParseError(ref cause) => cause,
UpdateDatasetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDatastoreError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDatastoreError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDatastoreError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return UpdateDatastoreError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return UpdateDatastoreError::InvalidRequest(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateDatastoreError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return UpdateDatastoreError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return UpdateDatastoreError::Throttling(String::from(error_message));
}
"ValidationException" => {
return UpdateDatastoreError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDatastoreError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDatastoreError {
fn from(err: serde_json::error::Error) -> UpdateDatastoreError {
UpdateDatastoreError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDatastoreError {
fn from(err: CredentialsError) -> UpdateDatastoreError {
UpdateDatastoreError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDatastoreError {
fn from(err: HttpDispatchError) -> UpdateDatastoreError {
UpdateDatastoreError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDatastoreError {
fn from(err: io::Error) -> UpdateDatastoreError {
UpdateDatastoreError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDatastoreError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDatastoreError {
fn description(&self) -> &str {
match *self {
UpdateDatastoreError::InternalFailure(ref cause) => cause,
UpdateDatastoreError::InvalidRequest(ref cause) => cause,
UpdateDatastoreError::ResourceNotFound(ref cause) => cause,
UpdateDatastoreError::ServiceUnavailable(ref cause) => cause,
UpdateDatastoreError::Throttling(ref cause) => cause,
UpdateDatastoreError::Validation(ref cause) => cause,
UpdateDatastoreError::Credentials(ref err) => err.description(),
UpdateDatastoreError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateDatastoreError::ParseError(ref cause) => cause,
UpdateDatastoreError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdatePipelineError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdatePipelineError {
pub fn from_response(res: BufferedHttpResponse) -> UpdatePipelineError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let error_type = match res.headers.get("x-amzn-errortype") {
Some(raw_error_type) => raw_error_type
.split(':')
.next()
.unwrap_or_else(|| "Unknown"),
_ => json
.get("code")
.or_else(|| json.get("Code"))
.and_then(|c| c.as_str())
.unwrap_or_else(|| "Unknown"),
};
let error_message = json
.get("message")
.or_else(|| json.get("Message"))
.and_then(|m| m.as_str())
.unwrap_or("");
match error_type {
"InternalFailureException" => {
return UpdatePipelineError::InternalFailure(String::from(error_message));
}
"InvalidRequestException" => {
return UpdatePipelineError::InvalidRequest(String::from(error_message));
}
"LimitExceededException" => {
return UpdatePipelineError::LimitExceeded(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdatePipelineError::ResourceNotFound(String::from(error_message));
}
"ServiceUnavailableException" => {
return UpdatePipelineError::ServiceUnavailable(String::from(error_message));
}
"ThrottlingException" => {
return UpdatePipelineError::Throttling(String::from(error_message));
}
"ValidationException" => {
return UpdatePipelineError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdatePipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdatePipelineError {
fn from(err: serde_json::error::Error) -> UpdatePipelineError {
UpdatePipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdatePipelineError {
fn from(err: CredentialsError) -> UpdatePipelineError {
UpdatePipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdatePipelineError {
fn from(err: HttpDispatchError) -> UpdatePipelineError {
UpdatePipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdatePipelineError {
fn from(err: io::Error) -> UpdatePipelineError {
UpdatePipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdatePipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdatePipelineError {
fn description(&self) -> &str {
match *self {
UpdatePipelineError::InternalFailure(ref cause) => cause,
UpdatePipelineError::InvalidRequest(ref cause) => cause,
UpdatePipelineError::LimitExceeded(ref cause) => cause,
UpdatePipelineError::ResourceNotFound(ref cause) => cause,
UpdatePipelineError::ServiceUnavailable(ref cause) => cause,
UpdatePipelineError::Throttling(ref cause) => cause,
UpdatePipelineError::Validation(ref cause) => cause,
UpdatePipelineError::Credentials(ref err) => err.description(),
UpdatePipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdatePipelineError::ParseError(ref cause) => cause,
UpdatePipelineError::Unknown(_) => "unknown error",
}
}
}
pub trait IotAnalytics {
fn batch_put_message(
&self,
input: BatchPutMessageRequest,
) -> RusotoFuture<BatchPutMessageResponse, BatchPutMessageError>;
fn cancel_pipeline_reprocessing(
&self,
input: CancelPipelineReprocessingRequest,
) -> RusotoFuture<CancelPipelineReprocessingResponse, CancelPipelineReprocessingError>;
fn create_channel(
&self,
input: CreateChannelRequest,
) -> RusotoFuture<CreateChannelResponse, CreateChannelError>;
fn create_dataset(
&self,
input: CreateDatasetRequest,
) -> RusotoFuture<CreateDatasetResponse, CreateDatasetError>;
fn create_dataset_content(
&self,
input: CreateDatasetContentRequest,
) -> RusotoFuture<CreateDatasetContentResponse, CreateDatasetContentError>;
fn create_datastore(
&self,
input: CreateDatastoreRequest,
) -> RusotoFuture<CreateDatastoreResponse, CreateDatastoreError>;
fn create_pipeline(
&self,
input: CreatePipelineRequest,
) -> RusotoFuture<CreatePipelineResponse, CreatePipelineError>;
fn delete_channel(&self, input: DeleteChannelRequest) -> RusotoFuture<(), DeleteChannelError>;
fn delete_dataset(&self, input: DeleteDatasetRequest) -> RusotoFuture<(), DeleteDatasetError>;
fn delete_dataset_content(
&self,
input: DeleteDatasetContentRequest,
) -> RusotoFuture<(), DeleteDatasetContentError>;
fn delete_datastore(
&self,
input: DeleteDatastoreRequest,
) -> RusotoFuture<(), DeleteDatastoreError>;
fn delete_pipeline(
&self,
input: DeletePipelineRequest,
) -> RusotoFuture<(), DeletePipelineError>;
fn describe_channel(
&self,
input: DescribeChannelRequest,
) -> RusotoFuture<DescribeChannelResponse, DescribeChannelError>;
fn describe_dataset(
&self,
input: DescribeDatasetRequest,
) -> RusotoFuture<DescribeDatasetResponse, DescribeDatasetError>;
fn describe_datastore(
&self,
input: DescribeDatastoreRequest,
) -> RusotoFuture<DescribeDatastoreResponse, DescribeDatastoreError>;
fn describe_logging_options(
&self,
) -> RusotoFuture<DescribeLoggingOptionsResponse, DescribeLoggingOptionsError>;
fn describe_pipeline(
&self,
input: DescribePipelineRequest,
) -> RusotoFuture<DescribePipelineResponse, DescribePipelineError>;
fn get_dataset_content(
&self,
input: GetDatasetContentRequest,
) -> RusotoFuture<GetDatasetContentResponse, GetDatasetContentError>;
fn list_channels(
&self,
input: ListChannelsRequest,
) -> RusotoFuture<ListChannelsResponse, ListChannelsError>;
fn list_dataset_contents(
&self,
input: ListDatasetContentsRequest,
) -> RusotoFuture<ListDatasetContentsResponse, ListDatasetContentsError>;
fn list_datasets(
&self,
input: ListDatasetsRequest,
) -> RusotoFuture<ListDatasetsResponse, ListDatasetsError>;
fn list_datastores(
&self,
input: ListDatastoresRequest,
) -> RusotoFuture<ListDatastoresResponse, ListDatastoresError>;
fn list_pipelines(
&self,
input: ListPipelinesRequest,
) -> RusotoFuture<ListPipelinesResponse, ListPipelinesError>;
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError>;
fn put_logging_options(
&self,
input: PutLoggingOptionsRequest,
) -> RusotoFuture<(), PutLoggingOptionsError>;
fn run_pipeline_activity(
&self,
input: RunPipelineActivityRequest,
) -> RusotoFuture<RunPipelineActivityResponse, RunPipelineActivityError>;
fn sample_channel_data(
&self,
input: SampleChannelDataRequest,
) -> RusotoFuture<SampleChannelDataResponse, SampleChannelDataError>;
fn start_pipeline_reprocessing(
&self,
input: StartPipelineReprocessingRequest,
) -> RusotoFuture<StartPipelineReprocessingResponse, StartPipelineReprocessingError>;
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError>;
fn update_channel(&self, input: UpdateChannelRequest) -> RusotoFuture<(), UpdateChannelError>;
fn update_dataset(&self, input: UpdateDatasetRequest) -> RusotoFuture<(), UpdateDatasetError>;
fn update_datastore(
&self,
input: UpdateDatastoreRequest,
) -> RusotoFuture<(), UpdateDatastoreError>;
fn update_pipeline(
&self,
input: UpdatePipelineRequest,
) -> RusotoFuture<(), UpdatePipelineError>;
}
#[derive(Clone)]
pub struct IotAnalyticsClient {
client: Client,
region: region::Region,
}
impl IotAnalyticsClient {
pub fn new(region: region::Region) -> IotAnalyticsClient {
IotAnalyticsClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> IotAnalyticsClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
IotAnalyticsClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl IotAnalytics for IotAnalyticsClient {
fn batch_put_message(
&self,
input: BatchPutMessageRequest,
) -> RusotoFuture<BatchPutMessageResponse, BatchPutMessageError> {
let request_uri = "/messages/batch";
let mut request = SignedRequest::new("POST", "iotanalytics", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 200 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<BatchPutMessageResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(BatchPutMessageError::from_response(response))),
)
}
})
}
fn cancel_pipeline_reprocessing(
&self,
input: CancelPipelineReprocessingRequest,
) -> RusotoFuture<CancelPipelineReprocessingResponse, CancelPipelineReprocessingError> {
let request_uri = format!(
"/pipelines/{pipeline_name}/reprocessing/{reprocessing_id}",
pipeline_name = input.pipeline_name,
reprocessing_id = input.reprocessing_id
);
let mut request = SignedRequest::new("DELETE", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CancelPipelineReprocessingResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CancelPipelineReprocessingError::from_response(response))
}))
}
})
}
fn create_channel(
&self,
input: CreateChannelRequest,
) -> RusotoFuture<CreateChannelResponse, CreateChannelError> {
let request_uri = "/channels";
let mut request = SignedRequest::new("POST", "iotanalytics", &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() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateChannelResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateChannelError::from_response(response))),
)
}
})
}
fn create_dataset(
&self,
input: CreateDatasetRequest,
) -> RusotoFuture<CreateDatasetResponse, CreateDatasetError> {
let request_uri = "/datasets";
let mut request = SignedRequest::new("POST", "iotanalytics", &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() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateDatasetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDatasetError::from_response(response))),
)
}
})
}
fn create_dataset_content(
&self,
input: CreateDatasetContentRequest,
) -> RusotoFuture<CreateDatasetContentResponse, CreateDatasetContentError> {
let request_uri = format!(
"/datasets/{dataset_name}/content",
dataset_name = input.dataset_name
);
let mut request = SignedRequest::new("POST", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<CreateDatasetContentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateDatasetContentError::from_response(response))
}),
)
}
})
}
fn create_datastore(
&self,
input: CreateDatastoreRequest,
) -> RusotoFuture<CreateDatastoreResponse, CreateDatastoreError> {
let request_uri = "/datastores";
let mut request = SignedRequest::new("POST", "iotanalytics", &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() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreateDatastoreResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateDatastoreError::from_response(response))),
)
}
})
}
fn create_pipeline(
&self,
input: CreatePipelineRequest,
) -> RusotoFuture<CreatePipelineResponse, CreatePipelineError> {
let request_uri = "/pipelines";
let mut request = SignedRequest::new("POST", "iotanalytics", &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() == 201 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<CreatePipelineResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreatePipelineError::from_response(response))),
)
}
})
}
fn delete_channel(&self, input: DeleteChannelRequest) -> RusotoFuture<(), DeleteChannelError> {
let request_uri = format!(
"/channels/{channel_name}",
channel_name = input.channel_name
);
let mut request = SignedRequest::new("DELETE", "iotanalytics", &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() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteChannelError::from_response(response))),
)
}
})
}
fn delete_dataset(&self, input: DeleteDatasetRequest) -> RusotoFuture<(), DeleteDatasetError> {
let request_uri = format!(
"/datasets/{dataset_name}",
dataset_name = input.dataset_name
);
let mut request = SignedRequest::new("DELETE", "iotanalytics", &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() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteDatasetError::from_response(response))),
)
}
})
}
fn delete_dataset_content(
&self,
input: DeleteDatasetContentRequest,
) -> RusotoFuture<(), DeleteDatasetContentError> {
let request_uri = format!(
"/datasets/{dataset_name}/content",
dataset_name = input.dataset_name
);
let mut request = SignedRequest::new("DELETE", "iotanalytics", &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.version_id {
params.put("versionId", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteDatasetContentError::from_response(response))
}),
)
}
})
}
fn delete_datastore(
&self,
input: DeleteDatastoreRequest,
) -> RusotoFuture<(), DeleteDatastoreError> {
let request_uri = format!(
"/datastores/{datastore_name}",
datastore_name = input.datastore_name
);
let mut request = SignedRequest::new("DELETE", "iotanalytics", &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() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteDatastoreError::from_response(response))),
)
}
})
}
fn delete_pipeline(
&self,
input: DeletePipelineRequest,
) -> RusotoFuture<(), DeletePipelineError> {
let request_uri = format!(
"/pipelines/{pipeline_name}",
pipeline_name = input.pipeline_name
);
let mut request = SignedRequest::new("DELETE", "iotanalytics", &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() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeletePipelineError::from_response(response))),
)
}
})
}
fn describe_channel(
&self,
input: DescribeChannelRequest,
) -> RusotoFuture<DescribeChannelResponse, DescribeChannelError> {
let request_uri = format!(
"/channels/{channel_name}",
channel_name = input.channel_name
);
let mut request = SignedRequest::new("GET", "iotanalytics", &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.include_statistics {
params.put("includeStatistics", x);
}
request.set_params(params);
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 == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DescribeChannelResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeChannelError::from_response(response))),
)
}
})
}
fn describe_dataset(
&self,
input: DescribeDatasetRequest,
) -> RusotoFuture<DescribeDatasetResponse, DescribeDatasetError> {
let request_uri = format!(
"/datasets/{dataset_name}",
dataset_name = input.dataset_name
);
let mut request = SignedRequest::new("GET", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DescribeDatasetResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeDatasetError::from_response(response))),
)
}
})
}
fn describe_datastore(
&self,
input: DescribeDatastoreRequest,
) -> RusotoFuture<DescribeDatastoreResponse, DescribeDatastoreError> {
let request_uri = format!(
"/datastores/{datastore_name}",
datastore_name = input.datastore_name
);
let mut request = SignedRequest::new("GET", "iotanalytics", &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.include_statistics {
params.put("includeStatistics", x);
}
request.set_params(params);
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 == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<DescribeDatastoreResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeDatastoreError::from_response(response))),
)
}
})
}
fn describe_logging_options(
&self,
) -> RusotoFuture<DescribeLoggingOptionsResponse, DescribeLoggingOptionsError> {
let request_uri = "/logging";
let mut request = SignedRequest::new("GET", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<DescribeLoggingOptionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeLoggingOptionsError::from_response(response))
}),
)
}
})
}
fn describe_pipeline(
&self,
input: DescribePipelineRequest,
) -> RusotoFuture<DescribePipelineResponse, DescribePipelineError> {
let request_uri = format!(
"/pipelines/{pipeline_name}",
pipeline_name = input.pipeline_name
);
let mut request = SignedRequest::new("GET", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DescribePipelineResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribePipelineError::from_response(response))),
)
}
})
}
fn get_dataset_content(
&self,
input: GetDatasetContentRequest,
) -> RusotoFuture<GetDatasetContentResponse, GetDatasetContentError> {
let request_uri = format!(
"/datasets/{dataset_name}/content",
dataset_name = input.dataset_name
);
let mut request = SignedRequest::new("GET", "iotanalytics", &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.version_id {
params.put("versionId", x);
}
request.set_params(params);
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 == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<GetDatasetContentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDatasetContentError::from_response(response))),
)
}
})
}
fn list_channels(
&self,
input: ListChannelsRequest,
) -> RusotoFuture<ListChannelsResponse, ListChannelsError> {
let request_uri = "/channels";
let mut request = SignedRequest::new("GET", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListChannelsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListChannelsError::from_response(response))),
)
}
})
}
fn list_dataset_contents(
&self,
input: ListDatasetContentsRequest,
) -> RusotoFuture<ListDatasetContentsResponse, ListDatasetContentsError> {
let request_uri = format!(
"/datasets/{dataset_name}/contents",
dataset_name = input.dataset_name
);
let mut request = SignedRequest::new("GET", "iotanalytics", &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);
}
if let Some(ref x) = input.scheduled_before {
params.put("scheduledBefore", x);
}
if let Some(ref x) = input.scheduled_on_or_after {
params.put("scheduledOnOrAfter", x);
}
request.set_params(params);
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 == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListDatasetContentsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListDatasetContentsError::from_response(response))
}),
)
}
})
}
fn list_datasets(
&self,
input: ListDatasetsRequest,
) -> RusotoFuture<ListDatasetsResponse, ListDatasetsError> {
let request_uri = "/datasets";
let mut request = SignedRequest::new("GET", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListDatasetsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListDatasetsError::from_response(response))),
)
}
})
}
fn list_datastores(
&self,
input: ListDatastoresRequest,
) -> RusotoFuture<ListDatastoresResponse, ListDatastoresError> {
let request_uri = "/datastores";
let mut request = SignedRequest::new("GET", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListDatastoresResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListDatastoresError::from_response(response))),
)
}
})
}
fn list_pipelines(
&self,
input: ListPipelinesRequest,
) -> RusotoFuture<ListPipelinesResponse, ListPipelinesError> {
let request_uri = "/pipelines";
let mut request = SignedRequest::new("GET", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListPipelinesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListPipelinesError::from_response(response))),
)
}
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError> {
let request_uri = "/tags";
let mut request = SignedRequest::new("GET", "iotanalytics", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
params.put("resourceArn", &input.resource_arn);
request.set_params(params);
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 == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<ListTagsForResourceResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
)
}
})
}
fn put_logging_options(
&self,
input: PutLoggingOptionsRequest,
) -> RusotoFuture<(), PutLoggingOptionsError> {
let request_uri = "/logging";
let mut request = SignedRequest::new("PUT", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutLoggingOptionsError::from_response(response))),
)
}
})
}
fn run_pipeline_activity(
&self,
input: RunPipelineActivityRequest,
) -> RusotoFuture<RunPipelineActivityResponse, RunPipelineActivityError> {
let request_uri = "/pipelineactivities/run";
let mut request = SignedRequest::new("POST", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<RunPipelineActivityResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RunPipelineActivityError::from_response(response))
}),
)
}
})
}
fn sample_channel_data(
&self,
input: SampleChannelDataRequest,
) -> RusotoFuture<SampleChannelDataResponse, SampleChannelDataError> {
let request_uri = format!(
"/channels/{channel_name}/sample",
channel_name = input.channel_name
);
let mut request = SignedRequest::new("GET", "iotanalytics", &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.end_time {
params.put("endTime", x);
}
if let Some(ref x) = input.max_messages {
params.put("maxMessages", x);
}
if let Some(ref x) = input.start_time {
params.put("startTime", x);
}
request.set_params(params);
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 == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<SampleChannelDataResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SampleChannelDataError::from_response(response))),
)
}
})
}
fn start_pipeline_reprocessing(
&self,
input: StartPipelineReprocessingRequest,
) -> RusotoFuture<StartPipelineReprocessingResponse, StartPipelineReprocessingError> {
let request_uri = format!(
"/pipelines/{pipeline_name}/reprocessing",
pipeline_name = input.pipeline_name
);
let mut request = SignedRequest::new("POST", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result =
serde_json::from_slice::<StartPipelineReprocessingResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(StartPipelineReprocessingError::from_response(response))
}))
}
})
}
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError> {
let request_uri = "/tags";
let mut request = SignedRequest::new("POST", "iotanalytics", &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);
let mut params = Params::new();
params.put("resourceArn", &input.resource_arn);
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<TagResourceResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
)
}
})
}
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError> {
let request_uri = "/tags";
let mut request = SignedRequest::new("DELETE", "iotanalytics", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
params.put("resourceArn", &input.resource_arn);
for item in input.tag_keys.iter() {
params.put("tagKeys", item);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.as_u16() == 204 {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body == b"null" || body.is_empty() {
body = b"{}".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<UntagResourceResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
)
}
})
}
fn update_channel(&self, input: UpdateChannelRequest) -> RusotoFuture<(), UpdateChannelError> {
let request_uri = format!(
"/channels/{channel_name}",
channel_name = input.channel_name
);
let mut request = SignedRequest::new("PUT", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateChannelError::from_response(response))),
)
}
})
}
fn update_dataset(&self, input: UpdateDatasetRequest) -> RusotoFuture<(), UpdateDatasetError> {
let request_uri = format!(
"/datasets/{dataset_name}",
dataset_name = input.dataset_name
);
let mut request = SignedRequest::new("PUT", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDatasetError::from_response(response))),
)
}
})
}
fn update_datastore(
&self,
input: UpdateDatastoreRequest,
) -> RusotoFuture<(), UpdateDatastoreError> {
let request_uri = format!(
"/datastores/{datastore_name}",
datastore_name = input.datastore_name
);
let mut request = SignedRequest::new("PUT", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateDatastoreError::from_response(response))),
)
}
})
}
fn update_pipeline(
&self,
input: UpdatePipelineRequest,
) -> RusotoFuture<(), UpdatePipelineError> {
let request_uri = format!(
"/pipelines/{pipeline_name}",
pipeline_name = input.pipeline_name
);
let mut request = SignedRequest::new("PUT", "iotanalytics", &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.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdatePipelineError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}