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)]
pub struct AcceptCertificateTransferRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
#[serde(rename = "setAsActive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub set_as_active: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Action {
#[serde(rename = "cloudwatchAlarm")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloudwatch_alarm: Option<CloudwatchAlarmAction>,
#[serde(rename = "cloudwatchMetric")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloudwatch_metric: Option<CloudwatchMetricAction>,
#[serde(rename = "dynamoDB")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dynamo_db: Option<DynamoDBAction>,
#[serde(rename = "dynamoDBv2")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dynamo_d_bv_2: Option<DynamoDBv2Action>,
#[serde(rename = "elasticsearch")]
#[serde(skip_serializing_if = "Option::is_none")]
pub elasticsearch: Option<ElasticsearchAction>,
#[serde(rename = "firehose")]
#[serde(skip_serializing_if = "Option::is_none")]
pub firehose: Option<FirehoseAction>,
#[serde(rename = "iotAnalytics")]
#[serde(skip_serializing_if = "Option::is_none")]
pub iot_analytics: Option<IotAnalyticsAction>,
#[serde(rename = "kinesis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kinesis: Option<KinesisAction>,
#[serde(rename = "lambda")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda: Option<LambdaAction>,
#[serde(rename = "republish")]
#[serde(skip_serializing_if = "Option::is_none")]
pub republish: Option<RepublishAction>,
#[serde(rename = "s3")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s_3: Option<S3Action>,
#[serde(rename = "salesforce")]
#[serde(skip_serializing_if = "Option::is_none")]
pub salesforce: Option<SalesforceAction>,
#[serde(rename = "sns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sns: Option<SnsAction>,
#[serde(rename = "sqs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sqs: Option<SqsAction>,
#[serde(rename = "stepFunctions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub step_functions: Option<StepFunctionsAction>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActiveViolation {
#[serde(rename = "behavior")]
#[serde(skip_serializing_if = "Option::is_none")]
pub behavior: Option<Behavior>,
#[serde(rename = "lastViolationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_violation_time: Option<f64>,
#[serde(rename = "lastViolationValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_violation_value: Option<MetricValue>,
#[serde(rename = "securityProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_name: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
#[serde(rename = "violationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violation_id: Option<String>,
#[serde(rename = "violationStartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violation_start_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AddThingToThingGroupRequest {
#[serde(rename = "thingArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_arn: Option<String>,
#[serde(rename = "thingGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_arn: Option<String>,
#[serde(rename = "thingGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_name: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddThingToThingGroupResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AlertTarget {
#[serde(rename = "alertTargetArn")]
pub alert_target_arn: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Allowed {
#[serde(rename = "policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<Policy>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateTargetsWithJobRequest {
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "targets")]
pub targets: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateTargetsWithJobResponse {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "jobArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_arn: Option<String>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachPolicyRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "target")]
pub target: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachPrincipalPolicyRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "principal")]
pub principal: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachSecurityProfileRequest {
#[serde(rename = "securityProfileName")]
pub security_profile_name: String,
#[serde(rename = "securityProfileTargetArn")]
pub security_profile_target_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttachSecurityProfileResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AttachThingPrincipalRequest {
#[serde(rename = "principal")]
pub principal: String,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttachThingPrincipalResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AttributePayload {
#[serde(rename = "attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "merge")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AuditCheckConfiguration {
#[serde(rename = "enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AuditCheckDetails {
#[serde(rename = "checkCompliant")]
#[serde(skip_serializing_if = "Option::is_none")]
pub check_compliant: Option<bool>,
#[serde(rename = "checkRunStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub check_run_status: Option<String>,
#[serde(rename = "errorCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_code: Option<String>,
#[serde(rename = "message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[serde(rename = "nonCompliantResourcesCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub non_compliant_resources_count: Option<i64>,
#[serde(rename = "totalResourcesCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_resources_count: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AuditFinding {
#[serde(rename = "checkName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub check_name: Option<String>,
#[serde(rename = "findingTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub finding_time: Option<f64>,
#[serde(rename = "nonCompliantResource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub non_compliant_resource: Option<NonCompliantResource>,
#[serde(rename = "reasonForNonCompliance")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason_for_non_compliance: Option<String>,
#[serde(rename = "reasonForNonComplianceCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason_for_non_compliance_code: Option<String>,
#[serde(rename = "relatedResources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub related_resources: Option<Vec<RelatedResource>>,
#[serde(rename = "severity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub severity: Option<String>,
#[serde(rename = "taskId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_id: Option<String>,
#[serde(rename = "taskStartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_start_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AuditNotificationTarget {
#[serde(rename = "enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "targetArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AuditTaskMetadata {
#[serde(rename = "taskId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_id: Option<String>,
#[serde(rename = "taskStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_status: Option<String>,
#[serde(rename = "taskType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AuthInfo {
#[serde(rename = "actionType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_type: Option<String>,
#[serde(rename = "resources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resources: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AuthResult {
#[serde(rename = "allowed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed: Option<Allowed>,
#[serde(rename = "authDecision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_decision: Option<String>,
#[serde(rename = "authInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_info: Option<AuthInfo>,
#[serde(rename = "denied")]
#[serde(skip_serializing_if = "Option::is_none")]
pub denied: Option<Denied>,
#[serde(rename = "missingContextValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub missing_context_values: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AuthorizerDescription {
#[serde(rename = "authorizerArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_arn: Option<String>,
#[serde(rename = "authorizerFunctionArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_function_arn: Option<String>,
#[serde(rename = "authorizerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_name: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "tokenKeyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub token_key_name: Option<String>,
#[serde(rename = "tokenSigningPublicKeys")]
#[serde(skip_serializing_if = "Option::is_none")]
pub token_signing_public_keys: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AuthorizerSummary {
#[serde(rename = "authorizerArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_arn: Option<String>,
#[serde(rename = "authorizerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Behavior {
#[serde(rename = "criteria")]
#[serde(skip_serializing_if = "Option::is_none")]
pub criteria: Option<BehaviorCriteria>,
#[serde(rename = "metric")]
#[serde(skip_serializing_if = "Option::is_none")]
pub metric: Option<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BehaviorCriteria {
#[serde(rename = "comparisonOperator")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comparison_operator: Option<String>,
#[serde(rename = "durationSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<i64>,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<MetricValue>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CACertificate {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CACertificateDescription {
#[serde(rename = "autoRegistrationStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_registration_status: Option<String>,
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
#[serde(rename = "certificatePem")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_pem: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "customerVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_version: Option<i64>,
#[serde(rename = "generationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub generation_id: Option<String>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "ownedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owned_by: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "validity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validity: Option<CertificateValidity>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CancelAuditTaskRequest {
#[serde(rename = "taskId")]
pub task_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CancelAuditTaskResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CancelCertificateTransferRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CancelJobExecutionRequest {
#[serde(rename = "expectedVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_version: Option<i64>,
#[serde(rename = "force")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "statusDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_details: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CancelJobRequest {
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
#[serde(rename = "force")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CancelJobResponse {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "jobArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_arn: Option<String>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Certificate {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CertificateDescription {
#[serde(rename = "caCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ca_certificate_id: Option<String>,
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
#[serde(rename = "certificatePem")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_pem: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "customerVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_version: Option<i64>,
#[serde(rename = "generationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub generation_id: Option<String>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "ownedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owned_by: Option<String>,
#[serde(rename = "previousOwnedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub previous_owned_by: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "transferData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_data: Option<TransferData>,
#[serde(rename = "validity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validity: Option<CertificateValidity>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CertificateValidity {
#[serde(rename = "notAfter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub not_after: Option<f64>,
#[serde(rename = "notBefore")]
#[serde(skip_serializing_if = "Option::is_none")]
pub not_before: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ClearDefaultAuthorizerRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ClearDefaultAuthorizerResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CloudwatchAlarmAction {
#[serde(rename = "alarmName")]
pub alarm_name: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "stateReason")]
pub state_reason: String,
#[serde(rename = "stateValue")]
pub state_value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CloudwatchMetricAction {
#[serde(rename = "metricName")]
pub metric_name: String,
#[serde(rename = "metricNamespace")]
pub metric_namespace: String,
#[serde(rename = "metricTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub metric_timestamp: Option<String>,
#[serde(rename = "metricUnit")]
pub metric_unit: String,
#[serde(rename = "metricValue")]
pub metric_value: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeSigning {
#[serde(rename = "awsSignerJobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_signer_job_id: Option<String>,
#[serde(rename = "customCodeSigning")]
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_code_signing: Option<CustomCodeSigning>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeSigningCertificateChain {
#[serde(rename = "certificateName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_name: Option<String>,
#[serde(rename = "inlineDocument")]
#[serde(skip_serializing_if = "Option::is_none")]
pub inline_document: Option<String>,
#[serde(rename = "stream")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream: Option<Stream>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeSigningSignature {
#[serde(rename = "inlineDocument")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub inline_document: Option<Vec<u8>>,
#[serde(rename = "stream")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream: Option<Stream>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Configuration {
#[serde(rename = "Enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateAuthorizerRequest {
#[serde(rename = "authorizerFunctionArn")]
pub authorizer_function_arn: String,
#[serde(rename = "authorizerName")]
pub authorizer_name: String,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "tokenKeyName")]
pub token_key_name: String,
#[serde(rename = "tokenSigningPublicKeys")]
pub token_signing_public_keys: ::std::collections::HashMap<String, String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateAuthorizerResponse {
#[serde(rename = "authorizerArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_arn: Option<String>,
#[serde(rename = "authorizerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateCertificateFromCsrRequest {
#[serde(rename = "certificateSigningRequest")]
pub certificate_signing_request: String,
#[serde(rename = "setAsActive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub set_as_active: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateCertificateFromCsrResponse {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
#[serde(rename = "certificatePem")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_pem: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateJobRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "document")]
#[serde(skip_serializing_if = "Option::is_none")]
pub document: Option<String>,
#[serde(rename = "documentSource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub document_source: Option<String>,
#[serde(rename = "jobExecutionsRolloutConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_executions_rollout_config: Option<JobExecutionsRolloutConfig>,
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "presignedUrlConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub presigned_url_config: Option<PresignedUrlConfig>,
#[serde(rename = "targetSelection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_selection: Option<String>,
#[serde(rename = "targets")]
pub targets: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateJobResponse {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "jobArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_arn: Option<String>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateKeysAndCertificateRequest {
#[serde(rename = "setAsActive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub set_as_active: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateKeysAndCertificateResponse {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
#[serde(rename = "certificatePem")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_pem: Option<String>,
#[serde(rename = "keyPair")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key_pair: Option<KeyPair>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateOTAUpdateRequest {
#[serde(rename = "additionalParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "files")]
pub files: Vec<OTAUpdateFile>,
#[serde(rename = "otaUpdateId")]
pub ota_update_id: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "targetSelection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_selection: Option<String>,
#[serde(rename = "targets")]
pub targets: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateOTAUpdateResponse {
#[serde(rename = "awsIotJobArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_iot_job_arn: Option<String>,
#[serde(rename = "awsIotJobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_iot_job_id: Option<String>,
#[serde(rename = "otaUpdateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_arn: Option<String>,
#[serde(rename = "otaUpdateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_id: Option<String>,
#[serde(rename = "otaUpdateStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePolicyRequest {
#[serde(rename = "policyDocument")]
pub policy_document: String,
#[serde(rename = "policyName")]
pub policy_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreatePolicyResponse {
#[serde(rename = "policyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
#[serde(rename = "policyDocument")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_document: Option<String>,
#[serde(rename = "policyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
#[serde(rename = "policyVersionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePolicyVersionRequest {
#[serde(rename = "policyDocument")]
pub policy_document: String,
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "setAsDefault")]
#[serde(skip_serializing_if = "Option::is_none")]
pub set_as_default: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreatePolicyVersionResponse {
#[serde(rename = "isDefaultVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_default_version: Option<bool>,
#[serde(rename = "policyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
#[serde(rename = "policyDocument")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_document: Option<String>,
#[serde(rename = "policyVersionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateRoleAliasRequest {
#[serde(rename = "credentialDurationSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credential_duration_seconds: Option<i64>,
#[serde(rename = "roleAlias")]
pub role_alias: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateRoleAliasResponse {
#[serde(rename = "roleAlias")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_alias: Option<String>,
#[serde(rename = "roleAliasArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_alias_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateScheduledAuditRequest {
#[serde(rename = "dayOfMonth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_month: Option<String>,
#[serde(rename = "dayOfWeek")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_week: Option<String>,
#[serde(rename = "frequency")]
pub frequency: String,
#[serde(rename = "scheduledAuditName")]
pub scheduled_audit_name: String,
#[serde(rename = "targetCheckNames")]
pub target_check_names: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateScheduledAuditResponse {
#[serde(rename = "scheduledAuditArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audit_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSecurityProfileRequest {
#[serde(rename = "alertTargets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alert_targets: Option<::std::collections::HashMap<String, AlertTarget>>,
#[serde(rename = "behaviors")]
pub behaviors: Vec<Behavior>,
#[serde(rename = "securityProfileDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_description: Option<String>,
#[serde(rename = "securityProfileName")]
pub security_profile_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSecurityProfileResponse {
#[serde(rename = "securityProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_arn: Option<String>,
#[serde(rename = "securityProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateStreamRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "files")]
pub files: Vec<StreamFile>,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "streamId")]
pub stream_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateStreamResponse {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "streamArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "streamId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
#[serde(rename = "streamVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateThingGroupRequest {
#[serde(rename = "parentGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_group_name: Option<String>,
#[serde(rename = "thingGroupName")]
pub thing_group_name: String,
#[serde(rename = "thingGroupProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_properties: Option<ThingGroupProperties>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateThingGroupResponse {
#[serde(rename = "thingGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_arn: Option<String>,
#[serde(rename = "thingGroupId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_id: Option<String>,
#[serde(rename = "thingGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateThingRequest {
#[serde(rename = "attributePayload")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_payload: Option<AttributePayload>,
#[serde(rename = "thingName")]
pub thing_name: String,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateThingResponse {
#[serde(rename = "thingArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_arn: Option<String>,
#[serde(rename = "thingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_id: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateThingTypeRequest {
#[serde(rename = "thingTypeName")]
pub thing_type_name: String,
#[serde(rename = "thingTypeProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_properties: Option<ThingTypeProperties>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateThingTypeResponse {
#[serde(rename = "thingTypeArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_arn: Option<String>,
#[serde(rename = "thingTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_id: Option<String>,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateTopicRuleRequest {
#[serde(rename = "ruleName")]
pub rule_name: String,
#[serde(rename = "topicRulePayload")]
pub topic_rule_payload: TopicRulePayload,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CustomCodeSigning {
#[serde(rename = "certificateChain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_chain: Option<CodeSigningCertificateChain>,
#[serde(rename = "hashAlgorithm")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hash_algorithm: Option<String>,
#[serde(rename = "signature")]
#[serde(skip_serializing_if = "Option::is_none")]
pub signature: Option<CodeSigningSignature>,
#[serde(rename = "signatureAlgorithm")]
#[serde(skip_serializing_if = "Option::is_none")]
pub signature_algorithm: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteAccountAuditConfigurationRequest {
#[serde(rename = "deleteScheduledAudits")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delete_scheduled_audits: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteAccountAuditConfigurationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteAuthorizerRequest {
#[serde(rename = "authorizerName")]
pub authorizer_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteAuthorizerResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteCACertificateRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteCACertificateResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteCertificateRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
#[serde(rename = "forceDelete")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force_delete: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteJobExecutionRequest {
#[serde(rename = "executionNumber")]
pub execution_number: i64,
#[serde(rename = "force")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteJobRequest {
#[serde(rename = "force")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteOTAUpdateRequest {
#[serde(rename = "otaUpdateId")]
pub ota_update_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteOTAUpdateResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeletePolicyRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeletePolicyVersionRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "policyVersionId")]
pub policy_version_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRegistrationCodeRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteRegistrationCodeResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRoleAliasRequest {
#[serde(rename = "roleAlias")]
pub role_alias: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteRoleAliasResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteScheduledAuditRequest {
#[serde(rename = "scheduledAuditName")]
pub scheduled_audit_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteScheduledAuditResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSecurityProfileRequest {
#[serde(rename = "expectedVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_version: Option<i64>,
#[serde(rename = "securityProfileName")]
pub security_profile_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSecurityProfileResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteStreamRequest {
#[serde(rename = "streamId")]
pub stream_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteStreamResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteThingGroupRequest {
#[serde(rename = "expectedVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_version: Option<i64>,
#[serde(rename = "thingGroupName")]
pub thing_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteThingGroupResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteThingRequest {
#[serde(rename = "expectedVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_version: Option<i64>,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteThingResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteThingTypeRequest {
#[serde(rename = "thingTypeName")]
pub thing_type_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteThingTypeResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteTopicRuleRequest {
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteV2LoggingLevelRequest {
#[serde(rename = "targetName")]
pub target_name: String,
#[serde(rename = "targetType")]
pub target_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Denied {
#[serde(rename = "explicitDeny")]
#[serde(skip_serializing_if = "Option::is_none")]
pub explicit_deny: Option<ExplicitDeny>,
#[serde(rename = "implicitDeny")]
#[serde(skip_serializing_if = "Option::is_none")]
pub implicit_deny: Option<ImplicitDeny>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeprecateThingTypeRequest {
#[serde(rename = "thingTypeName")]
pub thing_type_name: String,
#[serde(rename = "undoDeprecate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub undo_deprecate: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeprecateThingTypeResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeAccountAuditConfigurationRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeAccountAuditConfigurationResponse {
#[serde(rename = "auditCheckConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub audit_check_configurations:
Option<::std::collections::HashMap<String, AuditCheckConfiguration>>,
#[serde(rename = "auditNotificationTargetConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub audit_notification_target_configurations:
Option<::std::collections::HashMap<String, AuditNotificationTarget>>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeAuditTaskRequest {
#[serde(rename = "taskId")]
pub task_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeAuditTaskResponse {
#[serde(rename = "auditDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub audit_details: Option<::std::collections::HashMap<String, AuditCheckDetails>>,
#[serde(rename = "scheduledAuditName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audit_name: Option<String>,
#[serde(rename = "taskStartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_start_time: Option<f64>,
#[serde(rename = "taskStatistics")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_statistics: Option<TaskStatistics>,
#[serde(rename = "taskStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_status: Option<String>,
#[serde(rename = "taskType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeAuthorizerRequest {
#[serde(rename = "authorizerName")]
pub authorizer_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeAuthorizerResponse {
#[serde(rename = "authorizerDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_description: Option<AuthorizerDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeCACertificateRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeCACertificateResponse {
#[serde(rename = "certificateDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_description: Option<CACertificateDescription>,
#[serde(rename = "registrationConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub registration_config: Option<RegistrationConfig>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeCertificateRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeCertificateResponse {
#[serde(rename = "certificateDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_description: Option<CertificateDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDefaultAuthorizerRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeDefaultAuthorizerResponse {
#[serde(rename = "authorizerDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_description: Option<AuthorizerDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeEndpointRequest {
#[serde(rename = "endpointType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeEndpointResponse {
#[serde(rename = "endpointAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub endpoint_address: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeEventConfigurationsRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeEventConfigurationsResponse {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "eventConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_configurations: Option<::std::collections::HashMap<String, Configuration>>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeIndexRequest {
#[serde(rename = "indexName")]
pub index_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeIndexResponse {
#[serde(rename = "indexName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_name: Option<String>,
#[serde(rename = "indexStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_status: Option<String>,
#[serde(rename = "schema")]
#[serde(skip_serializing_if = "Option::is_none")]
pub schema: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeJobExecutionRequest {
#[serde(rename = "executionNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_number: Option<i64>,
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeJobExecutionResponse {
#[serde(rename = "execution")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution: Option<JobExecution>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeJobRequest {
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeJobResponse {
#[serde(rename = "documentSource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub document_source: Option<String>,
#[serde(rename = "job")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job: Option<Job>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeRoleAliasRequest {
#[serde(rename = "roleAlias")]
pub role_alias: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeRoleAliasResponse {
#[serde(rename = "roleAliasDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_alias_description: Option<RoleAliasDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeScheduledAuditRequest {
#[serde(rename = "scheduledAuditName")]
pub scheduled_audit_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeScheduledAuditResponse {
#[serde(rename = "dayOfMonth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_month: Option<String>,
#[serde(rename = "dayOfWeek")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_week: Option<String>,
#[serde(rename = "frequency")]
#[serde(skip_serializing_if = "Option::is_none")]
pub frequency: Option<String>,
#[serde(rename = "scheduledAuditArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audit_arn: Option<String>,
#[serde(rename = "scheduledAuditName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audit_name: Option<String>,
#[serde(rename = "targetCheckNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_check_names: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeSecurityProfileRequest {
#[serde(rename = "securityProfileName")]
pub security_profile_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeSecurityProfileResponse {
#[serde(rename = "alertTargets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alert_targets: Option<::std::collections::HashMap<String, AlertTarget>>,
#[serde(rename = "behaviors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub behaviors: Option<Vec<Behavior>>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "securityProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_arn: Option<String>,
#[serde(rename = "securityProfileDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_description: Option<String>,
#[serde(rename = "securityProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_name: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeStreamRequest {
#[serde(rename = "streamId")]
pub stream_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeStreamResponse {
#[serde(rename = "streamInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_info: Option<StreamInfo>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeThingGroupRequest {
#[serde(rename = "thingGroupName")]
pub thing_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeThingGroupResponse {
#[serde(rename = "thingGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_arn: Option<String>,
#[serde(rename = "thingGroupId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_id: Option<String>,
#[serde(rename = "thingGroupMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_metadata: Option<ThingGroupMetadata>,
#[serde(rename = "thingGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_name: Option<String>,
#[serde(rename = "thingGroupProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_properties: Option<ThingGroupProperties>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeThingRegistrationTaskRequest {
#[serde(rename = "taskId")]
pub task_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeThingRegistrationTaskResponse {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "failureCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_count: Option<i64>,
#[serde(rename = "inputFileBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input_file_bucket: Option<String>,
#[serde(rename = "inputFileKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input_file_key: Option<String>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[serde(rename = "percentageProgress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub percentage_progress: Option<i64>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "successCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub success_count: Option<i64>,
#[serde(rename = "taskId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_id: Option<String>,
#[serde(rename = "templateBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_body: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeThingRequest {
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeThingResponse {
#[serde(rename = "attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "defaultClientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_client_id: Option<String>,
#[serde(rename = "thingArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_arn: Option<String>,
#[serde(rename = "thingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_id: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeThingTypeRequest {
#[serde(rename = "thingTypeName")]
pub thing_type_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeThingTypeResponse {
#[serde(rename = "thingTypeArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_arn: Option<String>,
#[serde(rename = "thingTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_id: Option<String>,
#[serde(rename = "thingTypeMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_metadata: Option<ThingTypeMetadata>,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
#[serde(rename = "thingTypeProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_properties: Option<ThingTypeProperties>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachPolicyRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "target")]
pub target: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachPrincipalPolicyRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "principal")]
pub principal: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachSecurityProfileRequest {
#[serde(rename = "securityProfileName")]
pub security_profile_name: String,
#[serde(rename = "securityProfileTargetArn")]
pub security_profile_target_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetachSecurityProfileResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetachThingPrincipalRequest {
#[serde(rename = "principal")]
pub principal: String,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetachThingPrincipalResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisableTopicRuleRequest {
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DynamoDBAction {
#[serde(rename = "hashKeyField")]
pub hash_key_field: String,
#[serde(rename = "hashKeyType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hash_key_type: Option<String>,
#[serde(rename = "hashKeyValue")]
pub hash_key_value: String,
#[serde(rename = "operation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub operation: Option<String>,
#[serde(rename = "payloadField")]
#[serde(skip_serializing_if = "Option::is_none")]
pub payload_field: Option<String>,
#[serde(rename = "rangeKeyField")]
#[serde(skip_serializing_if = "Option::is_none")]
pub range_key_field: Option<String>,
#[serde(rename = "rangeKeyType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub range_key_type: Option<String>,
#[serde(rename = "rangeKeyValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub range_key_value: Option<String>,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "tableName")]
pub table_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DynamoDBv2Action {
#[serde(rename = "putItem")]
#[serde(skip_serializing_if = "Option::is_none")]
pub put_item: Option<PutItemInput>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EffectivePolicy {
#[serde(rename = "policyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
#[serde(rename = "policyDocument")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_document: Option<String>,
#[serde(rename = "policyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ElasticsearchAction {
#[serde(rename = "endpoint")]
pub endpoint: String,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "index")]
pub index: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct EnableTopicRuleRequest {
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ErrorInfo {
#[serde(rename = "code")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(rename = "message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ExplicitDeny {
#[serde(rename = "policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<Policy>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FirehoseAction {
#[serde(rename = "deliveryStreamName")]
pub delivery_stream_name: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "separator")]
#[serde(skip_serializing_if = "Option::is_none")]
pub separator: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetEffectivePoliciesRequest {
#[serde(rename = "cognitoIdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cognito_identity_pool_id: Option<String>,
#[serde(rename = "principal")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principal: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetEffectivePoliciesResponse {
#[serde(rename = "effectivePolicies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub effective_policies: Option<Vec<EffectivePolicy>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetIndexingConfigurationRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetIndexingConfigurationResponse {
#[serde(rename = "thingIndexingConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_indexing_configuration: Option<ThingIndexingConfiguration>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetJobDocumentRequest {
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetJobDocumentResponse {
#[serde(rename = "document")]
#[serde(skip_serializing_if = "Option::is_none")]
pub document: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetLoggingOptionsRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetLoggingOptionsResponse {
#[serde(rename = "logLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_level: Option<String>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetOTAUpdateRequest {
#[serde(rename = "otaUpdateId")]
pub ota_update_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetOTAUpdateResponse {
#[serde(rename = "otaUpdateInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_info: Option<OTAUpdateInfo>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetPolicyRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetPolicyResponse {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "defaultVersionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_version_id: Option<String>,
#[serde(rename = "generationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub generation_id: Option<String>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "policyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
#[serde(rename = "policyDocument")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_document: Option<String>,
#[serde(rename = "policyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetPolicyVersionRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "policyVersionId")]
pub policy_version_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetPolicyVersionResponse {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "generationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub generation_id: Option<String>,
#[serde(rename = "isDefaultVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_default_version: Option<bool>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "policyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
#[serde(rename = "policyDocument")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_document: Option<String>,
#[serde(rename = "policyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
#[serde(rename = "policyVersionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRegistrationCodeRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRegistrationCodeResponse {
#[serde(rename = "registrationCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub registration_code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetTopicRuleRequest {
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetTopicRuleResponse {
#[serde(rename = "rule")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule: Option<TopicRule>,
#[serde(rename = "ruleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetV2LoggingOptionsRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetV2LoggingOptionsResponse {
#[serde(rename = "defaultLogLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_log_level: Option<String>,
#[serde(rename = "disableAllLogs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_all_logs: Option<bool>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GroupNameAndArn {
#[serde(rename = "groupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group_arn: Option<String>,
#[serde(rename = "groupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ImplicitDeny {
#[serde(rename = "policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<Policy>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct IotAnalyticsAction {
#[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 = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Job {
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
#[serde(rename = "completedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub completed_at: Option<f64>,
#[serde(rename = "createdAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "forceCanceled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force_canceled: Option<bool>,
#[serde(rename = "jobArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_arn: Option<String>,
#[serde(rename = "jobExecutionsRolloutConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_executions_rollout_config: Option<JobExecutionsRolloutConfig>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
#[serde(rename = "jobProcessDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_process_details: Option<JobProcessDetails>,
#[serde(rename = "lastUpdatedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_at: Option<f64>,
#[serde(rename = "presignedUrlConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub presigned_url_config: Option<PresignedUrlConfig>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "targetSelection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_selection: Option<String>,
#[serde(rename = "targets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub targets: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobExecution {
#[serde(rename = "executionNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_number: Option<i64>,
#[serde(rename = "forceCanceled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub force_canceled: Option<bool>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
#[serde(rename = "lastUpdatedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_at: Option<f64>,
#[serde(rename = "queuedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queued_at: Option<f64>,
#[serde(rename = "startedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub started_at: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "statusDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_details: Option<JobExecutionStatusDetails>,
#[serde(rename = "thingArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_arn: Option<String>,
#[serde(rename = "versionNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version_number: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobExecutionStatusDetails {
#[serde(rename = "detailsMap")]
#[serde(skip_serializing_if = "Option::is_none")]
pub details_map: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobExecutionSummary {
#[serde(rename = "executionNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_number: Option<i64>,
#[serde(rename = "lastUpdatedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_at: Option<f64>,
#[serde(rename = "queuedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queued_at: Option<f64>,
#[serde(rename = "startedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub started_at: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobExecutionSummaryForJob {
#[serde(rename = "jobExecutionSummary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_execution_summary: Option<JobExecutionSummary>,
#[serde(rename = "thingArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobExecutionSummaryForThing {
#[serde(rename = "jobExecutionSummary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_execution_summary: Option<JobExecutionSummary>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct JobExecutionsRolloutConfig {
#[serde(rename = "maximumPerMinute")]
#[serde(skip_serializing_if = "Option::is_none")]
pub maximum_per_minute: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobProcessDetails {
#[serde(rename = "numberOfCanceledThings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_canceled_things: Option<i64>,
#[serde(rename = "numberOfFailedThings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_failed_things: Option<i64>,
#[serde(rename = "numberOfInProgressThings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_in_progress_things: Option<i64>,
#[serde(rename = "numberOfQueuedThings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_queued_things: Option<i64>,
#[serde(rename = "numberOfRejectedThings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_rejected_things: Option<i64>,
#[serde(rename = "numberOfRemovedThings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_removed_things: Option<i64>,
#[serde(rename = "numberOfSucceededThings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_succeeded_things: Option<i64>,
#[serde(rename = "processingTargets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub processing_targets: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobSummary {
#[serde(rename = "completedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub completed_at: Option<f64>,
#[serde(rename = "createdAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<f64>,
#[serde(rename = "jobArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_arn: Option<String>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
#[serde(rename = "lastUpdatedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_at: Option<f64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "targetSelection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_selection: Option<String>,
#[serde(rename = "thingGroupId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct KeyPair {
#[serde(rename = "PrivateKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub private_key: Option<String>,
#[serde(rename = "PublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub public_key: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct KinesisAction {
#[serde(rename = "partitionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub partition_key: Option<String>,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "streamName")]
pub stream_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct LambdaAction {
#[serde(rename = "functionArn")]
pub function_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListActiveViolationsRequest {
#[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 = "securityProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_name: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListActiveViolationsResponse {
#[serde(rename = "activeViolations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub active_violations: Option<Vec<ActiveViolation>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAttachedPoliciesRequest {
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
#[serde(rename = "recursive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive: Option<bool>,
#[serde(rename = "target")]
pub target: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAttachedPoliciesResponse {
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
#[serde(rename = "policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<Policy>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAuditFindingsRequest {
#[serde(rename = "checkName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub check_name: Option<String>,
#[serde(rename = "endTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[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 = "resourceIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_identifier: Option<ResourceIdentifier>,
#[serde(rename = "startTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
#[serde(rename = "taskId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAuditFindingsResponse {
#[serde(rename = "findings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub findings: Option<Vec<AuditFinding>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAuditTasksRequest {
#[serde(rename = "endTime")]
pub end_time: f64,
#[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 = "startTime")]
pub start_time: f64,
#[serde(rename = "taskStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_status: Option<String>,
#[serde(rename = "taskType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAuditTasksResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "tasks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tasks: Option<Vec<AuditTaskMetadata>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAuthorizersRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAuthorizersResponse {
#[serde(rename = "authorizers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizers: Option<Vec<AuthorizerSummary>>,
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListCACertificatesRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListCACertificatesResponse {
#[serde(rename = "certificates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificates: Option<Vec<CACertificate>>,
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListCertificatesByCARequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "caCertificateId")]
pub ca_certificate_id: String,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListCertificatesByCAResponse {
#[serde(rename = "certificates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificates: Option<Vec<Certificate>>,
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListCertificatesRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListCertificatesResponse {
#[serde(rename = "certificates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificates: Option<Vec<Certificate>>,
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListIndicesRequest {
#[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 ListIndicesResponse {
#[serde(rename = "indexNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_names: Option<Vec<String>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListJobExecutionsForJobRequest {
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListJobExecutionsForJobResponse {
#[serde(rename = "executionSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_summaries: Option<Vec<JobExecutionSummaryForJob>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListJobExecutionsForThingRequest {
#[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 = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListJobExecutionsForThingResponse {
#[serde(rename = "executionSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_summaries: Option<Vec<JobExecutionSummaryForThing>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListJobsRequest {
#[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 = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "targetSelection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_selection: Option<String>,
#[serde(rename = "thingGroupId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_id: Option<String>,
#[serde(rename = "thingGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListJobsResponse {
#[serde(rename = "jobs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub jobs: Option<Vec<JobSummary>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListOTAUpdatesRequest {
#[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 = "otaUpdateStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListOTAUpdatesResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "otaUpdates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_updates: Option<Vec<OTAUpdateSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListOutgoingCertificatesRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListOutgoingCertificatesResponse {
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
#[serde(rename = "outgoingCertificates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub outgoing_certificates: Option<Vec<OutgoingCertificate>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPoliciesRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPoliciesResponse {
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
#[serde(rename = "policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<Policy>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPolicyPrincipalsRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
#[serde(rename = "policyName")]
pub policy_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPolicyPrincipalsResponse {
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
#[serde(rename = "principals")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principals: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPolicyVersionsRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPolicyVersionsResponse {
#[serde(rename = "policyVersions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_versions: Option<Vec<PolicyVersion>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPrincipalPoliciesRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
#[serde(rename = "principal")]
pub principal: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPrincipalPoliciesResponse {
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
#[serde(rename = "policies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<Policy>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPrincipalThingsRequest {
#[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 = "principal")]
pub principal: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPrincipalThingsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "things")]
#[serde(skip_serializing_if = "Option::is_none")]
pub things: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListRoleAliasesRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListRoleAliasesResponse {
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
#[serde(rename = "roleAliases")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_aliases: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListScheduledAuditsRequest {
#[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 ListScheduledAuditsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "scheduledAudits")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audits: Option<Vec<ScheduledAuditMetadata>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListSecurityProfilesForTargetRequest {
#[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 = "recursive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive: Option<bool>,
#[serde(rename = "securityProfileTargetArn")]
pub security_profile_target_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListSecurityProfilesForTargetResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "securityProfileTargetMappings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_target_mappings: Option<Vec<SecurityProfileTargetMapping>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListSecurityProfilesRequest {
#[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 ListSecurityProfilesResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "securityProfileIdentifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_identifiers: Option<Vec<SecurityProfileIdentifier>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListStreamsRequest {
#[serde(rename = "ascendingOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ascending_order: Option<bool>,
#[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 ListStreamsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "streams")]
#[serde(skip_serializing_if = "Option::is_none")]
pub streams: Option<Vec<StreamSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTargetsForPolicyRequest {
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub marker: Option<String>,
#[serde(rename = "pageSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub page_size: Option<i64>,
#[serde(rename = "policyName")]
pub policy_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTargetsForPolicyResponse {
#[serde(rename = "nextMarker")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_marker: Option<String>,
#[serde(rename = "targets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub targets: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTargetsForSecurityProfileRequest {
#[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 = "securityProfileName")]
pub security_profile_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTargetsForSecurityProfileResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "securityProfileTargets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_targets: Option<Vec<SecurityProfileTarget>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingGroupsForThingRequest {
#[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 = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingGroupsForThingResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "thingGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_groups: Option<Vec<GroupNameAndArn>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingGroupsRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "namePrefixFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name_prefix_filter: Option<String>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "parentGroup")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_group: Option<String>,
#[serde(rename = "recursive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingGroupsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "thingGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_groups: Option<Vec<GroupNameAndArn>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingPrincipalsRequest {
#[serde(rename = "thingName")]
pub thing_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingPrincipalsResponse {
#[serde(rename = "principals")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principals: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingRegistrationTaskReportsRequest {
#[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 = "reportType")]
pub report_type: String,
#[serde(rename = "taskId")]
pub task_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingRegistrationTaskReportsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "reportType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub report_type: Option<String>,
#[serde(rename = "resourceLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_links: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingRegistrationTasksRequest {
#[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 = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingRegistrationTasksResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "taskIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_ids: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingTypesRequest {
#[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 = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingTypesResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "thingTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_types: Option<Vec<ThingTypeDefinition>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingsInThingGroupRequest {
#[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 = "recursive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive: Option<bool>,
#[serde(rename = "thingGroupName")]
pub thing_group_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingsInThingGroupResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "things")]
#[serde(skip_serializing_if = "Option::is_none")]
pub things: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListThingsRequest {
#[serde(rename = "attributeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_name: Option<String>,
#[serde(rename = "attributeValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_value: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListThingsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "things")]
#[serde(skip_serializing_if = "Option::is_none")]
pub things: Option<Vec<ThingAttribute>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTopicRulesRequest {
#[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 = "ruleDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_disabled: Option<bool>,
#[serde(rename = "topic")]
#[serde(skip_serializing_if = "Option::is_none")]
pub topic: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTopicRulesResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "rules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rules: Option<Vec<TopicRuleListItem>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListV2LoggingLevelsRequest {
#[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 = "targetType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListV2LoggingLevelsResponse {
#[serde(rename = "logTargetConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_target_configurations: Option<Vec<LogTargetConfiguration>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListViolationEventsRequest {
#[serde(rename = "endTime")]
pub end_time: f64,
#[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 = "securityProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_name: Option<String>,
#[serde(rename = "startTime")]
pub start_time: f64,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListViolationEventsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "violationEvents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violation_events: Option<Vec<ViolationEvent>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct LogTarget {
#[serde(rename = "targetName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_name: Option<String>,
#[serde(rename = "targetType")]
pub target_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LogTargetConfiguration {
#[serde(rename = "logLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_level: Option<String>,
#[serde(rename = "logTarget")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_target: Option<LogTarget>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct LoggingOptionsPayload {
#[serde(rename = "logLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_level: Option<String>,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MetricValue {
#[serde(rename = "cidrs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cidrs: Option<Vec<String>>,
#[serde(rename = "count")]
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(rename = "ports")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ports: Option<Vec<i64>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct NonCompliantResource {
#[serde(rename = "additionalInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_info: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "resourceIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_identifier: Option<ResourceIdentifier>,
#[serde(rename = "resourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct OTAUpdateFile {
#[serde(rename = "attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "codeSigning")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_signing: Option<CodeSigning>,
#[serde(rename = "fileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
#[serde(rename = "fileSource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_source: Option<Stream>,
#[serde(rename = "fileVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct OTAUpdateInfo {
#[serde(rename = "additionalParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "awsIotJobArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_iot_job_arn: Option<String>,
#[serde(rename = "awsIotJobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_iot_job_id: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "errorInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_info: Option<ErrorInfo>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "otaUpdateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_arn: Option<String>,
#[serde(rename = "otaUpdateFiles")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_files: Option<Vec<OTAUpdateFile>>,
#[serde(rename = "otaUpdateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_id: Option<String>,
#[serde(rename = "otaUpdateStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_status: Option<String>,
#[serde(rename = "targetSelection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_selection: Option<String>,
#[serde(rename = "targets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub targets: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct OTAUpdateSummary {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "otaUpdateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_arn: Option<String>,
#[serde(rename = "otaUpdateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ota_update_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct OutgoingCertificate {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "transferDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_date: Option<f64>,
#[serde(rename = "transferMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_message: Option<String>,
#[serde(rename = "transferredTo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transferred_to: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Policy {
#[serde(rename = "policyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
#[serde(rename = "policyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PolicyVersion {
#[serde(rename = "createDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub create_date: Option<f64>,
#[serde(rename = "isDefaultVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_default_version: Option<bool>,
#[serde(rename = "versionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PolicyVersionIdentifier {
#[serde(rename = "policyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
#[serde(rename = "policyVersionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_version_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PresignedUrlConfig {
#[serde(rename = "expiresInSec")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_in_sec: Option<i64>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PutItemInput {
#[serde(rename = "tableName")]
pub table_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RegisterCACertificateRequest {
#[serde(rename = "allowAutoRegistration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_auto_registration: Option<bool>,
#[serde(rename = "caCertificate")]
pub ca_certificate: String,
#[serde(rename = "registrationConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub registration_config: Option<RegistrationConfig>,
#[serde(rename = "setAsActive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub set_as_active: Option<bool>,
#[serde(rename = "verificationCertificate")]
pub verification_certificate: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RegisterCACertificateResponse {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RegisterCertificateRequest {
#[serde(rename = "caCertificatePem")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ca_certificate_pem: Option<String>,
#[serde(rename = "certificatePem")]
pub certificate_pem: String,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RegisterCertificateResponse {
#[serde(rename = "certificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_arn: Option<String>,
#[serde(rename = "certificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RegisterThingRequest {
#[serde(rename = "parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "templateBody")]
pub template_body: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RegisterThingResponse {
#[serde(rename = "certificatePem")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_pem: Option<String>,
#[serde(rename = "resourceArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arns: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RegistrationConfig {
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "templateBody")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template_body: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RejectCertificateTransferRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
#[serde(rename = "rejectReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reject_reason: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RelatedResource {
#[serde(rename = "additionalInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_info: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "resourceIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_identifier: Option<ResourceIdentifier>,
#[serde(rename = "resourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RemoveThingFromThingGroupRequest {
#[serde(rename = "thingArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_arn: Option<String>,
#[serde(rename = "thingGroupArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_arn: Option<String>,
#[serde(rename = "thingGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_name: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RemoveThingFromThingGroupResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ReplaceTopicRuleRequest {
#[serde(rename = "ruleName")]
pub rule_name: String,
#[serde(rename = "topicRulePayload")]
pub topic_rule_payload: TopicRulePayload,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RepublishAction {
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "topic")]
pub topic: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResourceIdentifier {
#[serde(rename = "account")]
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<String>,
#[serde(rename = "caCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ca_certificate_id: Option<String>,
#[serde(rename = "clientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "cognitoIdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cognito_identity_pool_id: Option<String>,
#[serde(rename = "deviceCertificateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_certificate_id: Option<String>,
#[serde(rename = "policyVersionIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_version_identifier: Option<PolicyVersionIdentifier>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RoleAliasDescription {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "credentialDurationSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credential_duration_seconds: Option<i64>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "owner")]
#[serde(skip_serializing_if = "Option::is_none")]
pub owner: Option<String>,
#[serde(rename = "roleAlias")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_alias: Option<String>,
#[serde(rename = "roleAliasArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_alias_arn: Option<String>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct S3Action {
#[serde(rename = "bucketName")]
pub bucket_name: String,
#[serde(rename = "cannedAcl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub canned_acl: Option<String>,
#[serde(rename = "key")]
pub key: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct S3Location {
#[serde(rename = "bucket")]
pub bucket: String,
#[serde(rename = "key")]
pub key: String,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SalesforceAction {
#[serde(rename = "token")]
pub token: String,
#[serde(rename = "url")]
pub url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ScheduledAuditMetadata {
#[serde(rename = "dayOfMonth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_month: Option<String>,
#[serde(rename = "dayOfWeek")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_week: Option<String>,
#[serde(rename = "frequency")]
#[serde(skip_serializing_if = "Option::is_none")]
pub frequency: Option<String>,
#[serde(rename = "scheduledAuditArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audit_arn: Option<String>,
#[serde(rename = "scheduledAuditName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audit_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchIndexRequest {
#[serde(rename = "indexName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index_name: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "queryString")]
pub query_string: String,
#[serde(rename = "queryVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub query_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchIndexResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "things")]
#[serde(skip_serializing_if = "Option::is_none")]
pub things: Option<Vec<ThingDocument>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SecurityProfileIdentifier {
#[serde(rename = "arn")]
pub arn: String,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SecurityProfileTarget {
#[serde(rename = "arn")]
pub arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SecurityProfileTargetMapping {
#[serde(rename = "securityProfileIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_identifier: Option<SecurityProfileIdentifier>,
#[serde(rename = "target")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<SecurityProfileTarget>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetDefaultAuthorizerRequest {
#[serde(rename = "authorizerName")]
pub authorizer_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SetDefaultAuthorizerResponse {
#[serde(rename = "authorizerArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_arn: Option<String>,
#[serde(rename = "authorizerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetDefaultPolicyVersionRequest {
#[serde(rename = "policyName")]
pub policy_name: String,
#[serde(rename = "policyVersionId")]
pub policy_version_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetLoggingOptionsRequest {
#[serde(rename = "loggingOptionsPayload")]
pub logging_options_payload: LoggingOptionsPayload,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetV2LoggingLevelRequest {
#[serde(rename = "logLevel")]
pub log_level: String,
#[serde(rename = "logTarget")]
pub log_target: LogTarget,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetV2LoggingOptionsRequest {
#[serde(rename = "defaultLogLevel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_log_level: Option<String>,
#[serde(rename = "disableAllLogs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_all_logs: Option<bool>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SnsAction {
#[serde(rename = "messageFormat")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message_format: Option<String>,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "targetArn")]
pub target_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SqsAction {
#[serde(rename = "queueUrl")]
pub queue_url: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "useBase64")]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_base_64: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartOnDemandAuditTaskRequest {
#[serde(rename = "targetCheckNames")]
pub target_check_names: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartOnDemandAuditTaskResponse {
#[serde(rename = "taskId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartThingRegistrationTaskRequest {
#[serde(rename = "inputFileBucket")]
pub input_file_bucket: String,
#[serde(rename = "inputFileKey")]
pub input_file_key: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "templateBody")]
pub template_body: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartThingRegistrationTaskResponse {
#[serde(rename = "taskId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StepFunctionsAction {
#[serde(rename = "executionNamePrefix")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_name_prefix: Option<String>,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "stateMachineName")]
pub state_machine_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StopThingRegistrationTaskRequest {
#[serde(rename = "taskId")]
pub task_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StopThingRegistrationTaskResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Stream {
#[serde(rename = "fileId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_id: Option<i64>,
#[serde(rename = "streamId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StreamFile {
#[serde(rename = "fileId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_id: Option<i64>,
#[serde(rename = "s3Location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s_3_location: Option<S3Location>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StreamInfo {
#[serde(rename = "createdAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "files")]
#[serde(skip_serializing_if = "Option::is_none")]
pub files: Option<Vec<StreamFile>>,
#[serde(rename = "lastUpdatedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_at: Option<f64>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "streamArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "streamId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
#[serde(rename = "streamVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StreamSummary {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "streamArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "streamId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
#[serde(rename = "streamVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskStatistics {
#[serde(rename = "canceledChecks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub canceled_checks: Option<i64>,
#[serde(rename = "compliantChecks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub compliant_checks: Option<i64>,
#[serde(rename = "failedChecks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failed_checks: Option<i64>,
#[serde(rename = "inProgressChecks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub in_progress_checks: Option<i64>,
#[serde(rename = "nonCompliantChecks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub non_compliant_checks: Option<i64>,
#[serde(rename = "totalChecks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total_checks: Option<i64>,
#[serde(rename = "waitingForDataCollectionChecks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub waiting_for_data_collection_checks: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TestAuthorizationRequest {
#[serde(rename = "authInfos")]
pub auth_infos: Vec<AuthInfo>,
#[serde(rename = "clientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "cognitoIdentityPoolId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cognito_identity_pool_id: Option<String>,
#[serde(rename = "policyNamesToAdd")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_names_to_add: Option<Vec<String>>,
#[serde(rename = "policyNamesToSkip")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_names_to_skip: Option<Vec<String>>,
#[serde(rename = "principal")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principal: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TestAuthorizationResponse {
#[serde(rename = "authResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_results: Option<Vec<AuthResult>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TestInvokeAuthorizerRequest {
#[serde(rename = "authorizerName")]
pub authorizer_name: String,
#[serde(rename = "token")]
pub token: String,
#[serde(rename = "tokenSignature")]
pub token_signature: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TestInvokeAuthorizerResponse {
#[serde(rename = "disconnectAfterInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disconnect_after_in_seconds: Option<i64>,
#[serde(rename = "isAuthenticated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_authenticated: Option<bool>,
#[serde(rename = "policyDocuments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_documents: Option<Vec<String>>,
#[serde(rename = "principalId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principal_id: Option<String>,
#[serde(rename = "refreshAfterInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_after_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThingAttribute {
#[serde(rename = "attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "thingArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_arn: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThingDocument {
#[serde(rename = "attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "shadow")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shadow: Option<String>,
#[serde(rename = "thingGroupNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_names: Option<Vec<String>>,
#[serde(rename = "thingId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_id: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThingGroupMetadata {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "parentGroupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_group_name: Option<String>,
#[serde(rename = "rootToParentThingGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub root_to_parent_thing_groups: Option<Vec<GroupNameAndArn>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ThingGroupProperties {
#[serde(rename = "attributePayload")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_payload: Option<AttributePayload>,
#[serde(rename = "thingGroupDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_group_description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ThingIndexingConfiguration {
#[serde(rename = "thingIndexingMode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_indexing_mode: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThingTypeDefinition {
#[serde(rename = "thingTypeArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_arn: Option<String>,
#[serde(rename = "thingTypeMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_metadata: Option<ThingTypeMetadata>,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
#[serde(rename = "thingTypeProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_properties: Option<ThingTypeProperties>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThingTypeMetadata {
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "deprecated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deprecated: Option<bool>,
#[serde(rename = "deprecationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deprecation_date: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ThingTypeProperties {
#[serde(rename = "searchableAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub searchable_attributes: Option<Vec<String>>,
#[serde(rename = "thingTypeDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_description: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TopicRule {
#[serde(rename = "actions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actions: Option<Vec<Action>>,
#[serde(rename = "awsIotSqlVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_iot_sql_version: Option<String>,
#[serde(rename = "createdAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "errorAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_action: Option<Action>,
#[serde(rename = "ruleDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_disabled: Option<bool>,
#[serde(rename = "ruleName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_name: Option<String>,
#[serde(rename = "sql")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sql: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TopicRuleListItem {
#[serde(rename = "createdAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<f64>,
#[serde(rename = "ruleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_arn: Option<String>,
#[serde(rename = "ruleDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_disabled: Option<bool>,
#[serde(rename = "ruleName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_name: Option<String>,
#[serde(rename = "topicPattern")]
#[serde(skip_serializing_if = "Option::is_none")]
pub topic_pattern: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TopicRulePayload {
#[serde(rename = "actions")]
pub actions: Vec<Action>,
#[serde(rename = "awsIotSqlVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aws_iot_sql_version: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "errorAction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_action: Option<Action>,
#[serde(rename = "ruleDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rule_disabled: Option<bool>,
#[serde(rename = "sql")]
pub sql: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TransferCertificateRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
#[serde(rename = "targetAwsAccount")]
pub target_aws_account: String,
#[serde(rename = "transferMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TransferCertificateResponse {
#[serde(rename = "transferredCertificateArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transferred_certificate_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TransferData {
#[serde(rename = "acceptDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub accept_date: Option<f64>,
#[serde(rename = "rejectDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reject_date: Option<f64>,
#[serde(rename = "rejectReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reject_reason: Option<String>,
#[serde(rename = "transferDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_date: Option<f64>,
#[serde(rename = "transferMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateAccountAuditConfigurationRequest {
#[serde(rename = "auditCheckConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub audit_check_configurations:
Option<::std::collections::HashMap<String, AuditCheckConfiguration>>,
#[serde(rename = "auditNotificationTargetConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub audit_notification_target_configurations:
Option<::std::collections::HashMap<String, AuditNotificationTarget>>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateAccountAuditConfigurationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateAuthorizerRequest {
#[serde(rename = "authorizerFunctionArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_function_arn: Option<String>,
#[serde(rename = "authorizerName")]
pub authorizer_name: String,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "tokenKeyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub token_key_name: Option<String>,
#[serde(rename = "tokenSigningPublicKeys")]
#[serde(skip_serializing_if = "Option::is_none")]
pub token_signing_public_keys: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateAuthorizerResponse {
#[serde(rename = "authorizerArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_arn: Option<String>,
#[serde(rename = "authorizerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorizer_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateCACertificateRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
#[serde(rename = "newAutoRegistrationStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub new_auto_registration_status: Option<String>,
#[serde(rename = "newStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub new_status: Option<String>,
#[serde(rename = "registrationConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub registration_config: Option<RegistrationConfig>,
#[serde(rename = "removeAutoRegistration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_auto_registration: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateCertificateRequest {
#[serde(rename = "certificateId")]
pub certificate_id: String,
#[serde(rename = "newStatus")]
pub new_status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateEventConfigurationsRequest {
#[serde(rename = "eventConfigurations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_configurations: Option<::std::collections::HashMap<String, Configuration>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateEventConfigurationsResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateIndexingConfigurationRequest {
#[serde(rename = "thingIndexingConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_indexing_configuration: Option<ThingIndexingConfiguration>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateIndexingConfigurationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRoleAliasRequest {
#[serde(rename = "credentialDurationSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub credential_duration_seconds: Option<i64>,
#[serde(rename = "roleAlias")]
pub role_alias: String,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateRoleAliasResponse {
#[serde(rename = "roleAlias")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_alias: Option<String>,
#[serde(rename = "roleAliasArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_alias_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateScheduledAuditRequest {
#[serde(rename = "dayOfMonth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_month: Option<String>,
#[serde(rename = "dayOfWeek")]
#[serde(skip_serializing_if = "Option::is_none")]
pub day_of_week: Option<String>,
#[serde(rename = "frequency")]
#[serde(skip_serializing_if = "Option::is_none")]
pub frequency: Option<String>,
#[serde(rename = "scheduledAuditName")]
pub scheduled_audit_name: String,
#[serde(rename = "targetCheckNames")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_check_names: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateScheduledAuditResponse {
#[serde(rename = "scheduledAuditArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled_audit_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateSecurityProfileRequest {
#[serde(rename = "alertTargets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alert_targets: Option<::std::collections::HashMap<String, AlertTarget>>,
#[serde(rename = "behaviors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub behaviors: Option<Vec<Behavior>>,
#[serde(rename = "expectedVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_version: Option<i64>,
#[serde(rename = "securityProfileDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_description: Option<String>,
#[serde(rename = "securityProfileName")]
pub security_profile_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateSecurityProfileResponse {
#[serde(rename = "alertTargets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub alert_targets: Option<::std::collections::HashMap<String, AlertTarget>>,
#[serde(rename = "behaviors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub behaviors: Option<Vec<Behavior>>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "securityProfileArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_arn: Option<String>,
#[serde(rename = "securityProfileDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_description: Option<String>,
#[serde(rename = "securityProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_name: Option<String>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateStreamRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "files")]
#[serde(skip_serializing_if = "Option::is_none")]
pub files: Option<Vec<StreamFile>>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "streamId")]
pub stream_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateStreamResponse {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "streamArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "streamId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
#[serde(rename = "streamVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateThingGroupRequest {
#[serde(rename = "expectedVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_version: Option<i64>,
#[serde(rename = "thingGroupName")]
pub thing_group_name: String,
#[serde(rename = "thingGroupProperties")]
pub thing_group_properties: ThingGroupProperties,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateThingGroupResponse {
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateThingGroupsForThingRequest {
#[serde(rename = "thingGroupsToAdd")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_groups_to_add: Option<Vec<String>>,
#[serde(rename = "thingGroupsToRemove")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_groups_to_remove: Option<Vec<String>>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateThingGroupsForThingResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateThingRequest {
#[serde(rename = "attributePayload")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_payload: Option<AttributePayload>,
#[serde(rename = "expectedVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_version: Option<i64>,
#[serde(rename = "removeThingType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_thing_type: Option<bool>,
#[serde(rename = "thingName")]
pub thing_name: String,
#[serde(rename = "thingTypeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_type_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateThingResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ValidateSecurityProfileBehaviorsRequest {
#[serde(rename = "behaviors")]
pub behaviors: Vec<Behavior>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ValidateSecurityProfileBehaviorsResponse {
#[serde(rename = "valid")]
#[serde(skip_serializing_if = "Option::is_none")]
pub valid: Option<bool>,
#[serde(rename = "validationErrors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub validation_errors: Option<Vec<ValidationError>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ValidationError {
#[serde(rename = "errorMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ViolationEvent {
#[serde(rename = "behavior")]
#[serde(skip_serializing_if = "Option::is_none")]
pub behavior: Option<Behavior>,
#[serde(rename = "metricValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub metric_value: Option<MetricValue>,
#[serde(rename = "securityProfileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_profile_name: Option<String>,
#[serde(rename = "thingName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub thing_name: Option<String>,
#[serde(rename = "violationEventTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violation_event_time: Option<f64>,
#[serde(rename = "violationEventType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violation_event_type: Option<String>,
#[serde(rename = "violationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violation_id: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum AcceptCertificateTransferError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
TransferAlreadyCompleted(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AcceptCertificateTransferError {
pub fn from_response(res: BufferedHttpResponse) -> AcceptCertificateTransferError {
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 AcceptCertificateTransferError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return AcceptCertificateTransferError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return AcceptCertificateTransferError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return AcceptCertificateTransferError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return AcceptCertificateTransferError::Throttling(String::from(error_message))
}
"TransferAlreadyCompletedException" => {
return AcceptCertificateTransferError::TransferAlreadyCompleted(String::from(
error_message,
))
}
"UnauthorizedException" => {
return AcceptCertificateTransferError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return AcceptCertificateTransferError::Validation(error_message.to_string())
}
_ => {}
}
}
return AcceptCertificateTransferError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AcceptCertificateTransferError {
fn from(err: serde_json::error::Error) -> AcceptCertificateTransferError {
AcceptCertificateTransferError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AcceptCertificateTransferError {
fn from(err: CredentialsError) -> AcceptCertificateTransferError {
AcceptCertificateTransferError::Credentials(err)
}
}
impl From<HttpDispatchError> for AcceptCertificateTransferError {
fn from(err: HttpDispatchError) -> AcceptCertificateTransferError {
AcceptCertificateTransferError::HttpDispatch(err)
}
}
impl From<io::Error> for AcceptCertificateTransferError {
fn from(err: io::Error) -> AcceptCertificateTransferError {
AcceptCertificateTransferError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AcceptCertificateTransferError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AcceptCertificateTransferError {
fn description(&self) -> &str {
match *self {
AcceptCertificateTransferError::InternalFailure(ref cause) => cause,
AcceptCertificateTransferError::InvalidRequest(ref cause) => cause,
AcceptCertificateTransferError::ResourceNotFound(ref cause) => cause,
AcceptCertificateTransferError::ServiceUnavailable(ref cause) => cause,
AcceptCertificateTransferError::Throttling(ref cause) => cause,
AcceptCertificateTransferError::TransferAlreadyCompleted(ref cause) => cause,
AcceptCertificateTransferError::Unauthorized(ref cause) => cause,
AcceptCertificateTransferError::Validation(ref cause) => cause,
AcceptCertificateTransferError::Credentials(ref err) => err.description(),
AcceptCertificateTransferError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AcceptCertificateTransferError::ParseError(ref cause) => cause,
AcceptCertificateTransferError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AddThingToThingGroupError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AddThingToThingGroupError {
pub fn from_response(res: BufferedHttpResponse) -> AddThingToThingGroupError {
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 AddThingToThingGroupError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return AddThingToThingGroupError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return AddThingToThingGroupError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return AddThingToThingGroupError::Throttling(String::from(error_message))
}
"ValidationException" => {
return AddThingToThingGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return AddThingToThingGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AddThingToThingGroupError {
fn from(err: serde_json::error::Error) -> AddThingToThingGroupError {
AddThingToThingGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AddThingToThingGroupError {
fn from(err: CredentialsError) -> AddThingToThingGroupError {
AddThingToThingGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for AddThingToThingGroupError {
fn from(err: HttpDispatchError) -> AddThingToThingGroupError {
AddThingToThingGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for AddThingToThingGroupError {
fn from(err: io::Error) -> AddThingToThingGroupError {
AddThingToThingGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AddThingToThingGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AddThingToThingGroupError {
fn description(&self) -> &str {
match *self {
AddThingToThingGroupError::InternalFailure(ref cause) => cause,
AddThingToThingGroupError::InvalidRequest(ref cause) => cause,
AddThingToThingGroupError::ResourceNotFound(ref cause) => cause,
AddThingToThingGroupError::Throttling(ref cause) => cause,
AddThingToThingGroupError::Validation(ref cause) => cause,
AddThingToThingGroupError::Credentials(ref err) => err.description(),
AddThingToThingGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AddThingToThingGroupError::ParseError(ref cause) => cause,
AddThingToThingGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateTargetsWithJobError {
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateTargetsWithJobError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateTargetsWithJobError {
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 {
"InvalidRequestException" => {
return AssociateTargetsWithJobError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return AssociateTargetsWithJobError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return AssociateTargetsWithJobError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return AssociateTargetsWithJobError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return AssociateTargetsWithJobError::Throttling(String::from(error_message))
}
"ValidationException" => {
return AssociateTargetsWithJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return AssociateTargetsWithJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateTargetsWithJobError {
fn from(err: serde_json::error::Error) -> AssociateTargetsWithJobError {
AssociateTargetsWithJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateTargetsWithJobError {
fn from(err: CredentialsError) -> AssociateTargetsWithJobError {
AssociateTargetsWithJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateTargetsWithJobError {
fn from(err: HttpDispatchError) -> AssociateTargetsWithJobError {
AssociateTargetsWithJobError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateTargetsWithJobError {
fn from(err: io::Error) -> AssociateTargetsWithJobError {
AssociateTargetsWithJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateTargetsWithJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateTargetsWithJobError {
fn description(&self) -> &str {
match *self {
AssociateTargetsWithJobError::InvalidRequest(ref cause) => cause,
AssociateTargetsWithJobError::LimitExceeded(ref cause) => cause,
AssociateTargetsWithJobError::ResourceNotFound(ref cause) => cause,
AssociateTargetsWithJobError::ServiceUnavailable(ref cause) => cause,
AssociateTargetsWithJobError::Throttling(ref cause) => cause,
AssociateTargetsWithJobError::Validation(ref cause) => cause,
AssociateTargetsWithJobError::Credentials(ref err) => err.description(),
AssociateTargetsWithJobError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateTargetsWithJobError::ParseError(ref cause) => cause,
AssociateTargetsWithJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachPolicyError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> AttachPolicyError {
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 AttachPolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return AttachPolicyError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return AttachPolicyError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return AttachPolicyError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return AttachPolicyError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return AttachPolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return AttachPolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return AttachPolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return AttachPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachPolicyError {
fn from(err: serde_json::error::Error) -> AttachPolicyError {
AttachPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachPolicyError {
fn from(err: CredentialsError) -> AttachPolicyError {
AttachPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachPolicyError {
fn from(err: HttpDispatchError) -> AttachPolicyError {
AttachPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachPolicyError {
fn from(err: io::Error) -> AttachPolicyError {
AttachPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachPolicyError {
fn description(&self) -> &str {
match *self {
AttachPolicyError::InternalFailure(ref cause) => cause,
AttachPolicyError::InvalidRequest(ref cause) => cause,
AttachPolicyError::LimitExceeded(ref cause) => cause,
AttachPolicyError::ResourceNotFound(ref cause) => cause,
AttachPolicyError::ServiceUnavailable(ref cause) => cause,
AttachPolicyError::Throttling(ref cause) => cause,
AttachPolicyError::Unauthorized(ref cause) => cause,
AttachPolicyError::Validation(ref cause) => cause,
AttachPolicyError::Credentials(ref err) => err.description(),
AttachPolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AttachPolicyError::ParseError(ref cause) => cause,
AttachPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachPrincipalPolicyError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachPrincipalPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> AttachPrincipalPolicyError {
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 AttachPrincipalPolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return AttachPrincipalPolicyError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return AttachPrincipalPolicyError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return AttachPrincipalPolicyError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return AttachPrincipalPolicyError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return AttachPrincipalPolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return AttachPrincipalPolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return AttachPrincipalPolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return AttachPrincipalPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachPrincipalPolicyError {
fn from(err: serde_json::error::Error) -> AttachPrincipalPolicyError {
AttachPrincipalPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachPrincipalPolicyError {
fn from(err: CredentialsError) -> AttachPrincipalPolicyError {
AttachPrincipalPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachPrincipalPolicyError {
fn from(err: HttpDispatchError) -> AttachPrincipalPolicyError {
AttachPrincipalPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachPrincipalPolicyError {
fn from(err: io::Error) -> AttachPrincipalPolicyError {
AttachPrincipalPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachPrincipalPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachPrincipalPolicyError {
fn description(&self) -> &str {
match *self {
AttachPrincipalPolicyError::InternalFailure(ref cause) => cause,
AttachPrincipalPolicyError::InvalidRequest(ref cause) => cause,
AttachPrincipalPolicyError::LimitExceeded(ref cause) => cause,
AttachPrincipalPolicyError::ResourceNotFound(ref cause) => cause,
AttachPrincipalPolicyError::ServiceUnavailable(ref cause) => cause,
AttachPrincipalPolicyError::Throttling(ref cause) => cause,
AttachPrincipalPolicyError::Unauthorized(ref cause) => cause,
AttachPrincipalPolicyError::Validation(ref cause) => cause,
AttachPrincipalPolicyError::Credentials(ref err) => err.description(),
AttachPrincipalPolicyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AttachPrincipalPolicyError::ParseError(ref cause) => cause,
AttachPrincipalPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachSecurityProfileError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
Throttling(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachSecurityProfileError {
pub fn from_response(res: BufferedHttpResponse) -> AttachSecurityProfileError {
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 AttachSecurityProfileError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return AttachSecurityProfileError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return AttachSecurityProfileError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return AttachSecurityProfileError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return AttachSecurityProfileError::Throttling(String::from(error_message))
}
"VersionConflictException" => {
return AttachSecurityProfileError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return AttachSecurityProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return AttachSecurityProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachSecurityProfileError {
fn from(err: serde_json::error::Error) -> AttachSecurityProfileError {
AttachSecurityProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachSecurityProfileError {
fn from(err: CredentialsError) -> AttachSecurityProfileError {
AttachSecurityProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachSecurityProfileError {
fn from(err: HttpDispatchError) -> AttachSecurityProfileError {
AttachSecurityProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachSecurityProfileError {
fn from(err: io::Error) -> AttachSecurityProfileError {
AttachSecurityProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachSecurityProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachSecurityProfileError {
fn description(&self) -> &str {
match *self {
AttachSecurityProfileError::InternalFailure(ref cause) => cause,
AttachSecurityProfileError::InvalidRequest(ref cause) => cause,
AttachSecurityProfileError::LimitExceeded(ref cause) => cause,
AttachSecurityProfileError::ResourceNotFound(ref cause) => cause,
AttachSecurityProfileError::Throttling(ref cause) => cause,
AttachSecurityProfileError::VersionConflict(ref cause) => cause,
AttachSecurityProfileError::Validation(ref cause) => cause,
AttachSecurityProfileError::Credentials(ref err) => err.description(),
AttachSecurityProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AttachSecurityProfileError::ParseError(ref cause) => cause,
AttachSecurityProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AttachThingPrincipalError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AttachThingPrincipalError {
pub fn from_response(res: BufferedHttpResponse) -> AttachThingPrincipalError {
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 AttachThingPrincipalError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return AttachThingPrincipalError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return AttachThingPrincipalError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return AttachThingPrincipalError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return AttachThingPrincipalError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return AttachThingPrincipalError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return AttachThingPrincipalError::Validation(error_message.to_string())
}
_ => {}
}
}
return AttachThingPrincipalError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AttachThingPrincipalError {
fn from(err: serde_json::error::Error) -> AttachThingPrincipalError {
AttachThingPrincipalError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AttachThingPrincipalError {
fn from(err: CredentialsError) -> AttachThingPrincipalError {
AttachThingPrincipalError::Credentials(err)
}
}
impl From<HttpDispatchError> for AttachThingPrincipalError {
fn from(err: HttpDispatchError) -> AttachThingPrincipalError {
AttachThingPrincipalError::HttpDispatch(err)
}
}
impl From<io::Error> for AttachThingPrincipalError {
fn from(err: io::Error) -> AttachThingPrincipalError {
AttachThingPrincipalError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AttachThingPrincipalError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AttachThingPrincipalError {
fn description(&self) -> &str {
match *self {
AttachThingPrincipalError::InternalFailure(ref cause) => cause,
AttachThingPrincipalError::InvalidRequest(ref cause) => cause,
AttachThingPrincipalError::ResourceNotFound(ref cause) => cause,
AttachThingPrincipalError::ServiceUnavailable(ref cause) => cause,
AttachThingPrincipalError::Throttling(ref cause) => cause,
AttachThingPrincipalError::Unauthorized(ref cause) => cause,
AttachThingPrincipalError::Validation(ref cause) => cause,
AttachThingPrincipalError::Credentials(ref err) => err.description(),
AttachThingPrincipalError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AttachThingPrincipalError::ParseError(ref cause) => cause,
AttachThingPrincipalError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CancelAuditTaskError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CancelAuditTaskError {
pub fn from_response(res: BufferedHttpResponse) -> CancelAuditTaskError {
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 CancelAuditTaskError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CancelAuditTaskError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return CancelAuditTaskError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return CancelAuditTaskError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CancelAuditTaskError::Validation(error_message.to_string())
}
_ => {}
}
}
return CancelAuditTaskError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CancelAuditTaskError {
fn from(err: serde_json::error::Error) -> CancelAuditTaskError {
CancelAuditTaskError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CancelAuditTaskError {
fn from(err: CredentialsError) -> CancelAuditTaskError {
CancelAuditTaskError::Credentials(err)
}
}
impl From<HttpDispatchError> for CancelAuditTaskError {
fn from(err: HttpDispatchError) -> CancelAuditTaskError {
CancelAuditTaskError::HttpDispatch(err)
}
}
impl From<io::Error> for CancelAuditTaskError {
fn from(err: io::Error) -> CancelAuditTaskError {
CancelAuditTaskError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CancelAuditTaskError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CancelAuditTaskError {
fn description(&self) -> &str {
match *self {
CancelAuditTaskError::InternalFailure(ref cause) => cause,
CancelAuditTaskError::InvalidRequest(ref cause) => cause,
CancelAuditTaskError::ResourceNotFound(ref cause) => cause,
CancelAuditTaskError::Throttling(ref cause) => cause,
CancelAuditTaskError::Validation(ref cause) => cause,
CancelAuditTaskError::Credentials(ref err) => err.description(),
CancelAuditTaskError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CancelAuditTaskError::ParseError(ref cause) => cause,
CancelAuditTaskError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CancelCertificateTransferError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
TransferAlreadyCompleted(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CancelCertificateTransferError {
pub fn from_response(res: BufferedHttpResponse) -> CancelCertificateTransferError {
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 CancelCertificateTransferError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return CancelCertificateTransferError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return CancelCertificateTransferError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return CancelCertificateTransferError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return CancelCertificateTransferError::Throttling(String::from(error_message))
}
"TransferAlreadyCompletedException" => {
return CancelCertificateTransferError::TransferAlreadyCompleted(String::from(
error_message,
))
}
"UnauthorizedException" => {
return CancelCertificateTransferError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CancelCertificateTransferError::Validation(error_message.to_string())
}
_ => {}
}
}
return CancelCertificateTransferError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CancelCertificateTransferError {
fn from(err: serde_json::error::Error) -> CancelCertificateTransferError {
CancelCertificateTransferError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CancelCertificateTransferError {
fn from(err: CredentialsError) -> CancelCertificateTransferError {
CancelCertificateTransferError::Credentials(err)
}
}
impl From<HttpDispatchError> for CancelCertificateTransferError {
fn from(err: HttpDispatchError) -> CancelCertificateTransferError {
CancelCertificateTransferError::HttpDispatch(err)
}
}
impl From<io::Error> for CancelCertificateTransferError {
fn from(err: io::Error) -> CancelCertificateTransferError {
CancelCertificateTransferError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CancelCertificateTransferError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CancelCertificateTransferError {
fn description(&self) -> &str {
match *self {
CancelCertificateTransferError::InternalFailure(ref cause) => cause,
CancelCertificateTransferError::InvalidRequest(ref cause) => cause,
CancelCertificateTransferError::ResourceNotFound(ref cause) => cause,
CancelCertificateTransferError::ServiceUnavailable(ref cause) => cause,
CancelCertificateTransferError::Throttling(ref cause) => cause,
CancelCertificateTransferError::TransferAlreadyCompleted(ref cause) => cause,
CancelCertificateTransferError::Unauthorized(ref cause) => cause,
CancelCertificateTransferError::Validation(ref cause) => cause,
CancelCertificateTransferError::Credentials(ref err) => err.description(),
CancelCertificateTransferError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CancelCertificateTransferError::ParseError(ref cause) => cause,
CancelCertificateTransferError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CancelJobError {
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CancelJobError {
pub fn from_response(res: BufferedHttpResponse) -> CancelJobError {
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 {
"InvalidRequestException" => {
return CancelJobError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return CancelJobError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return CancelJobError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CancelJobError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CancelJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return CancelJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CancelJobError {
fn from(err: serde_json::error::Error) -> CancelJobError {
CancelJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CancelJobError {
fn from(err: CredentialsError) -> CancelJobError {
CancelJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for CancelJobError {
fn from(err: HttpDispatchError) -> CancelJobError {
CancelJobError::HttpDispatch(err)
}
}
impl From<io::Error> for CancelJobError {
fn from(err: io::Error) -> CancelJobError {
CancelJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CancelJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CancelJobError {
fn description(&self) -> &str {
match *self {
CancelJobError::InvalidRequest(ref cause) => cause,
CancelJobError::ResourceNotFound(ref cause) => cause,
CancelJobError::ServiceUnavailable(ref cause) => cause,
CancelJobError::Throttling(ref cause) => cause,
CancelJobError::Validation(ref cause) => cause,
CancelJobError::Credentials(ref err) => err.description(),
CancelJobError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CancelJobError::ParseError(ref cause) => cause,
CancelJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CancelJobExecutionError {
InvalidRequest(String),
InvalidStateTransition(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CancelJobExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> CancelJobExecutionError {
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 {
"InvalidRequestException" => {
return CancelJobExecutionError::InvalidRequest(String::from(error_message))
}
"InvalidStateTransitionException" => {
return CancelJobExecutionError::InvalidStateTransition(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return CancelJobExecutionError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return CancelJobExecutionError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CancelJobExecutionError::Throttling(String::from(error_message))
}
"VersionConflictException" => {
return CancelJobExecutionError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return CancelJobExecutionError::Validation(error_message.to_string())
}
_ => {}
}
}
return CancelJobExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CancelJobExecutionError {
fn from(err: serde_json::error::Error) -> CancelJobExecutionError {
CancelJobExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CancelJobExecutionError {
fn from(err: CredentialsError) -> CancelJobExecutionError {
CancelJobExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CancelJobExecutionError {
fn from(err: HttpDispatchError) -> CancelJobExecutionError {
CancelJobExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for CancelJobExecutionError {
fn from(err: io::Error) -> CancelJobExecutionError {
CancelJobExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CancelJobExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CancelJobExecutionError {
fn description(&self) -> &str {
match *self {
CancelJobExecutionError::InvalidRequest(ref cause) => cause,
CancelJobExecutionError::InvalidStateTransition(ref cause) => cause,
CancelJobExecutionError::ResourceNotFound(ref cause) => cause,
CancelJobExecutionError::ServiceUnavailable(ref cause) => cause,
CancelJobExecutionError::Throttling(ref cause) => cause,
CancelJobExecutionError::VersionConflict(ref cause) => cause,
CancelJobExecutionError::Validation(ref cause) => cause,
CancelJobExecutionError::Credentials(ref err) => err.description(),
CancelJobExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CancelJobExecutionError::ParseError(ref cause) => cause,
CancelJobExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ClearDefaultAuthorizerError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ClearDefaultAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> ClearDefaultAuthorizerError {
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 ClearDefaultAuthorizerError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ClearDefaultAuthorizerError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ClearDefaultAuthorizerError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return ClearDefaultAuthorizerError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ClearDefaultAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ClearDefaultAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ClearDefaultAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return ClearDefaultAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ClearDefaultAuthorizerError {
fn from(err: serde_json::error::Error) -> ClearDefaultAuthorizerError {
ClearDefaultAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ClearDefaultAuthorizerError {
fn from(err: CredentialsError) -> ClearDefaultAuthorizerError {
ClearDefaultAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for ClearDefaultAuthorizerError {
fn from(err: HttpDispatchError) -> ClearDefaultAuthorizerError {
ClearDefaultAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for ClearDefaultAuthorizerError {
fn from(err: io::Error) -> ClearDefaultAuthorizerError {
ClearDefaultAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ClearDefaultAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ClearDefaultAuthorizerError {
fn description(&self) -> &str {
match *self {
ClearDefaultAuthorizerError::InternalFailure(ref cause) => cause,
ClearDefaultAuthorizerError::InvalidRequest(ref cause) => cause,
ClearDefaultAuthorizerError::ResourceNotFound(ref cause) => cause,
ClearDefaultAuthorizerError::ServiceUnavailable(ref cause) => cause,
ClearDefaultAuthorizerError::Throttling(ref cause) => cause,
ClearDefaultAuthorizerError::Unauthorized(ref cause) => cause,
ClearDefaultAuthorizerError::Validation(ref cause) => cause,
ClearDefaultAuthorizerError::Credentials(ref err) => err.description(),
ClearDefaultAuthorizerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ClearDefaultAuthorizerError::ParseError(ref cause) => cause,
ClearDefaultAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateAuthorizerError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> CreateAuthorizerError {
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 CreateAuthorizerError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateAuthorizerError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return CreateAuthorizerError::LimitExceeded(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateAuthorizerError::ResourceAlreadyExists(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateAuthorizerError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreateAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateAuthorizerError {
fn from(err: serde_json::error::Error) -> CreateAuthorizerError {
CreateAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateAuthorizerError {
fn from(err: CredentialsError) -> CreateAuthorizerError {
CreateAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateAuthorizerError {
fn from(err: HttpDispatchError) -> CreateAuthorizerError {
CreateAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateAuthorizerError {
fn from(err: io::Error) -> CreateAuthorizerError {
CreateAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateAuthorizerError {
fn description(&self) -> &str {
match *self {
CreateAuthorizerError::InternalFailure(ref cause) => cause,
CreateAuthorizerError::InvalidRequest(ref cause) => cause,
CreateAuthorizerError::LimitExceeded(ref cause) => cause,
CreateAuthorizerError::ResourceAlreadyExists(ref cause) => cause,
CreateAuthorizerError::ServiceUnavailable(ref cause) => cause,
CreateAuthorizerError::Throttling(ref cause) => cause,
CreateAuthorizerError::Unauthorized(ref cause) => cause,
CreateAuthorizerError::Validation(ref cause) => cause,
CreateAuthorizerError::Credentials(ref err) => err.description(),
CreateAuthorizerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateAuthorizerError::ParseError(ref cause) => cause,
CreateAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateCertificateFromCsrError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateCertificateFromCsrError {
pub fn from_response(res: BufferedHttpResponse) -> CreateCertificateFromCsrError {
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 CreateCertificateFromCsrError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return CreateCertificateFromCsrError::InvalidRequest(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return CreateCertificateFromCsrError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return CreateCertificateFromCsrError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateCertificateFromCsrError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateCertificateFromCsrError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateCertificateFromCsrError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateCertificateFromCsrError {
fn from(err: serde_json::error::Error) -> CreateCertificateFromCsrError {
CreateCertificateFromCsrError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateCertificateFromCsrError {
fn from(err: CredentialsError) -> CreateCertificateFromCsrError {
CreateCertificateFromCsrError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateCertificateFromCsrError {
fn from(err: HttpDispatchError) -> CreateCertificateFromCsrError {
CreateCertificateFromCsrError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateCertificateFromCsrError {
fn from(err: io::Error) -> CreateCertificateFromCsrError {
CreateCertificateFromCsrError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateCertificateFromCsrError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateCertificateFromCsrError {
fn description(&self) -> &str {
match *self {
CreateCertificateFromCsrError::InternalFailure(ref cause) => cause,
CreateCertificateFromCsrError::InvalidRequest(ref cause) => cause,
CreateCertificateFromCsrError::ServiceUnavailable(ref cause) => cause,
CreateCertificateFromCsrError::Throttling(ref cause) => cause,
CreateCertificateFromCsrError::Unauthorized(ref cause) => cause,
CreateCertificateFromCsrError::Validation(ref cause) => cause,
CreateCertificateFromCsrError::Credentials(ref err) => err.description(),
CreateCertificateFromCsrError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateCertificateFromCsrError::ParseError(ref cause) => cause,
CreateCertificateFromCsrError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateJobError {
InvalidRequest(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateJobError {
pub fn from_response(res: BufferedHttpResponse) -> CreateJobError {
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 {
"InvalidRequestException" => {
return CreateJobError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return CreateJobError::LimitExceeded(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateJobError::ResourceAlreadyExists(String::from(error_message))
}
"ResourceNotFoundException" => {
return CreateJobError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateJobError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreateJobError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CreateJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateJobError {
fn from(err: serde_json::error::Error) -> CreateJobError {
CreateJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateJobError {
fn from(err: CredentialsError) -> CreateJobError {
CreateJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateJobError {
fn from(err: HttpDispatchError) -> CreateJobError {
CreateJobError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateJobError {
fn from(err: io::Error) -> CreateJobError {
CreateJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateJobError {
fn description(&self) -> &str {
match *self {
CreateJobError::InvalidRequest(ref cause) => cause,
CreateJobError::LimitExceeded(ref cause) => cause,
CreateJobError::ResourceAlreadyExists(ref cause) => cause,
CreateJobError::ResourceNotFound(ref cause) => cause,
CreateJobError::ServiceUnavailable(ref cause) => cause,
CreateJobError::Throttling(ref cause) => cause,
CreateJobError::Validation(ref cause) => cause,
CreateJobError::Credentials(ref err) => err.description(),
CreateJobError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateJobError::ParseError(ref cause) => cause,
CreateJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateKeysAndCertificateError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateKeysAndCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> CreateKeysAndCertificateError {
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 CreateKeysAndCertificateError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return CreateKeysAndCertificateError::InvalidRequest(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return CreateKeysAndCertificateError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return CreateKeysAndCertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateKeysAndCertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateKeysAndCertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateKeysAndCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateKeysAndCertificateError {
fn from(err: serde_json::error::Error) -> CreateKeysAndCertificateError {
CreateKeysAndCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateKeysAndCertificateError {
fn from(err: CredentialsError) -> CreateKeysAndCertificateError {
CreateKeysAndCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateKeysAndCertificateError {
fn from(err: HttpDispatchError) -> CreateKeysAndCertificateError {
CreateKeysAndCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateKeysAndCertificateError {
fn from(err: io::Error) -> CreateKeysAndCertificateError {
CreateKeysAndCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateKeysAndCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateKeysAndCertificateError {
fn description(&self) -> &str {
match *self {
CreateKeysAndCertificateError::InternalFailure(ref cause) => cause,
CreateKeysAndCertificateError::InvalidRequest(ref cause) => cause,
CreateKeysAndCertificateError::ServiceUnavailable(ref cause) => cause,
CreateKeysAndCertificateError::Throttling(ref cause) => cause,
CreateKeysAndCertificateError::Unauthorized(ref cause) => cause,
CreateKeysAndCertificateError::Validation(ref cause) => cause,
CreateKeysAndCertificateError::Credentials(ref err) => err.description(),
CreateKeysAndCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateKeysAndCertificateError::ParseError(ref cause) => cause,
CreateKeysAndCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateOTAUpdateError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateOTAUpdateError {
pub fn from_response(res: BufferedHttpResponse) -> CreateOTAUpdateError {
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 CreateOTAUpdateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateOTAUpdateError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateOTAUpdateError::ResourceAlreadyExists(String::from(error_message))
}
"ResourceNotFoundException" => {
return CreateOTAUpdateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateOTAUpdateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreateOTAUpdateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateOTAUpdateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateOTAUpdateError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateOTAUpdateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateOTAUpdateError {
fn from(err: serde_json::error::Error) -> CreateOTAUpdateError {
CreateOTAUpdateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateOTAUpdateError {
fn from(err: CredentialsError) -> CreateOTAUpdateError {
CreateOTAUpdateError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateOTAUpdateError {
fn from(err: HttpDispatchError) -> CreateOTAUpdateError {
CreateOTAUpdateError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateOTAUpdateError {
fn from(err: io::Error) -> CreateOTAUpdateError {
CreateOTAUpdateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateOTAUpdateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateOTAUpdateError {
fn description(&self) -> &str {
match *self {
CreateOTAUpdateError::InternalFailure(ref cause) => cause,
CreateOTAUpdateError::InvalidRequest(ref cause) => cause,
CreateOTAUpdateError::ResourceAlreadyExists(ref cause) => cause,
CreateOTAUpdateError::ResourceNotFound(ref cause) => cause,
CreateOTAUpdateError::ServiceUnavailable(ref cause) => cause,
CreateOTAUpdateError::Throttling(ref cause) => cause,
CreateOTAUpdateError::Unauthorized(ref cause) => cause,
CreateOTAUpdateError::Validation(ref cause) => cause,
CreateOTAUpdateError::Credentials(ref err) => err.description(),
CreateOTAUpdateError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateOTAUpdateError::ParseError(ref cause) => cause,
CreateOTAUpdateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePolicyError {
InternalFailure(String),
InvalidRequest(String),
MalformedPolicy(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePolicyError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePolicyError {
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 CreatePolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreatePolicyError::InvalidRequest(String::from(error_message))
}
"MalformedPolicyException" => {
return CreatePolicyError::MalformedPolicy(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreatePolicyError::ResourceAlreadyExists(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreatePolicyError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreatePolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreatePolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreatePolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreatePolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreatePolicyError {
fn from(err: serde_json::error::Error) -> CreatePolicyError {
CreatePolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreatePolicyError {
fn from(err: CredentialsError) -> CreatePolicyError {
CreatePolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePolicyError {
fn from(err: HttpDispatchError) -> CreatePolicyError {
CreatePolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePolicyError {
fn from(err: io::Error) -> CreatePolicyError {
CreatePolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePolicyError {
fn description(&self) -> &str {
match *self {
CreatePolicyError::InternalFailure(ref cause) => cause,
CreatePolicyError::InvalidRequest(ref cause) => cause,
CreatePolicyError::MalformedPolicy(ref cause) => cause,
CreatePolicyError::ResourceAlreadyExists(ref cause) => cause,
CreatePolicyError::ServiceUnavailable(ref cause) => cause,
CreatePolicyError::Throttling(ref cause) => cause,
CreatePolicyError::Unauthorized(ref cause) => cause,
CreatePolicyError::Validation(ref cause) => cause,
CreatePolicyError::Credentials(ref err) => err.description(),
CreatePolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreatePolicyError::ParseError(ref cause) => cause,
CreatePolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePolicyVersionError {
InternalFailure(String),
InvalidRequest(String),
MalformedPolicy(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
VersionsLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePolicyVersionError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePolicyVersionError {
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 CreatePolicyVersionError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreatePolicyVersionError::InvalidRequest(String::from(error_message))
}
"MalformedPolicyException" => {
return CreatePolicyVersionError::MalformedPolicy(String::from(error_message))
}
"ResourceNotFoundException" => {
return CreatePolicyVersionError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreatePolicyVersionError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreatePolicyVersionError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreatePolicyVersionError::Unauthorized(String::from(error_message))
}
"VersionsLimitExceededException" => {
return CreatePolicyVersionError::VersionsLimitExceeded(String::from(
error_message,
))
}
"ValidationException" => {
return CreatePolicyVersionError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreatePolicyVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreatePolicyVersionError {
fn from(err: serde_json::error::Error) -> CreatePolicyVersionError {
CreatePolicyVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreatePolicyVersionError {
fn from(err: CredentialsError) -> CreatePolicyVersionError {
CreatePolicyVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePolicyVersionError {
fn from(err: HttpDispatchError) -> CreatePolicyVersionError {
CreatePolicyVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePolicyVersionError {
fn from(err: io::Error) -> CreatePolicyVersionError {
CreatePolicyVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePolicyVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePolicyVersionError {
fn description(&self) -> &str {
match *self {
CreatePolicyVersionError::InternalFailure(ref cause) => cause,
CreatePolicyVersionError::InvalidRequest(ref cause) => cause,
CreatePolicyVersionError::MalformedPolicy(ref cause) => cause,
CreatePolicyVersionError::ResourceNotFound(ref cause) => cause,
CreatePolicyVersionError::ServiceUnavailable(ref cause) => cause,
CreatePolicyVersionError::Throttling(ref cause) => cause,
CreatePolicyVersionError::Unauthorized(ref cause) => cause,
CreatePolicyVersionError::VersionsLimitExceeded(ref cause) => cause,
CreatePolicyVersionError::Validation(ref cause) => cause,
CreatePolicyVersionError::Credentials(ref err) => err.description(),
CreatePolicyVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreatePolicyVersionError::ParseError(ref cause) => cause,
CreatePolicyVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateRoleAliasError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateRoleAliasError {
pub fn from_response(res: BufferedHttpResponse) -> CreateRoleAliasError {
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 CreateRoleAliasError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateRoleAliasError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return CreateRoleAliasError::LimitExceeded(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateRoleAliasError::ResourceAlreadyExists(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateRoleAliasError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreateRoleAliasError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateRoleAliasError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateRoleAliasError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateRoleAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateRoleAliasError {
fn from(err: serde_json::error::Error) -> CreateRoleAliasError {
CreateRoleAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateRoleAliasError {
fn from(err: CredentialsError) -> CreateRoleAliasError {
CreateRoleAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateRoleAliasError {
fn from(err: HttpDispatchError) -> CreateRoleAliasError {
CreateRoleAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateRoleAliasError {
fn from(err: io::Error) -> CreateRoleAliasError {
CreateRoleAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateRoleAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateRoleAliasError {
fn description(&self) -> &str {
match *self {
CreateRoleAliasError::InternalFailure(ref cause) => cause,
CreateRoleAliasError::InvalidRequest(ref cause) => cause,
CreateRoleAliasError::LimitExceeded(ref cause) => cause,
CreateRoleAliasError::ResourceAlreadyExists(ref cause) => cause,
CreateRoleAliasError::ServiceUnavailable(ref cause) => cause,
CreateRoleAliasError::Throttling(ref cause) => cause,
CreateRoleAliasError::Unauthorized(ref cause) => cause,
CreateRoleAliasError::Validation(ref cause) => cause,
CreateRoleAliasError::Credentials(ref err) => err.description(),
CreateRoleAliasError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateRoleAliasError::ParseError(ref cause) => cause,
CreateRoleAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateScheduledAuditError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateScheduledAuditError {
pub fn from_response(res: BufferedHttpResponse) -> CreateScheduledAuditError {
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 CreateScheduledAuditError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateScheduledAuditError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return CreateScheduledAuditError::LimitExceeded(String::from(error_message))
}
"ThrottlingException" => {
return CreateScheduledAuditError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CreateScheduledAuditError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateScheduledAuditError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateScheduledAuditError {
fn from(err: serde_json::error::Error) -> CreateScheduledAuditError {
CreateScheduledAuditError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateScheduledAuditError {
fn from(err: CredentialsError) -> CreateScheduledAuditError {
CreateScheduledAuditError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateScheduledAuditError {
fn from(err: HttpDispatchError) -> CreateScheduledAuditError {
CreateScheduledAuditError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateScheduledAuditError {
fn from(err: io::Error) -> CreateScheduledAuditError {
CreateScheduledAuditError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateScheduledAuditError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateScheduledAuditError {
fn description(&self) -> &str {
match *self {
CreateScheduledAuditError::InternalFailure(ref cause) => cause,
CreateScheduledAuditError::InvalidRequest(ref cause) => cause,
CreateScheduledAuditError::LimitExceeded(ref cause) => cause,
CreateScheduledAuditError::Throttling(ref cause) => cause,
CreateScheduledAuditError::Validation(ref cause) => cause,
CreateScheduledAuditError::Credentials(ref err) => err.description(),
CreateScheduledAuditError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateScheduledAuditError::ParseError(ref cause) => cause,
CreateScheduledAuditError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSecurityProfileError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateSecurityProfileError {
pub fn from_response(res: BufferedHttpResponse) -> CreateSecurityProfileError {
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 CreateSecurityProfileError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateSecurityProfileError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateSecurityProfileError::ResourceAlreadyExists(String::from(
error_message,
))
}
"ThrottlingException" => {
return CreateSecurityProfileError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CreateSecurityProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateSecurityProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateSecurityProfileError {
fn from(err: serde_json::error::Error) -> CreateSecurityProfileError {
CreateSecurityProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateSecurityProfileError {
fn from(err: CredentialsError) -> CreateSecurityProfileError {
CreateSecurityProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateSecurityProfileError {
fn from(err: HttpDispatchError) -> CreateSecurityProfileError {
CreateSecurityProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateSecurityProfileError {
fn from(err: io::Error) -> CreateSecurityProfileError {
CreateSecurityProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateSecurityProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSecurityProfileError {
fn description(&self) -> &str {
match *self {
CreateSecurityProfileError::InternalFailure(ref cause) => cause,
CreateSecurityProfileError::InvalidRequest(ref cause) => cause,
CreateSecurityProfileError::ResourceAlreadyExists(ref cause) => cause,
CreateSecurityProfileError::Throttling(ref cause) => cause,
CreateSecurityProfileError::Validation(ref cause) => cause,
CreateSecurityProfileError::Credentials(ref err) => err.description(),
CreateSecurityProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateSecurityProfileError::ParseError(ref cause) => cause,
CreateSecurityProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateStreamError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateStreamError {
pub fn from_response(res: BufferedHttpResponse) -> CreateStreamError {
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 CreateStreamError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateStreamError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateStreamError::ResourceAlreadyExists(String::from(error_message))
}
"ResourceNotFoundException" => {
return CreateStreamError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateStreamError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreateStreamError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateStreamError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateStreamError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateStreamError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateStreamError {
fn from(err: serde_json::error::Error) -> CreateStreamError {
CreateStreamError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateStreamError {
fn from(err: CredentialsError) -> CreateStreamError {
CreateStreamError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateStreamError {
fn from(err: HttpDispatchError) -> CreateStreamError {
CreateStreamError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateStreamError {
fn from(err: io::Error) -> CreateStreamError {
CreateStreamError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateStreamError {
fn description(&self) -> &str {
match *self {
CreateStreamError::InternalFailure(ref cause) => cause,
CreateStreamError::InvalidRequest(ref cause) => cause,
CreateStreamError::ResourceAlreadyExists(ref cause) => cause,
CreateStreamError::ResourceNotFound(ref cause) => cause,
CreateStreamError::ServiceUnavailable(ref cause) => cause,
CreateStreamError::Throttling(ref cause) => cause,
CreateStreamError::Unauthorized(ref cause) => cause,
CreateStreamError::Validation(ref cause) => cause,
CreateStreamError::Credentials(ref err) => err.description(),
CreateStreamError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateStreamError::ParseError(ref cause) => cause,
CreateStreamError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateThingError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateThingError {
pub fn from_response(res: BufferedHttpResponse) -> CreateThingError {
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 CreateThingError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateThingError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateThingError::ResourceAlreadyExists(String::from(error_message))
}
"ResourceNotFoundException" => {
return CreateThingError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateThingError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreateThingError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateThingError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateThingError {
fn from(err: serde_json::error::Error) -> CreateThingError {
CreateThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateThingError {
fn from(err: CredentialsError) -> CreateThingError {
CreateThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateThingError {
fn from(err: HttpDispatchError) -> CreateThingError {
CreateThingError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateThingError {
fn from(err: io::Error) -> CreateThingError {
CreateThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateThingError {
fn description(&self) -> &str {
match *self {
CreateThingError::InternalFailure(ref cause) => cause,
CreateThingError::InvalidRequest(ref cause) => cause,
CreateThingError::ResourceAlreadyExists(ref cause) => cause,
CreateThingError::ResourceNotFound(ref cause) => cause,
CreateThingError::ServiceUnavailable(ref cause) => cause,
CreateThingError::Throttling(ref cause) => cause,
CreateThingError::Unauthorized(ref cause) => cause,
CreateThingError::Validation(ref cause) => cause,
CreateThingError::Credentials(ref err) => err.description(),
CreateThingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateThingError::ParseError(ref cause) => cause,
CreateThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateThingGroupError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateThingGroupError {
pub fn from_response(res: BufferedHttpResponse) -> CreateThingGroupError {
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 CreateThingGroupError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateThingGroupError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateThingGroupError::ResourceAlreadyExists(String::from(error_message))
}
"ThrottlingException" => {
return CreateThingGroupError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CreateThingGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateThingGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateThingGroupError {
fn from(err: serde_json::error::Error) -> CreateThingGroupError {
CreateThingGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateThingGroupError {
fn from(err: CredentialsError) -> CreateThingGroupError {
CreateThingGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateThingGroupError {
fn from(err: HttpDispatchError) -> CreateThingGroupError {
CreateThingGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateThingGroupError {
fn from(err: io::Error) -> CreateThingGroupError {
CreateThingGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateThingGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateThingGroupError {
fn description(&self) -> &str {
match *self {
CreateThingGroupError::InternalFailure(ref cause) => cause,
CreateThingGroupError::InvalidRequest(ref cause) => cause,
CreateThingGroupError::ResourceAlreadyExists(ref cause) => cause,
CreateThingGroupError::Throttling(ref cause) => cause,
CreateThingGroupError::Validation(ref cause) => cause,
CreateThingGroupError::Credentials(ref err) => err.description(),
CreateThingGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateThingGroupError::ParseError(ref cause) => cause,
CreateThingGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateThingTypeError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateThingTypeError {
pub fn from_response(res: BufferedHttpResponse) -> CreateThingTypeError {
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 CreateThingTypeError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return CreateThingTypeError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateThingTypeError::ResourceAlreadyExists(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateThingTypeError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return CreateThingTypeError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return CreateThingTypeError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return CreateThingTypeError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateThingTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateThingTypeError {
fn from(err: serde_json::error::Error) -> CreateThingTypeError {
CreateThingTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateThingTypeError {
fn from(err: CredentialsError) -> CreateThingTypeError {
CreateThingTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateThingTypeError {
fn from(err: HttpDispatchError) -> CreateThingTypeError {
CreateThingTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateThingTypeError {
fn from(err: io::Error) -> CreateThingTypeError {
CreateThingTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateThingTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateThingTypeError {
fn description(&self) -> &str {
match *self {
CreateThingTypeError::InternalFailure(ref cause) => cause,
CreateThingTypeError::InvalidRequest(ref cause) => cause,
CreateThingTypeError::ResourceAlreadyExists(ref cause) => cause,
CreateThingTypeError::ServiceUnavailable(ref cause) => cause,
CreateThingTypeError::Throttling(ref cause) => cause,
CreateThingTypeError::Unauthorized(ref cause) => cause,
CreateThingTypeError::Validation(ref cause) => cause,
CreateThingTypeError::Credentials(ref err) => err.description(),
CreateThingTypeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateThingTypeError::ParseError(ref cause) => cause,
CreateThingTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateTopicRuleError {
Internal(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
SqlParse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateTopicRuleError {
pub fn from_response(res: BufferedHttpResponse) -> CreateTopicRuleError {
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 {
"InternalException" => {
return CreateTopicRuleError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return CreateTopicRuleError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return CreateTopicRuleError::ResourceAlreadyExists(String::from(error_message))
}
"ServiceUnavailableException" => {
return CreateTopicRuleError::ServiceUnavailable(String::from(error_message))
}
"SqlParseException" => {
return CreateTopicRuleError::SqlParse(String::from(error_message))
}
"ValidationException" => {
return CreateTopicRuleError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateTopicRuleError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateTopicRuleError {
fn from(err: serde_json::error::Error) -> CreateTopicRuleError {
CreateTopicRuleError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateTopicRuleError {
fn from(err: CredentialsError) -> CreateTopicRuleError {
CreateTopicRuleError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateTopicRuleError {
fn from(err: HttpDispatchError) -> CreateTopicRuleError {
CreateTopicRuleError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateTopicRuleError {
fn from(err: io::Error) -> CreateTopicRuleError {
CreateTopicRuleError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateTopicRuleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateTopicRuleError {
fn description(&self) -> &str {
match *self {
CreateTopicRuleError::Internal(ref cause) => cause,
CreateTopicRuleError::InvalidRequest(ref cause) => cause,
CreateTopicRuleError::ResourceAlreadyExists(ref cause) => cause,
CreateTopicRuleError::ServiceUnavailable(ref cause) => cause,
CreateTopicRuleError::SqlParse(ref cause) => cause,
CreateTopicRuleError::Validation(ref cause) => cause,
CreateTopicRuleError::Credentials(ref err) => err.description(),
CreateTopicRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateTopicRuleError::ParseError(ref cause) => cause,
CreateTopicRuleError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteAccountAuditConfigurationError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteAccountAuditConfigurationError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteAccountAuditConfigurationError {
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 DeleteAccountAuditConfigurationError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return DeleteAccountAuditConfigurationError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return DeleteAccountAuditConfigurationError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return DeleteAccountAuditConfigurationError::Throttling(String::from(
error_message,
))
}
"ValidationException" => {
return DeleteAccountAuditConfigurationError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return DeleteAccountAuditConfigurationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteAccountAuditConfigurationError {
fn from(err: serde_json::error::Error) -> DeleteAccountAuditConfigurationError {
DeleteAccountAuditConfigurationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteAccountAuditConfigurationError {
fn from(err: CredentialsError) -> DeleteAccountAuditConfigurationError {
DeleteAccountAuditConfigurationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteAccountAuditConfigurationError {
fn from(err: HttpDispatchError) -> DeleteAccountAuditConfigurationError {
DeleteAccountAuditConfigurationError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteAccountAuditConfigurationError {
fn from(err: io::Error) -> DeleteAccountAuditConfigurationError {
DeleteAccountAuditConfigurationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteAccountAuditConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteAccountAuditConfigurationError {
fn description(&self) -> &str {
match *self {
DeleteAccountAuditConfigurationError::InternalFailure(ref cause) => cause,
DeleteAccountAuditConfigurationError::InvalidRequest(ref cause) => cause,
DeleteAccountAuditConfigurationError::ResourceNotFound(ref cause) => cause,
DeleteAccountAuditConfigurationError::Throttling(ref cause) => cause,
DeleteAccountAuditConfigurationError::Validation(ref cause) => cause,
DeleteAccountAuditConfigurationError::Credentials(ref err) => err.description(),
DeleteAccountAuditConfigurationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteAccountAuditConfigurationError::ParseError(ref cause) => cause,
DeleteAccountAuditConfigurationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteAuthorizerError {
DeleteConflict(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteAuthorizerError {
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 {
"DeleteConflictException" => {
return DeleteAuthorizerError::DeleteConflict(String::from(error_message))
}
"InternalFailureException" => {
return DeleteAuthorizerError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteAuthorizerError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteAuthorizerError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteAuthorizerError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteAuthorizerError {
fn from(err: serde_json::error::Error) -> DeleteAuthorizerError {
DeleteAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteAuthorizerError {
fn from(err: CredentialsError) -> DeleteAuthorizerError {
DeleteAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteAuthorizerError {
fn from(err: HttpDispatchError) -> DeleteAuthorizerError {
DeleteAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteAuthorizerError {
fn from(err: io::Error) -> DeleteAuthorizerError {
DeleteAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteAuthorizerError {
fn description(&self) -> &str {
match *self {
DeleteAuthorizerError::DeleteConflict(ref cause) => cause,
DeleteAuthorizerError::InternalFailure(ref cause) => cause,
DeleteAuthorizerError::InvalidRequest(ref cause) => cause,
DeleteAuthorizerError::ResourceNotFound(ref cause) => cause,
DeleteAuthorizerError::ServiceUnavailable(ref cause) => cause,
DeleteAuthorizerError::Throttling(ref cause) => cause,
DeleteAuthorizerError::Unauthorized(ref cause) => cause,
DeleteAuthorizerError::Validation(ref cause) => cause,
DeleteAuthorizerError::Credentials(ref err) => err.description(),
DeleteAuthorizerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteAuthorizerError::ParseError(ref cause) => cause,
DeleteAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteCACertificateError {
CertificateState(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteCACertificateError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteCACertificateError {
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 {
"CertificateStateException" => {
return DeleteCACertificateError::CertificateState(String::from(error_message))
}
"InternalFailureException" => {
return DeleteCACertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteCACertificateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteCACertificateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteCACertificateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteCACertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteCACertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteCACertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteCACertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteCACertificateError {
fn from(err: serde_json::error::Error) -> DeleteCACertificateError {
DeleteCACertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteCACertificateError {
fn from(err: CredentialsError) -> DeleteCACertificateError {
DeleteCACertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteCACertificateError {
fn from(err: HttpDispatchError) -> DeleteCACertificateError {
DeleteCACertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteCACertificateError {
fn from(err: io::Error) -> DeleteCACertificateError {
DeleteCACertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteCACertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteCACertificateError {
fn description(&self) -> &str {
match *self {
DeleteCACertificateError::CertificateState(ref cause) => cause,
DeleteCACertificateError::InternalFailure(ref cause) => cause,
DeleteCACertificateError::InvalidRequest(ref cause) => cause,
DeleteCACertificateError::ResourceNotFound(ref cause) => cause,
DeleteCACertificateError::ServiceUnavailable(ref cause) => cause,
DeleteCACertificateError::Throttling(ref cause) => cause,
DeleteCACertificateError::Unauthorized(ref cause) => cause,
DeleteCACertificateError::Validation(ref cause) => cause,
DeleteCACertificateError::Credentials(ref err) => err.description(),
DeleteCACertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteCACertificateError::ParseError(ref cause) => cause,
DeleteCACertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteCertificateError {
CertificateState(String),
DeleteConflict(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteCertificateError {
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 {
"CertificateStateException" => {
return DeleteCertificateError::CertificateState(String::from(error_message))
}
"DeleteConflictException" => {
return DeleteCertificateError::DeleteConflict(String::from(error_message))
}
"InternalFailureException" => {
return DeleteCertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteCertificateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteCertificateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteCertificateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteCertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteCertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteCertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteCertificateError {
fn from(err: serde_json::error::Error) -> DeleteCertificateError {
DeleteCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteCertificateError {
fn from(err: CredentialsError) -> DeleteCertificateError {
DeleteCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteCertificateError {
fn from(err: HttpDispatchError) -> DeleteCertificateError {
DeleteCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteCertificateError {
fn from(err: io::Error) -> DeleteCertificateError {
DeleteCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteCertificateError {
fn description(&self) -> &str {
match *self {
DeleteCertificateError::CertificateState(ref cause) => cause,
DeleteCertificateError::DeleteConflict(ref cause) => cause,
DeleteCertificateError::InternalFailure(ref cause) => cause,
DeleteCertificateError::InvalidRequest(ref cause) => cause,
DeleteCertificateError::ResourceNotFound(ref cause) => cause,
DeleteCertificateError::ServiceUnavailable(ref cause) => cause,
DeleteCertificateError::Throttling(ref cause) => cause,
DeleteCertificateError::Unauthorized(ref cause) => cause,
DeleteCertificateError::Validation(ref cause) => cause,
DeleteCertificateError::Credentials(ref err) => err.description(),
DeleteCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteCertificateError::ParseError(ref cause) => cause,
DeleteCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteJobError {
InvalidRequest(String),
InvalidStateTransition(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteJobError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteJobError {
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 {
"InvalidRequestException" => {
return DeleteJobError::InvalidRequest(String::from(error_message))
}
"InvalidStateTransitionException" => {
return DeleteJobError::InvalidStateTransition(String::from(error_message))
}
"LimitExceededException" => {
return DeleteJobError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteJobError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteJobError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteJobError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DeleteJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteJobError {
fn from(err: serde_json::error::Error) -> DeleteJobError {
DeleteJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteJobError {
fn from(err: CredentialsError) -> DeleteJobError {
DeleteJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteJobError {
fn from(err: HttpDispatchError) -> DeleteJobError {
DeleteJobError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteJobError {
fn from(err: io::Error) -> DeleteJobError {
DeleteJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteJobError {
fn description(&self) -> &str {
match *self {
DeleteJobError::InvalidRequest(ref cause) => cause,
DeleteJobError::InvalidStateTransition(ref cause) => cause,
DeleteJobError::LimitExceeded(ref cause) => cause,
DeleteJobError::ResourceNotFound(ref cause) => cause,
DeleteJobError::ServiceUnavailable(ref cause) => cause,
DeleteJobError::Throttling(ref cause) => cause,
DeleteJobError::Validation(ref cause) => cause,
DeleteJobError::Credentials(ref err) => err.description(),
DeleteJobError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteJobError::ParseError(ref cause) => cause,
DeleteJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteJobExecutionError {
InvalidRequest(String),
InvalidStateTransition(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteJobExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteJobExecutionError {
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 {
"InvalidRequestException" => {
return DeleteJobExecutionError::InvalidRequest(String::from(error_message))
}
"InvalidStateTransitionException" => {
return DeleteJobExecutionError::InvalidStateTransition(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return DeleteJobExecutionError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteJobExecutionError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteJobExecutionError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DeleteJobExecutionError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteJobExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteJobExecutionError {
fn from(err: serde_json::error::Error) -> DeleteJobExecutionError {
DeleteJobExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteJobExecutionError {
fn from(err: CredentialsError) -> DeleteJobExecutionError {
DeleteJobExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteJobExecutionError {
fn from(err: HttpDispatchError) -> DeleteJobExecutionError {
DeleteJobExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteJobExecutionError {
fn from(err: io::Error) -> DeleteJobExecutionError {
DeleteJobExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteJobExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteJobExecutionError {
fn description(&self) -> &str {
match *self {
DeleteJobExecutionError::InvalidRequest(ref cause) => cause,
DeleteJobExecutionError::InvalidStateTransition(ref cause) => cause,
DeleteJobExecutionError::ResourceNotFound(ref cause) => cause,
DeleteJobExecutionError::ServiceUnavailable(ref cause) => cause,
DeleteJobExecutionError::Throttling(ref cause) => cause,
DeleteJobExecutionError::Validation(ref cause) => cause,
DeleteJobExecutionError::Credentials(ref err) => err.description(),
DeleteJobExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteJobExecutionError::ParseError(ref cause) => cause,
DeleteJobExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteOTAUpdateError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteOTAUpdateError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteOTAUpdateError {
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 DeleteOTAUpdateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteOTAUpdateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteOTAUpdateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteOTAUpdateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteOTAUpdateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteOTAUpdateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteOTAUpdateError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteOTAUpdateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteOTAUpdateError {
fn from(err: serde_json::error::Error) -> DeleteOTAUpdateError {
DeleteOTAUpdateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteOTAUpdateError {
fn from(err: CredentialsError) -> DeleteOTAUpdateError {
DeleteOTAUpdateError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteOTAUpdateError {
fn from(err: HttpDispatchError) -> DeleteOTAUpdateError {
DeleteOTAUpdateError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteOTAUpdateError {
fn from(err: io::Error) -> DeleteOTAUpdateError {
DeleteOTAUpdateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteOTAUpdateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteOTAUpdateError {
fn description(&self) -> &str {
match *self {
DeleteOTAUpdateError::InternalFailure(ref cause) => cause,
DeleteOTAUpdateError::InvalidRequest(ref cause) => cause,
DeleteOTAUpdateError::ResourceNotFound(ref cause) => cause,
DeleteOTAUpdateError::ServiceUnavailable(ref cause) => cause,
DeleteOTAUpdateError::Throttling(ref cause) => cause,
DeleteOTAUpdateError::Unauthorized(ref cause) => cause,
DeleteOTAUpdateError::Validation(ref cause) => cause,
DeleteOTAUpdateError::Credentials(ref err) => err.description(),
DeleteOTAUpdateError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteOTAUpdateError::ParseError(ref cause) => cause,
DeleteOTAUpdateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeletePolicyError {
DeleteConflict(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeletePolicyError {
pub fn from_response(res: BufferedHttpResponse) -> DeletePolicyError {
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 {
"DeleteConflictException" => {
return DeletePolicyError::DeleteConflict(String::from(error_message))
}
"InternalFailureException" => {
return DeletePolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeletePolicyError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeletePolicyError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeletePolicyError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeletePolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeletePolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeletePolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeletePolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeletePolicyError {
fn from(err: serde_json::error::Error) -> DeletePolicyError {
DeletePolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeletePolicyError {
fn from(err: CredentialsError) -> DeletePolicyError {
DeletePolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeletePolicyError {
fn from(err: HttpDispatchError) -> DeletePolicyError {
DeletePolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for DeletePolicyError {
fn from(err: io::Error) -> DeletePolicyError {
DeletePolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeletePolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeletePolicyError {
fn description(&self) -> &str {
match *self {
DeletePolicyError::DeleteConflict(ref cause) => cause,
DeletePolicyError::InternalFailure(ref cause) => cause,
DeletePolicyError::InvalidRequest(ref cause) => cause,
DeletePolicyError::ResourceNotFound(ref cause) => cause,
DeletePolicyError::ServiceUnavailable(ref cause) => cause,
DeletePolicyError::Throttling(ref cause) => cause,
DeletePolicyError::Unauthorized(ref cause) => cause,
DeletePolicyError::Validation(ref cause) => cause,
DeletePolicyError::Credentials(ref err) => err.description(),
DeletePolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeletePolicyError::ParseError(ref cause) => cause,
DeletePolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeletePolicyVersionError {
DeleteConflict(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeletePolicyVersionError {
pub fn from_response(res: BufferedHttpResponse) -> DeletePolicyVersionError {
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 {
"DeleteConflictException" => {
return DeletePolicyVersionError::DeleteConflict(String::from(error_message))
}
"InternalFailureException" => {
return DeletePolicyVersionError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeletePolicyVersionError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeletePolicyVersionError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeletePolicyVersionError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeletePolicyVersionError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeletePolicyVersionError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeletePolicyVersionError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeletePolicyVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeletePolicyVersionError {
fn from(err: serde_json::error::Error) -> DeletePolicyVersionError {
DeletePolicyVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeletePolicyVersionError {
fn from(err: CredentialsError) -> DeletePolicyVersionError {
DeletePolicyVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeletePolicyVersionError {
fn from(err: HttpDispatchError) -> DeletePolicyVersionError {
DeletePolicyVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeletePolicyVersionError {
fn from(err: io::Error) -> DeletePolicyVersionError {
DeletePolicyVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeletePolicyVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeletePolicyVersionError {
fn description(&self) -> &str {
match *self {
DeletePolicyVersionError::DeleteConflict(ref cause) => cause,
DeletePolicyVersionError::InternalFailure(ref cause) => cause,
DeletePolicyVersionError::InvalidRequest(ref cause) => cause,
DeletePolicyVersionError::ResourceNotFound(ref cause) => cause,
DeletePolicyVersionError::ServiceUnavailable(ref cause) => cause,
DeletePolicyVersionError::Throttling(ref cause) => cause,
DeletePolicyVersionError::Unauthorized(ref cause) => cause,
DeletePolicyVersionError::Validation(ref cause) => cause,
DeletePolicyVersionError::Credentials(ref err) => err.description(),
DeletePolicyVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeletePolicyVersionError::ParseError(ref cause) => cause,
DeletePolicyVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRegistrationCodeError {
InternalFailure(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRegistrationCodeError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRegistrationCodeError {
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 DeleteRegistrationCodeError::InternalFailure(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteRegistrationCodeError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return DeleteRegistrationCodeError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return DeleteRegistrationCodeError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteRegistrationCodeError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteRegistrationCodeError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteRegistrationCodeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRegistrationCodeError {
fn from(err: serde_json::error::Error) -> DeleteRegistrationCodeError {
DeleteRegistrationCodeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRegistrationCodeError {
fn from(err: CredentialsError) -> DeleteRegistrationCodeError {
DeleteRegistrationCodeError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRegistrationCodeError {
fn from(err: HttpDispatchError) -> DeleteRegistrationCodeError {
DeleteRegistrationCodeError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRegistrationCodeError {
fn from(err: io::Error) -> DeleteRegistrationCodeError {
DeleteRegistrationCodeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRegistrationCodeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRegistrationCodeError {
fn description(&self) -> &str {
match *self {
DeleteRegistrationCodeError::InternalFailure(ref cause) => cause,
DeleteRegistrationCodeError::ResourceNotFound(ref cause) => cause,
DeleteRegistrationCodeError::ServiceUnavailable(ref cause) => cause,
DeleteRegistrationCodeError::Throttling(ref cause) => cause,
DeleteRegistrationCodeError::Unauthorized(ref cause) => cause,
DeleteRegistrationCodeError::Validation(ref cause) => cause,
DeleteRegistrationCodeError::Credentials(ref err) => err.description(),
DeleteRegistrationCodeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteRegistrationCodeError::ParseError(ref cause) => cause,
DeleteRegistrationCodeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRoleAliasError {
DeleteConflict(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRoleAliasError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRoleAliasError {
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 {
"DeleteConflictException" => {
return DeleteRoleAliasError::DeleteConflict(String::from(error_message))
}
"InternalFailureException" => {
return DeleteRoleAliasError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteRoleAliasError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteRoleAliasError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteRoleAliasError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteRoleAliasError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteRoleAliasError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteRoleAliasError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteRoleAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRoleAliasError {
fn from(err: serde_json::error::Error) -> DeleteRoleAliasError {
DeleteRoleAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRoleAliasError {
fn from(err: CredentialsError) -> DeleteRoleAliasError {
DeleteRoleAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRoleAliasError {
fn from(err: HttpDispatchError) -> DeleteRoleAliasError {
DeleteRoleAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRoleAliasError {
fn from(err: io::Error) -> DeleteRoleAliasError {
DeleteRoleAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRoleAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRoleAliasError {
fn description(&self) -> &str {
match *self {
DeleteRoleAliasError::DeleteConflict(ref cause) => cause,
DeleteRoleAliasError::InternalFailure(ref cause) => cause,
DeleteRoleAliasError::InvalidRequest(ref cause) => cause,
DeleteRoleAliasError::ResourceNotFound(ref cause) => cause,
DeleteRoleAliasError::ServiceUnavailable(ref cause) => cause,
DeleteRoleAliasError::Throttling(ref cause) => cause,
DeleteRoleAliasError::Unauthorized(ref cause) => cause,
DeleteRoleAliasError::Validation(ref cause) => cause,
DeleteRoleAliasError::Credentials(ref err) => err.description(),
DeleteRoleAliasError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteRoleAliasError::ParseError(ref cause) => cause,
DeleteRoleAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteScheduledAuditError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteScheduledAuditError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteScheduledAuditError {
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 DeleteScheduledAuditError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteScheduledAuditError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteScheduledAuditError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return DeleteScheduledAuditError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DeleteScheduledAuditError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteScheduledAuditError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteScheduledAuditError {
fn from(err: serde_json::error::Error) -> DeleteScheduledAuditError {
DeleteScheduledAuditError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteScheduledAuditError {
fn from(err: CredentialsError) -> DeleteScheduledAuditError {
DeleteScheduledAuditError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteScheduledAuditError {
fn from(err: HttpDispatchError) -> DeleteScheduledAuditError {
DeleteScheduledAuditError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteScheduledAuditError {
fn from(err: io::Error) -> DeleteScheduledAuditError {
DeleteScheduledAuditError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteScheduledAuditError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteScheduledAuditError {
fn description(&self) -> &str {
match *self {
DeleteScheduledAuditError::InternalFailure(ref cause) => cause,
DeleteScheduledAuditError::InvalidRequest(ref cause) => cause,
DeleteScheduledAuditError::ResourceNotFound(ref cause) => cause,
DeleteScheduledAuditError::Throttling(ref cause) => cause,
DeleteScheduledAuditError::Validation(ref cause) => cause,
DeleteScheduledAuditError::Credentials(ref err) => err.description(),
DeleteScheduledAuditError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteScheduledAuditError::ParseError(ref cause) => cause,
DeleteScheduledAuditError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSecurityProfileError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSecurityProfileError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSecurityProfileError {
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 DeleteSecurityProfileError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteSecurityProfileError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return DeleteSecurityProfileError::Throttling(String::from(error_message))
}
"VersionConflictException" => {
return DeleteSecurityProfileError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return DeleteSecurityProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteSecurityProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSecurityProfileError {
fn from(err: serde_json::error::Error) -> DeleteSecurityProfileError {
DeleteSecurityProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSecurityProfileError {
fn from(err: CredentialsError) -> DeleteSecurityProfileError {
DeleteSecurityProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSecurityProfileError {
fn from(err: HttpDispatchError) -> DeleteSecurityProfileError {
DeleteSecurityProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSecurityProfileError {
fn from(err: io::Error) -> DeleteSecurityProfileError {
DeleteSecurityProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSecurityProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSecurityProfileError {
fn description(&self) -> &str {
match *self {
DeleteSecurityProfileError::InternalFailure(ref cause) => cause,
DeleteSecurityProfileError::InvalidRequest(ref cause) => cause,
DeleteSecurityProfileError::Throttling(ref cause) => cause,
DeleteSecurityProfileError::VersionConflict(ref cause) => cause,
DeleteSecurityProfileError::Validation(ref cause) => cause,
DeleteSecurityProfileError::Credentials(ref err) => err.description(),
DeleteSecurityProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteSecurityProfileError::ParseError(ref cause) => cause,
DeleteSecurityProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteStreamError {
DeleteConflict(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteStreamError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteStreamError {
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 {
"DeleteConflictException" => {
return DeleteStreamError::DeleteConflict(String::from(error_message))
}
"InternalFailureException" => {
return DeleteStreamError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteStreamError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteStreamError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteStreamError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteStreamError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteStreamError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteStreamError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteStreamError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteStreamError {
fn from(err: serde_json::error::Error) -> DeleteStreamError {
DeleteStreamError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteStreamError {
fn from(err: CredentialsError) -> DeleteStreamError {
DeleteStreamError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteStreamError {
fn from(err: HttpDispatchError) -> DeleteStreamError {
DeleteStreamError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteStreamError {
fn from(err: io::Error) -> DeleteStreamError {
DeleteStreamError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteStreamError {
fn description(&self) -> &str {
match *self {
DeleteStreamError::DeleteConflict(ref cause) => cause,
DeleteStreamError::InternalFailure(ref cause) => cause,
DeleteStreamError::InvalidRequest(ref cause) => cause,
DeleteStreamError::ResourceNotFound(ref cause) => cause,
DeleteStreamError::ServiceUnavailable(ref cause) => cause,
DeleteStreamError::Throttling(ref cause) => cause,
DeleteStreamError::Unauthorized(ref cause) => cause,
DeleteStreamError::Validation(ref cause) => cause,
DeleteStreamError::Credentials(ref err) => err.description(),
DeleteStreamError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteStreamError::ParseError(ref cause) => cause,
DeleteStreamError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteThingError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteThingError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteThingError {
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 DeleteThingError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteThingError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteThingError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteThingError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteThingError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteThingError::Unauthorized(String::from(error_message))
}
"VersionConflictException" => {
return DeleteThingError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return DeleteThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteThingError {
fn from(err: serde_json::error::Error) -> DeleteThingError {
DeleteThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteThingError {
fn from(err: CredentialsError) -> DeleteThingError {
DeleteThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteThingError {
fn from(err: HttpDispatchError) -> DeleteThingError {
DeleteThingError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteThingError {
fn from(err: io::Error) -> DeleteThingError {
DeleteThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteThingError {
fn description(&self) -> &str {
match *self {
DeleteThingError::InternalFailure(ref cause) => cause,
DeleteThingError::InvalidRequest(ref cause) => cause,
DeleteThingError::ResourceNotFound(ref cause) => cause,
DeleteThingError::ServiceUnavailable(ref cause) => cause,
DeleteThingError::Throttling(ref cause) => cause,
DeleteThingError::Unauthorized(ref cause) => cause,
DeleteThingError::VersionConflict(ref cause) => cause,
DeleteThingError::Validation(ref cause) => cause,
DeleteThingError::Credentials(ref err) => err.description(),
DeleteThingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteThingError::ParseError(ref cause) => cause,
DeleteThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteThingGroupError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteThingGroupError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteThingGroupError {
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 DeleteThingGroupError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteThingGroupError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return DeleteThingGroupError::Throttling(String::from(error_message))
}
"VersionConflictException" => {
return DeleteThingGroupError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return DeleteThingGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteThingGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteThingGroupError {
fn from(err: serde_json::error::Error) -> DeleteThingGroupError {
DeleteThingGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteThingGroupError {
fn from(err: CredentialsError) -> DeleteThingGroupError {
DeleteThingGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteThingGroupError {
fn from(err: HttpDispatchError) -> DeleteThingGroupError {
DeleteThingGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteThingGroupError {
fn from(err: io::Error) -> DeleteThingGroupError {
DeleteThingGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteThingGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteThingGroupError {
fn description(&self) -> &str {
match *self {
DeleteThingGroupError::InternalFailure(ref cause) => cause,
DeleteThingGroupError::InvalidRequest(ref cause) => cause,
DeleteThingGroupError::Throttling(ref cause) => cause,
DeleteThingGroupError::VersionConflict(ref cause) => cause,
DeleteThingGroupError::Validation(ref cause) => cause,
DeleteThingGroupError::Credentials(ref err) => err.description(),
DeleteThingGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteThingGroupError::ParseError(ref cause) => cause,
DeleteThingGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteThingTypeError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteThingTypeError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteThingTypeError {
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 DeleteThingTypeError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteThingTypeError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteThingTypeError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteThingTypeError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeleteThingTypeError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteThingTypeError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteThingTypeError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteThingTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteThingTypeError {
fn from(err: serde_json::error::Error) -> DeleteThingTypeError {
DeleteThingTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteThingTypeError {
fn from(err: CredentialsError) -> DeleteThingTypeError {
DeleteThingTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteThingTypeError {
fn from(err: HttpDispatchError) -> DeleteThingTypeError {
DeleteThingTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteThingTypeError {
fn from(err: io::Error) -> DeleteThingTypeError {
DeleteThingTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteThingTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteThingTypeError {
fn description(&self) -> &str {
match *self {
DeleteThingTypeError::InternalFailure(ref cause) => cause,
DeleteThingTypeError::InvalidRequest(ref cause) => cause,
DeleteThingTypeError::ResourceNotFound(ref cause) => cause,
DeleteThingTypeError::ServiceUnavailable(ref cause) => cause,
DeleteThingTypeError::Throttling(ref cause) => cause,
DeleteThingTypeError::Unauthorized(ref cause) => cause,
DeleteThingTypeError::Validation(ref cause) => cause,
DeleteThingTypeError::Credentials(ref err) => err.description(),
DeleteThingTypeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteThingTypeError::ParseError(ref cause) => cause,
DeleteThingTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteTopicRuleError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteTopicRuleError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteTopicRuleError {
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 {
"InternalException" => {
return DeleteTopicRuleError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteTopicRuleError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteTopicRuleError::ServiceUnavailable(String::from(error_message))
}
"UnauthorizedException" => {
return DeleteTopicRuleError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeleteTopicRuleError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteTopicRuleError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteTopicRuleError {
fn from(err: serde_json::error::Error) -> DeleteTopicRuleError {
DeleteTopicRuleError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteTopicRuleError {
fn from(err: CredentialsError) -> DeleteTopicRuleError {
DeleteTopicRuleError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteTopicRuleError {
fn from(err: HttpDispatchError) -> DeleteTopicRuleError {
DeleteTopicRuleError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteTopicRuleError {
fn from(err: io::Error) -> DeleteTopicRuleError {
DeleteTopicRuleError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteTopicRuleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteTopicRuleError {
fn description(&self) -> &str {
match *self {
DeleteTopicRuleError::Internal(ref cause) => cause,
DeleteTopicRuleError::InvalidRequest(ref cause) => cause,
DeleteTopicRuleError::ServiceUnavailable(ref cause) => cause,
DeleteTopicRuleError::Unauthorized(ref cause) => cause,
DeleteTopicRuleError::Validation(ref cause) => cause,
DeleteTopicRuleError::Credentials(ref err) => err.description(),
DeleteTopicRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteTopicRuleError::ParseError(ref cause) => cause,
DeleteTopicRuleError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteV2LoggingLevelError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteV2LoggingLevelError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteV2LoggingLevelError {
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 {
"InternalException" => {
return DeleteV2LoggingLevelError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return DeleteV2LoggingLevelError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeleteV2LoggingLevelError::ServiceUnavailable(String::from(
error_message,
))
}
"ValidationException" => {
return DeleteV2LoggingLevelError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteV2LoggingLevelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteV2LoggingLevelError {
fn from(err: serde_json::error::Error) -> DeleteV2LoggingLevelError {
DeleteV2LoggingLevelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteV2LoggingLevelError {
fn from(err: CredentialsError) -> DeleteV2LoggingLevelError {
DeleteV2LoggingLevelError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteV2LoggingLevelError {
fn from(err: HttpDispatchError) -> DeleteV2LoggingLevelError {
DeleteV2LoggingLevelError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteV2LoggingLevelError {
fn from(err: io::Error) -> DeleteV2LoggingLevelError {
DeleteV2LoggingLevelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteV2LoggingLevelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteV2LoggingLevelError {
fn description(&self) -> &str {
match *self {
DeleteV2LoggingLevelError::Internal(ref cause) => cause,
DeleteV2LoggingLevelError::InvalidRequest(ref cause) => cause,
DeleteV2LoggingLevelError::ServiceUnavailable(ref cause) => cause,
DeleteV2LoggingLevelError::Validation(ref cause) => cause,
DeleteV2LoggingLevelError::Credentials(ref err) => err.description(),
DeleteV2LoggingLevelError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteV2LoggingLevelError::ParseError(ref cause) => cause,
DeleteV2LoggingLevelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeprecateThingTypeError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeprecateThingTypeError {
pub fn from_response(res: BufferedHttpResponse) -> DeprecateThingTypeError {
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 DeprecateThingTypeError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DeprecateThingTypeError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeprecateThingTypeError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DeprecateThingTypeError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DeprecateThingTypeError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DeprecateThingTypeError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DeprecateThingTypeError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeprecateThingTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeprecateThingTypeError {
fn from(err: serde_json::error::Error) -> DeprecateThingTypeError {
DeprecateThingTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeprecateThingTypeError {
fn from(err: CredentialsError) -> DeprecateThingTypeError {
DeprecateThingTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeprecateThingTypeError {
fn from(err: HttpDispatchError) -> DeprecateThingTypeError {
DeprecateThingTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for DeprecateThingTypeError {
fn from(err: io::Error) -> DeprecateThingTypeError {
DeprecateThingTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeprecateThingTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeprecateThingTypeError {
fn description(&self) -> &str {
match *self {
DeprecateThingTypeError::InternalFailure(ref cause) => cause,
DeprecateThingTypeError::InvalidRequest(ref cause) => cause,
DeprecateThingTypeError::ResourceNotFound(ref cause) => cause,
DeprecateThingTypeError::ServiceUnavailable(ref cause) => cause,
DeprecateThingTypeError::Throttling(ref cause) => cause,
DeprecateThingTypeError::Unauthorized(ref cause) => cause,
DeprecateThingTypeError::Validation(ref cause) => cause,
DeprecateThingTypeError::Credentials(ref err) => err.description(),
DeprecateThingTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeprecateThingTypeError::ParseError(ref cause) => cause,
DeprecateThingTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeAccountAuditConfigurationError {
InternalFailure(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeAccountAuditConfigurationError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeAccountAuditConfigurationError {
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 DescribeAccountAuditConfigurationError::InternalFailure(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeAccountAuditConfigurationError::Throttling(String::from(
error_message,
))
}
"ValidationException" => {
return DescribeAccountAuditConfigurationError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return DescribeAccountAuditConfigurationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeAccountAuditConfigurationError {
fn from(err: serde_json::error::Error) -> DescribeAccountAuditConfigurationError {
DescribeAccountAuditConfigurationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeAccountAuditConfigurationError {
fn from(err: CredentialsError) -> DescribeAccountAuditConfigurationError {
DescribeAccountAuditConfigurationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeAccountAuditConfigurationError {
fn from(err: HttpDispatchError) -> DescribeAccountAuditConfigurationError {
DescribeAccountAuditConfigurationError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeAccountAuditConfigurationError {
fn from(err: io::Error) -> DescribeAccountAuditConfigurationError {
DescribeAccountAuditConfigurationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeAccountAuditConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeAccountAuditConfigurationError {
fn description(&self) -> &str {
match *self {
DescribeAccountAuditConfigurationError::InternalFailure(ref cause) => cause,
DescribeAccountAuditConfigurationError::Throttling(ref cause) => cause,
DescribeAccountAuditConfigurationError::Validation(ref cause) => cause,
DescribeAccountAuditConfigurationError::Credentials(ref err) => err.description(),
DescribeAccountAuditConfigurationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeAccountAuditConfigurationError::ParseError(ref cause) => cause,
DescribeAccountAuditConfigurationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeAuditTaskError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeAuditTaskError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeAuditTaskError {
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 DescribeAuditTaskError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeAuditTaskError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeAuditTaskError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return DescribeAuditTaskError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeAuditTaskError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeAuditTaskError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeAuditTaskError {
fn from(err: serde_json::error::Error) -> DescribeAuditTaskError {
DescribeAuditTaskError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeAuditTaskError {
fn from(err: CredentialsError) -> DescribeAuditTaskError {
DescribeAuditTaskError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeAuditTaskError {
fn from(err: HttpDispatchError) -> DescribeAuditTaskError {
DescribeAuditTaskError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeAuditTaskError {
fn from(err: io::Error) -> DescribeAuditTaskError {
DescribeAuditTaskError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeAuditTaskError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeAuditTaskError {
fn description(&self) -> &str {
match *self {
DescribeAuditTaskError::InternalFailure(ref cause) => cause,
DescribeAuditTaskError::InvalidRequest(ref cause) => cause,
DescribeAuditTaskError::ResourceNotFound(ref cause) => cause,
DescribeAuditTaskError::Throttling(ref cause) => cause,
DescribeAuditTaskError::Validation(ref cause) => cause,
DescribeAuditTaskError::Credentials(ref err) => err.description(),
DescribeAuditTaskError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeAuditTaskError::ParseError(ref cause) => cause,
DescribeAuditTaskError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeAuthorizerError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeAuthorizerError {
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 DescribeAuthorizerError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeAuthorizerError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeAuthorizerError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeAuthorizerError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeAuthorizerError {
fn from(err: serde_json::error::Error) -> DescribeAuthorizerError {
DescribeAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeAuthorizerError {
fn from(err: CredentialsError) -> DescribeAuthorizerError {
DescribeAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeAuthorizerError {
fn from(err: HttpDispatchError) -> DescribeAuthorizerError {
DescribeAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeAuthorizerError {
fn from(err: io::Error) -> DescribeAuthorizerError {
DescribeAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeAuthorizerError {
fn description(&self) -> &str {
match *self {
DescribeAuthorizerError::InternalFailure(ref cause) => cause,
DescribeAuthorizerError::InvalidRequest(ref cause) => cause,
DescribeAuthorizerError::ResourceNotFound(ref cause) => cause,
DescribeAuthorizerError::ServiceUnavailable(ref cause) => cause,
DescribeAuthorizerError::Throttling(ref cause) => cause,
DescribeAuthorizerError::Unauthorized(ref cause) => cause,
DescribeAuthorizerError::Validation(ref cause) => cause,
DescribeAuthorizerError::Credentials(ref err) => err.description(),
DescribeAuthorizerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeAuthorizerError::ParseError(ref cause) => cause,
DescribeAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeCACertificateError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeCACertificateError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeCACertificateError {
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 DescribeCACertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeCACertificateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeCACertificateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeCACertificateError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeCACertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeCACertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeCACertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeCACertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeCACertificateError {
fn from(err: serde_json::error::Error) -> DescribeCACertificateError {
DescribeCACertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeCACertificateError {
fn from(err: CredentialsError) -> DescribeCACertificateError {
DescribeCACertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeCACertificateError {
fn from(err: HttpDispatchError) -> DescribeCACertificateError {
DescribeCACertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeCACertificateError {
fn from(err: io::Error) -> DescribeCACertificateError {
DescribeCACertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeCACertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeCACertificateError {
fn description(&self) -> &str {
match *self {
DescribeCACertificateError::InternalFailure(ref cause) => cause,
DescribeCACertificateError::InvalidRequest(ref cause) => cause,
DescribeCACertificateError::ResourceNotFound(ref cause) => cause,
DescribeCACertificateError::ServiceUnavailable(ref cause) => cause,
DescribeCACertificateError::Throttling(ref cause) => cause,
DescribeCACertificateError::Unauthorized(ref cause) => cause,
DescribeCACertificateError::Validation(ref cause) => cause,
DescribeCACertificateError::Credentials(ref err) => err.description(),
DescribeCACertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeCACertificateError::ParseError(ref cause) => cause,
DescribeCACertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeCertificateError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeCertificateError {
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 DescribeCertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeCertificateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeCertificateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeCertificateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeCertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeCertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeCertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeCertificateError {
fn from(err: serde_json::error::Error) -> DescribeCertificateError {
DescribeCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeCertificateError {
fn from(err: CredentialsError) -> DescribeCertificateError {
DescribeCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeCertificateError {
fn from(err: HttpDispatchError) -> DescribeCertificateError {
DescribeCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeCertificateError {
fn from(err: io::Error) -> DescribeCertificateError {
DescribeCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeCertificateError {
fn description(&self) -> &str {
match *self {
DescribeCertificateError::InternalFailure(ref cause) => cause,
DescribeCertificateError::InvalidRequest(ref cause) => cause,
DescribeCertificateError::ResourceNotFound(ref cause) => cause,
DescribeCertificateError::ServiceUnavailable(ref cause) => cause,
DescribeCertificateError::Throttling(ref cause) => cause,
DescribeCertificateError::Unauthorized(ref cause) => cause,
DescribeCertificateError::Validation(ref cause) => cause,
DescribeCertificateError::Credentials(ref err) => err.description(),
DescribeCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeCertificateError::ParseError(ref cause) => cause,
DescribeCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDefaultAuthorizerError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeDefaultAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeDefaultAuthorizerError {
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 DescribeDefaultAuthorizerError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return DescribeDefaultAuthorizerError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return DescribeDefaultAuthorizerError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return DescribeDefaultAuthorizerError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeDefaultAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeDefaultAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeDefaultAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeDefaultAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeDefaultAuthorizerError {
fn from(err: serde_json::error::Error) -> DescribeDefaultAuthorizerError {
DescribeDefaultAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeDefaultAuthorizerError {
fn from(err: CredentialsError) -> DescribeDefaultAuthorizerError {
DescribeDefaultAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeDefaultAuthorizerError {
fn from(err: HttpDispatchError) -> DescribeDefaultAuthorizerError {
DescribeDefaultAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeDefaultAuthorizerError {
fn from(err: io::Error) -> DescribeDefaultAuthorizerError {
DescribeDefaultAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeDefaultAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDefaultAuthorizerError {
fn description(&self) -> &str {
match *self {
DescribeDefaultAuthorizerError::InternalFailure(ref cause) => cause,
DescribeDefaultAuthorizerError::InvalidRequest(ref cause) => cause,
DescribeDefaultAuthorizerError::ResourceNotFound(ref cause) => cause,
DescribeDefaultAuthorizerError::ServiceUnavailable(ref cause) => cause,
DescribeDefaultAuthorizerError::Throttling(ref cause) => cause,
DescribeDefaultAuthorizerError::Unauthorized(ref cause) => cause,
DescribeDefaultAuthorizerError::Validation(ref cause) => cause,
DescribeDefaultAuthorizerError::Credentials(ref err) => err.description(),
DescribeDefaultAuthorizerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeDefaultAuthorizerError::ParseError(ref cause) => cause,
DescribeDefaultAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeEndpointError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeEndpointError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeEndpointError {
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 DescribeEndpointError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeEndpointError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return DescribeEndpointError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeEndpointError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeEndpointError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeEndpointError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeEndpointError {
fn from(err: serde_json::error::Error) -> DescribeEndpointError {
DescribeEndpointError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeEndpointError {
fn from(err: CredentialsError) -> DescribeEndpointError {
DescribeEndpointError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeEndpointError {
fn from(err: HttpDispatchError) -> DescribeEndpointError {
DescribeEndpointError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeEndpointError {
fn from(err: io::Error) -> DescribeEndpointError {
DescribeEndpointError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeEndpointError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeEndpointError {
fn description(&self) -> &str {
match *self {
DescribeEndpointError::InternalFailure(ref cause) => cause,
DescribeEndpointError::InvalidRequest(ref cause) => cause,
DescribeEndpointError::Throttling(ref cause) => cause,
DescribeEndpointError::Unauthorized(ref cause) => cause,
DescribeEndpointError::Validation(ref cause) => cause,
DescribeEndpointError::Credentials(ref err) => err.description(),
DescribeEndpointError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeEndpointError::ParseError(ref cause) => cause,
DescribeEndpointError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeEventConfigurationsError {
InternalFailure(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeEventConfigurationsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeEventConfigurationsError {
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 DescribeEventConfigurationsError::InternalFailure(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeEventConfigurationsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeEventConfigurationsError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeEventConfigurationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeEventConfigurationsError {
fn from(err: serde_json::error::Error) -> DescribeEventConfigurationsError {
DescribeEventConfigurationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeEventConfigurationsError {
fn from(err: CredentialsError) -> DescribeEventConfigurationsError {
DescribeEventConfigurationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeEventConfigurationsError {
fn from(err: HttpDispatchError) -> DescribeEventConfigurationsError {
DescribeEventConfigurationsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeEventConfigurationsError {
fn from(err: io::Error) -> DescribeEventConfigurationsError {
DescribeEventConfigurationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeEventConfigurationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeEventConfigurationsError {
fn description(&self) -> &str {
match *self {
DescribeEventConfigurationsError::InternalFailure(ref cause) => cause,
DescribeEventConfigurationsError::Throttling(ref cause) => cause,
DescribeEventConfigurationsError::Validation(ref cause) => cause,
DescribeEventConfigurationsError::Credentials(ref err) => err.description(),
DescribeEventConfigurationsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeEventConfigurationsError::ParseError(ref cause) => cause,
DescribeEventConfigurationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeIndexError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeIndexError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeIndexError {
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 DescribeIndexError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeIndexError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeIndexError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeIndexError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeIndexError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeIndexError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeIndexError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeIndexError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeIndexError {
fn from(err: serde_json::error::Error) -> DescribeIndexError {
DescribeIndexError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeIndexError {
fn from(err: CredentialsError) -> DescribeIndexError {
DescribeIndexError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeIndexError {
fn from(err: HttpDispatchError) -> DescribeIndexError {
DescribeIndexError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeIndexError {
fn from(err: io::Error) -> DescribeIndexError {
DescribeIndexError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeIndexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeIndexError {
fn description(&self) -> &str {
match *self {
DescribeIndexError::InternalFailure(ref cause) => cause,
DescribeIndexError::InvalidRequest(ref cause) => cause,
DescribeIndexError::ResourceNotFound(ref cause) => cause,
DescribeIndexError::ServiceUnavailable(ref cause) => cause,
DescribeIndexError::Throttling(ref cause) => cause,
DescribeIndexError::Unauthorized(ref cause) => cause,
DescribeIndexError::Validation(ref cause) => cause,
DescribeIndexError::Credentials(ref err) => err.description(),
DescribeIndexError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeIndexError::ParseError(ref cause) => cause,
DescribeIndexError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeJobError {
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeJobError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeJobError {
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 {
"InvalidRequestException" => {
return DescribeJobError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeJobError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeJobError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeJobError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeJobError {
fn from(err: serde_json::error::Error) -> DescribeJobError {
DescribeJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeJobError {
fn from(err: CredentialsError) -> DescribeJobError {
DescribeJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeJobError {
fn from(err: HttpDispatchError) -> DescribeJobError {
DescribeJobError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeJobError {
fn from(err: io::Error) -> DescribeJobError {
DescribeJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeJobError {
fn description(&self) -> &str {
match *self {
DescribeJobError::InvalidRequest(ref cause) => cause,
DescribeJobError::ResourceNotFound(ref cause) => cause,
DescribeJobError::ServiceUnavailable(ref cause) => cause,
DescribeJobError::Throttling(ref cause) => cause,
DescribeJobError::Validation(ref cause) => cause,
DescribeJobError::Credentials(ref err) => err.description(),
DescribeJobError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeJobError::ParseError(ref cause) => cause,
DescribeJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeJobExecutionError {
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeJobExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeJobExecutionError {
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 {
"InvalidRequestException" => {
return DescribeJobExecutionError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeJobExecutionError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeJobExecutionError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeJobExecutionError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeJobExecutionError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeJobExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeJobExecutionError {
fn from(err: serde_json::error::Error) -> DescribeJobExecutionError {
DescribeJobExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeJobExecutionError {
fn from(err: CredentialsError) -> DescribeJobExecutionError {
DescribeJobExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeJobExecutionError {
fn from(err: HttpDispatchError) -> DescribeJobExecutionError {
DescribeJobExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeJobExecutionError {
fn from(err: io::Error) -> DescribeJobExecutionError {
DescribeJobExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeJobExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeJobExecutionError {
fn description(&self) -> &str {
match *self {
DescribeJobExecutionError::InvalidRequest(ref cause) => cause,
DescribeJobExecutionError::ResourceNotFound(ref cause) => cause,
DescribeJobExecutionError::ServiceUnavailable(ref cause) => cause,
DescribeJobExecutionError::Throttling(ref cause) => cause,
DescribeJobExecutionError::Validation(ref cause) => cause,
DescribeJobExecutionError::Credentials(ref err) => err.description(),
DescribeJobExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeJobExecutionError::ParseError(ref cause) => cause,
DescribeJobExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeRoleAliasError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeRoleAliasError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeRoleAliasError {
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 DescribeRoleAliasError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeRoleAliasError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeRoleAliasError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeRoleAliasError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeRoleAliasError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeRoleAliasError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeRoleAliasError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeRoleAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeRoleAliasError {
fn from(err: serde_json::error::Error) -> DescribeRoleAliasError {
DescribeRoleAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeRoleAliasError {
fn from(err: CredentialsError) -> DescribeRoleAliasError {
DescribeRoleAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeRoleAliasError {
fn from(err: HttpDispatchError) -> DescribeRoleAliasError {
DescribeRoleAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeRoleAliasError {
fn from(err: io::Error) -> DescribeRoleAliasError {
DescribeRoleAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeRoleAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeRoleAliasError {
fn description(&self) -> &str {
match *self {
DescribeRoleAliasError::InternalFailure(ref cause) => cause,
DescribeRoleAliasError::InvalidRequest(ref cause) => cause,
DescribeRoleAliasError::ResourceNotFound(ref cause) => cause,
DescribeRoleAliasError::ServiceUnavailable(ref cause) => cause,
DescribeRoleAliasError::Throttling(ref cause) => cause,
DescribeRoleAliasError::Unauthorized(ref cause) => cause,
DescribeRoleAliasError::Validation(ref cause) => cause,
DescribeRoleAliasError::Credentials(ref err) => err.description(),
DescribeRoleAliasError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeRoleAliasError::ParseError(ref cause) => cause,
DescribeRoleAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeScheduledAuditError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeScheduledAuditError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeScheduledAuditError {
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 DescribeScheduledAuditError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeScheduledAuditError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeScheduledAuditError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeScheduledAuditError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeScheduledAuditError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeScheduledAuditError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeScheduledAuditError {
fn from(err: serde_json::error::Error) -> DescribeScheduledAuditError {
DescribeScheduledAuditError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeScheduledAuditError {
fn from(err: CredentialsError) -> DescribeScheduledAuditError {
DescribeScheduledAuditError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeScheduledAuditError {
fn from(err: HttpDispatchError) -> DescribeScheduledAuditError {
DescribeScheduledAuditError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeScheduledAuditError {
fn from(err: io::Error) -> DescribeScheduledAuditError {
DescribeScheduledAuditError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeScheduledAuditError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeScheduledAuditError {
fn description(&self) -> &str {
match *self {
DescribeScheduledAuditError::InternalFailure(ref cause) => cause,
DescribeScheduledAuditError::InvalidRequest(ref cause) => cause,
DescribeScheduledAuditError::ResourceNotFound(ref cause) => cause,
DescribeScheduledAuditError::Throttling(ref cause) => cause,
DescribeScheduledAuditError::Validation(ref cause) => cause,
DescribeScheduledAuditError::Credentials(ref err) => err.description(),
DescribeScheduledAuditError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeScheduledAuditError::ParseError(ref cause) => cause,
DescribeScheduledAuditError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeSecurityProfileError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeSecurityProfileError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeSecurityProfileError {
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 DescribeSecurityProfileError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return DescribeSecurityProfileError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeSecurityProfileError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeSecurityProfileError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeSecurityProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeSecurityProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeSecurityProfileError {
fn from(err: serde_json::error::Error) -> DescribeSecurityProfileError {
DescribeSecurityProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeSecurityProfileError {
fn from(err: CredentialsError) -> DescribeSecurityProfileError {
DescribeSecurityProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeSecurityProfileError {
fn from(err: HttpDispatchError) -> DescribeSecurityProfileError {
DescribeSecurityProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeSecurityProfileError {
fn from(err: io::Error) -> DescribeSecurityProfileError {
DescribeSecurityProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeSecurityProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeSecurityProfileError {
fn description(&self) -> &str {
match *self {
DescribeSecurityProfileError::InternalFailure(ref cause) => cause,
DescribeSecurityProfileError::InvalidRequest(ref cause) => cause,
DescribeSecurityProfileError::ResourceNotFound(ref cause) => cause,
DescribeSecurityProfileError::Throttling(ref cause) => cause,
DescribeSecurityProfileError::Validation(ref cause) => cause,
DescribeSecurityProfileError::Credentials(ref err) => err.description(),
DescribeSecurityProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeSecurityProfileError::ParseError(ref cause) => cause,
DescribeSecurityProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeStreamError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeStreamError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeStreamError {
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 DescribeStreamError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeStreamError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeStreamError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeStreamError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeStreamError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeStreamError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeStreamError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeStreamError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeStreamError {
fn from(err: serde_json::error::Error) -> DescribeStreamError {
DescribeStreamError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeStreamError {
fn from(err: CredentialsError) -> DescribeStreamError {
DescribeStreamError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeStreamError {
fn from(err: HttpDispatchError) -> DescribeStreamError {
DescribeStreamError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeStreamError {
fn from(err: io::Error) -> DescribeStreamError {
DescribeStreamError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeStreamError {
fn description(&self) -> &str {
match *self {
DescribeStreamError::InternalFailure(ref cause) => cause,
DescribeStreamError::InvalidRequest(ref cause) => cause,
DescribeStreamError::ResourceNotFound(ref cause) => cause,
DescribeStreamError::ServiceUnavailable(ref cause) => cause,
DescribeStreamError::Throttling(ref cause) => cause,
DescribeStreamError::Unauthorized(ref cause) => cause,
DescribeStreamError::Validation(ref cause) => cause,
DescribeStreamError::Credentials(ref err) => err.description(),
DescribeStreamError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeStreamError::ParseError(ref cause) => cause,
DescribeStreamError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeThingError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeThingError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeThingError {
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 DescribeThingError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeThingError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeThingError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeThingError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeThingError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeThingError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeThingError {
fn from(err: serde_json::error::Error) -> DescribeThingError {
DescribeThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeThingError {
fn from(err: CredentialsError) -> DescribeThingError {
DescribeThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeThingError {
fn from(err: HttpDispatchError) -> DescribeThingError {
DescribeThingError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeThingError {
fn from(err: io::Error) -> DescribeThingError {
DescribeThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeThingError {
fn description(&self) -> &str {
match *self {
DescribeThingError::InternalFailure(ref cause) => cause,
DescribeThingError::InvalidRequest(ref cause) => cause,
DescribeThingError::ResourceNotFound(ref cause) => cause,
DescribeThingError::ServiceUnavailable(ref cause) => cause,
DescribeThingError::Throttling(ref cause) => cause,
DescribeThingError::Unauthorized(ref cause) => cause,
DescribeThingError::Validation(ref cause) => cause,
DescribeThingError::Credentials(ref err) => err.description(),
DescribeThingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeThingError::ParseError(ref cause) => cause,
DescribeThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeThingGroupError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeThingGroupError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeThingGroupError {
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 DescribeThingGroupError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeThingGroupError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeThingGroupError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return DescribeThingGroupError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeThingGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeThingGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeThingGroupError {
fn from(err: serde_json::error::Error) -> DescribeThingGroupError {
DescribeThingGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeThingGroupError {
fn from(err: CredentialsError) -> DescribeThingGroupError {
DescribeThingGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeThingGroupError {
fn from(err: HttpDispatchError) -> DescribeThingGroupError {
DescribeThingGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeThingGroupError {
fn from(err: io::Error) -> DescribeThingGroupError {
DescribeThingGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeThingGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeThingGroupError {
fn description(&self) -> &str {
match *self {
DescribeThingGroupError::InternalFailure(ref cause) => cause,
DescribeThingGroupError::InvalidRequest(ref cause) => cause,
DescribeThingGroupError::ResourceNotFound(ref cause) => cause,
DescribeThingGroupError::Throttling(ref cause) => cause,
DescribeThingGroupError::Validation(ref cause) => cause,
DescribeThingGroupError::Credentials(ref err) => err.description(),
DescribeThingGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeThingGroupError::ParseError(ref cause) => cause,
DescribeThingGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeThingRegistrationTaskError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeThingRegistrationTaskError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeThingRegistrationTaskError {
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 DescribeThingRegistrationTaskError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return DescribeThingRegistrationTaskError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return DescribeThingRegistrationTaskError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeThingRegistrationTaskError::Throttling(String::from(
error_message,
))
}
"UnauthorizedException" => {
return DescribeThingRegistrationTaskError::Unauthorized(String::from(
error_message,
))
}
"ValidationException" => {
return DescribeThingRegistrationTaskError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeThingRegistrationTaskError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeThingRegistrationTaskError {
fn from(err: serde_json::error::Error) -> DescribeThingRegistrationTaskError {
DescribeThingRegistrationTaskError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeThingRegistrationTaskError {
fn from(err: CredentialsError) -> DescribeThingRegistrationTaskError {
DescribeThingRegistrationTaskError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeThingRegistrationTaskError {
fn from(err: HttpDispatchError) -> DescribeThingRegistrationTaskError {
DescribeThingRegistrationTaskError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeThingRegistrationTaskError {
fn from(err: io::Error) -> DescribeThingRegistrationTaskError {
DescribeThingRegistrationTaskError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeThingRegistrationTaskError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeThingRegistrationTaskError {
fn description(&self) -> &str {
match *self {
DescribeThingRegistrationTaskError::InternalFailure(ref cause) => cause,
DescribeThingRegistrationTaskError::InvalidRequest(ref cause) => cause,
DescribeThingRegistrationTaskError::ResourceNotFound(ref cause) => cause,
DescribeThingRegistrationTaskError::Throttling(ref cause) => cause,
DescribeThingRegistrationTaskError::Unauthorized(ref cause) => cause,
DescribeThingRegistrationTaskError::Validation(ref cause) => cause,
DescribeThingRegistrationTaskError::Credentials(ref err) => err.description(),
DescribeThingRegistrationTaskError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeThingRegistrationTaskError::ParseError(ref cause) => cause,
DescribeThingRegistrationTaskError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeThingTypeError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeThingTypeError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeThingTypeError {
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 DescribeThingTypeError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DescribeThingTypeError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DescribeThingTypeError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DescribeThingTypeError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DescribeThingTypeError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DescribeThingTypeError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DescribeThingTypeError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeThingTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeThingTypeError {
fn from(err: serde_json::error::Error) -> DescribeThingTypeError {
DescribeThingTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeThingTypeError {
fn from(err: CredentialsError) -> DescribeThingTypeError {
DescribeThingTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeThingTypeError {
fn from(err: HttpDispatchError) -> DescribeThingTypeError {
DescribeThingTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeThingTypeError {
fn from(err: io::Error) -> DescribeThingTypeError {
DescribeThingTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeThingTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeThingTypeError {
fn description(&self) -> &str {
match *self {
DescribeThingTypeError::InternalFailure(ref cause) => cause,
DescribeThingTypeError::InvalidRequest(ref cause) => cause,
DescribeThingTypeError::ResourceNotFound(ref cause) => cause,
DescribeThingTypeError::ServiceUnavailable(ref cause) => cause,
DescribeThingTypeError::Throttling(ref cause) => cause,
DescribeThingTypeError::Unauthorized(ref cause) => cause,
DescribeThingTypeError::Validation(ref cause) => cause,
DescribeThingTypeError::Credentials(ref err) => err.description(),
DescribeThingTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeThingTypeError::ParseError(ref cause) => cause,
DescribeThingTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachPolicyError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> DetachPolicyError {
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 DetachPolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DetachPolicyError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return DetachPolicyError::LimitExceeded(String::from(error_message))
}
"ServiceUnavailableException" => {
return DetachPolicyError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return DetachPolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DetachPolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DetachPolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetachPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachPolicyError {
fn from(err: serde_json::error::Error) -> DetachPolicyError {
DetachPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachPolicyError {
fn from(err: CredentialsError) -> DetachPolicyError {
DetachPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachPolicyError {
fn from(err: HttpDispatchError) -> DetachPolicyError {
DetachPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachPolicyError {
fn from(err: io::Error) -> DetachPolicyError {
DetachPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachPolicyError {
fn description(&self) -> &str {
match *self {
DetachPolicyError::InternalFailure(ref cause) => cause,
DetachPolicyError::InvalidRequest(ref cause) => cause,
DetachPolicyError::LimitExceeded(ref cause) => cause,
DetachPolicyError::ServiceUnavailable(ref cause) => cause,
DetachPolicyError::Throttling(ref cause) => cause,
DetachPolicyError::Unauthorized(ref cause) => cause,
DetachPolicyError::Validation(ref cause) => cause,
DetachPolicyError::Credentials(ref err) => err.description(),
DetachPolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetachPolicyError::ParseError(ref cause) => cause,
DetachPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachPrincipalPolicyError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachPrincipalPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> DetachPrincipalPolicyError {
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 DetachPrincipalPolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DetachPrincipalPolicyError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DetachPrincipalPolicyError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DetachPrincipalPolicyError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return DetachPrincipalPolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DetachPrincipalPolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DetachPrincipalPolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetachPrincipalPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachPrincipalPolicyError {
fn from(err: serde_json::error::Error) -> DetachPrincipalPolicyError {
DetachPrincipalPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachPrincipalPolicyError {
fn from(err: CredentialsError) -> DetachPrincipalPolicyError {
DetachPrincipalPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachPrincipalPolicyError {
fn from(err: HttpDispatchError) -> DetachPrincipalPolicyError {
DetachPrincipalPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachPrincipalPolicyError {
fn from(err: io::Error) -> DetachPrincipalPolicyError {
DetachPrincipalPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachPrincipalPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachPrincipalPolicyError {
fn description(&self) -> &str {
match *self {
DetachPrincipalPolicyError::InternalFailure(ref cause) => cause,
DetachPrincipalPolicyError::InvalidRequest(ref cause) => cause,
DetachPrincipalPolicyError::ResourceNotFound(ref cause) => cause,
DetachPrincipalPolicyError::ServiceUnavailable(ref cause) => cause,
DetachPrincipalPolicyError::Throttling(ref cause) => cause,
DetachPrincipalPolicyError::Unauthorized(ref cause) => cause,
DetachPrincipalPolicyError::Validation(ref cause) => cause,
DetachPrincipalPolicyError::Credentials(ref err) => err.description(),
DetachPrincipalPolicyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DetachPrincipalPolicyError::ParseError(ref cause) => cause,
DetachPrincipalPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachSecurityProfileError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachSecurityProfileError {
pub fn from_response(res: BufferedHttpResponse) -> DetachSecurityProfileError {
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 DetachSecurityProfileError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DetachSecurityProfileError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DetachSecurityProfileError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return DetachSecurityProfileError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DetachSecurityProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetachSecurityProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachSecurityProfileError {
fn from(err: serde_json::error::Error) -> DetachSecurityProfileError {
DetachSecurityProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachSecurityProfileError {
fn from(err: CredentialsError) -> DetachSecurityProfileError {
DetachSecurityProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachSecurityProfileError {
fn from(err: HttpDispatchError) -> DetachSecurityProfileError {
DetachSecurityProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachSecurityProfileError {
fn from(err: io::Error) -> DetachSecurityProfileError {
DetachSecurityProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachSecurityProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachSecurityProfileError {
fn description(&self) -> &str {
match *self {
DetachSecurityProfileError::InternalFailure(ref cause) => cause,
DetachSecurityProfileError::InvalidRequest(ref cause) => cause,
DetachSecurityProfileError::ResourceNotFound(ref cause) => cause,
DetachSecurityProfileError::Throttling(ref cause) => cause,
DetachSecurityProfileError::Validation(ref cause) => cause,
DetachSecurityProfileError::Credentials(ref err) => err.description(),
DetachSecurityProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DetachSecurityProfileError::ParseError(ref cause) => cause,
DetachSecurityProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetachThingPrincipalError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetachThingPrincipalError {
pub fn from_response(res: BufferedHttpResponse) -> DetachThingPrincipalError {
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 DetachThingPrincipalError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return DetachThingPrincipalError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return DetachThingPrincipalError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return DetachThingPrincipalError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return DetachThingPrincipalError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return DetachThingPrincipalError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DetachThingPrincipalError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetachThingPrincipalError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetachThingPrincipalError {
fn from(err: serde_json::error::Error) -> DetachThingPrincipalError {
DetachThingPrincipalError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetachThingPrincipalError {
fn from(err: CredentialsError) -> DetachThingPrincipalError {
DetachThingPrincipalError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetachThingPrincipalError {
fn from(err: HttpDispatchError) -> DetachThingPrincipalError {
DetachThingPrincipalError::HttpDispatch(err)
}
}
impl From<io::Error> for DetachThingPrincipalError {
fn from(err: io::Error) -> DetachThingPrincipalError {
DetachThingPrincipalError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetachThingPrincipalError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetachThingPrincipalError {
fn description(&self) -> &str {
match *self {
DetachThingPrincipalError::InternalFailure(ref cause) => cause,
DetachThingPrincipalError::InvalidRequest(ref cause) => cause,
DetachThingPrincipalError::ResourceNotFound(ref cause) => cause,
DetachThingPrincipalError::ServiceUnavailable(ref cause) => cause,
DetachThingPrincipalError::Throttling(ref cause) => cause,
DetachThingPrincipalError::Unauthorized(ref cause) => cause,
DetachThingPrincipalError::Validation(ref cause) => cause,
DetachThingPrincipalError::Credentials(ref err) => err.description(),
DetachThingPrincipalError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DetachThingPrincipalError::ParseError(ref cause) => cause,
DetachThingPrincipalError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisableTopicRuleError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisableTopicRuleError {
pub fn from_response(res: BufferedHttpResponse) -> DisableTopicRuleError {
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 {
"InternalException" => {
return DisableTopicRuleError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return DisableTopicRuleError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return DisableTopicRuleError::ServiceUnavailable(String::from(error_message))
}
"UnauthorizedException" => {
return DisableTopicRuleError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return DisableTopicRuleError::Validation(error_message.to_string())
}
_ => {}
}
}
return DisableTopicRuleError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisableTopicRuleError {
fn from(err: serde_json::error::Error) -> DisableTopicRuleError {
DisableTopicRuleError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisableTopicRuleError {
fn from(err: CredentialsError) -> DisableTopicRuleError {
DisableTopicRuleError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisableTopicRuleError {
fn from(err: HttpDispatchError) -> DisableTopicRuleError {
DisableTopicRuleError::HttpDispatch(err)
}
}
impl From<io::Error> for DisableTopicRuleError {
fn from(err: io::Error) -> DisableTopicRuleError {
DisableTopicRuleError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisableTopicRuleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisableTopicRuleError {
fn description(&self) -> &str {
match *self {
DisableTopicRuleError::Internal(ref cause) => cause,
DisableTopicRuleError::InvalidRequest(ref cause) => cause,
DisableTopicRuleError::ServiceUnavailable(ref cause) => cause,
DisableTopicRuleError::Unauthorized(ref cause) => cause,
DisableTopicRuleError::Validation(ref cause) => cause,
DisableTopicRuleError::Credentials(ref err) => err.description(),
DisableTopicRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DisableTopicRuleError::ParseError(ref cause) => cause,
DisableTopicRuleError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum EnableTopicRuleError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl EnableTopicRuleError {
pub fn from_response(res: BufferedHttpResponse) -> EnableTopicRuleError {
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 {
"InternalException" => {
return EnableTopicRuleError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return EnableTopicRuleError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return EnableTopicRuleError::ServiceUnavailable(String::from(error_message))
}
"UnauthorizedException" => {
return EnableTopicRuleError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return EnableTopicRuleError::Validation(error_message.to_string())
}
_ => {}
}
}
return EnableTopicRuleError::Unknown(res);
}
}
impl From<serde_json::error::Error> for EnableTopicRuleError {
fn from(err: serde_json::error::Error) -> EnableTopicRuleError {
EnableTopicRuleError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for EnableTopicRuleError {
fn from(err: CredentialsError) -> EnableTopicRuleError {
EnableTopicRuleError::Credentials(err)
}
}
impl From<HttpDispatchError> for EnableTopicRuleError {
fn from(err: HttpDispatchError) -> EnableTopicRuleError {
EnableTopicRuleError::HttpDispatch(err)
}
}
impl From<io::Error> for EnableTopicRuleError {
fn from(err: io::Error) -> EnableTopicRuleError {
EnableTopicRuleError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for EnableTopicRuleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for EnableTopicRuleError {
fn description(&self) -> &str {
match *self {
EnableTopicRuleError::Internal(ref cause) => cause,
EnableTopicRuleError::InvalidRequest(ref cause) => cause,
EnableTopicRuleError::ServiceUnavailable(ref cause) => cause,
EnableTopicRuleError::Unauthorized(ref cause) => cause,
EnableTopicRuleError::Validation(ref cause) => cause,
EnableTopicRuleError::Credentials(ref err) => err.description(),
EnableTopicRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
EnableTopicRuleError::ParseError(ref cause) => cause,
EnableTopicRuleError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetEffectivePoliciesError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetEffectivePoliciesError {
pub fn from_response(res: BufferedHttpResponse) -> GetEffectivePoliciesError {
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 GetEffectivePoliciesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return GetEffectivePoliciesError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return GetEffectivePoliciesError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return GetEffectivePoliciesError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetEffectivePoliciesError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return GetEffectivePoliciesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return GetEffectivePoliciesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return GetEffectivePoliciesError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetEffectivePoliciesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetEffectivePoliciesError {
fn from(err: serde_json::error::Error) -> GetEffectivePoliciesError {
GetEffectivePoliciesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetEffectivePoliciesError {
fn from(err: CredentialsError) -> GetEffectivePoliciesError {
GetEffectivePoliciesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetEffectivePoliciesError {
fn from(err: HttpDispatchError) -> GetEffectivePoliciesError {
GetEffectivePoliciesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetEffectivePoliciesError {
fn from(err: io::Error) -> GetEffectivePoliciesError {
GetEffectivePoliciesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetEffectivePoliciesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetEffectivePoliciesError {
fn description(&self) -> &str {
match *self {
GetEffectivePoliciesError::InternalFailure(ref cause) => cause,
GetEffectivePoliciesError::InvalidRequest(ref cause) => cause,
GetEffectivePoliciesError::LimitExceeded(ref cause) => cause,
GetEffectivePoliciesError::ResourceNotFound(ref cause) => cause,
GetEffectivePoliciesError::ServiceUnavailable(ref cause) => cause,
GetEffectivePoliciesError::Throttling(ref cause) => cause,
GetEffectivePoliciesError::Unauthorized(ref cause) => cause,
GetEffectivePoliciesError::Validation(ref cause) => cause,
GetEffectivePoliciesError::Credentials(ref err) => err.description(),
GetEffectivePoliciesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetEffectivePoliciesError::ParseError(ref cause) => cause,
GetEffectivePoliciesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetIndexingConfigurationError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetIndexingConfigurationError {
pub fn from_response(res: BufferedHttpResponse) -> GetIndexingConfigurationError {
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 GetIndexingConfigurationError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return GetIndexingConfigurationError::InvalidRequest(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return GetIndexingConfigurationError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return GetIndexingConfigurationError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return GetIndexingConfigurationError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return GetIndexingConfigurationError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetIndexingConfigurationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetIndexingConfigurationError {
fn from(err: serde_json::error::Error) -> GetIndexingConfigurationError {
GetIndexingConfigurationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetIndexingConfigurationError {
fn from(err: CredentialsError) -> GetIndexingConfigurationError {
GetIndexingConfigurationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetIndexingConfigurationError {
fn from(err: HttpDispatchError) -> GetIndexingConfigurationError {
GetIndexingConfigurationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetIndexingConfigurationError {
fn from(err: io::Error) -> GetIndexingConfigurationError {
GetIndexingConfigurationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetIndexingConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetIndexingConfigurationError {
fn description(&self) -> &str {
match *self {
GetIndexingConfigurationError::InternalFailure(ref cause) => cause,
GetIndexingConfigurationError::InvalidRequest(ref cause) => cause,
GetIndexingConfigurationError::ServiceUnavailable(ref cause) => cause,
GetIndexingConfigurationError::Throttling(ref cause) => cause,
GetIndexingConfigurationError::Unauthorized(ref cause) => cause,
GetIndexingConfigurationError::Validation(ref cause) => cause,
GetIndexingConfigurationError::Credentials(ref err) => err.description(),
GetIndexingConfigurationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetIndexingConfigurationError::ParseError(ref cause) => cause,
GetIndexingConfigurationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetJobDocumentError {
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetJobDocumentError {
pub fn from_response(res: BufferedHttpResponse) -> GetJobDocumentError {
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 {
"InvalidRequestException" => {
return GetJobDocumentError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return GetJobDocumentError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetJobDocumentError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return GetJobDocumentError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetJobDocumentError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetJobDocumentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetJobDocumentError {
fn from(err: serde_json::error::Error) -> GetJobDocumentError {
GetJobDocumentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetJobDocumentError {
fn from(err: CredentialsError) -> GetJobDocumentError {
GetJobDocumentError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetJobDocumentError {
fn from(err: HttpDispatchError) -> GetJobDocumentError {
GetJobDocumentError::HttpDispatch(err)
}
}
impl From<io::Error> for GetJobDocumentError {
fn from(err: io::Error) -> GetJobDocumentError {
GetJobDocumentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetJobDocumentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetJobDocumentError {
fn description(&self) -> &str {
match *self {
GetJobDocumentError::InvalidRequest(ref cause) => cause,
GetJobDocumentError::ResourceNotFound(ref cause) => cause,
GetJobDocumentError::ServiceUnavailable(ref cause) => cause,
GetJobDocumentError::Throttling(ref cause) => cause,
GetJobDocumentError::Validation(ref cause) => cause,
GetJobDocumentError::Credentials(ref err) => err.description(),
GetJobDocumentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetJobDocumentError::ParseError(ref cause) => cause,
GetJobDocumentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetLoggingOptionsError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetLoggingOptionsError {
pub fn from_response(res: BufferedHttpResponse) -> GetLoggingOptionsError {
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 {
"InternalException" => {
return GetLoggingOptionsError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return GetLoggingOptionsError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetLoggingOptionsError::ServiceUnavailable(String::from(error_message))
}
"ValidationException" => {
return GetLoggingOptionsError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetLoggingOptionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetLoggingOptionsError {
fn from(err: serde_json::error::Error) -> GetLoggingOptionsError {
GetLoggingOptionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetLoggingOptionsError {
fn from(err: CredentialsError) -> GetLoggingOptionsError {
GetLoggingOptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetLoggingOptionsError {
fn from(err: HttpDispatchError) -> GetLoggingOptionsError {
GetLoggingOptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetLoggingOptionsError {
fn from(err: io::Error) -> GetLoggingOptionsError {
GetLoggingOptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetLoggingOptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetLoggingOptionsError {
fn description(&self) -> &str {
match *self {
GetLoggingOptionsError::Internal(ref cause) => cause,
GetLoggingOptionsError::InvalidRequest(ref cause) => cause,
GetLoggingOptionsError::ServiceUnavailable(ref cause) => cause,
GetLoggingOptionsError::Validation(ref cause) => cause,
GetLoggingOptionsError::Credentials(ref err) => err.description(),
GetLoggingOptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetLoggingOptionsError::ParseError(ref cause) => cause,
GetLoggingOptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetOTAUpdateError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetOTAUpdateError {
pub fn from_response(res: BufferedHttpResponse) -> GetOTAUpdateError {
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 GetOTAUpdateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return GetOTAUpdateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return GetOTAUpdateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetOTAUpdateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return GetOTAUpdateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return GetOTAUpdateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return GetOTAUpdateError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetOTAUpdateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetOTAUpdateError {
fn from(err: serde_json::error::Error) -> GetOTAUpdateError {
GetOTAUpdateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetOTAUpdateError {
fn from(err: CredentialsError) -> GetOTAUpdateError {
GetOTAUpdateError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetOTAUpdateError {
fn from(err: HttpDispatchError) -> GetOTAUpdateError {
GetOTAUpdateError::HttpDispatch(err)
}
}
impl From<io::Error> for GetOTAUpdateError {
fn from(err: io::Error) -> GetOTAUpdateError {
GetOTAUpdateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetOTAUpdateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetOTAUpdateError {
fn description(&self) -> &str {
match *self {
GetOTAUpdateError::InternalFailure(ref cause) => cause,
GetOTAUpdateError::InvalidRequest(ref cause) => cause,
GetOTAUpdateError::ResourceNotFound(ref cause) => cause,
GetOTAUpdateError::ServiceUnavailable(ref cause) => cause,
GetOTAUpdateError::Throttling(ref cause) => cause,
GetOTAUpdateError::Unauthorized(ref cause) => cause,
GetOTAUpdateError::Validation(ref cause) => cause,
GetOTAUpdateError::Credentials(ref err) => err.description(),
GetOTAUpdateError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetOTAUpdateError::ParseError(ref cause) => cause,
GetOTAUpdateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPolicyError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> GetPolicyError {
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 GetPolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return GetPolicyError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return GetPolicyError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetPolicyError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return GetPolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return GetPolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return GetPolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetPolicyError {
fn from(err: serde_json::error::Error) -> GetPolicyError {
GetPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetPolicyError {
fn from(err: CredentialsError) -> GetPolicyError {
GetPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPolicyError {
fn from(err: HttpDispatchError) -> GetPolicyError {
GetPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPolicyError {
fn from(err: io::Error) -> GetPolicyError {
GetPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPolicyError {
fn description(&self) -> &str {
match *self {
GetPolicyError::InternalFailure(ref cause) => cause,
GetPolicyError::InvalidRequest(ref cause) => cause,
GetPolicyError::ResourceNotFound(ref cause) => cause,
GetPolicyError::ServiceUnavailable(ref cause) => cause,
GetPolicyError::Throttling(ref cause) => cause,
GetPolicyError::Unauthorized(ref cause) => cause,
GetPolicyError::Validation(ref cause) => cause,
GetPolicyError::Credentials(ref err) => err.description(),
GetPolicyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetPolicyError::ParseError(ref cause) => cause,
GetPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPolicyVersionError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPolicyVersionError {
pub fn from_response(res: BufferedHttpResponse) -> GetPolicyVersionError {
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 GetPolicyVersionError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return GetPolicyVersionError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return GetPolicyVersionError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetPolicyVersionError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return GetPolicyVersionError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return GetPolicyVersionError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return GetPolicyVersionError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetPolicyVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetPolicyVersionError {
fn from(err: serde_json::error::Error) -> GetPolicyVersionError {
GetPolicyVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetPolicyVersionError {
fn from(err: CredentialsError) -> GetPolicyVersionError {
GetPolicyVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPolicyVersionError {
fn from(err: HttpDispatchError) -> GetPolicyVersionError {
GetPolicyVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPolicyVersionError {
fn from(err: io::Error) -> GetPolicyVersionError {
GetPolicyVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPolicyVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPolicyVersionError {
fn description(&self) -> &str {
match *self {
GetPolicyVersionError::InternalFailure(ref cause) => cause,
GetPolicyVersionError::InvalidRequest(ref cause) => cause,
GetPolicyVersionError::ResourceNotFound(ref cause) => cause,
GetPolicyVersionError::ServiceUnavailable(ref cause) => cause,
GetPolicyVersionError::Throttling(ref cause) => cause,
GetPolicyVersionError::Unauthorized(ref cause) => cause,
GetPolicyVersionError::Validation(ref cause) => cause,
GetPolicyVersionError::Credentials(ref err) => err.description(),
GetPolicyVersionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetPolicyVersionError::ParseError(ref cause) => cause,
GetPolicyVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRegistrationCodeError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRegistrationCodeError {
pub fn from_response(res: BufferedHttpResponse) -> GetRegistrationCodeError {
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 GetRegistrationCodeError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return GetRegistrationCodeError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetRegistrationCodeError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return GetRegistrationCodeError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return GetRegistrationCodeError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return GetRegistrationCodeError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetRegistrationCodeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRegistrationCodeError {
fn from(err: serde_json::error::Error) -> GetRegistrationCodeError {
GetRegistrationCodeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRegistrationCodeError {
fn from(err: CredentialsError) -> GetRegistrationCodeError {
GetRegistrationCodeError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRegistrationCodeError {
fn from(err: HttpDispatchError) -> GetRegistrationCodeError {
GetRegistrationCodeError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRegistrationCodeError {
fn from(err: io::Error) -> GetRegistrationCodeError {
GetRegistrationCodeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRegistrationCodeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRegistrationCodeError {
fn description(&self) -> &str {
match *self {
GetRegistrationCodeError::InternalFailure(ref cause) => cause,
GetRegistrationCodeError::InvalidRequest(ref cause) => cause,
GetRegistrationCodeError::ServiceUnavailable(ref cause) => cause,
GetRegistrationCodeError::Throttling(ref cause) => cause,
GetRegistrationCodeError::Unauthorized(ref cause) => cause,
GetRegistrationCodeError::Validation(ref cause) => cause,
GetRegistrationCodeError::Credentials(ref err) => err.description(),
GetRegistrationCodeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetRegistrationCodeError::ParseError(ref cause) => cause,
GetRegistrationCodeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetTopicRuleError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetTopicRuleError {
pub fn from_response(res: BufferedHttpResponse) -> GetTopicRuleError {
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 {
"InternalException" => {
return GetTopicRuleError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return GetTopicRuleError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetTopicRuleError::ServiceUnavailable(String::from(error_message))
}
"UnauthorizedException" => {
return GetTopicRuleError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return GetTopicRuleError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetTopicRuleError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetTopicRuleError {
fn from(err: serde_json::error::Error) -> GetTopicRuleError {
GetTopicRuleError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetTopicRuleError {
fn from(err: CredentialsError) -> GetTopicRuleError {
GetTopicRuleError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetTopicRuleError {
fn from(err: HttpDispatchError) -> GetTopicRuleError {
GetTopicRuleError::HttpDispatch(err)
}
}
impl From<io::Error> for GetTopicRuleError {
fn from(err: io::Error) -> GetTopicRuleError {
GetTopicRuleError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetTopicRuleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetTopicRuleError {
fn description(&self) -> &str {
match *self {
GetTopicRuleError::Internal(ref cause) => cause,
GetTopicRuleError::InvalidRequest(ref cause) => cause,
GetTopicRuleError::ServiceUnavailable(ref cause) => cause,
GetTopicRuleError::Unauthorized(ref cause) => cause,
GetTopicRuleError::Validation(ref cause) => cause,
GetTopicRuleError::Credentials(ref err) => err.description(),
GetTopicRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetTopicRuleError::ParseError(ref cause) => cause,
GetTopicRuleError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetV2LoggingOptionsError {
Internal(String),
NotConfigured(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetV2LoggingOptionsError {
pub fn from_response(res: BufferedHttpResponse) -> GetV2LoggingOptionsError {
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 {
"InternalException" => {
return GetV2LoggingOptionsError::Internal(String::from(error_message))
}
"NotConfiguredException" => {
return GetV2LoggingOptionsError::NotConfigured(String::from(error_message))
}
"ServiceUnavailableException" => {
return GetV2LoggingOptionsError::ServiceUnavailable(String::from(error_message))
}
"ValidationException" => {
return GetV2LoggingOptionsError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetV2LoggingOptionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetV2LoggingOptionsError {
fn from(err: serde_json::error::Error) -> GetV2LoggingOptionsError {
GetV2LoggingOptionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetV2LoggingOptionsError {
fn from(err: CredentialsError) -> GetV2LoggingOptionsError {
GetV2LoggingOptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetV2LoggingOptionsError {
fn from(err: HttpDispatchError) -> GetV2LoggingOptionsError {
GetV2LoggingOptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetV2LoggingOptionsError {
fn from(err: io::Error) -> GetV2LoggingOptionsError {
GetV2LoggingOptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetV2LoggingOptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetV2LoggingOptionsError {
fn description(&self) -> &str {
match *self {
GetV2LoggingOptionsError::Internal(ref cause) => cause,
GetV2LoggingOptionsError::NotConfigured(ref cause) => cause,
GetV2LoggingOptionsError::ServiceUnavailable(ref cause) => cause,
GetV2LoggingOptionsError::Validation(ref cause) => cause,
GetV2LoggingOptionsError::Credentials(ref err) => err.description(),
GetV2LoggingOptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetV2LoggingOptionsError::ParseError(ref cause) => cause,
GetV2LoggingOptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListActiveViolationsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListActiveViolationsError {
pub fn from_response(res: BufferedHttpResponse) -> ListActiveViolationsError {
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 ListActiveViolationsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListActiveViolationsError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListActiveViolationsError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return ListActiveViolationsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListActiveViolationsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListActiveViolationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListActiveViolationsError {
fn from(err: serde_json::error::Error) -> ListActiveViolationsError {
ListActiveViolationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListActiveViolationsError {
fn from(err: CredentialsError) -> ListActiveViolationsError {
ListActiveViolationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListActiveViolationsError {
fn from(err: HttpDispatchError) -> ListActiveViolationsError {
ListActiveViolationsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListActiveViolationsError {
fn from(err: io::Error) -> ListActiveViolationsError {
ListActiveViolationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListActiveViolationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListActiveViolationsError {
fn description(&self) -> &str {
match *self {
ListActiveViolationsError::InternalFailure(ref cause) => cause,
ListActiveViolationsError::InvalidRequest(ref cause) => cause,
ListActiveViolationsError::ResourceNotFound(ref cause) => cause,
ListActiveViolationsError::Throttling(ref cause) => cause,
ListActiveViolationsError::Validation(ref cause) => cause,
ListActiveViolationsError::Credentials(ref err) => err.description(),
ListActiveViolationsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListActiveViolationsError::ParseError(ref cause) => cause,
ListActiveViolationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAttachedPoliciesError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAttachedPoliciesError {
pub fn from_response(res: BufferedHttpResponse) -> ListAttachedPoliciesError {
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 ListAttachedPoliciesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListAttachedPoliciesError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return ListAttachedPoliciesError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListAttachedPoliciesError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListAttachedPoliciesError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListAttachedPoliciesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListAttachedPoliciesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListAttachedPoliciesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListAttachedPoliciesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAttachedPoliciesError {
fn from(err: serde_json::error::Error) -> ListAttachedPoliciesError {
ListAttachedPoliciesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAttachedPoliciesError {
fn from(err: CredentialsError) -> ListAttachedPoliciesError {
ListAttachedPoliciesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAttachedPoliciesError {
fn from(err: HttpDispatchError) -> ListAttachedPoliciesError {
ListAttachedPoliciesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAttachedPoliciesError {
fn from(err: io::Error) -> ListAttachedPoliciesError {
ListAttachedPoliciesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAttachedPoliciesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAttachedPoliciesError {
fn description(&self) -> &str {
match *self {
ListAttachedPoliciesError::InternalFailure(ref cause) => cause,
ListAttachedPoliciesError::InvalidRequest(ref cause) => cause,
ListAttachedPoliciesError::LimitExceeded(ref cause) => cause,
ListAttachedPoliciesError::ResourceNotFound(ref cause) => cause,
ListAttachedPoliciesError::ServiceUnavailable(ref cause) => cause,
ListAttachedPoliciesError::Throttling(ref cause) => cause,
ListAttachedPoliciesError::Unauthorized(ref cause) => cause,
ListAttachedPoliciesError::Validation(ref cause) => cause,
ListAttachedPoliciesError::Credentials(ref err) => err.description(),
ListAttachedPoliciesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListAttachedPoliciesError::ParseError(ref cause) => cause,
ListAttachedPoliciesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAuditFindingsError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAuditFindingsError {
pub fn from_response(res: BufferedHttpResponse) -> ListAuditFindingsError {
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 ListAuditFindingsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListAuditFindingsError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return ListAuditFindingsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListAuditFindingsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListAuditFindingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAuditFindingsError {
fn from(err: serde_json::error::Error) -> ListAuditFindingsError {
ListAuditFindingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAuditFindingsError {
fn from(err: CredentialsError) -> ListAuditFindingsError {
ListAuditFindingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAuditFindingsError {
fn from(err: HttpDispatchError) -> ListAuditFindingsError {
ListAuditFindingsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAuditFindingsError {
fn from(err: io::Error) -> ListAuditFindingsError {
ListAuditFindingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAuditFindingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAuditFindingsError {
fn description(&self) -> &str {
match *self {
ListAuditFindingsError::InternalFailure(ref cause) => cause,
ListAuditFindingsError::InvalidRequest(ref cause) => cause,
ListAuditFindingsError::Throttling(ref cause) => cause,
ListAuditFindingsError::Validation(ref cause) => cause,
ListAuditFindingsError::Credentials(ref err) => err.description(),
ListAuditFindingsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListAuditFindingsError::ParseError(ref cause) => cause,
ListAuditFindingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAuditTasksError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAuditTasksError {
pub fn from_response(res: BufferedHttpResponse) -> ListAuditTasksError {
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 ListAuditTasksError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListAuditTasksError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return ListAuditTasksError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListAuditTasksError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListAuditTasksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAuditTasksError {
fn from(err: serde_json::error::Error) -> ListAuditTasksError {
ListAuditTasksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAuditTasksError {
fn from(err: CredentialsError) -> ListAuditTasksError {
ListAuditTasksError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAuditTasksError {
fn from(err: HttpDispatchError) -> ListAuditTasksError {
ListAuditTasksError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAuditTasksError {
fn from(err: io::Error) -> ListAuditTasksError {
ListAuditTasksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAuditTasksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAuditTasksError {
fn description(&self) -> &str {
match *self {
ListAuditTasksError::InternalFailure(ref cause) => cause,
ListAuditTasksError::InvalidRequest(ref cause) => cause,
ListAuditTasksError::Throttling(ref cause) => cause,
ListAuditTasksError::Validation(ref cause) => cause,
ListAuditTasksError::Credentials(ref err) => err.description(),
ListAuditTasksError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListAuditTasksError::ParseError(ref cause) => cause,
ListAuditTasksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAuthorizersError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAuthorizersError {
pub fn from_response(res: BufferedHttpResponse) -> ListAuthorizersError {
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 ListAuthorizersError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListAuthorizersError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListAuthorizersError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListAuthorizersError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListAuthorizersError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListAuthorizersError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListAuthorizersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAuthorizersError {
fn from(err: serde_json::error::Error) -> ListAuthorizersError {
ListAuthorizersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAuthorizersError {
fn from(err: CredentialsError) -> ListAuthorizersError {
ListAuthorizersError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAuthorizersError {
fn from(err: HttpDispatchError) -> ListAuthorizersError {
ListAuthorizersError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAuthorizersError {
fn from(err: io::Error) -> ListAuthorizersError {
ListAuthorizersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAuthorizersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAuthorizersError {
fn description(&self) -> &str {
match *self {
ListAuthorizersError::InternalFailure(ref cause) => cause,
ListAuthorizersError::InvalidRequest(ref cause) => cause,
ListAuthorizersError::ServiceUnavailable(ref cause) => cause,
ListAuthorizersError::Throttling(ref cause) => cause,
ListAuthorizersError::Unauthorized(ref cause) => cause,
ListAuthorizersError::Validation(ref cause) => cause,
ListAuthorizersError::Credentials(ref err) => err.description(),
ListAuthorizersError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListAuthorizersError::ParseError(ref cause) => cause,
ListAuthorizersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListCACertificatesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListCACertificatesError {
pub fn from_response(res: BufferedHttpResponse) -> ListCACertificatesError {
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 ListCACertificatesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListCACertificatesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListCACertificatesError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListCACertificatesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListCACertificatesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListCACertificatesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListCACertificatesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListCACertificatesError {
fn from(err: serde_json::error::Error) -> ListCACertificatesError {
ListCACertificatesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListCACertificatesError {
fn from(err: CredentialsError) -> ListCACertificatesError {
ListCACertificatesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListCACertificatesError {
fn from(err: HttpDispatchError) -> ListCACertificatesError {
ListCACertificatesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListCACertificatesError {
fn from(err: io::Error) -> ListCACertificatesError {
ListCACertificatesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListCACertificatesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListCACertificatesError {
fn description(&self) -> &str {
match *self {
ListCACertificatesError::InternalFailure(ref cause) => cause,
ListCACertificatesError::InvalidRequest(ref cause) => cause,
ListCACertificatesError::ServiceUnavailable(ref cause) => cause,
ListCACertificatesError::Throttling(ref cause) => cause,
ListCACertificatesError::Unauthorized(ref cause) => cause,
ListCACertificatesError::Validation(ref cause) => cause,
ListCACertificatesError::Credentials(ref err) => err.description(),
ListCACertificatesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListCACertificatesError::ParseError(ref cause) => cause,
ListCACertificatesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListCertificatesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListCertificatesError {
pub fn from_response(res: BufferedHttpResponse) -> ListCertificatesError {
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 ListCertificatesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListCertificatesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListCertificatesError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListCertificatesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListCertificatesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListCertificatesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListCertificatesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListCertificatesError {
fn from(err: serde_json::error::Error) -> ListCertificatesError {
ListCertificatesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListCertificatesError {
fn from(err: CredentialsError) -> ListCertificatesError {
ListCertificatesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListCertificatesError {
fn from(err: HttpDispatchError) -> ListCertificatesError {
ListCertificatesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListCertificatesError {
fn from(err: io::Error) -> ListCertificatesError {
ListCertificatesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListCertificatesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListCertificatesError {
fn description(&self) -> &str {
match *self {
ListCertificatesError::InternalFailure(ref cause) => cause,
ListCertificatesError::InvalidRequest(ref cause) => cause,
ListCertificatesError::ServiceUnavailable(ref cause) => cause,
ListCertificatesError::Throttling(ref cause) => cause,
ListCertificatesError::Unauthorized(ref cause) => cause,
ListCertificatesError::Validation(ref cause) => cause,
ListCertificatesError::Credentials(ref err) => err.description(),
ListCertificatesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListCertificatesError::ParseError(ref cause) => cause,
ListCertificatesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListCertificatesByCAError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListCertificatesByCAError {
pub fn from_response(res: BufferedHttpResponse) -> ListCertificatesByCAError {
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 ListCertificatesByCAError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListCertificatesByCAError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListCertificatesByCAError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListCertificatesByCAError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListCertificatesByCAError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListCertificatesByCAError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListCertificatesByCAError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListCertificatesByCAError {
fn from(err: serde_json::error::Error) -> ListCertificatesByCAError {
ListCertificatesByCAError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListCertificatesByCAError {
fn from(err: CredentialsError) -> ListCertificatesByCAError {
ListCertificatesByCAError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListCertificatesByCAError {
fn from(err: HttpDispatchError) -> ListCertificatesByCAError {
ListCertificatesByCAError::HttpDispatch(err)
}
}
impl From<io::Error> for ListCertificatesByCAError {
fn from(err: io::Error) -> ListCertificatesByCAError {
ListCertificatesByCAError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListCertificatesByCAError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListCertificatesByCAError {
fn description(&self) -> &str {
match *self {
ListCertificatesByCAError::InternalFailure(ref cause) => cause,
ListCertificatesByCAError::InvalidRequest(ref cause) => cause,
ListCertificatesByCAError::ServiceUnavailable(ref cause) => cause,
ListCertificatesByCAError::Throttling(ref cause) => cause,
ListCertificatesByCAError::Unauthorized(ref cause) => cause,
ListCertificatesByCAError::Validation(ref cause) => cause,
ListCertificatesByCAError::Credentials(ref err) => err.description(),
ListCertificatesByCAError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListCertificatesByCAError::ParseError(ref cause) => cause,
ListCertificatesByCAError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListIndicesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListIndicesError {
pub fn from_response(res: BufferedHttpResponse) -> ListIndicesError {
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 ListIndicesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListIndicesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListIndicesError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListIndicesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListIndicesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListIndicesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListIndicesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListIndicesError {
fn from(err: serde_json::error::Error) -> ListIndicesError {
ListIndicesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListIndicesError {
fn from(err: CredentialsError) -> ListIndicesError {
ListIndicesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListIndicesError {
fn from(err: HttpDispatchError) -> ListIndicesError {
ListIndicesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListIndicesError {
fn from(err: io::Error) -> ListIndicesError {
ListIndicesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListIndicesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListIndicesError {
fn description(&self) -> &str {
match *self {
ListIndicesError::InternalFailure(ref cause) => cause,
ListIndicesError::InvalidRequest(ref cause) => cause,
ListIndicesError::ServiceUnavailable(ref cause) => cause,
ListIndicesError::Throttling(ref cause) => cause,
ListIndicesError::Unauthorized(ref cause) => cause,
ListIndicesError::Validation(ref cause) => cause,
ListIndicesError::Credentials(ref err) => err.description(),
ListIndicesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListIndicesError::ParseError(ref cause) => cause,
ListIndicesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListJobExecutionsForJobError {
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListJobExecutionsForJobError {
pub fn from_response(res: BufferedHttpResponse) -> ListJobExecutionsForJobError {
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 {
"InvalidRequestException" => {
return ListJobExecutionsForJobError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListJobExecutionsForJobError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return ListJobExecutionsForJobError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListJobExecutionsForJobError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListJobExecutionsForJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListJobExecutionsForJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListJobExecutionsForJobError {
fn from(err: serde_json::error::Error) -> ListJobExecutionsForJobError {
ListJobExecutionsForJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListJobExecutionsForJobError {
fn from(err: CredentialsError) -> ListJobExecutionsForJobError {
ListJobExecutionsForJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListJobExecutionsForJobError {
fn from(err: HttpDispatchError) -> ListJobExecutionsForJobError {
ListJobExecutionsForJobError::HttpDispatch(err)
}
}
impl From<io::Error> for ListJobExecutionsForJobError {
fn from(err: io::Error) -> ListJobExecutionsForJobError {
ListJobExecutionsForJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListJobExecutionsForJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListJobExecutionsForJobError {
fn description(&self) -> &str {
match *self {
ListJobExecutionsForJobError::InvalidRequest(ref cause) => cause,
ListJobExecutionsForJobError::ResourceNotFound(ref cause) => cause,
ListJobExecutionsForJobError::ServiceUnavailable(ref cause) => cause,
ListJobExecutionsForJobError::Throttling(ref cause) => cause,
ListJobExecutionsForJobError::Validation(ref cause) => cause,
ListJobExecutionsForJobError::Credentials(ref err) => err.description(),
ListJobExecutionsForJobError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListJobExecutionsForJobError::ParseError(ref cause) => cause,
ListJobExecutionsForJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListJobExecutionsForThingError {
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListJobExecutionsForThingError {
pub fn from_response(res: BufferedHttpResponse) -> ListJobExecutionsForThingError {
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 {
"InvalidRequestException" => {
return ListJobExecutionsForThingError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return ListJobExecutionsForThingError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return ListJobExecutionsForThingError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListJobExecutionsForThingError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListJobExecutionsForThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListJobExecutionsForThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListJobExecutionsForThingError {
fn from(err: serde_json::error::Error) -> ListJobExecutionsForThingError {
ListJobExecutionsForThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListJobExecutionsForThingError {
fn from(err: CredentialsError) -> ListJobExecutionsForThingError {
ListJobExecutionsForThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListJobExecutionsForThingError {
fn from(err: HttpDispatchError) -> ListJobExecutionsForThingError {
ListJobExecutionsForThingError::HttpDispatch(err)
}
}
impl From<io::Error> for ListJobExecutionsForThingError {
fn from(err: io::Error) -> ListJobExecutionsForThingError {
ListJobExecutionsForThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListJobExecutionsForThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListJobExecutionsForThingError {
fn description(&self) -> &str {
match *self {
ListJobExecutionsForThingError::InvalidRequest(ref cause) => cause,
ListJobExecutionsForThingError::ResourceNotFound(ref cause) => cause,
ListJobExecutionsForThingError::ServiceUnavailable(ref cause) => cause,
ListJobExecutionsForThingError::Throttling(ref cause) => cause,
ListJobExecutionsForThingError::Validation(ref cause) => cause,
ListJobExecutionsForThingError::Credentials(ref err) => err.description(),
ListJobExecutionsForThingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListJobExecutionsForThingError::ParseError(ref cause) => cause,
ListJobExecutionsForThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListJobsError {
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListJobsError {
pub fn from_response(res: BufferedHttpResponse) -> ListJobsError {
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 {
"InvalidRequestException" => {
return ListJobsError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListJobsError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListJobsError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListJobsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListJobsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListJobsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListJobsError {
fn from(err: serde_json::error::Error) -> ListJobsError {
ListJobsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListJobsError {
fn from(err: CredentialsError) -> ListJobsError {
ListJobsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListJobsError {
fn from(err: HttpDispatchError) -> ListJobsError {
ListJobsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListJobsError {
fn from(err: io::Error) -> ListJobsError {
ListJobsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListJobsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListJobsError {
fn description(&self) -> &str {
match *self {
ListJobsError::InvalidRequest(ref cause) => cause,
ListJobsError::ResourceNotFound(ref cause) => cause,
ListJobsError::ServiceUnavailable(ref cause) => cause,
ListJobsError::Throttling(ref cause) => cause,
ListJobsError::Validation(ref cause) => cause,
ListJobsError::Credentials(ref err) => err.description(),
ListJobsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListJobsError::ParseError(ref cause) => cause,
ListJobsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListOTAUpdatesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListOTAUpdatesError {
pub fn from_response(res: BufferedHttpResponse) -> ListOTAUpdatesError {
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 ListOTAUpdatesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListOTAUpdatesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListOTAUpdatesError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListOTAUpdatesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListOTAUpdatesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListOTAUpdatesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListOTAUpdatesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListOTAUpdatesError {
fn from(err: serde_json::error::Error) -> ListOTAUpdatesError {
ListOTAUpdatesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListOTAUpdatesError {
fn from(err: CredentialsError) -> ListOTAUpdatesError {
ListOTAUpdatesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListOTAUpdatesError {
fn from(err: HttpDispatchError) -> ListOTAUpdatesError {
ListOTAUpdatesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListOTAUpdatesError {
fn from(err: io::Error) -> ListOTAUpdatesError {
ListOTAUpdatesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListOTAUpdatesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListOTAUpdatesError {
fn description(&self) -> &str {
match *self {
ListOTAUpdatesError::InternalFailure(ref cause) => cause,
ListOTAUpdatesError::InvalidRequest(ref cause) => cause,
ListOTAUpdatesError::ServiceUnavailable(ref cause) => cause,
ListOTAUpdatesError::Throttling(ref cause) => cause,
ListOTAUpdatesError::Unauthorized(ref cause) => cause,
ListOTAUpdatesError::Validation(ref cause) => cause,
ListOTAUpdatesError::Credentials(ref err) => err.description(),
ListOTAUpdatesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListOTAUpdatesError::ParseError(ref cause) => cause,
ListOTAUpdatesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListOutgoingCertificatesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListOutgoingCertificatesError {
pub fn from_response(res: BufferedHttpResponse) -> ListOutgoingCertificatesError {
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 ListOutgoingCertificatesError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return ListOutgoingCertificatesError::InvalidRequest(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return ListOutgoingCertificatesError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListOutgoingCertificatesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListOutgoingCertificatesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListOutgoingCertificatesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListOutgoingCertificatesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListOutgoingCertificatesError {
fn from(err: serde_json::error::Error) -> ListOutgoingCertificatesError {
ListOutgoingCertificatesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListOutgoingCertificatesError {
fn from(err: CredentialsError) -> ListOutgoingCertificatesError {
ListOutgoingCertificatesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListOutgoingCertificatesError {
fn from(err: HttpDispatchError) -> ListOutgoingCertificatesError {
ListOutgoingCertificatesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListOutgoingCertificatesError {
fn from(err: io::Error) -> ListOutgoingCertificatesError {
ListOutgoingCertificatesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListOutgoingCertificatesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListOutgoingCertificatesError {
fn description(&self) -> &str {
match *self {
ListOutgoingCertificatesError::InternalFailure(ref cause) => cause,
ListOutgoingCertificatesError::InvalidRequest(ref cause) => cause,
ListOutgoingCertificatesError::ServiceUnavailable(ref cause) => cause,
ListOutgoingCertificatesError::Throttling(ref cause) => cause,
ListOutgoingCertificatesError::Unauthorized(ref cause) => cause,
ListOutgoingCertificatesError::Validation(ref cause) => cause,
ListOutgoingCertificatesError::Credentials(ref err) => err.description(),
ListOutgoingCertificatesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListOutgoingCertificatesError::ParseError(ref cause) => cause,
ListOutgoingCertificatesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPoliciesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPoliciesError {
pub fn from_response(res: BufferedHttpResponse) -> ListPoliciesError {
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 ListPoliciesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListPoliciesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListPoliciesError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListPoliciesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListPoliciesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListPoliciesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListPoliciesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPoliciesError {
fn from(err: serde_json::error::Error) -> ListPoliciesError {
ListPoliciesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPoliciesError {
fn from(err: CredentialsError) -> ListPoliciesError {
ListPoliciesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPoliciesError {
fn from(err: HttpDispatchError) -> ListPoliciesError {
ListPoliciesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPoliciesError {
fn from(err: io::Error) -> ListPoliciesError {
ListPoliciesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPoliciesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPoliciesError {
fn description(&self) -> &str {
match *self {
ListPoliciesError::InternalFailure(ref cause) => cause,
ListPoliciesError::InvalidRequest(ref cause) => cause,
ListPoliciesError::ServiceUnavailable(ref cause) => cause,
ListPoliciesError::Throttling(ref cause) => cause,
ListPoliciesError::Unauthorized(ref cause) => cause,
ListPoliciesError::Validation(ref cause) => cause,
ListPoliciesError::Credentials(ref err) => err.description(),
ListPoliciesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListPoliciesError::ParseError(ref cause) => cause,
ListPoliciesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPolicyPrincipalsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPolicyPrincipalsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPolicyPrincipalsError {
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 ListPolicyPrincipalsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListPolicyPrincipalsError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListPolicyPrincipalsError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListPolicyPrincipalsError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListPolicyPrincipalsError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListPolicyPrincipalsError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListPolicyPrincipalsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListPolicyPrincipalsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPolicyPrincipalsError {
fn from(err: serde_json::error::Error) -> ListPolicyPrincipalsError {
ListPolicyPrincipalsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPolicyPrincipalsError {
fn from(err: CredentialsError) -> ListPolicyPrincipalsError {
ListPolicyPrincipalsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPolicyPrincipalsError {
fn from(err: HttpDispatchError) -> ListPolicyPrincipalsError {
ListPolicyPrincipalsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPolicyPrincipalsError {
fn from(err: io::Error) -> ListPolicyPrincipalsError {
ListPolicyPrincipalsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPolicyPrincipalsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPolicyPrincipalsError {
fn description(&self) -> &str {
match *self {
ListPolicyPrincipalsError::InternalFailure(ref cause) => cause,
ListPolicyPrincipalsError::InvalidRequest(ref cause) => cause,
ListPolicyPrincipalsError::ResourceNotFound(ref cause) => cause,
ListPolicyPrincipalsError::ServiceUnavailable(ref cause) => cause,
ListPolicyPrincipalsError::Throttling(ref cause) => cause,
ListPolicyPrincipalsError::Unauthorized(ref cause) => cause,
ListPolicyPrincipalsError::Validation(ref cause) => cause,
ListPolicyPrincipalsError::Credentials(ref err) => err.description(),
ListPolicyPrincipalsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPolicyPrincipalsError::ParseError(ref cause) => cause,
ListPolicyPrincipalsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPolicyVersionsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPolicyVersionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPolicyVersionsError {
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 ListPolicyVersionsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListPolicyVersionsError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListPolicyVersionsError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListPolicyVersionsError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListPolicyVersionsError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListPolicyVersionsError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListPolicyVersionsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListPolicyVersionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPolicyVersionsError {
fn from(err: serde_json::error::Error) -> ListPolicyVersionsError {
ListPolicyVersionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPolicyVersionsError {
fn from(err: CredentialsError) -> ListPolicyVersionsError {
ListPolicyVersionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPolicyVersionsError {
fn from(err: HttpDispatchError) -> ListPolicyVersionsError {
ListPolicyVersionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPolicyVersionsError {
fn from(err: io::Error) -> ListPolicyVersionsError {
ListPolicyVersionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPolicyVersionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPolicyVersionsError {
fn description(&self) -> &str {
match *self {
ListPolicyVersionsError::InternalFailure(ref cause) => cause,
ListPolicyVersionsError::InvalidRequest(ref cause) => cause,
ListPolicyVersionsError::ResourceNotFound(ref cause) => cause,
ListPolicyVersionsError::ServiceUnavailable(ref cause) => cause,
ListPolicyVersionsError::Throttling(ref cause) => cause,
ListPolicyVersionsError::Unauthorized(ref cause) => cause,
ListPolicyVersionsError::Validation(ref cause) => cause,
ListPolicyVersionsError::Credentials(ref err) => err.description(),
ListPolicyVersionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPolicyVersionsError::ParseError(ref cause) => cause,
ListPolicyVersionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPrincipalPoliciesError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPrincipalPoliciesError {
pub fn from_response(res: BufferedHttpResponse) -> ListPrincipalPoliciesError {
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 ListPrincipalPoliciesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListPrincipalPoliciesError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListPrincipalPoliciesError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListPrincipalPoliciesError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListPrincipalPoliciesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListPrincipalPoliciesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListPrincipalPoliciesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListPrincipalPoliciesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPrincipalPoliciesError {
fn from(err: serde_json::error::Error) -> ListPrincipalPoliciesError {
ListPrincipalPoliciesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPrincipalPoliciesError {
fn from(err: CredentialsError) -> ListPrincipalPoliciesError {
ListPrincipalPoliciesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPrincipalPoliciesError {
fn from(err: HttpDispatchError) -> ListPrincipalPoliciesError {
ListPrincipalPoliciesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPrincipalPoliciesError {
fn from(err: io::Error) -> ListPrincipalPoliciesError {
ListPrincipalPoliciesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPrincipalPoliciesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPrincipalPoliciesError {
fn description(&self) -> &str {
match *self {
ListPrincipalPoliciesError::InternalFailure(ref cause) => cause,
ListPrincipalPoliciesError::InvalidRequest(ref cause) => cause,
ListPrincipalPoliciesError::ResourceNotFound(ref cause) => cause,
ListPrincipalPoliciesError::ServiceUnavailable(ref cause) => cause,
ListPrincipalPoliciesError::Throttling(ref cause) => cause,
ListPrincipalPoliciesError::Unauthorized(ref cause) => cause,
ListPrincipalPoliciesError::Validation(ref cause) => cause,
ListPrincipalPoliciesError::Credentials(ref err) => err.description(),
ListPrincipalPoliciesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPrincipalPoliciesError::ParseError(ref cause) => cause,
ListPrincipalPoliciesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPrincipalThingsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPrincipalThingsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPrincipalThingsError {
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 ListPrincipalThingsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListPrincipalThingsError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListPrincipalThingsError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListPrincipalThingsError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListPrincipalThingsError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListPrincipalThingsError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListPrincipalThingsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListPrincipalThingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPrincipalThingsError {
fn from(err: serde_json::error::Error) -> ListPrincipalThingsError {
ListPrincipalThingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPrincipalThingsError {
fn from(err: CredentialsError) -> ListPrincipalThingsError {
ListPrincipalThingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPrincipalThingsError {
fn from(err: HttpDispatchError) -> ListPrincipalThingsError {
ListPrincipalThingsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPrincipalThingsError {
fn from(err: io::Error) -> ListPrincipalThingsError {
ListPrincipalThingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPrincipalThingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPrincipalThingsError {
fn description(&self) -> &str {
match *self {
ListPrincipalThingsError::InternalFailure(ref cause) => cause,
ListPrincipalThingsError::InvalidRequest(ref cause) => cause,
ListPrincipalThingsError::ResourceNotFound(ref cause) => cause,
ListPrincipalThingsError::ServiceUnavailable(ref cause) => cause,
ListPrincipalThingsError::Throttling(ref cause) => cause,
ListPrincipalThingsError::Unauthorized(ref cause) => cause,
ListPrincipalThingsError::Validation(ref cause) => cause,
ListPrincipalThingsError::Credentials(ref err) => err.description(),
ListPrincipalThingsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPrincipalThingsError::ParseError(ref cause) => cause,
ListPrincipalThingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListRoleAliasesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListRoleAliasesError {
pub fn from_response(res: BufferedHttpResponse) -> ListRoleAliasesError {
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 ListRoleAliasesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListRoleAliasesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListRoleAliasesError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListRoleAliasesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListRoleAliasesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListRoleAliasesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListRoleAliasesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListRoleAliasesError {
fn from(err: serde_json::error::Error) -> ListRoleAliasesError {
ListRoleAliasesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListRoleAliasesError {
fn from(err: CredentialsError) -> ListRoleAliasesError {
ListRoleAliasesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListRoleAliasesError {
fn from(err: HttpDispatchError) -> ListRoleAliasesError {
ListRoleAliasesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListRoleAliasesError {
fn from(err: io::Error) -> ListRoleAliasesError {
ListRoleAliasesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListRoleAliasesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListRoleAliasesError {
fn description(&self) -> &str {
match *self {
ListRoleAliasesError::InternalFailure(ref cause) => cause,
ListRoleAliasesError::InvalidRequest(ref cause) => cause,
ListRoleAliasesError::ServiceUnavailable(ref cause) => cause,
ListRoleAliasesError::Throttling(ref cause) => cause,
ListRoleAliasesError::Unauthorized(ref cause) => cause,
ListRoleAliasesError::Validation(ref cause) => cause,
ListRoleAliasesError::Credentials(ref err) => err.description(),
ListRoleAliasesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListRoleAliasesError::ParseError(ref cause) => cause,
ListRoleAliasesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListScheduledAuditsError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListScheduledAuditsError {
pub fn from_response(res: BufferedHttpResponse) -> ListScheduledAuditsError {
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 ListScheduledAuditsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListScheduledAuditsError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return ListScheduledAuditsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListScheduledAuditsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListScheduledAuditsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListScheduledAuditsError {
fn from(err: serde_json::error::Error) -> ListScheduledAuditsError {
ListScheduledAuditsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListScheduledAuditsError {
fn from(err: CredentialsError) -> ListScheduledAuditsError {
ListScheduledAuditsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListScheduledAuditsError {
fn from(err: HttpDispatchError) -> ListScheduledAuditsError {
ListScheduledAuditsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListScheduledAuditsError {
fn from(err: io::Error) -> ListScheduledAuditsError {
ListScheduledAuditsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListScheduledAuditsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListScheduledAuditsError {
fn description(&self) -> &str {
match *self {
ListScheduledAuditsError::InternalFailure(ref cause) => cause,
ListScheduledAuditsError::InvalidRequest(ref cause) => cause,
ListScheduledAuditsError::Throttling(ref cause) => cause,
ListScheduledAuditsError::Validation(ref cause) => cause,
ListScheduledAuditsError::Credentials(ref err) => err.description(),
ListScheduledAuditsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListScheduledAuditsError::ParseError(ref cause) => cause,
ListScheduledAuditsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSecurityProfilesError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListSecurityProfilesError {
pub fn from_response(res: BufferedHttpResponse) -> ListSecurityProfilesError {
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 ListSecurityProfilesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListSecurityProfilesError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return ListSecurityProfilesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListSecurityProfilesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListSecurityProfilesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListSecurityProfilesError {
fn from(err: serde_json::error::Error) -> ListSecurityProfilesError {
ListSecurityProfilesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListSecurityProfilesError {
fn from(err: CredentialsError) -> ListSecurityProfilesError {
ListSecurityProfilesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListSecurityProfilesError {
fn from(err: HttpDispatchError) -> ListSecurityProfilesError {
ListSecurityProfilesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListSecurityProfilesError {
fn from(err: io::Error) -> ListSecurityProfilesError {
ListSecurityProfilesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListSecurityProfilesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListSecurityProfilesError {
fn description(&self) -> &str {
match *self {
ListSecurityProfilesError::InternalFailure(ref cause) => cause,
ListSecurityProfilesError::InvalidRequest(ref cause) => cause,
ListSecurityProfilesError::Throttling(ref cause) => cause,
ListSecurityProfilesError::Validation(ref cause) => cause,
ListSecurityProfilesError::Credentials(ref err) => err.description(),
ListSecurityProfilesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListSecurityProfilesError::ParseError(ref cause) => cause,
ListSecurityProfilesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSecurityProfilesForTargetError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListSecurityProfilesForTargetError {
pub fn from_response(res: BufferedHttpResponse) -> ListSecurityProfilesForTargetError {
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 ListSecurityProfilesForTargetError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return ListSecurityProfilesForTargetError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return ListSecurityProfilesForTargetError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListSecurityProfilesForTargetError::Throttling(String::from(
error_message,
))
}
"ValidationException" => {
return ListSecurityProfilesForTargetError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListSecurityProfilesForTargetError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListSecurityProfilesForTargetError {
fn from(err: serde_json::error::Error) -> ListSecurityProfilesForTargetError {
ListSecurityProfilesForTargetError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListSecurityProfilesForTargetError {
fn from(err: CredentialsError) -> ListSecurityProfilesForTargetError {
ListSecurityProfilesForTargetError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListSecurityProfilesForTargetError {
fn from(err: HttpDispatchError) -> ListSecurityProfilesForTargetError {
ListSecurityProfilesForTargetError::HttpDispatch(err)
}
}
impl From<io::Error> for ListSecurityProfilesForTargetError {
fn from(err: io::Error) -> ListSecurityProfilesForTargetError {
ListSecurityProfilesForTargetError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListSecurityProfilesForTargetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListSecurityProfilesForTargetError {
fn description(&self) -> &str {
match *self {
ListSecurityProfilesForTargetError::InternalFailure(ref cause) => cause,
ListSecurityProfilesForTargetError::InvalidRequest(ref cause) => cause,
ListSecurityProfilesForTargetError::ResourceNotFound(ref cause) => cause,
ListSecurityProfilesForTargetError::Throttling(ref cause) => cause,
ListSecurityProfilesForTargetError::Validation(ref cause) => cause,
ListSecurityProfilesForTargetError::Credentials(ref err) => err.description(),
ListSecurityProfilesForTargetError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListSecurityProfilesForTargetError::ParseError(ref cause) => cause,
ListSecurityProfilesForTargetError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListStreamsError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListStreamsError {
pub fn from_response(res: BufferedHttpResponse) -> ListStreamsError {
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 ListStreamsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListStreamsError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListStreamsError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListStreamsError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListStreamsError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListStreamsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListStreamsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListStreamsError {
fn from(err: serde_json::error::Error) -> ListStreamsError {
ListStreamsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListStreamsError {
fn from(err: CredentialsError) -> ListStreamsError {
ListStreamsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListStreamsError {
fn from(err: HttpDispatchError) -> ListStreamsError {
ListStreamsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListStreamsError {
fn from(err: io::Error) -> ListStreamsError {
ListStreamsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListStreamsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListStreamsError {
fn description(&self) -> &str {
match *self {
ListStreamsError::InternalFailure(ref cause) => cause,
ListStreamsError::InvalidRequest(ref cause) => cause,
ListStreamsError::ServiceUnavailable(ref cause) => cause,
ListStreamsError::Throttling(ref cause) => cause,
ListStreamsError::Unauthorized(ref cause) => cause,
ListStreamsError::Validation(ref cause) => cause,
ListStreamsError::Credentials(ref err) => err.description(),
ListStreamsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListStreamsError::ParseError(ref cause) => cause,
ListStreamsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTargetsForPolicyError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTargetsForPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> ListTargetsForPolicyError {
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 ListTargetsForPolicyError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListTargetsForPolicyError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return ListTargetsForPolicyError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListTargetsForPolicyError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListTargetsForPolicyError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListTargetsForPolicyError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListTargetsForPolicyError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListTargetsForPolicyError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListTargetsForPolicyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTargetsForPolicyError {
fn from(err: serde_json::error::Error) -> ListTargetsForPolicyError {
ListTargetsForPolicyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTargetsForPolicyError {
fn from(err: CredentialsError) -> ListTargetsForPolicyError {
ListTargetsForPolicyError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTargetsForPolicyError {
fn from(err: HttpDispatchError) -> ListTargetsForPolicyError {
ListTargetsForPolicyError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTargetsForPolicyError {
fn from(err: io::Error) -> ListTargetsForPolicyError {
ListTargetsForPolicyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTargetsForPolicyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTargetsForPolicyError {
fn description(&self) -> &str {
match *self {
ListTargetsForPolicyError::InternalFailure(ref cause) => cause,
ListTargetsForPolicyError::InvalidRequest(ref cause) => cause,
ListTargetsForPolicyError::LimitExceeded(ref cause) => cause,
ListTargetsForPolicyError::ResourceNotFound(ref cause) => cause,
ListTargetsForPolicyError::ServiceUnavailable(ref cause) => cause,
ListTargetsForPolicyError::Throttling(ref cause) => cause,
ListTargetsForPolicyError::Unauthorized(ref cause) => cause,
ListTargetsForPolicyError::Validation(ref cause) => cause,
ListTargetsForPolicyError::Credentials(ref err) => err.description(),
ListTargetsForPolicyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTargetsForPolicyError::ParseError(ref cause) => cause,
ListTargetsForPolicyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTargetsForSecurityProfileError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTargetsForSecurityProfileError {
pub fn from_response(res: BufferedHttpResponse) -> ListTargetsForSecurityProfileError {
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 ListTargetsForSecurityProfileError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return ListTargetsForSecurityProfileError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return ListTargetsForSecurityProfileError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListTargetsForSecurityProfileError::Throttling(String::from(
error_message,
))
}
"ValidationException" => {
return ListTargetsForSecurityProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListTargetsForSecurityProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTargetsForSecurityProfileError {
fn from(err: serde_json::error::Error) -> ListTargetsForSecurityProfileError {
ListTargetsForSecurityProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTargetsForSecurityProfileError {
fn from(err: CredentialsError) -> ListTargetsForSecurityProfileError {
ListTargetsForSecurityProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTargetsForSecurityProfileError {
fn from(err: HttpDispatchError) -> ListTargetsForSecurityProfileError {
ListTargetsForSecurityProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTargetsForSecurityProfileError {
fn from(err: io::Error) -> ListTargetsForSecurityProfileError {
ListTargetsForSecurityProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTargetsForSecurityProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTargetsForSecurityProfileError {
fn description(&self) -> &str {
match *self {
ListTargetsForSecurityProfileError::InternalFailure(ref cause) => cause,
ListTargetsForSecurityProfileError::InvalidRequest(ref cause) => cause,
ListTargetsForSecurityProfileError::ResourceNotFound(ref cause) => cause,
ListTargetsForSecurityProfileError::Throttling(ref cause) => cause,
ListTargetsForSecurityProfileError::Validation(ref cause) => cause,
ListTargetsForSecurityProfileError::Credentials(ref err) => err.description(),
ListTargetsForSecurityProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTargetsForSecurityProfileError::ParseError(ref cause) => cause,
ListTargetsForSecurityProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingGroupsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingGroupsError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingGroupsError {
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 ListThingGroupsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListThingGroupsError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListThingGroupsError::ResourceNotFound(String::from(error_message))
}
"ValidationException" => {
return ListThingGroupsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListThingGroupsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingGroupsError {
fn from(err: serde_json::error::Error) -> ListThingGroupsError {
ListThingGroupsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingGroupsError {
fn from(err: CredentialsError) -> ListThingGroupsError {
ListThingGroupsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingGroupsError {
fn from(err: HttpDispatchError) -> ListThingGroupsError {
ListThingGroupsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingGroupsError {
fn from(err: io::Error) -> ListThingGroupsError {
ListThingGroupsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingGroupsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingGroupsError {
fn description(&self) -> &str {
match *self {
ListThingGroupsError::InternalFailure(ref cause) => cause,
ListThingGroupsError::InvalidRequest(ref cause) => cause,
ListThingGroupsError::ResourceNotFound(ref cause) => cause,
ListThingGroupsError::Validation(ref cause) => cause,
ListThingGroupsError::Credentials(ref err) => err.description(),
ListThingGroupsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListThingGroupsError::ParseError(ref cause) => cause,
ListThingGroupsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingGroupsForThingError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingGroupsForThingError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingGroupsForThingError {
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 ListThingGroupsForThingError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return ListThingGroupsForThingError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListThingGroupsForThingError::ResourceNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return ListThingGroupsForThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListThingGroupsForThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingGroupsForThingError {
fn from(err: serde_json::error::Error) -> ListThingGroupsForThingError {
ListThingGroupsForThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingGroupsForThingError {
fn from(err: CredentialsError) -> ListThingGroupsForThingError {
ListThingGroupsForThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingGroupsForThingError {
fn from(err: HttpDispatchError) -> ListThingGroupsForThingError {
ListThingGroupsForThingError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingGroupsForThingError {
fn from(err: io::Error) -> ListThingGroupsForThingError {
ListThingGroupsForThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingGroupsForThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingGroupsForThingError {
fn description(&self) -> &str {
match *self {
ListThingGroupsForThingError::InternalFailure(ref cause) => cause,
ListThingGroupsForThingError::InvalidRequest(ref cause) => cause,
ListThingGroupsForThingError::ResourceNotFound(ref cause) => cause,
ListThingGroupsForThingError::Validation(ref cause) => cause,
ListThingGroupsForThingError::Credentials(ref err) => err.description(),
ListThingGroupsForThingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListThingGroupsForThingError::ParseError(ref cause) => cause,
ListThingGroupsForThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingPrincipalsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingPrincipalsError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingPrincipalsError {
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 ListThingPrincipalsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListThingPrincipalsError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListThingPrincipalsError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListThingPrincipalsError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListThingPrincipalsError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListThingPrincipalsError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListThingPrincipalsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListThingPrincipalsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingPrincipalsError {
fn from(err: serde_json::error::Error) -> ListThingPrincipalsError {
ListThingPrincipalsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingPrincipalsError {
fn from(err: CredentialsError) -> ListThingPrincipalsError {
ListThingPrincipalsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingPrincipalsError {
fn from(err: HttpDispatchError) -> ListThingPrincipalsError {
ListThingPrincipalsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingPrincipalsError {
fn from(err: io::Error) -> ListThingPrincipalsError {
ListThingPrincipalsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingPrincipalsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingPrincipalsError {
fn description(&self) -> &str {
match *self {
ListThingPrincipalsError::InternalFailure(ref cause) => cause,
ListThingPrincipalsError::InvalidRequest(ref cause) => cause,
ListThingPrincipalsError::ResourceNotFound(ref cause) => cause,
ListThingPrincipalsError::ServiceUnavailable(ref cause) => cause,
ListThingPrincipalsError::Throttling(ref cause) => cause,
ListThingPrincipalsError::Unauthorized(ref cause) => cause,
ListThingPrincipalsError::Validation(ref cause) => cause,
ListThingPrincipalsError::Credentials(ref err) => err.description(),
ListThingPrincipalsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListThingPrincipalsError::ParseError(ref cause) => cause,
ListThingPrincipalsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingRegistrationTaskReportsError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingRegistrationTaskReportsError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingRegistrationTaskReportsError {
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 ListThingRegistrationTaskReportsError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return ListThingRegistrationTaskReportsError::InvalidRequest(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListThingRegistrationTaskReportsError::Throttling(String::from(
error_message,
))
}
"UnauthorizedException" => {
return ListThingRegistrationTaskReportsError::Unauthorized(String::from(
error_message,
))
}
"ValidationException" => {
return ListThingRegistrationTaskReportsError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return ListThingRegistrationTaskReportsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingRegistrationTaskReportsError {
fn from(err: serde_json::error::Error) -> ListThingRegistrationTaskReportsError {
ListThingRegistrationTaskReportsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingRegistrationTaskReportsError {
fn from(err: CredentialsError) -> ListThingRegistrationTaskReportsError {
ListThingRegistrationTaskReportsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingRegistrationTaskReportsError {
fn from(err: HttpDispatchError) -> ListThingRegistrationTaskReportsError {
ListThingRegistrationTaskReportsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingRegistrationTaskReportsError {
fn from(err: io::Error) -> ListThingRegistrationTaskReportsError {
ListThingRegistrationTaskReportsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingRegistrationTaskReportsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingRegistrationTaskReportsError {
fn description(&self) -> &str {
match *self {
ListThingRegistrationTaskReportsError::InternalFailure(ref cause) => cause,
ListThingRegistrationTaskReportsError::InvalidRequest(ref cause) => cause,
ListThingRegistrationTaskReportsError::Throttling(ref cause) => cause,
ListThingRegistrationTaskReportsError::Unauthorized(ref cause) => cause,
ListThingRegistrationTaskReportsError::Validation(ref cause) => cause,
ListThingRegistrationTaskReportsError::Credentials(ref err) => err.description(),
ListThingRegistrationTaskReportsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListThingRegistrationTaskReportsError::ParseError(ref cause) => cause,
ListThingRegistrationTaskReportsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingRegistrationTasksError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingRegistrationTasksError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingRegistrationTasksError {
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 ListThingRegistrationTasksError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return ListThingRegistrationTasksError::InvalidRequest(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListThingRegistrationTasksError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListThingRegistrationTasksError::Unauthorized(String::from(
error_message,
))
}
"ValidationException" => {
return ListThingRegistrationTasksError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListThingRegistrationTasksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingRegistrationTasksError {
fn from(err: serde_json::error::Error) -> ListThingRegistrationTasksError {
ListThingRegistrationTasksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingRegistrationTasksError {
fn from(err: CredentialsError) -> ListThingRegistrationTasksError {
ListThingRegistrationTasksError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingRegistrationTasksError {
fn from(err: HttpDispatchError) -> ListThingRegistrationTasksError {
ListThingRegistrationTasksError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingRegistrationTasksError {
fn from(err: io::Error) -> ListThingRegistrationTasksError {
ListThingRegistrationTasksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingRegistrationTasksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingRegistrationTasksError {
fn description(&self) -> &str {
match *self {
ListThingRegistrationTasksError::InternalFailure(ref cause) => cause,
ListThingRegistrationTasksError::InvalidRequest(ref cause) => cause,
ListThingRegistrationTasksError::Throttling(ref cause) => cause,
ListThingRegistrationTasksError::Unauthorized(ref cause) => cause,
ListThingRegistrationTasksError::Validation(ref cause) => cause,
ListThingRegistrationTasksError::Credentials(ref err) => err.description(),
ListThingRegistrationTasksError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListThingRegistrationTasksError::ParseError(ref cause) => cause,
ListThingRegistrationTasksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingTypesError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingTypesError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingTypesError {
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 ListThingTypesError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListThingTypesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListThingTypesError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListThingTypesError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListThingTypesError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListThingTypesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListThingTypesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingTypesError {
fn from(err: serde_json::error::Error) -> ListThingTypesError {
ListThingTypesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingTypesError {
fn from(err: CredentialsError) -> ListThingTypesError {
ListThingTypesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingTypesError {
fn from(err: HttpDispatchError) -> ListThingTypesError {
ListThingTypesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingTypesError {
fn from(err: io::Error) -> ListThingTypesError {
ListThingTypesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingTypesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingTypesError {
fn description(&self) -> &str {
match *self {
ListThingTypesError::InternalFailure(ref cause) => cause,
ListThingTypesError::InvalidRequest(ref cause) => cause,
ListThingTypesError::ServiceUnavailable(ref cause) => cause,
ListThingTypesError::Throttling(ref cause) => cause,
ListThingTypesError::Unauthorized(ref cause) => cause,
ListThingTypesError::Validation(ref cause) => cause,
ListThingTypesError::Credentials(ref err) => err.description(),
ListThingTypesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListThingTypesError::ParseError(ref cause) => cause,
ListThingTypesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingsError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingsError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingsError {
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 ListThingsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListThingsError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListThingsError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return ListThingsError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return ListThingsError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ListThingsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListThingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingsError {
fn from(err: serde_json::error::Error) -> ListThingsError {
ListThingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingsError {
fn from(err: CredentialsError) -> ListThingsError {
ListThingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingsError {
fn from(err: HttpDispatchError) -> ListThingsError {
ListThingsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingsError {
fn from(err: io::Error) -> ListThingsError {
ListThingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingsError {
fn description(&self) -> &str {
match *self {
ListThingsError::InternalFailure(ref cause) => cause,
ListThingsError::InvalidRequest(ref cause) => cause,
ListThingsError::ServiceUnavailable(ref cause) => cause,
ListThingsError::Throttling(ref cause) => cause,
ListThingsError::Unauthorized(ref cause) => cause,
ListThingsError::Validation(ref cause) => cause,
ListThingsError::Credentials(ref err) => err.description(),
ListThingsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListThingsError::ParseError(ref cause) => cause,
ListThingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListThingsInThingGroupError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListThingsInThingGroupError {
pub fn from_response(res: BufferedHttpResponse) -> ListThingsInThingGroupError {
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 ListThingsInThingGroupError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListThingsInThingGroupError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return ListThingsInThingGroupError::ResourceNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return ListThingsInThingGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListThingsInThingGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListThingsInThingGroupError {
fn from(err: serde_json::error::Error) -> ListThingsInThingGroupError {
ListThingsInThingGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListThingsInThingGroupError {
fn from(err: CredentialsError) -> ListThingsInThingGroupError {
ListThingsInThingGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListThingsInThingGroupError {
fn from(err: HttpDispatchError) -> ListThingsInThingGroupError {
ListThingsInThingGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for ListThingsInThingGroupError {
fn from(err: io::Error) -> ListThingsInThingGroupError {
ListThingsInThingGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListThingsInThingGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListThingsInThingGroupError {
fn description(&self) -> &str {
match *self {
ListThingsInThingGroupError::InternalFailure(ref cause) => cause,
ListThingsInThingGroupError::InvalidRequest(ref cause) => cause,
ListThingsInThingGroupError::ResourceNotFound(ref cause) => cause,
ListThingsInThingGroupError::Validation(ref cause) => cause,
ListThingsInThingGroupError::Credentials(ref err) => err.description(),
ListThingsInThingGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListThingsInThingGroupError::ParseError(ref cause) => cause,
ListThingsInThingGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTopicRulesError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTopicRulesError {
pub fn from_response(res: BufferedHttpResponse) -> ListTopicRulesError {
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 {
"InternalException" => {
return ListTopicRulesError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return ListTopicRulesError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListTopicRulesError::ServiceUnavailable(String::from(error_message))
}
"ValidationException" => {
return ListTopicRulesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListTopicRulesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTopicRulesError {
fn from(err: serde_json::error::Error) -> ListTopicRulesError {
ListTopicRulesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTopicRulesError {
fn from(err: CredentialsError) -> ListTopicRulesError {
ListTopicRulesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTopicRulesError {
fn from(err: HttpDispatchError) -> ListTopicRulesError {
ListTopicRulesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTopicRulesError {
fn from(err: io::Error) -> ListTopicRulesError {
ListTopicRulesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTopicRulesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTopicRulesError {
fn description(&self) -> &str {
match *self {
ListTopicRulesError::Internal(ref cause) => cause,
ListTopicRulesError::InvalidRequest(ref cause) => cause,
ListTopicRulesError::ServiceUnavailable(ref cause) => cause,
ListTopicRulesError::Validation(ref cause) => cause,
ListTopicRulesError::Credentials(ref err) => err.description(),
ListTopicRulesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListTopicRulesError::ParseError(ref cause) => cause,
ListTopicRulesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListV2LoggingLevelsError {
Internal(String),
InvalidRequest(String),
NotConfigured(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListV2LoggingLevelsError {
pub fn from_response(res: BufferedHttpResponse) -> ListV2LoggingLevelsError {
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 {
"InternalException" => {
return ListV2LoggingLevelsError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return ListV2LoggingLevelsError::InvalidRequest(String::from(error_message))
}
"NotConfiguredException" => {
return ListV2LoggingLevelsError::NotConfigured(String::from(error_message))
}
"ServiceUnavailableException" => {
return ListV2LoggingLevelsError::ServiceUnavailable(String::from(error_message))
}
"ValidationException" => {
return ListV2LoggingLevelsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListV2LoggingLevelsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListV2LoggingLevelsError {
fn from(err: serde_json::error::Error) -> ListV2LoggingLevelsError {
ListV2LoggingLevelsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListV2LoggingLevelsError {
fn from(err: CredentialsError) -> ListV2LoggingLevelsError {
ListV2LoggingLevelsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListV2LoggingLevelsError {
fn from(err: HttpDispatchError) -> ListV2LoggingLevelsError {
ListV2LoggingLevelsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListV2LoggingLevelsError {
fn from(err: io::Error) -> ListV2LoggingLevelsError {
ListV2LoggingLevelsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListV2LoggingLevelsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListV2LoggingLevelsError {
fn description(&self) -> &str {
match *self {
ListV2LoggingLevelsError::Internal(ref cause) => cause,
ListV2LoggingLevelsError::InvalidRequest(ref cause) => cause,
ListV2LoggingLevelsError::NotConfigured(ref cause) => cause,
ListV2LoggingLevelsError::ServiceUnavailable(ref cause) => cause,
ListV2LoggingLevelsError::Validation(ref cause) => cause,
ListV2LoggingLevelsError::Credentials(ref err) => err.description(),
ListV2LoggingLevelsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListV2LoggingLevelsError::ParseError(ref cause) => cause,
ListV2LoggingLevelsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListViolationEventsError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListViolationEventsError {
pub fn from_response(res: BufferedHttpResponse) -> ListViolationEventsError {
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 ListViolationEventsError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return ListViolationEventsError::InvalidRequest(String::from(error_message))
}
"ThrottlingException" => {
return ListViolationEventsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListViolationEventsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListViolationEventsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListViolationEventsError {
fn from(err: serde_json::error::Error) -> ListViolationEventsError {
ListViolationEventsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListViolationEventsError {
fn from(err: CredentialsError) -> ListViolationEventsError {
ListViolationEventsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListViolationEventsError {
fn from(err: HttpDispatchError) -> ListViolationEventsError {
ListViolationEventsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListViolationEventsError {
fn from(err: io::Error) -> ListViolationEventsError {
ListViolationEventsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListViolationEventsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListViolationEventsError {
fn description(&self) -> &str {
match *self {
ListViolationEventsError::InternalFailure(ref cause) => cause,
ListViolationEventsError::InvalidRequest(ref cause) => cause,
ListViolationEventsError::Throttling(ref cause) => cause,
ListViolationEventsError::Validation(ref cause) => cause,
ListViolationEventsError::Credentials(ref err) => err.description(),
ListViolationEventsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListViolationEventsError::ParseError(ref cause) => cause,
ListViolationEventsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RegisterCACertificateError {
CertificateValidation(String),
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
RegistrationCodeValidation(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RegisterCACertificateError {
pub fn from_response(res: BufferedHttpResponse) -> RegisterCACertificateError {
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 {
"CertificateValidationException" => {
return RegisterCACertificateError::CertificateValidation(String::from(
error_message,
))
}
"InternalFailureException" => {
return RegisterCACertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return RegisterCACertificateError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return RegisterCACertificateError::LimitExceeded(String::from(error_message))
}
"RegistrationCodeValidationException" => {
return RegisterCACertificateError::RegistrationCodeValidation(String::from(
error_message,
))
}
"ResourceAlreadyExistsException" => {
return RegisterCACertificateError::ResourceAlreadyExists(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return RegisterCACertificateError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return RegisterCACertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return RegisterCACertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return RegisterCACertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return RegisterCACertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RegisterCACertificateError {
fn from(err: serde_json::error::Error) -> RegisterCACertificateError {
RegisterCACertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RegisterCACertificateError {
fn from(err: CredentialsError) -> RegisterCACertificateError {
RegisterCACertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for RegisterCACertificateError {
fn from(err: HttpDispatchError) -> RegisterCACertificateError {
RegisterCACertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for RegisterCACertificateError {
fn from(err: io::Error) -> RegisterCACertificateError {
RegisterCACertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RegisterCACertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RegisterCACertificateError {
fn description(&self) -> &str {
match *self {
RegisterCACertificateError::CertificateValidation(ref cause) => cause,
RegisterCACertificateError::InternalFailure(ref cause) => cause,
RegisterCACertificateError::InvalidRequest(ref cause) => cause,
RegisterCACertificateError::LimitExceeded(ref cause) => cause,
RegisterCACertificateError::RegistrationCodeValidation(ref cause) => cause,
RegisterCACertificateError::ResourceAlreadyExists(ref cause) => cause,
RegisterCACertificateError::ServiceUnavailable(ref cause) => cause,
RegisterCACertificateError::Throttling(ref cause) => cause,
RegisterCACertificateError::Unauthorized(ref cause) => cause,
RegisterCACertificateError::Validation(ref cause) => cause,
RegisterCACertificateError::Credentials(ref err) => err.description(),
RegisterCACertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RegisterCACertificateError::ParseError(ref cause) => cause,
RegisterCACertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RegisterCertificateError {
CertificateConflict(String),
CertificateState(String),
CertificateValidation(String),
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RegisterCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> RegisterCertificateError {
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 {
"CertificateConflictException" => {
return RegisterCertificateError::CertificateConflict(String::from(
error_message,
))
}
"CertificateStateException" => {
return RegisterCertificateError::CertificateState(String::from(error_message))
}
"CertificateValidationException" => {
return RegisterCertificateError::CertificateValidation(String::from(
error_message,
))
}
"InternalFailureException" => {
return RegisterCertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return RegisterCertificateError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return RegisterCertificateError::ResourceAlreadyExists(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return RegisterCertificateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return RegisterCertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return RegisterCertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return RegisterCertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return RegisterCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RegisterCertificateError {
fn from(err: serde_json::error::Error) -> RegisterCertificateError {
RegisterCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RegisterCertificateError {
fn from(err: CredentialsError) -> RegisterCertificateError {
RegisterCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for RegisterCertificateError {
fn from(err: HttpDispatchError) -> RegisterCertificateError {
RegisterCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for RegisterCertificateError {
fn from(err: io::Error) -> RegisterCertificateError {
RegisterCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RegisterCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RegisterCertificateError {
fn description(&self) -> &str {
match *self {
RegisterCertificateError::CertificateConflict(ref cause) => cause,
RegisterCertificateError::CertificateState(ref cause) => cause,
RegisterCertificateError::CertificateValidation(ref cause) => cause,
RegisterCertificateError::InternalFailure(ref cause) => cause,
RegisterCertificateError::InvalidRequest(ref cause) => cause,
RegisterCertificateError::ResourceAlreadyExists(ref cause) => cause,
RegisterCertificateError::ServiceUnavailable(ref cause) => cause,
RegisterCertificateError::Throttling(ref cause) => cause,
RegisterCertificateError::Unauthorized(ref cause) => cause,
RegisterCertificateError::Validation(ref cause) => cause,
RegisterCertificateError::Credentials(ref err) => err.description(),
RegisterCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RegisterCertificateError::ParseError(ref cause) => cause,
RegisterCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RegisterThingError {
ConflictingResourceUpdate(String),
InternalFailure(String),
InvalidRequest(String),
ResourceRegistrationFailure(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RegisterThingError {
pub fn from_response(res: BufferedHttpResponse) -> RegisterThingError {
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 {
"ConflictingResourceUpdateException" => {
return RegisterThingError::ConflictingResourceUpdate(String::from(
error_message,
))
}
"InternalFailureException" => {
return RegisterThingError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return RegisterThingError::InvalidRequest(String::from(error_message))
}
"ResourceRegistrationFailureException" => {
return RegisterThingError::ResourceRegistrationFailure(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return RegisterThingError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return RegisterThingError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return RegisterThingError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return RegisterThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return RegisterThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RegisterThingError {
fn from(err: serde_json::error::Error) -> RegisterThingError {
RegisterThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RegisterThingError {
fn from(err: CredentialsError) -> RegisterThingError {
RegisterThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for RegisterThingError {
fn from(err: HttpDispatchError) -> RegisterThingError {
RegisterThingError::HttpDispatch(err)
}
}
impl From<io::Error> for RegisterThingError {
fn from(err: io::Error) -> RegisterThingError {
RegisterThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RegisterThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RegisterThingError {
fn description(&self) -> &str {
match *self {
RegisterThingError::ConflictingResourceUpdate(ref cause) => cause,
RegisterThingError::InternalFailure(ref cause) => cause,
RegisterThingError::InvalidRequest(ref cause) => cause,
RegisterThingError::ResourceRegistrationFailure(ref cause) => cause,
RegisterThingError::ServiceUnavailable(ref cause) => cause,
RegisterThingError::Throttling(ref cause) => cause,
RegisterThingError::Unauthorized(ref cause) => cause,
RegisterThingError::Validation(ref cause) => cause,
RegisterThingError::Credentials(ref err) => err.description(),
RegisterThingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
RegisterThingError::ParseError(ref cause) => cause,
RegisterThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RejectCertificateTransferError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
TransferAlreadyCompleted(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RejectCertificateTransferError {
pub fn from_response(res: BufferedHttpResponse) -> RejectCertificateTransferError {
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 RejectCertificateTransferError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return RejectCertificateTransferError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return RejectCertificateTransferError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return RejectCertificateTransferError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return RejectCertificateTransferError::Throttling(String::from(error_message))
}
"TransferAlreadyCompletedException" => {
return RejectCertificateTransferError::TransferAlreadyCompleted(String::from(
error_message,
))
}
"UnauthorizedException" => {
return RejectCertificateTransferError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return RejectCertificateTransferError::Validation(error_message.to_string())
}
_ => {}
}
}
return RejectCertificateTransferError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RejectCertificateTransferError {
fn from(err: serde_json::error::Error) -> RejectCertificateTransferError {
RejectCertificateTransferError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RejectCertificateTransferError {
fn from(err: CredentialsError) -> RejectCertificateTransferError {
RejectCertificateTransferError::Credentials(err)
}
}
impl From<HttpDispatchError> for RejectCertificateTransferError {
fn from(err: HttpDispatchError) -> RejectCertificateTransferError {
RejectCertificateTransferError::HttpDispatch(err)
}
}
impl From<io::Error> for RejectCertificateTransferError {
fn from(err: io::Error) -> RejectCertificateTransferError {
RejectCertificateTransferError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RejectCertificateTransferError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RejectCertificateTransferError {
fn description(&self) -> &str {
match *self {
RejectCertificateTransferError::InternalFailure(ref cause) => cause,
RejectCertificateTransferError::InvalidRequest(ref cause) => cause,
RejectCertificateTransferError::ResourceNotFound(ref cause) => cause,
RejectCertificateTransferError::ServiceUnavailable(ref cause) => cause,
RejectCertificateTransferError::Throttling(ref cause) => cause,
RejectCertificateTransferError::TransferAlreadyCompleted(ref cause) => cause,
RejectCertificateTransferError::Unauthorized(ref cause) => cause,
RejectCertificateTransferError::Validation(ref cause) => cause,
RejectCertificateTransferError::Credentials(ref err) => err.description(),
RejectCertificateTransferError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RejectCertificateTransferError::ParseError(ref cause) => cause,
RejectCertificateTransferError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RemoveThingFromThingGroupError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RemoveThingFromThingGroupError {
pub fn from_response(res: BufferedHttpResponse) -> RemoveThingFromThingGroupError {
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 RemoveThingFromThingGroupError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return RemoveThingFromThingGroupError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return RemoveThingFromThingGroupError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return RemoveThingFromThingGroupError::Throttling(String::from(error_message))
}
"ValidationException" => {
return RemoveThingFromThingGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return RemoveThingFromThingGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RemoveThingFromThingGroupError {
fn from(err: serde_json::error::Error) -> RemoveThingFromThingGroupError {
RemoveThingFromThingGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RemoveThingFromThingGroupError {
fn from(err: CredentialsError) -> RemoveThingFromThingGroupError {
RemoveThingFromThingGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for RemoveThingFromThingGroupError {
fn from(err: HttpDispatchError) -> RemoveThingFromThingGroupError {
RemoveThingFromThingGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for RemoveThingFromThingGroupError {
fn from(err: io::Error) -> RemoveThingFromThingGroupError {
RemoveThingFromThingGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RemoveThingFromThingGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RemoveThingFromThingGroupError {
fn description(&self) -> &str {
match *self {
RemoveThingFromThingGroupError::InternalFailure(ref cause) => cause,
RemoveThingFromThingGroupError::InvalidRequest(ref cause) => cause,
RemoveThingFromThingGroupError::ResourceNotFound(ref cause) => cause,
RemoveThingFromThingGroupError::Throttling(ref cause) => cause,
RemoveThingFromThingGroupError::Validation(ref cause) => cause,
RemoveThingFromThingGroupError::Credentials(ref err) => err.description(),
RemoveThingFromThingGroupError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RemoveThingFromThingGroupError::ParseError(ref cause) => cause,
RemoveThingFromThingGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ReplaceTopicRuleError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
SqlParse(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ReplaceTopicRuleError {
pub fn from_response(res: BufferedHttpResponse) -> ReplaceTopicRuleError {
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 {
"InternalException" => {
return ReplaceTopicRuleError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return ReplaceTopicRuleError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return ReplaceTopicRuleError::ServiceUnavailable(String::from(error_message))
}
"SqlParseException" => {
return ReplaceTopicRuleError::SqlParse(String::from(error_message))
}
"UnauthorizedException" => {
return ReplaceTopicRuleError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return ReplaceTopicRuleError::Validation(error_message.to_string())
}
_ => {}
}
}
return ReplaceTopicRuleError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ReplaceTopicRuleError {
fn from(err: serde_json::error::Error) -> ReplaceTopicRuleError {
ReplaceTopicRuleError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ReplaceTopicRuleError {
fn from(err: CredentialsError) -> ReplaceTopicRuleError {
ReplaceTopicRuleError::Credentials(err)
}
}
impl From<HttpDispatchError> for ReplaceTopicRuleError {
fn from(err: HttpDispatchError) -> ReplaceTopicRuleError {
ReplaceTopicRuleError::HttpDispatch(err)
}
}
impl From<io::Error> for ReplaceTopicRuleError {
fn from(err: io::Error) -> ReplaceTopicRuleError {
ReplaceTopicRuleError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ReplaceTopicRuleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ReplaceTopicRuleError {
fn description(&self) -> &str {
match *self {
ReplaceTopicRuleError::Internal(ref cause) => cause,
ReplaceTopicRuleError::InvalidRequest(ref cause) => cause,
ReplaceTopicRuleError::ServiceUnavailable(ref cause) => cause,
ReplaceTopicRuleError::SqlParse(ref cause) => cause,
ReplaceTopicRuleError::Unauthorized(ref cause) => cause,
ReplaceTopicRuleError::Validation(ref cause) => cause,
ReplaceTopicRuleError::Credentials(ref err) => err.description(),
ReplaceTopicRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ReplaceTopicRuleError::ParseError(ref cause) => cause,
ReplaceTopicRuleError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchIndexError {
IndexNotReady(String),
InternalFailure(String),
InvalidQuery(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchIndexError {
pub fn from_response(res: BufferedHttpResponse) -> SearchIndexError {
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 {
"IndexNotReadyException" => {
return SearchIndexError::IndexNotReady(String::from(error_message))
}
"InternalFailureException" => {
return SearchIndexError::InternalFailure(String::from(error_message))
}
"InvalidQueryException" => {
return SearchIndexError::InvalidQuery(String::from(error_message))
}
"InvalidRequestException" => {
return SearchIndexError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return SearchIndexError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return SearchIndexError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return SearchIndexError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return SearchIndexError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return SearchIndexError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchIndexError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchIndexError {
fn from(err: serde_json::error::Error) -> SearchIndexError {
SearchIndexError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchIndexError {
fn from(err: CredentialsError) -> SearchIndexError {
SearchIndexError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchIndexError {
fn from(err: HttpDispatchError) -> SearchIndexError {
SearchIndexError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchIndexError {
fn from(err: io::Error) -> SearchIndexError {
SearchIndexError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchIndexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchIndexError {
fn description(&self) -> &str {
match *self {
SearchIndexError::IndexNotReady(ref cause) => cause,
SearchIndexError::InternalFailure(ref cause) => cause,
SearchIndexError::InvalidQuery(ref cause) => cause,
SearchIndexError::InvalidRequest(ref cause) => cause,
SearchIndexError::ResourceNotFound(ref cause) => cause,
SearchIndexError::ServiceUnavailable(ref cause) => cause,
SearchIndexError::Throttling(ref cause) => cause,
SearchIndexError::Unauthorized(ref cause) => cause,
SearchIndexError::Validation(ref cause) => cause,
SearchIndexError::Credentials(ref err) => err.description(),
SearchIndexError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchIndexError::ParseError(ref cause) => cause,
SearchIndexError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetDefaultAuthorizerError {
InternalFailure(String),
InvalidRequest(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetDefaultAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> SetDefaultAuthorizerError {
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 SetDefaultAuthorizerError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return SetDefaultAuthorizerError::InvalidRequest(String::from(error_message))
}
"ResourceAlreadyExistsException" => {
return SetDefaultAuthorizerError::ResourceAlreadyExists(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return SetDefaultAuthorizerError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return SetDefaultAuthorizerError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return SetDefaultAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return SetDefaultAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return SetDefaultAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return SetDefaultAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetDefaultAuthorizerError {
fn from(err: serde_json::error::Error) -> SetDefaultAuthorizerError {
SetDefaultAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetDefaultAuthorizerError {
fn from(err: CredentialsError) -> SetDefaultAuthorizerError {
SetDefaultAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetDefaultAuthorizerError {
fn from(err: HttpDispatchError) -> SetDefaultAuthorizerError {
SetDefaultAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for SetDefaultAuthorizerError {
fn from(err: io::Error) -> SetDefaultAuthorizerError {
SetDefaultAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetDefaultAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetDefaultAuthorizerError {
fn description(&self) -> &str {
match *self {
SetDefaultAuthorizerError::InternalFailure(ref cause) => cause,
SetDefaultAuthorizerError::InvalidRequest(ref cause) => cause,
SetDefaultAuthorizerError::ResourceAlreadyExists(ref cause) => cause,
SetDefaultAuthorizerError::ResourceNotFound(ref cause) => cause,
SetDefaultAuthorizerError::ServiceUnavailable(ref cause) => cause,
SetDefaultAuthorizerError::Throttling(ref cause) => cause,
SetDefaultAuthorizerError::Unauthorized(ref cause) => cause,
SetDefaultAuthorizerError::Validation(ref cause) => cause,
SetDefaultAuthorizerError::Credentials(ref err) => err.description(),
SetDefaultAuthorizerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetDefaultAuthorizerError::ParseError(ref cause) => cause,
SetDefaultAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetDefaultPolicyVersionError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetDefaultPolicyVersionError {
pub fn from_response(res: BufferedHttpResponse) -> SetDefaultPolicyVersionError {
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 SetDefaultPolicyVersionError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return SetDefaultPolicyVersionError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return SetDefaultPolicyVersionError::ResourceNotFound(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return SetDefaultPolicyVersionError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return SetDefaultPolicyVersionError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return SetDefaultPolicyVersionError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return SetDefaultPolicyVersionError::Validation(error_message.to_string())
}
_ => {}
}
}
return SetDefaultPolicyVersionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetDefaultPolicyVersionError {
fn from(err: serde_json::error::Error) -> SetDefaultPolicyVersionError {
SetDefaultPolicyVersionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetDefaultPolicyVersionError {
fn from(err: CredentialsError) -> SetDefaultPolicyVersionError {
SetDefaultPolicyVersionError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetDefaultPolicyVersionError {
fn from(err: HttpDispatchError) -> SetDefaultPolicyVersionError {
SetDefaultPolicyVersionError::HttpDispatch(err)
}
}
impl From<io::Error> for SetDefaultPolicyVersionError {
fn from(err: io::Error) -> SetDefaultPolicyVersionError {
SetDefaultPolicyVersionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetDefaultPolicyVersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetDefaultPolicyVersionError {
fn description(&self) -> &str {
match *self {
SetDefaultPolicyVersionError::InternalFailure(ref cause) => cause,
SetDefaultPolicyVersionError::InvalidRequest(ref cause) => cause,
SetDefaultPolicyVersionError::ResourceNotFound(ref cause) => cause,
SetDefaultPolicyVersionError::ServiceUnavailable(ref cause) => cause,
SetDefaultPolicyVersionError::Throttling(ref cause) => cause,
SetDefaultPolicyVersionError::Unauthorized(ref cause) => cause,
SetDefaultPolicyVersionError::Validation(ref cause) => cause,
SetDefaultPolicyVersionError::Credentials(ref err) => err.description(),
SetDefaultPolicyVersionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetDefaultPolicyVersionError::ParseError(ref cause) => cause,
SetDefaultPolicyVersionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetLoggingOptionsError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetLoggingOptionsError {
pub fn from_response(res: BufferedHttpResponse) -> SetLoggingOptionsError {
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 {
"InternalException" => {
return SetLoggingOptionsError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return SetLoggingOptionsError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return SetLoggingOptionsError::ServiceUnavailable(String::from(error_message))
}
"ValidationException" => {
return SetLoggingOptionsError::Validation(error_message.to_string())
}
_ => {}
}
}
return SetLoggingOptionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetLoggingOptionsError {
fn from(err: serde_json::error::Error) -> SetLoggingOptionsError {
SetLoggingOptionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetLoggingOptionsError {
fn from(err: CredentialsError) -> SetLoggingOptionsError {
SetLoggingOptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetLoggingOptionsError {
fn from(err: HttpDispatchError) -> SetLoggingOptionsError {
SetLoggingOptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for SetLoggingOptionsError {
fn from(err: io::Error) -> SetLoggingOptionsError {
SetLoggingOptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetLoggingOptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetLoggingOptionsError {
fn description(&self) -> &str {
match *self {
SetLoggingOptionsError::Internal(ref cause) => cause,
SetLoggingOptionsError::InvalidRequest(ref cause) => cause,
SetLoggingOptionsError::ServiceUnavailable(ref cause) => cause,
SetLoggingOptionsError::Validation(ref cause) => cause,
SetLoggingOptionsError::Credentials(ref err) => err.description(),
SetLoggingOptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetLoggingOptionsError::ParseError(ref cause) => cause,
SetLoggingOptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetV2LoggingLevelError {
Internal(String),
InvalidRequest(String),
NotConfigured(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetV2LoggingLevelError {
pub fn from_response(res: BufferedHttpResponse) -> SetV2LoggingLevelError {
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 {
"InternalException" => {
return SetV2LoggingLevelError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return SetV2LoggingLevelError::InvalidRequest(String::from(error_message))
}
"NotConfiguredException" => {
return SetV2LoggingLevelError::NotConfigured(String::from(error_message))
}
"ServiceUnavailableException" => {
return SetV2LoggingLevelError::ServiceUnavailable(String::from(error_message))
}
"ValidationException" => {
return SetV2LoggingLevelError::Validation(error_message.to_string())
}
_ => {}
}
}
return SetV2LoggingLevelError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetV2LoggingLevelError {
fn from(err: serde_json::error::Error) -> SetV2LoggingLevelError {
SetV2LoggingLevelError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetV2LoggingLevelError {
fn from(err: CredentialsError) -> SetV2LoggingLevelError {
SetV2LoggingLevelError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetV2LoggingLevelError {
fn from(err: HttpDispatchError) -> SetV2LoggingLevelError {
SetV2LoggingLevelError::HttpDispatch(err)
}
}
impl From<io::Error> for SetV2LoggingLevelError {
fn from(err: io::Error) -> SetV2LoggingLevelError {
SetV2LoggingLevelError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetV2LoggingLevelError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetV2LoggingLevelError {
fn description(&self) -> &str {
match *self {
SetV2LoggingLevelError::Internal(ref cause) => cause,
SetV2LoggingLevelError::InvalidRequest(ref cause) => cause,
SetV2LoggingLevelError::NotConfigured(ref cause) => cause,
SetV2LoggingLevelError::ServiceUnavailable(ref cause) => cause,
SetV2LoggingLevelError::Validation(ref cause) => cause,
SetV2LoggingLevelError::Credentials(ref err) => err.description(),
SetV2LoggingLevelError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetV2LoggingLevelError::ParseError(ref cause) => cause,
SetV2LoggingLevelError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetV2LoggingOptionsError {
Internal(String),
InvalidRequest(String),
ServiceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetV2LoggingOptionsError {
pub fn from_response(res: BufferedHttpResponse) -> SetV2LoggingOptionsError {
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 {
"InternalException" => {
return SetV2LoggingOptionsError::Internal(String::from(error_message))
}
"InvalidRequestException" => {
return SetV2LoggingOptionsError::InvalidRequest(String::from(error_message))
}
"ServiceUnavailableException" => {
return SetV2LoggingOptionsError::ServiceUnavailable(String::from(error_message))
}
"ValidationException" => {
return SetV2LoggingOptionsError::Validation(error_message.to_string())
}
_ => {}
}
}
return SetV2LoggingOptionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SetV2LoggingOptionsError {
fn from(err: serde_json::error::Error) -> SetV2LoggingOptionsError {
SetV2LoggingOptionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SetV2LoggingOptionsError {
fn from(err: CredentialsError) -> SetV2LoggingOptionsError {
SetV2LoggingOptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetV2LoggingOptionsError {
fn from(err: HttpDispatchError) -> SetV2LoggingOptionsError {
SetV2LoggingOptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for SetV2LoggingOptionsError {
fn from(err: io::Error) -> SetV2LoggingOptionsError {
SetV2LoggingOptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetV2LoggingOptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetV2LoggingOptionsError {
fn description(&self) -> &str {
match *self {
SetV2LoggingOptionsError::Internal(ref cause) => cause,
SetV2LoggingOptionsError::InvalidRequest(ref cause) => cause,
SetV2LoggingOptionsError::ServiceUnavailable(ref cause) => cause,
SetV2LoggingOptionsError::Validation(ref cause) => cause,
SetV2LoggingOptionsError::Credentials(ref err) => err.description(),
SetV2LoggingOptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetV2LoggingOptionsError::ParseError(ref cause) => cause,
SetV2LoggingOptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartOnDemandAuditTaskError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartOnDemandAuditTaskError {
pub fn from_response(res: BufferedHttpResponse) -> StartOnDemandAuditTaskError {
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 StartOnDemandAuditTaskError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return StartOnDemandAuditTaskError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return StartOnDemandAuditTaskError::LimitExceeded(String::from(error_message))
}
"ThrottlingException" => {
return StartOnDemandAuditTaskError::Throttling(String::from(error_message))
}
"ValidationException" => {
return StartOnDemandAuditTaskError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartOnDemandAuditTaskError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartOnDemandAuditTaskError {
fn from(err: serde_json::error::Error) -> StartOnDemandAuditTaskError {
StartOnDemandAuditTaskError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartOnDemandAuditTaskError {
fn from(err: CredentialsError) -> StartOnDemandAuditTaskError {
StartOnDemandAuditTaskError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartOnDemandAuditTaskError {
fn from(err: HttpDispatchError) -> StartOnDemandAuditTaskError {
StartOnDemandAuditTaskError::HttpDispatch(err)
}
}
impl From<io::Error> for StartOnDemandAuditTaskError {
fn from(err: io::Error) -> StartOnDemandAuditTaskError {
StartOnDemandAuditTaskError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartOnDemandAuditTaskError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartOnDemandAuditTaskError {
fn description(&self) -> &str {
match *self {
StartOnDemandAuditTaskError::InternalFailure(ref cause) => cause,
StartOnDemandAuditTaskError::InvalidRequest(ref cause) => cause,
StartOnDemandAuditTaskError::LimitExceeded(ref cause) => cause,
StartOnDemandAuditTaskError::Throttling(ref cause) => cause,
StartOnDemandAuditTaskError::Validation(ref cause) => cause,
StartOnDemandAuditTaskError::Credentials(ref err) => err.description(),
StartOnDemandAuditTaskError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartOnDemandAuditTaskError::ParseError(ref cause) => cause,
StartOnDemandAuditTaskError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartThingRegistrationTaskError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartThingRegistrationTaskError {
pub fn from_response(res: BufferedHttpResponse) -> StartThingRegistrationTaskError {
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 StartThingRegistrationTaskError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return StartThingRegistrationTaskError::InvalidRequest(String::from(
error_message,
))
}
"ThrottlingException" => {
return StartThingRegistrationTaskError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return StartThingRegistrationTaskError::Unauthorized(String::from(
error_message,
))
}
"ValidationException" => {
return StartThingRegistrationTaskError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartThingRegistrationTaskError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartThingRegistrationTaskError {
fn from(err: serde_json::error::Error) -> StartThingRegistrationTaskError {
StartThingRegistrationTaskError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartThingRegistrationTaskError {
fn from(err: CredentialsError) -> StartThingRegistrationTaskError {
StartThingRegistrationTaskError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartThingRegistrationTaskError {
fn from(err: HttpDispatchError) -> StartThingRegistrationTaskError {
StartThingRegistrationTaskError::HttpDispatch(err)
}
}
impl From<io::Error> for StartThingRegistrationTaskError {
fn from(err: io::Error) -> StartThingRegistrationTaskError {
StartThingRegistrationTaskError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartThingRegistrationTaskError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartThingRegistrationTaskError {
fn description(&self) -> &str {
match *self {
StartThingRegistrationTaskError::InternalFailure(ref cause) => cause,
StartThingRegistrationTaskError::InvalidRequest(ref cause) => cause,
StartThingRegistrationTaskError::Throttling(ref cause) => cause,
StartThingRegistrationTaskError::Unauthorized(ref cause) => cause,
StartThingRegistrationTaskError::Validation(ref cause) => cause,
StartThingRegistrationTaskError::Credentials(ref err) => err.description(),
StartThingRegistrationTaskError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartThingRegistrationTaskError::ParseError(ref cause) => cause,
StartThingRegistrationTaskError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StopThingRegistrationTaskError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StopThingRegistrationTaskError {
pub fn from_response(res: BufferedHttpResponse) -> StopThingRegistrationTaskError {
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 StopThingRegistrationTaskError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return StopThingRegistrationTaskError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return StopThingRegistrationTaskError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return StopThingRegistrationTaskError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return StopThingRegistrationTaskError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return StopThingRegistrationTaskError::Validation(error_message.to_string())
}
_ => {}
}
}
return StopThingRegistrationTaskError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StopThingRegistrationTaskError {
fn from(err: serde_json::error::Error) -> StopThingRegistrationTaskError {
StopThingRegistrationTaskError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StopThingRegistrationTaskError {
fn from(err: CredentialsError) -> StopThingRegistrationTaskError {
StopThingRegistrationTaskError::Credentials(err)
}
}
impl From<HttpDispatchError> for StopThingRegistrationTaskError {
fn from(err: HttpDispatchError) -> StopThingRegistrationTaskError {
StopThingRegistrationTaskError::HttpDispatch(err)
}
}
impl From<io::Error> for StopThingRegistrationTaskError {
fn from(err: io::Error) -> StopThingRegistrationTaskError {
StopThingRegistrationTaskError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StopThingRegistrationTaskError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StopThingRegistrationTaskError {
fn description(&self) -> &str {
match *self {
StopThingRegistrationTaskError::InternalFailure(ref cause) => cause,
StopThingRegistrationTaskError::InvalidRequest(ref cause) => cause,
StopThingRegistrationTaskError::ResourceNotFound(ref cause) => cause,
StopThingRegistrationTaskError::Throttling(ref cause) => cause,
StopThingRegistrationTaskError::Unauthorized(ref cause) => cause,
StopThingRegistrationTaskError::Validation(ref cause) => cause,
StopThingRegistrationTaskError::Credentials(ref err) => err.description(),
StopThingRegistrationTaskError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StopThingRegistrationTaskError::ParseError(ref cause) => cause,
StopThingRegistrationTaskError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TestAuthorizationError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TestAuthorizationError {
pub fn from_response(res: BufferedHttpResponse) -> TestAuthorizationError {
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 TestAuthorizationError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return TestAuthorizationError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return TestAuthorizationError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return TestAuthorizationError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return TestAuthorizationError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return TestAuthorizationError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return TestAuthorizationError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return TestAuthorizationError::Validation(error_message.to_string())
}
_ => {}
}
}
return TestAuthorizationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TestAuthorizationError {
fn from(err: serde_json::error::Error) -> TestAuthorizationError {
TestAuthorizationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TestAuthorizationError {
fn from(err: CredentialsError) -> TestAuthorizationError {
TestAuthorizationError::Credentials(err)
}
}
impl From<HttpDispatchError> for TestAuthorizationError {
fn from(err: HttpDispatchError) -> TestAuthorizationError {
TestAuthorizationError::HttpDispatch(err)
}
}
impl From<io::Error> for TestAuthorizationError {
fn from(err: io::Error) -> TestAuthorizationError {
TestAuthorizationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TestAuthorizationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TestAuthorizationError {
fn description(&self) -> &str {
match *self {
TestAuthorizationError::InternalFailure(ref cause) => cause,
TestAuthorizationError::InvalidRequest(ref cause) => cause,
TestAuthorizationError::LimitExceeded(ref cause) => cause,
TestAuthorizationError::ResourceNotFound(ref cause) => cause,
TestAuthorizationError::ServiceUnavailable(ref cause) => cause,
TestAuthorizationError::Throttling(ref cause) => cause,
TestAuthorizationError::Unauthorized(ref cause) => cause,
TestAuthorizationError::Validation(ref cause) => cause,
TestAuthorizationError::Credentials(ref err) => err.description(),
TestAuthorizationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
TestAuthorizationError::ParseError(ref cause) => cause,
TestAuthorizationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TestInvokeAuthorizerError {
InternalFailure(String),
InvalidRequest(String),
InvalidResponse(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TestInvokeAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> TestInvokeAuthorizerError {
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 TestInvokeAuthorizerError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return TestInvokeAuthorizerError::InvalidRequest(String::from(error_message))
}
"InvalidResponseException" => {
return TestInvokeAuthorizerError::InvalidResponse(String::from(error_message))
}
"ResourceNotFoundException" => {
return TestInvokeAuthorizerError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return TestInvokeAuthorizerError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return TestInvokeAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return TestInvokeAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return TestInvokeAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return TestInvokeAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TestInvokeAuthorizerError {
fn from(err: serde_json::error::Error) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TestInvokeAuthorizerError {
fn from(err: CredentialsError) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for TestInvokeAuthorizerError {
fn from(err: HttpDispatchError) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for TestInvokeAuthorizerError {
fn from(err: io::Error) -> TestInvokeAuthorizerError {
TestInvokeAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TestInvokeAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TestInvokeAuthorizerError {
fn description(&self) -> &str {
match *self {
TestInvokeAuthorizerError::InternalFailure(ref cause) => cause,
TestInvokeAuthorizerError::InvalidRequest(ref cause) => cause,
TestInvokeAuthorizerError::InvalidResponse(ref cause) => cause,
TestInvokeAuthorizerError::ResourceNotFound(ref cause) => cause,
TestInvokeAuthorizerError::ServiceUnavailable(ref cause) => cause,
TestInvokeAuthorizerError::Throttling(ref cause) => cause,
TestInvokeAuthorizerError::Unauthorized(ref cause) => cause,
TestInvokeAuthorizerError::Validation(ref cause) => cause,
TestInvokeAuthorizerError::Credentials(ref err) => err.description(),
TestInvokeAuthorizerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
TestInvokeAuthorizerError::ParseError(ref cause) => cause,
TestInvokeAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TransferCertificateError {
CertificateState(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
TransferConflict(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TransferCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> TransferCertificateError {
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 {
"CertificateStateException" => {
return TransferCertificateError::CertificateState(String::from(error_message))
}
"InternalFailureException" => {
return TransferCertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return TransferCertificateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return TransferCertificateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return TransferCertificateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return TransferCertificateError::Throttling(String::from(error_message))
}
"TransferConflictException" => {
return TransferCertificateError::TransferConflict(String::from(error_message))
}
"UnauthorizedException" => {
return TransferCertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return TransferCertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return TransferCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TransferCertificateError {
fn from(err: serde_json::error::Error) -> TransferCertificateError {
TransferCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TransferCertificateError {
fn from(err: CredentialsError) -> TransferCertificateError {
TransferCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for TransferCertificateError {
fn from(err: HttpDispatchError) -> TransferCertificateError {
TransferCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for TransferCertificateError {
fn from(err: io::Error) -> TransferCertificateError {
TransferCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TransferCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TransferCertificateError {
fn description(&self) -> &str {
match *self {
TransferCertificateError::CertificateState(ref cause) => cause,
TransferCertificateError::InternalFailure(ref cause) => cause,
TransferCertificateError::InvalidRequest(ref cause) => cause,
TransferCertificateError::ResourceNotFound(ref cause) => cause,
TransferCertificateError::ServiceUnavailable(ref cause) => cause,
TransferCertificateError::Throttling(ref cause) => cause,
TransferCertificateError::TransferConflict(ref cause) => cause,
TransferCertificateError::Unauthorized(ref cause) => cause,
TransferCertificateError::Validation(ref cause) => cause,
TransferCertificateError::Credentials(ref err) => err.description(),
TransferCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
TransferCertificateError::ParseError(ref cause) => cause,
TransferCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateAccountAuditConfigurationError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateAccountAuditConfigurationError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateAccountAuditConfigurationError {
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 UpdateAccountAuditConfigurationError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return UpdateAccountAuditConfigurationError::InvalidRequest(String::from(
error_message,
))
}
"ThrottlingException" => {
return UpdateAccountAuditConfigurationError::Throttling(String::from(
error_message,
))
}
"ValidationException" => {
return UpdateAccountAuditConfigurationError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return UpdateAccountAuditConfigurationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateAccountAuditConfigurationError {
fn from(err: serde_json::error::Error) -> UpdateAccountAuditConfigurationError {
UpdateAccountAuditConfigurationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateAccountAuditConfigurationError {
fn from(err: CredentialsError) -> UpdateAccountAuditConfigurationError {
UpdateAccountAuditConfigurationError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateAccountAuditConfigurationError {
fn from(err: HttpDispatchError) -> UpdateAccountAuditConfigurationError {
UpdateAccountAuditConfigurationError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateAccountAuditConfigurationError {
fn from(err: io::Error) -> UpdateAccountAuditConfigurationError {
UpdateAccountAuditConfigurationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateAccountAuditConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateAccountAuditConfigurationError {
fn description(&self) -> &str {
match *self {
UpdateAccountAuditConfigurationError::InternalFailure(ref cause) => cause,
UpdateAccountAuditConfigurationError::InvalidRequest(ref cause) => cause,
UpdateAccountAuditConfigurationError::Throttling(ref cause) => cause,
UpdateAccountAuditConfigurationError::Validation(ref cause) => cause,
UpdateAccountAuditConfigurationError::Credentials(ref err) => err.description(),
UpdateAccountAuditConfigurationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateAccountAuditConfigurationError::ParseError(ref cause) => cause,
UpdateAccountAuditConfigurationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateAuthorizerError {
InternalFailure(String),
InvalidRequest(String),
LimitExceeded(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateAuthorizerError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateAuthorizerError {
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 UpdateAuthorizerError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateAuthorizerError::InvalidRequest(String::from(error_message))
}
"LimitExceededException" => {
return UpdateAuthorizerError::LimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateAuthorizerError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return UpdateAuthorizerError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return UpdateAuthorizerError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return UpdateAuthorizerError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return UpdateAuthorizerError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateAuthorizerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateAuthorizerError {
fn from(err: serde_json::error::Error) -> UpdateAuthorizerError {
UpdateAuthorizerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateAuthorizerError {
fn from(err: CredentialsError) -> UpdateAuthorizerError {
UpdateAuthorizerError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateAuthorizerError {
fn from(err: HttpDispatchError) -> UpdateAuthorizerError {
UpdateAuthorizerError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateAuthorizerError {
fn from(err: io::Error) -> UpdateAuthorizerError {
UpdateAuthorizerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateAuthorizerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateAuthorizerError {
fn description(&self) -> &str {
match *self {
UpdateAuthorizerError::InternalFailure(ref cause) => cause,
UpdateAuthorizerError::InvalidRequest(ref cause) => cause,
UpdateAuthorizerError::LimitExceeded(ref cause) => cause,
UpdateAuthorizerError::ResourceNotFound(ref cause) => cause,
UpdateAuthorizerError::ServiceUnavailable(ref cause) => cause,
UpdateAuthorizerError::Throttling(ref cause) => cause,
UpdateAuthorizerError::Unauthorized(ref cause) => cause,
UpdateAuthorizerError::Validation(ref cause) => cause,
UpdateAuthorizerError::Credentials(ref err) => err.description(),
UpdateAuthorizerError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateAuthorizerError::ParseError(ref cause) => cause,
UpdateAuthorizerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateCACertificateError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateCACertificateError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateCACertificateError {
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 UpdateCACertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateCACertificateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateCACertificateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return UpdateCACertificateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return UpdateCACertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return UpdateCACertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return UpdateCACertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateCACertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateCACertificateError {
fn from(err: serde_json::error::Error) -> UpdateCACertificateError {
UpdateCACertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateCACertificateError {
fn from(err: CredentialsError) -> UpdateCACertificateError {
UpdateCACertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateCACertificateError {
fn from(err: HttpDispatchError) -> UpdateCACertificateError {
UpdateCACertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateCACertificateError {
fn from(err: io::Error) -> UpdateCACertificateError {
UpdateCACertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateCACertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateCACertificateError {
fn description(&self) -> &str {
match *self {
UpdateCACertificateError::InternalFailure(ref cause) => cause,
UpdateCACertificateError::InvalidRequest(ref cause) => cause,
UpdateCACertificateError::ResourceNotFound(ref cause) => cause,
UpdateCACertificateError::ServiceUnavailable(ref cause) => cause,
UpdateCACertificateError::Throttling(ref cause) => cause,
UpdateCACertificateError::Unauthorized(ref cause) => cause,
UpdateCACertificateError::Validation(ref cause) => cause,
UpdateCACertificateError::Credentials(ref err) => err.description(),
UpdateCACertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateCACertificateError::ParseError(ref cause) => cause,
UpdateCACertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateCertificateError {
CertificateState(String),
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateCertificateError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateCertificateError {
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 {
"CertificateStateException" => {
return UpdateCertificateError::CertificateState(String::from(error_message))
}
"InternalFailureException" => {
return UpdateCertificateError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateCertificateError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateCertificateError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return UpdateCertificateError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return UpdateCertificateError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return UpdateCertificateError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return UpdateCertificateError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateCertificateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateCertificateError {
fn from(err: serde_json::error::Error) -> UpdateCertificateError {
UpdateCertificateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateCertificateError {
fn from(err: CredentialsError) -> UpdateCertificateError {
UpdateCertificateError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateCertificateError {
fn from(err: HttpDispatchError) -> UpdateCertificateError {
UpdateCertificateError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateCertificateError {
fn from(err: io::Error) -> UpdateCertificateError {
UpdateCertificateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateCertificateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateCertificateError {
fn description(&self) -> &str {
match *self {
UpdateCertificateError::CertificateState(ref cause) => cause,
UpdateCertificateError::InternalFailure(ref cause) => cause,
UpdateCertificateError::InvalidRequest(ref cause) => cause,
UpdateCertificateError::ResourceNotFound(ref cause) => cause,
UpdateCertificateError::ServiceUnavailable(ref cause) => cause,
UpdateCertificateError::Throttling(ref cause) => cause,
UpdateCertificateError::Unauthorized(ref cause) => cause,
UpdateCertificateError::Validation(ref cause) => cause,
UpdateCertificateError::Credentials(ref err) => err.description(),
UpdateCertificateError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateCertificateError::ParseError(ref cause) => cause,
UpdateCertificateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateEventConfigurationsError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateEventConfigurationsError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateEventConfigurationsError {
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 UpdateEventConfigurationsError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return UpdateEventConfigurationsError::InvalidRequest(String::from(
error_message,
))
}
"ThrottlingException" => {
return UpdateEventConfigurationsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return UpdateEventConfigurationsError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateEventConfigurationsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateEventConfigurationsError {
fn from(err: serde_json::error::Error) -> UpdateEventConfigurationsError {
UpdateEventConfigurationsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateEventConfigurationsError {
fn from(err: CredentialsError) -> UpdateEventConfigurationsError {
UpdateEventConfigurationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateEventConfigurationsError {
fn from(err: HttpDispatchError) -> UpdateEventConfigurationsError {
UpdateEventConfigurationsError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateEventConfigurationsError {
fn from(err: io::Error) -> UpdateEventConfigurationsError {
UpdateEventConfigurationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateEventConfigurationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateEventConfigurationsError {
fn description(&self) -> &str {
match *self {
UpdateEventConfigurationsError::InternalFailure(ref cause) => cause,
UpdateEventConfigurationsError::InvalidRequest(ref cause) => cause,
UpdateEventConfigurationsError::Throttling(ref cause) => cause,
UpdateEventConfigurationsError::Validation(ref cause) => cause,
UpdateEventConfigurationsError::Credentials(ref err) => err.description(),
UpdateEventConfigurationsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateEventConfigurationsError::ParseError(ref cause) => cause,
UpdateEventConfigurationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateIndexingConfigurationError {
InternalFailure(String),
InvalidRequest(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateIndexingConfigurationError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateIndexingConfigurationError {
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 UpdateIndexingConfigurationError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return UpdateIndexingConfigurationError::InvalidRequest(String::from(
error_message,
))
}
"ServiceUnavailableException" => {
return UpdateIndexingConfigurationError::ServiceUnavailable(String::from(
error_message,
))
}
"ThrottlingException" => {
return UpdateIndexingConfigurationError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return UpdateIndexingConfigurationError::Unauthorized(String::from(
error_message,
))
}
"ValidationException" => {
return UpdateIndexingConfigurationError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateIndexingConfigurationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateIndexingConfigurationError {
fn from(err: serde_json::error::Error) -> UpdateIndexingConfigurationError {
UpdateIndexingConfigurationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateIndexingConfigurationError {
fn from(err: CredentialsError) -> UpdateIndexingConfigurationError {
UpdateIndexingConfigurationError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateIndexingConfigurationError {
fn from(err: HttpDispatchError) -> UpdateIndexingConfigurationError {
UpdateIndexingConfigurationError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateIndexingConfigurationError {
fn from(err: io::Error) -> UpdateIndexingConfigurationError {
UpdateIndexingConfigurationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateIndexingConfigurationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateIndexingConfigurationError {
fn description(&self) -> &str {
match *self {
UpdateIndexingConfigurationError::InternalFailure(ref cause) => cause,
UpdateIndexingConfigurationError::InvalidRequest(ref cause) => cause,
UpdateIndexingConfigurationError::ServiceUnavailable(ref cause) => cause,
UpdateIndexingConfigurationError::Throttling(ref cause) => cause,
UpdateIndexingConfigurationError::Unauthorized(ref cause) => cause,
UpdateIndexingConfigurationError::Validation(ref cause) => cause,
UpdateIndexingConfigurationError::Credentials(ref err) => err.description(),
UpdateIndexingConfigurationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateIndexingConfigurationError::ParseError(ref cause) => cause,
UpdateIndexingConfigurationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRoleAliasError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRoleAliasError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRoleAliasError {
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 UpdateRoleAliasError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateRoleAliasError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateRoleAliasError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return UpdateRoleAliasError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return UpdateRoleAliasError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return UpdateRoleAliasError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return UpdateRoleAliasError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateRoleAliasError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRoleAliasError {
fn from(err: serde_json::error::Error) -> UpdateRoleAliasError {
UpdateRoleAliasError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRoleAliasError {
fn from(err: CredentialsError) -> UpdateRoleAliasError {
UpdateRoleAliasError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRoleAliasError {
fn from(err: HttpDispatchError) -> UpdateRoleAliasError {
UpdateRoleAliasError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRoleAliasError {
fn from(err: io::Error) -> UpdateRoleAliasError {
UpdateRoleAliasError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRoleAliasError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRoleAliasError {
fn description(&self) -> &str {
match *self {
UpdateRoleAliasError::InternalFailure(ref cause) => cause,
UpdateRoleAliasError::InvalidRequest(ref cause) => cause,
UpdateRoleAliasError::ResourceNotFound(ref cause) => cause,
UpdateRoleAliasError::ServiceUnavailable(ref cause) => cause,
UpdateRoleAliasError::Throttling(ref cause) => cause,
UpdateRoleAliasError::Unauthorized(ref cause) => cause,
UpdateRoleAliasError::Validation(ref cause) => cause,
UpdateRoleAliasError::Credentials(ref err) => err.description(),
UpdateRoleAliasError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateRoleAliasError::ParseError(ref cause) => cause,
UpdateRoleAliasError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateScheduledAuditError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateScheduledAuditError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateScheduledAuditError {
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 UpdateScheduledAuditError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateScheduledAuditError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateScheduledAuditError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return UpdateScheduledAuditError::Throttling(String::from(error_message))
}
"ValidationException" => {
return UpdateScheduledAuditError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateScheduledAuditError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateScheduledAuditError {
fn from(err: serde_json::error::Error) -> UpdateScheduledAuditError {
UpdateScheduledAuditError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateScheduledAuditError {
fn from(err: CredentialsError) -> UpdateScheduledAuditError {
UpdateScheduledAuditError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateScheduledAuditError {
fn from(err: HttpDispatchError) -> UpdateScheduledAuditError {
UpdateScheduledAuditError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateScheduledAuditError {
fn from(err: io::Error) -> UpdateScheduledAuditError {
UpdateScheduledAuditError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateScheduledAuditError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateScheduledAuditError {
fn description(&self) -> &str {
match *self {
UpdateScheduledAuditError::InternalFailure(ref cause) => cause,
UpdateScheduledAuditError::InvalidRequest(ref cause) => cause,
UpdateScheduledAuditError::ResourceNotFound(ref cause) => cause,
UpdateScheduledAuditError::Throttling(ref cause) => cause,
UpdateScheduledAuditError::Validation(ref cause) => cause,
UpdateScheduledAuditError::Credentials(ref err) => err.description(),
UpdateScheduledAuditError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateScheduledAuditError::ParseError(ref cause) => cause,
UpdateScheduledAuditError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateSecurityProfileError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateSecurityProfileError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateSecurityProfileError {
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 UpdateSecurityProfileError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateSecurityProfileError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateSecurityProfileError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return UpdateSecurityProfileError::Throttling(String::from(error_message))
}
"VersionConflictException" => {
return UpdateSecurityProfileError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return UpdateSecurityProfileError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateSecurityProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateSecurityProfileError {
fn from(err: serde_json::error::Error) -> UpdateSecurityProfileError {
UpdateSecurityProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateSecurityProfileError {
fn from(err: CredentialsError) -> UpdateSecurityProfileError {
UpdateSecurityProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateSecurityProfileError {
fn from(err: HttpDispatchError) -> UpdateSecurityProfileError {
UpdateSecurityProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateSecurityProfileError {
fn from(err: io::Error) -> UpdateSecurityProfileError {
UpdateSecurityProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateSecurityProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateSecurityProfileError {
fn description(&self) -> &str {
match *self {
UpdateSecurityProfileError::InternalFailure(ref cause) => cause,
UpdateSecurityProfileError::InvalidRequest(ref cause) => cause,
UpdateSecurityProfileError::ResourceNotFound(ref cause) => cause,
UpdateSecurityProfileError::Throttling(ref cause) => cause,
UpdateSecurityProfileError::VersionConflict(ref cause) => cause,
UpdateSecurityProfileError::Validation(ref cause) => cause,
UpdateSecurityProfileError::Credentials(ref err) => err.description(),
UpdateSecurityProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateSecurityProfileError::ParseError(ref cause) => cause,
UpdateSecurityProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateStreamError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateStreamError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateStreamError {
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 UpdateStreamError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateStreamError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateStreamError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return UpdateStreamError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return UpdateStreamError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return UpdateStreamError::Unauthorized(String::from(error_message))
}
"ValidationException" => {
return UpdateStreamError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateStreamError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateStreamError {
fn from(err: serde_json::error::Error) -> UpdateStreamError {
UpdateStreamError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateStreamError {
fn from(err: CredentialsError) -> UpdateStreamError {
UpdateStreamError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateStreamError {
fn from(err: HttpDispatchError) -> UpdateStreamError {
UpdateStreamError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateStreamError {
fn from(err: io::Error) -> UpdateStreamError {
UpdateStreamError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateStreamError {
fn description(&self) -> &str {
match *self {
UpdateStreamError::InternalFailure(ref cause) => cause,
UpdateStreamError::InvalidRequest(ref cause) => cause,
UpdateStreamError::ResourceNotFound(ref cause) => cause,
UpdateStreamError::ServiceUnavailable(ref cause) => cause,
UpdateStreamError::Throttling(ref cause) => cause,
UpdateStreamError::Unauthorized(ref cause) => cause,
UpdateStreamError::Validation(ref cause) => cause,
UpdateStreamError::Credentials(ref err) => err.description(),
UpdateStreamError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateStreamError::ParseError(ref cause) => cause,
UpdateStreamError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateThingError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
ServiceUnavailable(String),
Throttling(String),
Unauthorized(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateThingError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateThingError {
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 UpdateThingError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateThingError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateThingError::ResourceNotFound(String::from(error_message))
}
"ServiceUnavailableException" => {
return UpdateThingError::ServiceUnavailable(String::from(error_message))
}
"ThrottlingException" => {
return UpdateThingError::Throttling(String::from(error_message))
}
"UnauthorizedException" => {
return UpdateThingError::Unauthorized(String::from(error_message))
}
"VersionConflictException" => {
return UpdateThingError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return UpdateThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateThingError {
fn from(err: serde_json::error::Error) -> UpdateThingError {
UpdateThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateThingError {
fn from(err: CredentialsError) -> UpdateThingError {
UpdateThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateThingError {
fn from(err: HttpDispatchError) -> UpdateThingError {
UpdateThingError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateThingError {
fn from(err: io::Error) -> UpdateThingError {
UpdateThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateThingError {
fn description(&self) -> &str {
match *self {
UpdateThingError::InternalFailure(ref cause) => cause,
UpdateThingError::InvalidRequest(ref cause) => cause,
UpdateThingError::ResourceNotFound(ref cause) => cause,
UpdateThingError::ServiceUnavailable(ref cause) => cause,
UpdateThingError::Throttling(ref cause) => cause,
UpdateThingError::Unauthorized(ref cause) => cause,
UpdateThingError::VersionConflict(ref cause) => cause,
UpdateThingError::Validation(ref cause) => cause,
UpdateThingError::Credentials(ref err) => err.description(),
UpdateThingError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateThingError::ParseError(ref cause) => cause,
UpdateThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateThingGroupError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
VersionConflict(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateThingGroupError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateThingGroupError {
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 UpdateThingGroupError::InternalFailure(String::from(error_message))
}
"InvalidRequestException" => {
return UpdateThingGroupError::InvalidRequest(String::from(error_message))
}
"ResourceNotFoundException" => {
return UpdateThingGroupError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return UpdateThingGroupError::Throttling(String::from(error_message))
}
"VersionConflictException" => {
return UpdateThingGroupError::VersionConflict(String::from(error_message))
}
"ValidationException" => {
return UpdateThingGroupError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateThingGroupError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateThingGroupError {
fn from(err: serde_json::error::Error) -> UpdateThingGroupError {
UpdateThingGroupError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateThingGroupError {
fn from(err: CredentialsError) -> UpdateThingGroupError {
UpdateThingGroupError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateThingGroupError {
fn from(err: HttpDispatchError) -> UpdateThingGroupError {
UpdateThingGroupError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateThingGroupError {
fn from(err: io::Error) -> UpdateThingGroupError {
UpdateThingGroupError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateThingGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateThingGroupError {
fn description(&self) -> &str {
match *self {
UpdateThingGroupError::InternalFailure(ref cause) => cause,
UpdateThingGroupError::InvalidRequest(ref cause) => cause,
UpdateThingGroupError::ResourceNotFound(ref cause) => cause,
UpdateThingGroupError::Throttling(ref cause) => cause,
UpdateThingGroupError::VersionConflict(ref cause) => cause,
UpdateThingGroupError::Validation(ref cause) => cause,
UpdateThingGroupError::Credentials(ref err) => err.description(),
UpdateThingGroupError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateThingGroupError::ParseError(ref cause) => cause,
UpdateThingGroupError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateThingGroupsForThingError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateThingGroupsForThingError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateThingGroupsForThingError {
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 UpdateThingGroupsForThingError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return UpdateThingGroupsForThingError::InvalidRequest(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return UpdateThingGroupsForThingError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return UpdateThingGroupsForThingError::Throttling(String::from(error_message))
}
"ValidationException" => {
return UpdateThingGroupsForThingError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdateThingGroupsForThingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateThingGroupsForThingError {
fn from(err: serde_json::error::Error) -> UpdateThingGroupsForThingError {
UpdateThingGroupsForThingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateThingGroupsForThingError {
fn from(err: CredentialsError) -> UpdateThingGroupsForThingError {
UpdateThingGroupsForThingError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateThingGroupsForThingError {
fn from(err: HttpDispatchError) -> UpdateThingGroupsForThingError {
UpdateThingGroupsForThingError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateThingGroupsForThingError {
fn from(err: io::Error) -> UpdateThingGroupsForThingError {
UpdateThingGroupsForThingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateThingGroupsForThingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateThingGroupsForThingError {
fn description(&self) -> &str {
match *self {
UpdateThingGroupsForThingError::InternalFailure(ref cause) => cause,
UpdateThingGroupsForThingError::InvalidRequest(ref cause) => cause,
UpdateThingGroupsForThingError::ResourceNotFound(ref cause) => cause,
UpdateThingGroupsForThingError::Throttling(ref cause) => cause,
UpdateThingGroupsForThingError::Validation(ref cause) => cause,
UpdateThingGroupsForThingError::Credentials(ref err) => err.description(),
UpdateThingGroupsForThingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateThingGroupsForThingError::ParseError(ref cause) => cause,
UpdateThingGroupsForThingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ValidateSecurityProfileBehaviorsError {
InternalFailure(String),
InvalidRequest(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ValidateSecurityProfileBehaviorsError {
pub fn from_response(res: BufferedHttpResponse) -> ValidateSecurityProfileBehaviorsError {
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 ValidateSecurityProfileBehaviorsError::InternalFailure(String::from(
error_message,
))
}
"InvalidRequestException" => {
return ValidateSecurityProfileBehaviorsError::InvalidRequest(String::from(
error_message,
))
}
"ThrottlingException" => {
return ValidateSecurityProfileBehaviorsError::Throttling(String::from(
error_message,
))
}
"ValidationException" => {
return ValidateSecurityProfileBehaviorsError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return ValidateSecurityProfileBehaviorsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ValidateSecurityProfileBehaviorsError {
fn from(err: serde_json::error::Error) -> ValidateSecurityProfileBehaviorsError {
ValidateSecurityProfileBehaviorsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ValidateSecurityProfileBehaviorsError {
fn from(err: CredentialsError) -> ValidateSecurityProfileBehaviorsError {
ValidateSecurityProfileBehaviorsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ValidateSecurityProfileBehaviorsError {
fn from(err: HttpDispatchError) -> ValidateSecurityProfileBehaviorsError {
ValidateSecurityProfileBehaviorsError::HttpDispatch(err)
}
}
impl From<io::Error> for ValidateSecurityProfileBehaviorsError {
fn from(err: io::Error) -> ValidateSecurityProfileBehaviorsError {
ValidateSecurityProfileBehaviorsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ValidateSecurityProfileBehaviorsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ValidateSecurityProfileBehaviorsError {
fn description(&self) -> &str {
match *self {
ValidateSecurityProfileBehaviorsError::InternalFailure(ref cause) => cause,
ValidateSecurityProfileBehaviorsError::InvalidRequest(ref cause) => cause,
ValidateSecurityProfileBehaviorsError::Throttling(ref cause) => cause,
ValidateSecurityProfileBehaviorsError::Validation(ref cause) => cause,
ValidateSecurityProfileBehaviorsError::Credentials(ref err) => err.description(),
ValidateSecurityProfileBehaviorsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ValidateSecurityProfileBehaviorsError::ParseError(ref cause) => cause,
ValidateSecurityProfileBehaviorsError::Unknown(_) => "unknown error",
}
}
}
pub trait Iot {
fn accept_certificate_transfer(
&self,
input: AcceptCertificateTransferRequest,
) -> RusotoFuture<(), AcceptCertificateTransferError>;
fn add_thing_to_thing_group(
&self,
input: AddThingToThingGroupRequest,
) -> RusotoFuture<AddThingToThingGroupResponse, AddThingToThingGroupError>;
fn associate_targets_with_job(
&self,
input: AssociateTargetsWithJobRequest,
) -> RusotoFuture<AssociateTargetsWithJobResponse, AssociateTargetsWithJobError>;
fn attach_policy(&self, input: AttachPolicyRequest) -> RusotoFuture<(), AttachPolicyError>;
fn attach_principal_policy(
&self,
input: AttachPrincipalPolicyRequest,
) -> RusotoFuture<(), AttachPrincipalPolicyError>;
fn attach_security_profile(
&self,
input: AttachSecurityProfileRequest,
) -> RusotoFuture<AttachSecurityProfileResponse, AttachSecurityProfileError>;
fn attach_thing_principal(
&self,
input: AttachThingPrincipalRequest,
) -> RusotoFuture<AttachThingPrincipalResponse, AttachThingPrincipalError>;
fn cancel_audit_task(
&self,
input: CancelAuditTaskRequest,
) -> RusotoFuture<CancelAuditTaskResponse, CancelAuditTaskError>;
fn cancel_certificate_transfer(
&self,
input: CancelCertificateTransferRequest,
) -> RusotoFuture<(), CancelCertificateTransferError>;
fn cancel_job(
&self,
input: CancelJobRequest,
) -> RusotoFuture<CancelJobResponse, CancelJobError>;
fn cancel_job_execution(
&self,
input: CancelJobExecutionRequest,
) -> RusotoFuture<(), CancelJobExecutionError>;
fn clear_default_authorizer(
&self,
) -> RusotoFuture<ClearDefaultAuthorizerResponse, ClearDefaultAuthorizerError>;
fn create_authorizer(
&self,
input: CreateAuthorizerRequest,
) -> RusotoFuture<CreateAuthorizerResponse, CreateAuthorizerError>;
fn create_certificate_from_csr(
&self,
input: CreateCertificateFromCsrRequest,
) -> RusotoFuture<CreateCertificateFromCsrResponse, CreateCertificateFromCsrError>;
fn create_job(
&self,
input: CreateJobRequest,
) -> RusotoFuture<CreateJobResponse, CreateJobError>;
fn create_keys_and_certificate(
&self,
input: CreateKeysAndCertificateRequest,
) -> RusotoFuture<CreateKeysAndCertificateResponse, CreateKeysAndCertificateError>;
fn create_ota_update(
&self,
input: CreateOTAUpdateRequest,
) -> RusotoFuture<CreateOTAUpdateResponse, CreateOTAUpdateError>;
fn create_policy(
&self,
input: CreatePolicyRequest,
) -> RusotoFuture<CreatePolicyResponse, CreatePolicyError>;
fn create_policy_version(
&self,
input: CreatePolicyVersionRequest,
) -> RusotoFuture<CreatePolicyVersionResponse, CreatePolicyVersionError>;
fn create_role_alias(
&self,
input: CreateRoleAliasRequest,
) -> RusotoFuture<CreateRoleAliasResponse, CreateRoleAliasError>;
fn create_scheduled_audit(
&self,
input: CreateScheduledAuditRequest,
) -> RusotoFuture<CreateScheduledAuditResponse, CreateScheduledAuditError>;
fn create_security_profile(
&self,
input: CreateSecurityProfileRequest,
) -> RusotoFuture<CreateSecurityProfileResponse, CreateSecurityProfileError>;
fn create_stream(
&self,
input: CreateStreamRequest,
) -> RusotoFuture<CreateStreamResponse, CreateStreamError>;
fn create_thing(
&self,
input: CreateThingRequest,
) -> RusotoFuture<CreateThingResponse, CreateThingError>;
fn create_thing_group(
&self,
input: CreateThingGroupRequest,
) -> RusotoFuture<CreateThingGroupResponse, CreateThingGroupError>;
fn create_thing_type(
&self,
input: CreateThingTypeRequest,
) -> RusotoFuture<CreateThingTypeResponse, CreateThingTypeError>;
fn create_topic_rule(
&self,
input: CreateTopicRuleRequest,
) -> RusotoFuture<(), CreateTopicRuleError>;
fn delete_account_audit_configuration(
&self,
input: DeleteAccountAuditConfigurationRequest,
) -> RusotoFuture<DeleteAccountAuditConfigurationResponse, DeleteAccountAuditConfigurationError>;
fn delete_authorizer(
&self,
input: DeleteAuthorizerRequest,
) -> RusotoFuture<DeleteAuthorizerResponse, DeleteAuthorizerError>;
fn delete_ca_certificate(
&self,
input: DeleteCACertificateRequest,
) -> RusotoFuture<DeleteCACertificateResponse, DeleteCACertificateError>;
fn delete_certificate(
&self,
input: DeleteCertificateRequest,
) -> RusotoFuture<(), DeleteCertificateError>;
fn delete_job(&self, input: DeleteJobRequest) -> RusotoFuture<(), DeleteJobError>;
fn delete_job_execution(
&self,
input: DeleteJobExecutionRequest,
) -> RusotoFuture<(), DeleteJobExecutionError>;
fn delete_ota_update(
&self,
input: DeleteOTAUpdateRequest,
) -> RusotoFuture<DeleteOTAUpdateResponse, DeleteOTAUpdateError>;
fn delete_policy(&self, input: DeletePolicyRequest) -> RusotoFuture<(), DeletePolicyError>;
fn delete_policy_version(
&self,
input: DeletePolicyVersionRequest,
) -> RusotoFuture<(), DeletePolicyVersionError>;
fn delete_registration_code(
&self,
) -> RusotoFuture<DeleteRegistrationCodeResponse, DeleteRegistrationCodeError>;
fn delete_role_alias(
&self,
input: DeleteRoleAliasRequest,
) -> RusotoFuture<DeleteRoleAliasResponse, DeleteRoleAliasError>;
fn delete_scheduled_audit(
&self,
input: DeleteScheduledAuditRequest,
) -> RusotoFuture<DeleteScheduledAuditResponse, DeleteScheduledAuditError>;
fn delete_security_profile(
&self,
input: DeleteSecurityProfileRequest,
) -> RusotoFuture<DeleteSecurityProfileResponse, DeleteSecurityProfileError>;
fn delete_stream(
&self,
input: DeleteStreamRequest,
) -> RusotoFuture<DeleteStreamResponse, DeleteStreamError>;
fn delete_thing(
&self,
input: DeleteThingRequest,
) -> RusotoFuture<DeleteThingResponse, DeleteThingError>;
fn delete_thing_group(
&self,
input: DeleteThingGroupRequest,
) -> RusotoFuture<DeleteThingGroupResponse, DeleteThingGroupError>;
fn delete_thing_type(
&self,
input: DeleteThingTypeRequest,
) -> RusotoFuture<DeleteThingTypeResponse, DeleteThingTypeError>;
fn delete_topic_rule(
&self,
input: DeleteTopicRuleRequest,
) -> RusotoFuture<(), DeleteTopicRuleError>;
fn delete_v2_logging_level(
&self,
input: DeleteV2LoggingLevelRequest,
) -> RusotoFuture<(), DeleteV2LoggingLevelError>;
fn deprecate_thing_type(
&self,
input: DeprecateThingTypeRequest,
) -> RusotoFuture<DeprecateThingTypeResponse, DeprecateThingTypeError>;
fn describe_account_audit_configuration(
&self,
) -> RusotoFuture<
DescribeAccountAuditConfigurationResponse,
DescribeAccountAuditConfigurationError,
>;
fn describe_audit_task(
&self,
input: DescribeAuditTaskRequest,
) -> RusotoFuture<DescribeAuditTaskResponse, DescribeAuditTaskError>;
fn describe_authorizer(
&self,
input: DescribeAuthorizerRequest,
) -> RusotoFuture<DescribeAuthorizerResponse, DescribeAuthorizerError>;
fn describe_ca_certificate(
&self,
input: DescribeCACertificateRequest,
) -> RusotoFuture<DescribeCACertificateResponse, DescribeCACertificateError>;
fn describe_certificate(
&self,
input: DescribeCertificateRequest,
) -> RusotoFuture<DescribeCertificateResponse, DescribeCertificateError>;
fn describe_default_authorizer(
&self,
) -> RusotoFuture<DescribeDefaultAuthorizerResponse, DescribeDefaultAuthorizerError>;
fn describe_endpoint(
&self,
input: DescribeEndpointRequest,
) -> RusotoFuture<DescribeEndpointResponse, DescribeEndpointError>;
fn describe_event_configurations(
&self,
) -> RusotoFuture<DescribeEventConfigurationsResponse, DescribeEventConfigurationsError>;
fn describe_index(
&self,
input: DescribeIndexRequest,
) -> RusotoFuture<DescribeIndexResponse, DescribeIndexError>;
fn describe_job(
&self,
input: DescribeJobRequest,
) -> RusotoFuture<DescribeJobResponse, DescribeJobError>;
fn describe_job_execution(
&self,
input: DescribeJobExecutionRequest,
) -> RusotoFuture<DescribeJobExecutionResponse, DescribeJobExecutionError>;
fn describe_role_alias(
&self,
input: DescribeRoleAliasRequest,
) -> RusotoFuture<DescribeRoleAliasResponse, DescribeRoleAliasError>;
fn describe_scheduled_audit(
&self,
input: DescribeScheduledAuditRequest,
) -> RusotoFuture<DescribeScheduledAuditResponse, DescribeScheduledAuditError>;
fn describe_security_profile(
&self,
input: DescribeSecurityProfileRequest,
) -> RusotoFuture<DescribeSecurityProfileResponse, DescribeSecurityProfileError>;
fn describe_stream(
&self,
input: DescribeStreamRequest,
) -> RusotoFuture<DescribeStreamResponse, DescribeStreamError>;
fn describe_thing(
&self,
input: DescribeThingRequest,
) -> RusotoFuture<DescribeThingResponse, DescribeThingError>;
fn describe_thing_group(
&self,
input: DescribeThingGroupRequest,
) -> RusotoFuture<DescribeThingGroupResponse, DescribeThingGroupError>;
fn describe_thing_registration_task(
&self,
input: DescribeThingRegistrationTaskRequest,
) -> RusotoFuture<DescribeThingRegistrationTaskResponse, DescribeThingRegistrationTaskError>;
fn describe_thing_type(
&self,
input: DescribeThingTypeRequest,
) -> RusotoFuture<DescribeThingTypeResponse, DescribeThingTypeError>;
fn detach_policy(&self, input: DetachPolicyRequest) -> RusotoFuture<(), DetachPolicyError>;
fn detach_principal_policy(
&self,
input: DetachPrincipalPolicyRequest,
) -> RusotoFuture<(), DetachPrincipalPolicyError>;
fn detach_security_profile(
&self,
input: DetachSecurityProfileRequest,
) -> RusotoFuture<DetachSecurityProfileResponse, DetachSecurityProfileError>;
fn detach_thing_principal(
&self,
input: DetachThingPrincipalRequest,
) -> RusotoFuture<DetachThingPrincipalResponse, DetachThingPrincipalError>;
fn disable_topic_rule(
&self,
input: DisableTopicRuleRequest,
) -> RusotoFuture<(), DisableTopicRuleError>;
fn enable_topic_rule(
&self,
input: EnableTopicRuleRequest,
) -> RusotoFuture<(), EnableTopicRuleError>;
fn get_effective_policies(
&self,
input: GetEffectivePoliciesRequest,
) -> RusotoFuture<GetEffectivePoliciesResponse, GetEffectivePoliciesError>;
fn get_indexing_configuration(
&self,
) -> RusotoFuture<GetIndexingConfigurationResponse, GetIndexingConfigurationError>;
fn get_job_document(
&self,
input: GetJobDocumentRequest,
) -> RusotoFuture<GetJobDocumentResponse, GetJobDocumentError>;
fn get_logging_options(
&self,
) -> RusotoFuture<GetLoggingOptionsResponse, GetLoggingOptionsError>;
fn get_ota_update(
&self,
input: GetOTAUpdateRequest,
) -> RusotoFuture<GetOTAUpdateResponse, GetOTAUpdateError>;
fn get_policy(
&self,
input: GetPolicyRequest,
) -> RusotoFuture<GetPolicyResponse, GetPolicyError>;
fn get_policy_version(
&self,
input: GetPolicyVersionRequest,
) -> RusotoFuture<GetPolicyVersionResponse, GetPolicyVersionError>;
fn get_registration_code(
&self,
) -> RusotoFuture<GetRegistrationCodeResponse, GetRegistrationCodeError>;
fn get_topic_rule(
&self,
input: GetTopicRuleRequest,
) -> RusotoFuture<GetTopicRuleResponse, GetTopicRuleError>;
fn get_v2_logging_options(
&self,
) -> RusotoFuture<GetV2LoggingOptionsResponse, GetV2LoggingOptionsError>;
fn list_active_violations(
&self,
input: ListActiveViolationsRequest,
) -> RusotoFuture<ListActiveViolationsResponse, ListActiveViolationsError>;
fn list_attached_policies(
&self,
input: ListAttachedPoliciesRequest,
) -> RusotoFuture<ListAttachedPoliciesResponse, ListAttachedPoliciesError>;
fn list_audit_findings(
&self,
input: ListAuditFindingsRequest,
) -> RusotoFuture<ListAuditFindingsResponse, ListAuditFindingsError>;
fn list_audit_tasks(
&self,
input: ListAuditTasksRequest,
) -> RusotoFuture<ListAuditTasksResponse, ListAuditTasksError>;
fn list_authorizers(
&self,
input: ListAuthorizersRequest,
) -> RusotoFuture<ListAuthorizersResponse, ListAuthorizersError>;
fn list_ca_certificates(
&self,
input: ListCACertificatesRequest,
) -> RusotoFuture<ListCACertificatesResponse, ListCACertificatesError>;
fn list_certificates(
&self,
input: ListCertificatesRequest,
) -> RusotoFuture<ListCertificatesResponse, ListCertificatesError>;
fn list_certificates_by_ca(
&self,
input: ListCertificatesByCARequest,
) -> RusotoFuture<ListCertificatesByCAResponse, ListCertificatesByCAError>;
fn list_indices(
&self,
input: ListIndicesRequest,
) -> RusotoFuture<ListIndicesResponse, ListIndicesError>;
fn list_job_executions_for_job(
&self,
input: ListJobExecutionsForJobRequest,
) -> RusotoFuture<ListJobExecutionsForJobResponse, ListJobExecutionsForJobError>;
fn list_job_executions_for_thing(
&self,
input: ListJobExecutionsForThingRequest,
) -> RusotoFuture<ListJobExecutionsForThingResponse, ListJobExecutionsForThingError>;
fn list_jobs(&self, input: ListJobsRequest) -> RusotoFuture<ListJobsResponse, ListJobsError>;
fn list_ota_updates(
&self,
input: ListOTAUpdatesRequest,
) -> RusotoFuture<ListOTAUpdatesResponse, ListOTAUpdatesError>;
fn list_outgoing_certificates(
&self,
input: ListOutgoingCertificatesRequest,
) -> RusotoFuture<ListOutgoingCertificatesResponse, ListOutgoingCertificatesError>;
fn list_policies(
&self,
input: ListPoliciesRequest,
) -> RusotoFuture<ListPoliciesResponse, ListPoliciesError>;
fn list_policy_principals(
&self,
input: ListPolicyPrincipalsRequest,
) -> RusotoFuture<ListPolicyPrincipalsResponse, ListPolicyPrincipalsError>;
fn list_policy_versions(
&self,
input: ListPolicyVersionsRequest,
) -> RusotoFuture<ListPolicyVersionsResponse, ListPolicyVersionsError>;
fn list_principal_policies(
&self,
input: ListPrincipalPoliciesRequest,
) -> RusotoFuture<ListPrincipalPoliciesResponse, ListPrincipalPoliciesError>;
fn list_principal_things(
&self,
input: ListPrincipalThingsRequest,
) -> RusotoFuture<ListPrincipalThingsResponse, ListPrincipalThingsError>;
fn list_role_aliases(
&self,
input: ListRoleAliasesRequest,
) -> RusotoFuture<ListRoleAliasesResponse, ListRoleAliasesError>;
fn list_scheduled_audits(
&self,
input: ListScheduledAuditsRequest,
) -> RusotoFuture<ListScheduledAuditsResponse, ListScheduledAuditsError>;
fn list_security_profiles(
&self,
input: ListSecurityProfilesRequest,
) -> RusotoFuture<ListSecurityProfilesResponse, ListSecurityProfilesError>;
fn list_security_profiles_for_target(
&self,
input: ListSecurityProfilesForTargetRequest,
) -> RusotoFuture<ListSecurityProfilesForTargetResponse, ListSecurityProfilesForTargetError>;
fn list_streams(
&self,
input: ListStreamsRequest,
) -> RusotoFuture<ListStreamsResponse, ListStreamsError>;
fn list_targets_for_policy(
&self,
input: ListTargetsForPolicyRequest,
) -> RusotoFuture<ListTargetsForPolicyResponse, ListTargetsForPolicyError>;
fn list_targets_for_security_profile(
&self,
input: ListTargetsForSecurityProfileRequest,
) -> RusotoFuture<ListTargetsForSecurityProfileResponse, ListTargetsForSecurityProfileError>;
fn list_thing_groups(
&self,
input: ListThingGroupsRequest,
) -> RusotoFuture<ListThingGroupsResponse, ListThingGroupsError>;
fn list_thing_groups_for_thing(
&self,
input: ListThingGroupsForThingRequest,
) -> RusotoFuture<ListThingGroupsForThingResponse, ListThingGroupsForThingError>;
fn list_thing_principals(
&self,
input: ListThingPrincipalsRequest,
) -> RusotoFuture<ListThingPrincipalsResponse, ListThingPrincipalsError>;
fn list_thing_registration_task_reports(
&self,
input: ListThingRegistrationTaskReportsRequest,
) -> RusotoFuture<ListThingRegistrationTaskReportsResponse, ListThingRegistrationTaskReportsError>;
fn list_thing_registration_tasks(
&self,
input: ListThingRegistrationTasksRequest,
) -> RusotoFuture<ListThingRegistrationTasksResponse, ListThingRegistrationTasksError>;
fn list_thing_types(
&self,
input: ListThingTypesRequest,
) -> RusotoFuture<ListThingTypesResponse, ListThingTypesError>;
fn list_things(
&self,
input: ListThingsRequest,
) -> RusotoFuture<ListThingsResponse, ListThingsError>;
fn list_things_in_thing_group(
&self,
input: ListThingsInThingGroupRequest,
) -> RusotoFuture<ListThingsInThingGroupResponse, ListThingsInThingGroupError>;
fn list_topic_rules(
&self,
input: ListTopicRulesRequest,
) -> RusotoFuture<ListTopicRulesResponse, ListTopicRulesError>;
fn list_v2_logging_levels(
&self,
input: ListV2LoggingLevelsRequest,
) -> RusotoFuture<ListV2LoggingLevelsResponse, ListV2LoggingLevelsError>;
fn list_violation_events(
&self,
input: ListViolationEventsRequest,
) -> RusotoFuture<ListViolationEventsResponse, ListViolationEventsError>;
fn register_ca_certificate(
&self,
input: RegisterCACertificateRequest,
) -> RusotoFuture<RegisterCACertificateResponse, RegisterCACertificateError>;
fn register_certificate(
&self,
input: RegisterCertificateRequest,
) -> RusotoFuture<RegisterCertificateResponse, RegisterCertificateError>;
fn register_thing(
&self,
input: RegisterThingRequest,
) -> RusotoFuture<RegisterThingResponse, RegisterThingError>;
fn reject_certificate_transfer(
&self,
input: RejectCertificateTransferRequest,
) -> RusotoFuture<(), RejectCertificateTransferError>;
fn remove_thing_from_thing_group(
&self,
input: RemoveThingFromThingGroupRequest,
) -> RusotoFuture<RemoveThingFromThingGroupResponse, RemoveThingFromThingGroupError>;
fn replace_topic_rule(
&self,
input: ReplaceTopicRuleRequest,
) -> RusotoFuture<(), ReplaceTopicRuleError>;
fn search_index(
&self,
input: SearchIndexRequest,
) -> RusotoFuture<SearchIndexResponse, SearchIndexError>;
fn set_default_authorizer(
&self,
input: SetDefaultAuthorizerRequest,
) -> RusotoFuture<SetDefaultAuthorizerResponse, SetDefaultAuthorizerError>;
fn set_default_policy_version(
&self,
input: SetDefaultPolicyVersionRequest,
) -> RusotoFuture<(), SetDefaultPolicyVersionError>;
fn set_logging_options(
&self,
input: SetLoggingOptionsRequest,
) -> RusotoFuture<(), SetLoggingOptionsError>;
fn set_v2_logging_level(
&self,
input: SetV2LoggingLevelRequest,
) -> RusotoFuture<(), SetV2LoggingLevelError>;
fn set_v2_logging_options(
&self,
input: SetV2LoggingOptionsRequest,
) -> RusotoFuture<(), SetV2LoggingOptionsError>;
fn start_on_demand_audit_task(
&self,
input: StartOnDemandAuditTaskRequest,
) -> RusotoFuture<StartOnDemandAuditTaskResponse, StartOnDemandAuditTaskError>;
fn start_thing_registration_task(
&self,
input: StartThingRegistrationTaskRequest,
) -> RusotoFuture<StartThingRegistrationTaskResponse, StartThingRegistrationTaskError>;
fn stop_thing_registration_task(
&self,
input: StopThingRegistrationTaskRequest,
) -> RusotoFuture<StopThingRegistrationTaskResponse, StopThingRegistrationTaskError>;
fn test_authorization(
&self,
input: TestAuthorizationRequest,
) -> RusotoFuture<TestAuthorizationResponse, TestAuthorizationError>;
fn test_invoke_authorizer(
&self,
input: TestInvokeAuthorizerRequest,
) -> RusotoFuture<TestInvokeAuthorizerResponse, TestInvokeAuthorizerError>;
fn transfer_certificate(
&self,
input: TransferCertificateRequest,
) -> RusotoFuture<TransferCertificateResponse, TransferCertificateError>;
fn update_account_audit_configuration(
&self,
input: UpdateAccountAuditConfigurationRequest,
) -> RusotoFuture<UpdateAccountAuditConfigurationResponse, UpdateAccountAuditConfigurationError>;
fn update_authorizer(
&self,
input: UpdateAuthorizerRequest,
) -> RusotoFuture<UpdateAuthorizerResponse, UpdateAuthorizerError>;
fn update_ca_certificate(
&self,
input: UpdateCACertificateRequest,
) -> RusotoFuture<(), UpdateCACertificateError>;
fn update_certificate(
&self,
input: UpdateCertificateRequest,
) -> RusotoFuture<(), UpdateCertificateError>;
fn update_event_configurations(
&self,
input: UpdateEventConfigurationsRequest,
) -> RusotoFuture<UpdateEventConfigurationsResponse, UpdateEventConfigurationsError>;
fn update_indexing_configuration(
&self,
input: UpdateIndexingConfigurationRequest,
) -> RusotoFuture<UpdateIndexingConfigurationResponse, UpdateIndexingConfigurationError>;
fn update_role_alias(
&self,
input: UpdateRoleAliasRequest,
) -> RusotoFuture<UpdateRoleAliasResponse, UpdateRoleAliasError>;
fn update_scheduled_audit(
&self,
input: UpdateScheduledAuditRequest,
) -> RusotoFuture<UpdateScheduledAuditResponse, UpdateScheduledAuditError>;
fn update_security_profile(
&self,
input: UpdateSecurityProfileRequest,
) -> RusotoFuture<UpdateSecurityProfileResponse, UpdateSecurityProfileError>;
fn update_stream(
&self,
input: UpdateStreamRequest,
) -> RusotoFuture<UpdateStreamResponse, UpdateStreamError>;
fn update_thing(
&self,
input: UpdateThingRequest,
) -> RusotoFuture<UpdateThingResponse, UpdateThingError>;
fn update_thing_group(
&self,
input: UpdateThingGroupRequest,
) -> RusotoFuture<UpdateThingGroupResponse, UpdateThingGroupError>;
fn update_thing_groups_for_thing(
&self,
input: UpdateThingGroupsForThingRequest,
) -> RusotoFuture<UpdateThingGroupsForThingResponse, UpdateThingGroupsForThingError>;
fn validate_security_profile_behaviors(
&self,
input: ValidateSecurityProfileBehaviorsRequest,
) -> RusotoFuture<ValidateSecurityProfileBehaviorsResponse, ValidateSecurityProfileBehaviorsError>;
}
pub struct IotClient {
client: Client,
region: region::Region,
}
impl IotClient {
pub fn new(region: region::Region) -> IotClient {
IotClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> IotClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
IotClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl Iot for IotClient {
fn accept_certificate_transfer(
&self,
input: AcceptCertificateTransferRequest,
) -> RusotoFuture<(), AcceptCertificateTransferError> {
let request_uri = format!(
"/accept-certificate-transfer/{certificate_id}",
certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.set_as_active {
params.put("setAsActive", 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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AcceptCertificateTransferError::from_response(response))
}))
}
})
}
fn add_thing_to_thing_group(
&self,
input: AddThingToThingGroupRequest,
) -> RusotoFuture<AddThingToThingGroupResponse, AddThingToThingGroupError> {
let request_uri = "/thing-groups/addThingToThingGroup";
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<AddThingToThingGroupResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AddThingToThingGroupError::from_response(response))
}),
)
}
})
}
fn associate_targets_with_job(
&self,
input: AssociateTargetsWithJobRequest,
) -> RusotoFuture<AssociateTargetsWithJobResponse, AssociateTargetsWithJobError> {
let request_uri = format!("/jobs/{job_id}/targets", job_id = input.job_id);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<AssociateTargetsWithJobResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateTargetsWithJobError::from_response(response))
}))
}
})
}
fn attach_policy(&self, input: AttachPolicyRequest) -> RusotoFuture<(), AttachPolicyError> {
let request_uri = format!(
"/target-policies/{policy_name}",
policy_name = input.policy_name
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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(AttachPolicyError::from_response(response))),
)
}
})
}
fn attach_principal_policy(
&self,
input: AttachPrincipalPolicyRequest,
) -> RusotoFuture<(), AttachPrincipalPolicyError> {
let request_uri = format!(
"/principal-policies/{policy_name}",
policy_name = input.policy_name
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
request.add_header("x-amzn-iot-principal", &input.principal);
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(AttachPrincipalPolicyError::from_response(response))
}),
)
}
})
}
fn attach_security_profile(
&self,
input: AttachSecurityProfileRequest,
) -> RusotoFuture<AttachSecurityProfileResponse, AttachSecurityProfileError> {
let request_uri = format!(
"/security-profiles/{security_profile_name}/targets",
security_profile_name = input.security_profile_name
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
params.put(
"securityProfileTargetArn",
&input.security_profile_target_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::<AttachSecurityProfileResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AttachSecurityProfileError::from_response(response))
}),
)
}
})
}
fn attach_thing_principal(
&self,
input: AttachThingPrincipalRequest,
) -> RusotoFuture<AttachThingPrincipalResponse, AttachThingPrincipalError> {
let request_uri = format!(
"/things/{thing_name}/principals",
thing_name = input.thing_name
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
request.add_header("x-amzn-principal", &input.principal);
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::<AttachThingPrincipalResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AttachThingPrincipalError::from_response(response))
}),
)
}
})
}
fn cancel_audit_task(
&self,
input: CancelAuditTaskRequest,
) -> RusotoFuture<CancelAuditTaskResponse, CancelAuditTaskError> {
let request_uri = format!("/audit/tasks/{task_id}/cancel", task_id = input.task_id);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<CancelAuditTaskResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CancelAuditTaskError::from_response(response))),
)
}
})
}
fn cancel_certificate_transfer(
&self,
input: CancelCertificateTransferRequest,
) -> RusotoFuture<(), CancelCertificateTransferError> {
let request_uri = format!(
"/cancel-certificate-transfer/{certificate_id}",
certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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(CancelCertificateTransferError::from_response(response))
}))
}
})
}
fn cancel_job(
&self,
input: CancelJobRequest,
) -> RusotoFuture<CancelJobResponse, CancelJobError> {
let request_uri = format!("/jobs/{job_id}/cancel", job_id = input.job_id);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.force {
params.put("force", 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::<CancelJobResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CancelJobError::from_response(response))),
)
}
})
}
fn cancel_job_execution(
&self,
input: CancelJobExecutionRequest,
) -> RusotoFuture<(), CancelJobExecutionError> {
let request_uri = format!(
"/things/{thing_name}/jobs/{job_id}/cancel",
job_id = input.job_id,
thing_name = input.thing_name
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.force {
params.put("force", 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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CancelJobExecutionError::from_response(response))),
)
}
})
}
fn clear_default_authorizer(
&self,
) -> RusotoFuture<ClearDefaultAuthorizerResponse, ClearDefaultAuthorizerError> {
let request_uri = "/default-authorizer";
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<ClearDefaultAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ClearDefaultAuthorizerError::from_response(response))
}),
)
}
})
}
fn create_authorizer(
&self,
input: CreateAuthorizerRequest,
) -> RusotoFuture<CreateAuthorizerResponse, CreateAuthorizerError> {
let request_uri = format!(
"/authorizer/{authorizer_name}",
authorizer_name = input.authorizer_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateAuthorizerError::from_response(response))),
)
}
})
}
fn create_certificate_from_csr(
&self,
input: CreateCertificateFromCsrRequest,
) -> RusotoFuture<CreateCertificateFromCsrResponse, CreateCertificateFromCsrError> {
let request_uri = "/certificates";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.set_as_active {
params.put("setAsActive", 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::<CreateCertificateFromCsrResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateCertificateFromCsrError::from_response(response))
}))
}
})
}
fn create_job(
&self,
input: CreateJobRequest,
) -> RusotoFuture<CreateJobResponse, CreateJobError> {
let request_uri = format!("/jobs/{job_id}", job_id = input.job_id);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateJobResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateJobError::from_response(response))),
)
}
})
}
fn create_keys_and_certificate(
&self,
input: CreateKeysAndCertificateRequest,
) -> RusotoFuture<CreateKeysAndCertificateResponse, CreateKeysAndCertificateError> {
let request_uri = "/keys-and-certificate";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.set_as_active {
params.put("setAsActive", 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::<CreateKeysAndCertificateResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateKeysAndCertificateError::from_response(response))
}))
}
})
}
fn create_ota_update(
&self,
input: CreateOTAUpdateRequest,
) -> RusotoFuture<CreateOTAUpdateResponse, CreateOTAUpdateError> {
let request_uri = format!(
"/otaUpdates/{ota_update_id}",
ota_update_id = input.ota_update_id
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateOTAUpdateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateOTAUpdateError::from_response(response))),
)
}
})
}
fn create_policy(
&self,
input: CreatePolicyRequest,
) -> RusotoFuture<CreatePolicyResponse, CreatePolicyError> {
let request_uri = format!("/policies/{policy_name}", policy_name = input.policy_name);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreatePolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreatePolicyError::from_response(response))),
)
}
})
}
fn create_policy_version(
&self,
input: CreatePolicyVersionRequest,
) -> RusotoFuture<CreatePolicyVersionResponse, CreatePolicyVersionError> {
let request_uri = format!(
"/policies/{policy_name}/version",
policy_name = input.policy_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.set_as_default {
params.put("setAsDefault", 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::<CreatePolicyVersionResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreatePolicyVersionError::from_response(response))
}),
)
}
})
}
fn create_role_alias(
&self,
input: CreateRoleAliasRequest,
) -> RusotoFuture<CreateRoleAliasResponse, CreateRoleAliasError> {
let request_uri = format!("/role-aliases/{role_alias}", role_alias = input.role_alias);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateRoleAliasResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateRoleAliasError::from_response(response))),
)
}
})
}
fn create_scheduled_audit(
&self,
input: CreateScheduledAuditRequest,
) -> RusotoFuture<CreateScheduledAuditResponse, CreateScheduledAuditError> {
let request_uri = format!(
"/audit/scheduledaudits/{scheduled_audit_name}",
scheduled_audit_name = input.scheduled_audit_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateScheduledAuditResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateScheduledAuditError::from_response(response))
}),
)
}
})
}
fn create_security_profile(
&self,
input: CreateSecurityProfileRequest,
) -> RusotoFuture<CreateSecurityProfileResponse, CreateSecurityProfileError> {
let request_uri = format!(
"/security-profiles/{security_profile_name}",
security_profile_name = input.security_profile_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateSecurityProfileResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateSecurityProfileError::from_response(response))
}),
)
}
})
}
fn create_stream(
&self,
input: CreateStreamRequest,
) -> RusotoFuture<CreateStreamResponse, CreateStreamError> {
let request_uri = format!("/streams/{stream_id}", stream_id = input.stream_id);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateStreamResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateStreamError::from_response(response))),
)
}
})
}
fn create_thing(
&self,
input: CreateThingRequest,
) -> RusotoFuture<CreateThingResponse, CreateThingError> {
let request_uri = format!("/things/{thing_name}", thing_name = input.thing_name);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateThingError::from_response(response))),
)
}
})
}
fn create_thing_group(
&self,
input: CreateThingGroupRequest,
) -> RusotoFuture<CreateThingGroupResponse, CreateThingGroupError> {
let request_uri = format!(
"/thing-groups/{thing_group_name}",
thing_group_name = input.thing_group_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateThingGroupResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateThingGroupError::from_response(response))),
)
}
})
}
fn create_thing_type(
&self,
input: CreateThingTypeRequest,
) -> RusotoFuture<CreateThingTypeResponse, CreateThingTypeError> {
let request_uri = format!(
"/thing-types/{thing_type_name}",
thing_type_name = input.thing_type_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<CreateThingTypeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateThingTypeError::from_response(response))),
)
}
})
}
fn create_topic_rule(
&self,
input: CreateTopicRuleRequest,
) -> RusotoFuture<(), CreateTopicRuleError> {
let request_uri = format!("/rules/{rule_name}", rule_name = input.rule_name);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input.topic_rule_payload).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(CreateTopicRuleError::from_response(response))),
)
}
})
}
fn delete_account_audit_configuration(
&self,
input: DeleteAccountAuditConfigurationRequest,
) -> RusotoFuture<DeleteAccountAuditConfigurationResponse, DeleteAccountAuditConfigurationError>
{
let request_uri = "/audit/configuration";
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.delete_scheduled_audits {
params.put("deleteScheduledAudits", 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::<DeleteAccountAuditConfigurationResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteAccountAuditConfigurationError::from_response(
response,
))
}))
}
})
}
fn delete_authorizer(
&self,
input: DeleteAuthorizerRequest,
) -> RusotoFuture<DeleteAuthorizerResponse, DeleteAuthorizerError> {
let request_uri = format!(
"/authorizer/{authorizer_name}",
authorizer_name = input.authorizer_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteAuthorizerError::from_response(response))),
)
}
})
}
fn delete_ca_certificate(
&self,
input: DeleteCACertificateRequest,
) -> RusotoFuture<DeleteCACertificateResponse, DeleteCACertificateError> {
let request_uri = format!(
"/cacertificate/{ca_certificate_id}",
ca_certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteCACertificateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteCACertificateError::from_response(response))
}),
)
}
})
}
fn delete_certificate(
&self,
input: DeleteCertificateRequest,
) -> RusotoFuture<(), DeleteCertificateError> {
let request_uri = format!(
"/certificates/{certificate_id}",
certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.force_delete {
params.put("forceDelete", 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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteCertificateError::from_response(response))),
)
}
})
}
fn delete_job(&self, input: DeleteJobRequest) -> RusotoFuture<(), DeleteJobError> {
let request_uri = format!("/jobs/{job_id}", job_id = input.job_id);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.force {
params.put("force", 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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteJobError::from_response(response))),
)
}
})
}
fn delete_job_execution(
&self,
input: DeleteJobExecutionRequest,
) -> RusotoFuture<(), DeleteJobExecutionError> {
let request_uri = format!(
"/things/{thing_name}/jobs/{job_id}/executionNumber/{execution_number}",
execution_number = input.execution_number,
job_id = input.job_id,
thing_name = input.thing_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.force {
params.put("force", 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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteJobExecutionError::from_response(response))),
)
}
})
}
fn delete_ota_update(
&self,
input: DeleteOTAUpdateRequest,
) -> RusotoFuture<DeleteOTAUpdateResponse, DeleteOTAUpdateError> {
let request_uri = format!(
"/otaUpdates/{ota_update_id}",
ota_update_id = input.ota_update_id
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteOTAUpdateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteOTAUpdateError::from_response(response))),
)
}
})
}
fn delete_policy(&self, input: DeletePolicyRequest) -> RusotoFuture<(), DeletePolicyError> {
let request_uri = format!("/policies/{policy_name}", policy_name = input.policy_name);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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(DeletePolicyError::from_response(response))),
)
}
})
}
fn delete_policy_version(
&self,
input: DeletePolicyVersionRequest,
) -> RusotoFuture<(), DeletePolicyVersionError> {
let request_uri = format!(
"/policies/{policy_name}/version/{policy_version_id}",
policy_name = input.policy_name,
policy_version_id = input.policy_version_id
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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(DeletePolicyVersionError::from_response(response))
}),
)
}
})
}
fn delete_registration_code(
&self,
) -> RusotoFuture<DeleteRegistrationCodeResponse, DeleteRegistrationCodeError> {
let request_uri = "/registrationcode";
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteRegistrationCodeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteRegistrationCodeError::from_response(response))
}),
)
}
})
}
fn delete_role_alias(
&self,
input: DeleteRoleAliasRequest,
) -> RusotoFuture<DeleteRoleAliasResponse, DeleteRoleAliasError> {
let request_uri = format!("/role-aliases/{role_alias}", role_alias = input.role_alias);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteRoleAliasResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteRoleAliasError::from_response(response))),
)
}
})
}
fn delete_scheduled_audit(
&self,
input: DeleteScheduledAuditRequest,
) -> RusotoFuture<DeleteScheduledAuditResponse, DeleteScheduledAuditError> {
let request_uri = format!(
"/audit/scheduledaudits/{scheduled_audit_name}",
scheduled_audit_name = input.scheduled_audit_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteScheduledAuditResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteScheduledAuditError::from_response(response))
}),
)
}
})
}
fn delete_security_profile(
&self,
input: DeleteSecurityProfileRequest,
) -> RusotoFuture<DeleteSecurityProfileResponse, DeleteSecurityProfileError> {
let request_uri = format!(
"/security-profiles/{security_profile_name}",
security_profile_name = input.security_profile_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.expected_version {
params.put("expectedVersion", 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::<DeleteSecurityProfileResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteSecurityProfileError::from_response(response))
}),
)
}
})
}
fn delete_stream(
&self,
input: DeleteStreamRequest,
) -> RusotoFuture<DeleteStreamResponse, DeleteStreamError> {
let request_uri = format!("/streams/{stream_id}", stream_id = input.stream_id);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteStreamResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteStreamError::from_response(response))),
)
}
})
}
fn delete_thing(
&self,
input: DeleteThingRequest,
) -> RusotoFuture<DeleteThingResponse, DeleteThingError> {
let request_uri = format!("/things/{thing_name}", thing_name = input.thing_name);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.expected_version {
params.put("expectedVersion", 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::<DeleteThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteThingError::from_response(response))),
)
}
})
}
fn delete_thing_group(
&self,
input: DeleteThingGroupRequest,
) -> RusotoFuture<DeleteThingGroupResponse, DeleteThingGroupError> {
let request_uri = format!(
"/thing-groups/{thing_group_name}",
thing_group_name = input.thing_group_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.expected_version {
params.put("expectedVersion", 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::<DeleteThingGroupResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteThingGroupError::from_response(response))),
)
}
})
}
fn delete_thing_type(
&self,
input: DeleteThingTypeRequest,
) -> RusotoFuture<DeleteThingTypeResponse, DeleteThingTypeError> {
let request_uri = format!(
"/thing-types/{thing_type_name}",
thing_type_name = input.thing_type_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DeleteThingTypeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteThingTypeError::from_response(response))),
)
}
})
}
fn delete_topic_rule(
&self,
input: DeleteTopicRuleRequest,
) -> RusotoFuture<(), DeleteTopicRuleError> {
let request_uri = format!("/rules/{rule_name}", rule_name = input.rule_name);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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(DeleteTopicRuleError::from_response(response))),
)
}
})
}
fn delete_v2_logging_level(
&self,
input: DeleteV2LoggingLevelRequest,
) -> RusotoFuture<(), DeleteV2LoggingLevelError> {
let request_uri = "/v2LoggingLevel";
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
params.put("targetName", &input.target_name);
params.put("targetType", &input.target_type);
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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteV2LoggingLevelError::from_response(response))
}),
)
}
})
}
fn deprecate_thing_type(
&self,
input: DeprecateThingTypeRequest,
) -> RusotoFuture<DeprecateThingTypeResponse, DeprecateThingTypeError> {
let request_uri = format!(
"/thing-types/{thing_type_name}/deprecate",
thing_type_name = input.thing_type_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<DeprecateThingTypeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeprecateThingTypeError::from_response(response))),
)
}
})
}
fn describe_account_audit_configuration(
&self,
) -> RusotoFuture<
DescribeAccountAuditConfigurationResponse,
DescribeAccountAuditConfigurationError,
> {
let request_uri = "/audit/configuration";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeAccountAuditConfigurationResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeAccountAuditConfigurationError::from_response(
response,
))
}))
}
})
}
fn describe_audit_task(
&self,
input: DescribeAuditTaskRequest,
) -> RusotoFuture<DescribeAuditTaskResponse, DescribeAuditTaskError> {
let request_uri = format!("/audit/tasks/{task_id}", task_id = input.task_id);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeAuditTaskResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeAuditTaskError::from_response(response))),
)
}
})
}
fn describe_authorizer(
&self,
input: DescribeAuthorizerRequest,
) -> RusotoFuture<DescribeAuthorizerResponse, DescribeAuthorizerError> {
let request_uri = format!(
"/authorizer/{authorizer_name}",
authorizer_name = input.authorizer_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeAuthorizerError::from_response(response))),
)
}
})
}
fn describe_ca_certificate(
&self,
input: DescribeCACertificateRequest,
) -> RusotoFuture<DescribeCACertificateResponse, DescribeCACertificateError> {
let request_uri = format!(
"/cacertificate/{ca_certificate_id}",
ca_certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeCACertificateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeCACertificateError::from_response(response))
}),
)
}
})
}
fn describe_certificate(
&self,
input: DescribeCertificateRequest,
) -> RusotoFuture<DescribeCertificateResponse, DescribeCertificateError> {
let request_uri = format!(
"/certificates/{certificate_id}",
certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeCertificateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeCertificateError::from_response(response))
}),
)
}
})
}
fn describe_default_authorizer(
&self,
) -> RusotoFuture<DescribeDefaultAuthorizerResponse, DescribeDefaultAuthorizerError> {
let request_uri = "/default-authorizer";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeDefaultAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeDefaultAuthorizerError::from_response(response))
}))
}
})
}
fn describe_endpoint(
&self,
input: DescribeEndpointRequest,
) -> RusotoFuture<DescribeEndpointResponse, DescribeEndpointError> {
let request_uri = "/endpoint";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.endpoint_type {
params.put("endpointType", 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::<DescribeEndpointResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeEndpointError::from_response(response))),
)
}
})
}
fn describe_event_configurations(
&self,
) -> RusotoFuture<DescribeEventConfigurationsResponse, DescribeEventConfigurationsError> {
let request_uri = "/event-configurations";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeEventConfigurationsResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeEventConfigurationsError::from_response(response))
}))
}
})
}
fn describe_index(
&self,
input: DescribeIndexRequest,
) -> RusotoFuture<DescribeIndexResponse, DescribeIndexError> {
let request_uri = format!("/indices/{index_name}", index_name = input.index_name);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeIndexResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeIndexError::from_response(response))),
)
}
})
}
fn describe_job(
&self,
input: DescribeJobRequest,
) -> RusotoFuture<DescribeJobResponse, DescribeJobError> {
let request_uri = format!("/jobs/{job_id}", job_id = input.job_id);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeJobResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeJobError::from_response(response))),
)
}
})
}
fn describe_job_execution(
&self,
input: DescribeJobExecutionRequest,
) -> RusotoFuture<DescribeJobExecutionResponse, DescribeJobExecutionError> {
let request_uri = format!(
"/things/{thing_name}/jobs/{job_id}",
job_id = input.job_id,
thing_name = input.thing_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.execution_number {
params.put("executionNumber", 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::<DescribeJobExecutionResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeJobExecutionError::from_response(response))
}),
)
}
})
}
fn describe_role_alias(
&self,
input: DescribeRoleAliasRequest,
) -> RusotoFuture<DescribeRoleAliasResponse, DescribeRoleAliasError> {
let request_uri = format!("/role-aliases/{role_alias}", role_alias = input.role_alias);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeRoleAliasResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeRoleAliasError::from_response(response))),
)
}
})
}
fn describe_scheduled_audit(
&self,
input: DescribeScheduledAuditRequest,
) -> RusotoFuture<DescribeScheduledAuditResponse, DescribeScheduledAuditError> {
let request_uri = format!(
"/audit/scheduledaudits/{scheduled_audit_name}",
scheduled_audit_name = input.scheduled_audit_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeScheduledAuditResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeScheduledAuditError::from_response(response))
}),
)
}
})
}
fn describe_security_profile(
&self,
input: DescribeSecurityProfileRequest,
) -> RusotoFuture<DescribeSecurityProfileResponse, DescribeSecurityProfileError> {
let request_uri = format!(
"/security-profiles/{security_profile_name}",
security_profile_name = input.security_profile_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeSecurityProfileResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeSecurityProfileError::from_response(response))
}))
}
})
}
fn describe_stream(
&self,
input: DescribeStreamRequest,
) -> RusotoFuture<DescribeStreamResponse, DescribeStreamError> {
let request_uri = format!("/streams/{stream_id}", stream_id = input.stream_id);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeStreamResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeStreamError::from_response(response))),
)
}
})
}
fn describe_thing(
&self,
input: DescribeThingRequest,
) -> RusotoFuture<DescribeThingResponse, DescribeThingError> {
let request_uri = format!("/things/{thing_name}", thing_name = input.thing_name);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeThingError::from_response(response))),
)
}
})
}
fn describe_thing_group(
&self,
input: DescribeThingGroupRequest,
) -> RusotoFuture<DescribeThingGroupResponse, DescribeThingGroupError> {
let request_uri = format!(
"/thing-groups/{thing_group_name}",
thing_group_name = input.thing_group_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeThingGroupResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeThingGroupError::from_response(response))),
)
}
})
}
fn describe_thing_registration_task(
&self,
input: DescribeThingRegistrationTaskRequest,
) -> RusotoFuture<DescribeThingRegistrationTaskResponse, DescribeThingRegistrationTaskError>
{
let request_uri = format!(
"/thing-registration-tasks/{task_id}",
task_id = input.task_id
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeThingRegistrationTaskResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeThingRegistrationTaskError::from_response(response))
}))
}
})
}
fn describe_thing_type(
&self,
input: DescribeThingTypeRequest,
) -> RusotoFuture<DescribeThingTypeResponse, DescribeThingTypeError> {
let request_uri = format!(
"/thing-types/{thing_type_name}",
thing_type_name = input.thing_type_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<DescribeThingTypeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeThingTypeError::from_response(response))),
)
}
})
}
fn detach_policy(&self, input: DetachPolicyRequest) -> RusotoFuture<(), DetachPolicyError> {
let request_uri = format!(
"/target-policies/{policy_name}",
policy_name = input.policy_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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(DetachPolicyError::from_response(response))),
)
}
})
}
fn detach_principal_policy(
&self,
input: DetachPrincipalPolicyRequest,
) -> RusotoFuture<(), DetachPrincipalPolicyError> {
let request_uri = format!(
"/principal-policies/{policy_name}",
policy_name = input.policy_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
request.add_header("x-amzn-iot-principal", &input.principal);
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(DetachPrincipalPolicyError::from_response(response))
}),
)
}
})
}
fn detach_security_profile(
&self,
input: DetachSecurityProfileRequest,
) -> RusotoFuture<DetachSecurityProfileResponse, DetachSecurityProfileError> {
let request_uri = format!(
"/security-profiles/{security_profile_name}/targets",
security_profile_name = input.security_profile_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
params.put(
"securityProfileTargetArn",
&input.security_profile_target_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::<DetachSecurityProfileResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DetachSecurityProfileError::from_response(response))
}),
)
}
})
}
fn detach_thing_principal(
&self,
input: DetachThingPrincipalRequest,
) -> RusotoFuture<DetachThingPrincipalResponse, DetachThingPrincipalError> {
let request_uri = format!(
"/things/{thing_name}/principals",
thing_name = input.thing_name
);
let mut request = SignedRequest::new("DELETE", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
request.add_header("x-amzn-principal", &input.principal);
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::<DetachThingPrincipalResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DetachThingPrincipalError::from_response(response))
}),
)
}
})
}
fn disable_topic_rule(
&self,
input: DisableTopicRuleRequest,
) -> RusotoFuture<(), DisableTopicRuleError> {
let request_uri = format!("/rules/{rule_name}/disable", rule_name = input.rule_name);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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(DisableTopicRuleError::from_response(response))),
)
}
})
}
fn enable_topic_rule(
&self,
input: EnableTopicRuleRequest,
) -> RusotoFuture<(), EnableTopicRuleError> {
let request_uri = format!("/rules/{rule_name}/enable", rule_name = input.rule_name);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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(EnableTopicRuleError::from_response(response))),
)
}
})
}
fn get_effective_policies(
&self,
input: GetEffectivePoliciesRequest,
) -> RusotoFuture<GetEffectivePoliciesResponse, GetEffectivePoliciesError> {
let request_uri = "/effective-policies";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.thing_name {
params.put("thingName", 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::<GetEffectivePoliciesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetEffectivePoliciesError::from_response(response))
}),
)
}
})
}
fn get_indexing_configuration(
&self,
) -> RusotoFuture<GetIndexingConfigurationResponse, GetIndexingConfigurationError> {
let request_uri = "/indexing/config";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetIndexingConfigurationResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetIndexingConfigurationError::from_response(response))
}))
}
})
}
fn get_job_document(
&self,
input: GetJobDocumentRequest,
) -> RusotoFuture<GetJobDocumentResponse, GetJobDocumentError> {
let request_uri = format!("/jobs/{job_id}/job-document", job_id = input.job_id);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetJobDocumentResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetJobDocumentError::from_response(response))),
)
}
})
}
fn get_logging_options(
&self,
) -> RusotoFuture<GetLoggingOptionsResponse, GetLoggingOptionsError> {
let request_uri = "/loggingOptions";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetLoggingOptionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetLoggingOptionsError::from_response(response))),
)
}
})
}
fn get_ota_update(
&self,
input: GetOTAUpdateRequest,
) -> RusotoFuture<GetOTAUpdateResponse, GetOTAUpdateError> {
let request_uri = format!(
"/otaUpdates/{ota_update_id}",
ota_update_id = input.ota_update_id
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetOTAUpdateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetOTAUpdateError::from_response(response))),
)
}
})
}
fn get_policy(
&self,
input: GetPolicyRequest,
) -> RusotoFuture<GetPolicyResponse, GetPolicyError> {
let request_uri = format!("/policies/{policy_name}", policy_name = input.policy_name);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetPolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetPolicyError::from_response(response))),
)
}
})
}
fn get_policy_version(
&self,
input: GetPolicyVersionRequest,
) -> RusotoFuture<GetPolicyVersionResponse, GetPolicyVersionError> {
let request_uri = format!(
"/policies/{policy_name}/version/{policy_version_id}",
policy_name = input.policy_name,
policy_version_id = input.policy_version_id
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetPolicyVersionResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetPolicyVersionError::from_response(response))),
)
}
})
}
fn get_registration_code(
&self,
) -> RusotoFuture<GetRegistrationCodeResponse, GetRegistrationCodeError> {
let request_uri = "/registrationcode";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetRegistrationCodeResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetRegistrationCodeError::from_response(response))
}),
)
}
})
}
fn get_topic_rule(
&self,
input: GetTopicRuleRequest,
) -> RusotoFuture<GetTopicRuleResponse, GetTopicRuleError> {
let request_uri = format!("/rules/{rule_name}", rule_name = input.rule_name);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetTopicRuleResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetTopicRuleError::from_response(response))),
)
}
})
}
fn get_v2_logging_options(
&self,
) -> RusotoFuture<GetV2LoggingOptionsResponse, GetV2LoggingOptionsError> {
let request_uri = "/v2LoggingOptions";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<GetV2LoggingOptionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetV2LoggingOptionsError::from_response(response))
}),
)
}
})
}
fn list_active_violations(
&self,
input: ListActiveViolationsRequest,
) -> RusotoFuture<ListActiveViolationsResponse, ListActiveViolationsError> {
let request_uri = "/active-violations";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.security_profile_name {
params.put("securityProfileName", x);
}
if let Some(ref x) = input.thing_name {
params.put("thingName", 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::<ListActiveViolationsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListActiveViolationsError::from_response(response))
}),
)
}
})
}
fn list_attached_policies(
&self,
input: ListAttachedPoliciesRequest,
) -> RusotoFuture<ListAttachedPoliciesResponse, ListAttachedPoliciesError> {
let request_uri = format!("/attached-policies/{target}", target = input.target);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", x);
}
if let Some(ref x) = input.recursive {
params.put("recursive", 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::<ListAttachedPoliciesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListAttachedPoliciesError::from_response(response))
}),
)
}
})
}
fn list_audit_findings(
&self,
input: ListAuditFindingsRequest,
) -> RusotoFuture<ListAuditFindingsResponse, ListAuditFindingsError> {
let request_uri = "/audit/findings";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<ListAuditFindingsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListAuditFindingsError::from_response(response))),
)
}
})
}
fn list_audit_tasks(
&self,
input: ListAuditTasksRequest,
) -> RusotoFuture<ListAuditTasksResponse, ListAuditTasksError> {
let request_uri = "/audit/tasks";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
params.put("endTime", &input.end_time);
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
params.put("startTime", &input.start_time);
if let Some(ref x) = input.task_status {
params.put("taskStatus", x);
}
if let Some(ref x) = input.task_type {
params.put("taskType", 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::<ListAuditTasksResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListAuditTasksError::from_response(response))),
)
}
})
}
fn list_authorizers(
&self,
input: ListAuthorizersRequest,
) -> RusotoFuture<ListAuthorizersResponse, ListAuthorizersError> {
let request_uri = "/authorizers/";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", x);
}
if let Some(ref x) = input.status {
params.put("status", 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::<ListAuthorizersResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListAuthorizersError::from_response(response))),
)
}
})
}
fn list_ca_certificates(
&self,
input: ListCACertificatesRequest,
) -> RusotoFuture<ListCACertificatesResponse, ListCACertificatesError> {
let request_uri = "/cacertificates";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListCACertificatesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListCACertificatesError::from_response(response))),
)
}
})
}
fn list_certificates(
&self,
input: ListCertificatesRequest,
) -> RusotoFuture<ListCertificatesResponse, ListCertificatesError> {
let request_uri = "/certificates";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListCertificatesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListCertificatesError::from_response(response))),
)
}
})
}
fn list_certificates_by_ca(
&self,
input: ListCertificatesByCARequest,
) -> RusotoFuture<ListCertificatesByCAResponse, ListCertificatesByCAError> {
let request_uri = format!(
"/certificates-by-ca/{ca_certificate_id}",
ca_certificate_id = input.ca_certificate_id
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListCertificatesByCAResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListCertificatesByCAError::from_response(response))
}),
)
}
})
}
fn list_indices(
&self,
input: ListIndicesRequest,
) -> RusotoFuture<ListIndicesResponse, ListIndicesError> {
let request_uri = "/indices";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<ListIndicesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListIndicesError::from_response(response))),
)
}
})
}
fn list_job_executions_for_job(
&self,
input: ListJobExecutionsForJobRequest,
) -> RusotoFuture<ListJobExecutionsForJobResponse, ListJobExecutionsForJobError> {
let request_uri = format!("/jobs/{job_id}/things", job_id = input.job_id);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.status {
params.put("status", 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::<ListJobExecutionsForJobResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListJobExecutionsForJobError::from_response(response))
}))
}
})
}
fn list_job_executions_for_thing(
&self,
input: ListJobExecutionsForThingRequest,
) -> RusotoFuture<ListJobExecutionsForThingResponse, ListJobExecutionsForThingError> {
let request_uri = format!("/things/{thing_name}/jobs", thing_name = input.thing_name);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.status {
params.put("status", 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::<ListJobExecutionsForThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListJobExecutionsForThingError::from_response(response))
}))
}
})
}
fn list_jobs(&self, input: ListJobsRequest) -> RusotoFuture<ListJobsResponse, ListJobsError> {
let request_uri = "/jobs";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.status {
params.put("status", x);
}
if let Some(ref x) = input.target_selection {
params.put("targetSelection", x);
}
if let Some(ref x) = input.thing_group_id {
params.put("thingGroupId", x);
}
if let Some(ref x) = input.thing_group_name {
params.put("thingGroupName", 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::<ListJobsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListJobsError::from_response(response))),
)
}
})
}
fn list_ota_updates(
&self,
input: ListOTAUpdatesRequest,
) -> RusotoFuture<ListOTAUpdatesResponse, ListOTAUpdatesError> {
let request_uri = "/otaUpdates";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.ota_update_status {
params.put("otaUpdateStatus", 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::<ListOTAUpdatesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListOTAUpdatesError::from_response(response))),
)
}
})
}
fn list_outgoing_certificates(
&self,
input: ListOutgoingCertificatesRequest,
) -> RusotoFuture<ListOutgoingCertificatesResponse, ListOutgoingCertificatesError> {
let request_uri = "/certificates-out-going";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListOutgoingCertificatesResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListOutgoingCertificatesError::from_response(response))
}))
}
})
}
fn list_policies(
&self,
input: ListPoliciesRequest,
) -> RusotoFuture<ListPoliciesResponse, ListPoliciesError> {
let request_uri = "/policies";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListPoliciesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListPoliciesError::from_response(response))),
)
}
})
}
fn list_policy_principals(
&self,
input: ListPolicyPrincipalsRequest,
) -> RusotoFuture<ListPolicyPrincipalsResponse, ListPolicyPrincipalsError> {
let request_uri = "/policy-principals";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
request.add_header("x-amzn-iot-policy", &input.policy_name);
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListPolicyPrincipalsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListPolicyPrincipalsError::from_response(response))
}),
)
}
})
}
fn list_policy_versions(
&self,
input: ListPolicyVersionsRequest,
) -> RusotoFuture<ListPolicyVersionsResponse, ListPolicyVersionsError> {
let request_uri = format!(
"/policies/{policy_name}/version",
policy_name = input.policy_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<ListPolicyVersionsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListPolicyVersionsError::from_response(response))),
)
}
})
}
fn list_principal_policies(
&self,
input: ListPrincipalPoliciesRequest,
) -> RusotoFuture<ListPrincipalPoliciesResponse, ListPrincipalPoliciesError> {
let request_uri = "/principal-policies";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
request.add_header("x-amzn-iot-principal", &input.principal);
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListPrincipalPoliciesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListPrincipalPoliciesError::from_response(response))
}),
)
}
})
}
fn list_principal_things(
&self,
input: ListPrincipalThingsRequest,
) -> RusotoFuture<ListPrincipalThingsResponse, ListPrincipalThingsError> {
let request_uri = "/principals/things";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
request.add_header("x-amzn-principal", &input.principal);
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::<ListPrincipalThingsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListPrincipalThingsError::from_response(response))
}),
)
}
})
}
fn list_role_aliases(
&self,
input: ListRoleAliasesRequest,
) -> RusotoFuture<ListRoleAliasesResponse, ListRoleAliasesError> {
let request_uri = "/role-aliases";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListRoleAliasesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListRoleAliasesError::from_response(response))),
)
}
})
}
fn list_scheduled_audits(
&self,
input: ListScheduledAuditsRequest,
) -> RusotoFuture<ListScheduledAuditsResponse, ListScheduledAuditsError> {
let request_uri = "/audit/scheduledaudits";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<ListScheduledAuditsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListScheduledAuditsError::from_response(response))
}),
)
}
})
}
fn list_security_profiles(
&self,
input: ListSecurityProfilesRequest,
) -> RusotoFuture<ListSecurityProfilesResponse, ListSecurityProfilesError> {
let request_uri = "/security-profiles";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<ListSecurityProfilesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListSecurityProfilesError::from_response(response))
}),
)
}
})
}
fn list_security_profiles_for_target(
&self,
input: ListSecurityProfilesForTargetRequest,
) -> RusotoFuture<ListSecurityProfilesForTargetResponse, ListSecurityProfilesForTargetError>
{
let request_uri = "/security-profiles-for-target";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.recursive {
params.put("recursive", x);
}
params.put(
"securityProfileTargetArn",
&input.security_profile_target_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::<ListSecurityProfilesForTargetResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListSecurityProfilesForTargetError::from_response(response))
}))
}
})
}
fn list_streams(
&self,
input: ListStreamsRequest,
) -> RusotoFuture<ListStreamsResponse, ListStreamsError> {
let request_uri = "/streams";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.ascending_order {
params.put("isAscendingOrder", x);
}
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
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::<ListStreamsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListStreamsError::from_response(response))),
)
}
})
}
fn list_targets_for_policy(
&self,
input: ListTargetsForPolicyRequest,
) -> RusotoFuture<ListTargetsForPolicyResponse, ListTargetsForPolicyError> {
let request_uri = format!(
"/policy-targets/{policy_name}",
policy_name = input.policy_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.marker {
params.put("marker", x);
}
if let Some(ref x) = input.page_size {
params.put("pageSize", 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::<ListTargetsForPolicyResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTargetsForPolicyError::from_response(response))
}),
)
}
})
}
fn list_targets_for_security_profile(
&self,
input: ListTargetsForSecurityProfileRequest,
) -> RusotoFuture<ListTargetsForSecurityProfileResponse, ListTargetsForSecurityProfileError>
{
let request_uri = format!(
"/security-profiles/{security_profile_name}/targets",
security_profile_name = input.security_profile_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<ListTargetsForSecurityProfileResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListTargetsForSecurityProfileError::from_response(response))
}))
}
})
}
fn list_thing_groups(
&self,
input: ListThingGroupsRequest,
) -> RusotoFuture<ListThingGroupsResponse, ListThingGroupsError> {
let request_uri = "/thing-groups";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.name_prefix_filter {
params.put("namePrefixFilter", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.parent_group {
params.put("parentGroup", x);
}
if let Some(ref x) = input.recursive {
params.put("recursive", 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::<ListThingGroupsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListThingGroupsError::from_response(response))),
)
}
})
}
fn list_thing_groups_for_thing(
&self,
input: ListThingGroupsForThingRequest,
) -> RusotoFuture<ListThingGroupsForThingResponse, ListThingGroupsForThingError> {
let request_uri = format!(
"/things/{thing_name}/thing-groups",
thing_name = input.thing_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<ListThingGroupsForThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListThingGroupsForThingError::from_response(response))
}))
}
})
}
fn list_thing_principals(
&self,
input: ListThingPrincipalsRequest,
) -> RusotoFuture<ListThingPrincipalsResponse, ListThingPrincipalsError> {
let request_uri = format!(
"/things/{thing_name}/principals",
thing_name = input.thing_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<ListThingPrincipalsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListThingPrincipalsError::from_response(response))
}),
)
}
})
}
fn list_thing_registration_task_reports(
&self,
input: ListThingRegistrationTaskReportsRequest,
) -> RusotoFuture<ListThingRegistrationTaskReportsResponse, ListThingRegistrationTaskReportsError>
{
let request_uri = format!(
"/thing-registration-tasks/{task_id}/reports",
task_id = input.task_id
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
params.put("reportType", &input.report_type);
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::<ListThingRegistrationTaskReportsResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListThingRegistrationTaskReportsError::from_response(
response,
))
}))
}
})
}
fn list_thing_registration_tasks(
&self,
input: ListThingRegistrationTasksRequest,
) -> RusotoFuture<ListThingRegistrationTasksResponse, ListThingRegistrationTasksError> {
let request_uri = "/thing-registration-tasks";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.status {
params.put("status", 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::<ListThingRegistrationTasksResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListThingRegistrationTasksError::from_response(response))
}))
}
})
}
fn list_thing_types(
&self,
input: ListThingTypesRequest,
) -> RusotoFuture<ListThingTypesResponse, ListThingTypesError> {
let request_uri = "/thing-types";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.thing_type_name {
params.put("thingTypeName", 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::<ListThingTypesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListThingTypesError::from_response(response))),
)
}
})
}
fn list_things(
&self,
input: ListThingsRequest,
) -> RusotoFuture<ListThingsResponse, ListThingsError> {
let request_uri = "/things";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.attribute_name {
params.put("attributeName", x);
}
if let Some(ref x) = input.attribute_value {
params.put("attributeValue", x);
}
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.thing_type_name {
params.put("thingTypeName", 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::<ListThingsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListThingsError::from_response(response))),
)
}
})
}
fn list_things_in_thing_group(
&self,
input: ListThingsInThingGroupRequest,
) -> RusotoFuture<ListThingsInThingGroupResponse, ListThingsInThingGroupError> {
let request_uri = format!(
"/thing-groups/{thing_group_name}/things",
thing_group_name = input.thing_group_name
);
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.recursive {
params.put("recursive", 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::<ListThingsInThingGroupResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListThingsInThingGroupError::from_response(response))
}),
)
}
})
}
fn list_topic_rules(
&self,
input: ListTopicRulesRequest,
) -> RusotoFuture<ListTopicRulesResponse, ListTopicRulesError> {
let request_uri = "/rules";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.rule_disabled {
params.put("ruleDisabled", x);
}
if let Some(ref x) = input.topic {
params.put("topic", 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::<ListTopicRulesResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListTopicRulesError::from_response(response))),
)
}
})
}
fn list_v2_logging_levels(
&self,
input: ListV2LoggingLevelsRequest,
) -> RusotoFuture<ListV2LoggingLevelsResponse, ListV2LoggingLevelsError> {
let request_uri = "/v2LoggingLevel";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.target_type {
params.put("targetType", 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::<ListV2LoggingLevelsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListV2LoggingLevelsError::from_response(response))
}),
)
}
})
}
fn list_violation_events(
&self,
input: ListViolationEventsRequest,
) -> RusotoFuture<ListViolationEventsResponse, ListViolationEventsError> {
let request_uri = "/violation-events";
let mut request = SignedRequest::new("GET", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
params.put("endTime", &input.end_time);
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.security_profile_name {
params.put("securityProfileName", x);
}
params.put("startTime", &input.start_time);
if let Some(ref x) = input.thing_name {
params.put("thingName", 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::<ListViolationEventsResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListViolationEventsError::from_response(response))
}),
)
}
})
}
fn register_ca_certificate(
&self,
input: RegisterCACertificateRequest,
) -> RusotoFuture<RegisterCACertificateResponse, RegisterCACertificateError> {
let request_uri = "/cacertificate";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.allow_auto_registration {
params.put("allowAutoRegistration", x);
}
if let Some(ref x) = input.set_as_active {
params.put("setAsActive", 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::<RegisterCACertificateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RegisterCACertificateError::from_response(response))
}),
)
}
})
}
fn register_certificate(
&self,
input: RegisterCertificateRequest,
) -> RusotoFuture<RegisterCertificateResponse, RegisterCertificateError> {
let request_uri = "/certificate/register";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<RegisterCertificateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RegisterCertificateError::from_response(response))
}),
)
}
})
}
fn register_thing(
&self,
input: RegisterThingRequest,
) -> RusotoFuture<RegisterThingResponse, RegisterThingError> {
let request_uri = "/things";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<RegisterThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(RegisterThingError::from_response(response))),
)
}
})
}
fn reject_certificate_transfer(
&self,
input: RejectCertificateTransferRequest,
) -> RusotoFuture<(), RejectCertificateTransferError> {
let request_uri = format!(
"/reject-certificate-transfer/{certificate_id}",
certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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(RejectCertificateTransferError::from_response(response))
}))
}
})
}
fn remove_thing_from_thing_group(
&self,
input: RemoveThingFromThingGroupRequest,
) -> RusotoFuture<RemoveThingFromThingGroupResponse, RemoveThingFromThingGroupError> {
let request_uri = "/thing-groups/removeThingFromThingGroup";
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<RemoveThingFromThingGroupResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(RemoveThingFromThingGroupError::from_response(response))
}))
}
})
}
fn replace_topic_rule(
&self,
input: ReplaceTopicRuleRequest,
) -> RusotoFuture<(), ReplaceTopicRuleError> {
let request_uri = format!("/rules/{rule_name}", rule_name = input.rule_name);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input.topic_rule_payload).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(ReplaceTopicRuleError::from_response(response))),
)
}
})
}
fn search_index(
&self,
input: SearchIndexRequest,
) -> RusotoFuture<SearchIndexResponse, SearchIndexError> {
let request_uri = "/indices/search";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<SearchIndexResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchIndexError::from_response(response))),
)
}
})
}
fn set_default_authorizer(
&self,
input: SetDefaultAuthorizerRequest,
) -> RusotoFuture<SetDefaultAuthorizerResponse, SetDefaultAuthorizerError> {
let request_uri = "/default-authorizer";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<SetDefaultAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(SetDefaultAuthorizerError::from_response(response))
}),
)
}
})
}
fn set_default_policy_version(
&self,
input: SetDefaultPolicyVersionRequest,
) -> RusotoFuture<(), SetDefaultPolicyVersionError> {
let request_uri = format!(
"/policies/{policy_name}/version/{policy_version_id}",
policy_name = input.policy_name,
policy_version_id = input.policy_version_id
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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(SetDefaultPolicyVersionError::from_response(response))
}))
}
})
}
fn set_logging_options(
&self,
input: SetLoggingOptionsRequest,
) -> RusotoFuture<(), SetLoggingOptionsError> {
let request_uri = "/loggingOptions";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input.logging_options_payload).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(SetLoggingOptionsError::from_response(response))),
)
}
})
}
fn set_v2_logging_level(
&self,
input: SetV2LoggingLevelRequest,
) -> RusotoFuture<(), SetV2LoggingLevelError> {
let request_uri = "/v2LoggingLevel";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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(SetV2LoggingLevelError::from_response(response))),
)
}
})
}
fn set_v2_logging_options(
&self,
input: SetV2LoggingOptionsRequest,
) -> RusotoFuture<(), SetV2LoggingOptionsError> {
let request_uri = "/v2LoggingOptions";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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(SetV2LoggingOptionsError::from_response(response))
}),
)
}
})
}
fn start_on_demand_audit_task(
&self,
input: StartOnDemandAuditTaskRequest,
) -> RusotoFuture<StartOnDemandAuditTaskResponse, StartOnDemandAuditTaskError> {
let request_uri = "/audit/tasks";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<StartOnDemandAuditTaskResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StartOnDemandAuditTaskError::from_response(response))
}),
)
}
})
}
fn start_thing_registration_task(
&self,
input: StartThingRegistrationTaskRequest,
) -> RusotoFuture<StartThingRegistrationTaskResponse, StartThingRegistrationTaskError> {
let request_uri = "/thing-registration-tasks";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<StartThingRegistrationTaskResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(StartThingRegistrationTaskError::from_response(response))
}))
}
})
}
fn stop_thing_registration_task(
&self,
input: StopThingRegistrationTaskRequest,
) -> RusotoFuture<StopThingRegistrationTaskResponse, StopThingRegistrationTaskError> {
let request_uri = format!(
"/thing-registration-tasks/{task_id}/cancel",
task_id = input.task_id
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
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::<StopThingRegistrationTaskResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(StopThingRegistrationTaskError::from_response(response))
}))
}
})
}
fn test_authorization(
&self,
input: TestAuthorizationRequest,
) -> RusotoFuture<TestAuthorizationResponse, TestAuthorizationError> {
let request_uri = "/test-authorization";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.client_id {
params.put("clientId", 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::<TestAuthorizationResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TestAuthorizationError::from_response(response))),
)
}
})
}
fn test_invoke_authorizer(
&self,
input: TestInvokeAuthorizerRequest,
) -> RusotoFuture<TestInvokeAuthorizerResponse, TestInvokeAuthorizerError> {
let request_uri = format!(
"/authorizer/{authorizer_name}/test",
authorizer_name = input.authorizer_name
);
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<TestInvokeAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(TestInvokeAuthorizerError::from_response(response))
}),
)
}
})
}
fn transfer_certificate(
&self,
input: TransferCertificateRequest,
) -> RusotoFuture<TransferCertificateResponse, TransferCertificateError> {
let request_uri = format!(
"/transfer-certificate/{certificate_id}",
certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
params.put("targetAwsAccount", &input.target_aws_account);
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::<TransferCertificateResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(TransferCertificateError::from_response(response))
}),
)
}
})
}
fn update_account_audit_configuration(
&self,
input: UpdateAccountAuditConfigurationRequest,
) -> RusotoFuture<UpdateAccountAuditConfigurationResponse, UpdateAccountAuditConfigurationError>
{
let request_uri = "/audit/configuration";
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateAccountAuditConfigurationResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateAccountAuditConfigurationError::from_response(
response,
))
}))
}
})
}
fn update_authorizer(
&self,
input: UpdateAuthorizerRequest,
) -> RusotoFuture<UpdateAuthorizerResponse, UpdateAuthorizerError> {
let request_uri = format!(
"/authorizer/{authorizer_name}",
authorizer_name = input.authorizer_name
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateAuthorizerResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateAuthorizerError::from_response(response))),
)
}
})
}
fn update_ca_certificate(
&self,
input: UpdateCACertificateRequest,
) -> RusotoFuture<(), UpdateCACertificateError> {
let request_uri = format!(
"/cacertificate/{ca_certificate_id}",
ca_certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.new_auto_registration_status {
params.put("newAutoRegistrationStatus", x);
}
if let Some(ref x) = input.new_status {
params.put("newStatus", 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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateCACertificateError::from_response(response))
}),
)
}
})
}
fn update_certificate(
&self,
input: UpdateCertificateRequest,
) -> RusotoFuture<(), UpdateCertificateError> {
let request_uri = format!(
"/certificates/{certificate_id}",
certificate_id = input.certificate_id
);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let mut params = Params::new();
params.put("newStatus", &input.new_status);
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 result = ::std::mem::drop(response);
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateCertificateError::from_response(response))),
)
}
})
}
fn update_event_configurations(
&self,
input: UpdateEventConfigurationsRequest,
) -> RusotoFuture<UpdateEventConfigurationsResponse, UpdateEventConfigurationsError> {
let request_uri = "/event-configurations";
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateEventConfigurationsResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateEventConfigurationsError::from_response(response))
}))
}
})
}
fn update_indexing_configuration(
&self,
input: UpdateIndexingConfigurationRequest,
) -> RusotoFuture<UpdateIndexingConfigurationResponse, UpdateIndexingConfigurationError> {
let request_uri = "/indexing/config";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateIndexingConfigurationResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateIndexingConfigurationError::from_response(response))
}))
}
})
}
fn update_role_alias(
&self,
input: UpdateRoleAliasRequest,
) -> RusotoFuture<UpdateRoleAliasResponse, UpdateRoleAliasError> {
let request_uri = format!("/role-aliases/{role_alias}", role_alias = input.role_alias);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateRoleAliasResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateRoleAliasError::from_response(response))),
)
}
})
}
fn update_scheduled_audit(
&self,
input: UpdateScheduledAuditRequest,
) -> RusotoFuture<UpdateScheduledAuditResponse, UpdateScheduledAuditError> {
let request_uri = format!(
"/audit/scheduledaudits/{scheduled_audit_name}",
scheduled_audit_name = input.scheduled_audit_name
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateScheduledAuditResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateScheduledAuditError::from_response(response))
}),
)
}
})
}
fn update_security_profile(
&self,
input: UpdateSecurityProfileRequest,
) -> RusotoFuture<UpdateSecurityProfileResponse, UpdateSecurityProfileError> {
let request_uri = format!(
"/security-profiles/{security_profile_name}",
security_profile_name = input.security_profile_name
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut params = Params::new();
if let Some(ref x) = input.expected_version {
params.put("expectedVersion", 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::<UpdateSecurityProfileResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateSecurityProfileError::from_response(response))
}),
)
}
})
}
fn update_stream(
&self,
input: UpdateStreamRequest,
) -> RusotoFuture<UpdateStreamResponse, UpdateStreamError> {
let request_uri = format!("/streams/{stream_id}", stream_id = input.stream_id);
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateStreamResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateStreamError::from_response(response))),
)
}
})
}
fn update_thing(
&self,
input: UpdateThingRequest,
) -> RusotoFuture<UpdateThingResponse, UpdateThingError> {
let request_uri = format!("/things/{thing_name}", thing_name = input.thing_name);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateThingError::from_response(response))),
)
}
})
}
fn update_thing_group(
&self,
input: UpdateThingGroupRequest,
) -> RusotoFuture<UpdateThingGroupResponse, UpdateThingGroupError> {
let request_uri = format!(
"/thing-groups/{thing_group_name}",
thing_group_name = input.thing_group_name
);
let mut request = SignedRequest::new("PATCH", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateThingGroupResponse>(&body).unwrap();
result
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateThingGroupError::from_response(response))),
)
}
})
}
fn update_thing_groups_for_thing(
&self,
input: UpdateThingGroupsForThingRequest,
) -> RusotoFuture<UpdateThingGroupsForThingResponse, UpdateThingGroupsForThingError> {
let request_uri = "/thing-groups/updateThingGroupsForThing";
let mut request = SignedRequest::new("PUT", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<UpdateThingGroupsForThingResponse>(&body).unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateThingGroupsForThingError::from_response(response))
}))
}
})
}
fn validate_security_profile_behaviors(
&self,
input: ValidateSecurityProfileBehaviorsRequest,
) -> RusotoFuture<ValidateSecurityProfileBehaviorsResponse, ValidateSecurityProfileBehaviorsError>
{
let request_uri = "/security-profile-behaviors/validate";
let mut request = SignedRequest::new("POST", "execute-api", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("iot".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.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::<ValidateSecurityProfileBehaviorsResponse>(&body)
.unwrap();
result
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ValidateSecurityProfileBehaviorsError::from_response(
response,
))
}))
}
})
}
}
#[cfg(test)]
mod protocol_tests {}