use std::error::Error;
use std::fmt;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError, RusotoFuture};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
use serde_json;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateDRTLogBucketRequest {
#[serde(rename = "LogBucket")]
pub log_bucket: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateDRTLogBucketResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateDRTRoleRequest {
#[serde(rename = "RoleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateDRTRoleResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttackDetail {
#[serde(rename = "AttackCounters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_counters: Option<Vec<SummarizedCounter>>,
#[serde(rename = "AttackId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_id: Option<String>,
#[serde(rename = "AttackProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_properties: Option<Vec<AttackProperty>>,
#[serde(rename = "EndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "Mitigations")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mitigations: Option<Vec<Mitigation>>,
#[serde(rename = "ResourceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arn: Option<String>,
#[serde(rename = "StartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
#[serde(rename = "SubResources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sub_resources: Option<Vec<SubResourceSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttackProperty {
#[serde(rename = "AttackLayer")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_layer: Option<String>,
#[serde(rename = "AttackPropertyIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_property_identifier: Option<String>,
#[serde(rename = "TopContributors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub top_contributors: Option<Vec<Contributor>>,
#[serde(rename = "Total")]
#[serde(skip_serializing_if = "Option::is_none")]
pub total: Option<i64>,
#[serde(rename = "Unit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unit: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttackSummary {
#[serde(rename = "AttackId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_id: Option<String>,
#[serde(rename = "AttackVectors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_vectors: Option<Vec<AttackVectorDescription>>,
#[serde(rename = "EndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "ResourceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arn: Option<String>,
#[serde(rename = "StartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AttackVectorDescription {
#[serde(rename = "VectorType")]
pub vector_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Contributor {
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateProtectionRequest {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateProtectionResponse {
#[serde(rename = "ProtectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub protection_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSubscriptionRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSubscriptionResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteProtectionRequest {
#[serde(rename = "ProtectionId")]
pub protection_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteProtectionResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSubscriptionRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSubscriptionResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeAttackRequest {
#[serde(rename = "AttackId")]
pub attack_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeAttackResponse {
#[serde(rename = "Attack")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack: Option<AttackDetail>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeDRTAccessRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeDRTAccessResponse {
#[serde(rename = "LogBucketList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub log_bucket_list: Option<Vec<String>>,
#[serde(rename = "RoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeEmergencyContactSettingsRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeEmergencyContactSettingsResponse {
#[serde(rename = "EmergencyContactList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub emergency_contact_list: Option<Vec<EmergencyContact>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeProtectionRequest {
#[serde(rename = "ProtectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub protection_id: Option<String>,
#[serde(rename = "ResourceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeProtectionResponse {
#[serde(rename = "Protection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub protection: Option<Protection>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeSubscriptionRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeSubscriptionResponse {
#[serde(rename = "Subscription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription: Option<Subscription>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateDRTLogBucketRequest {
#[serde(rename = "LogBucket")]
pub log_bucket: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateDRTLogBucketResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateDRTRoleRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateDRTRoleResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EmergencyContact {
#[serde(rename = "EmailAddress")]
pub email_address: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetSubscriptionStateRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetSubscriptionStateResponse {
#[serde(rename = "SubscriptionState")]
pub subscription_state: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Limit {
#[serde(rename = "Max")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max: Option<i64>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAttacksRequest {
#[serde(rename = "EndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<TimeRange>,
#[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 = "ResourceArns")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arns: Option<Vec<String>>,
#[serde(rename = "StartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<TimeRange>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAttacksResponse {
#[serde(rename = "AttackSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_summaries: Option<Vec<AttackSummary>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListProtectionsRequest {
#[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 ListProtectionsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Protections")]
#[serde(skip_serializing_if = "Option::is_none")]
pub protections: Option<Vec<Protection>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Mitigation {
#[serde(rename = "MitigationName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mitigation_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Protection {
#[serde(rename = "Id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ResourceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SubResourceSummary {
#[serde(rename = "AttackVectors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_vectors: Option<Vec<SummarizedAttackVector>>,
#[serde(rename = "Counters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub counters: Option<Vec<SummarizedCounter>>,
#[serde(rename = "Id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Subscription {
#[serde(rename = "AutoRenew")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_renew: Option<String>,
#[serde(rename = "EndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "Limits")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limits: Option<Vec<Limit>>,
#[serde(rename = "StartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
#[serde(rename = "TimeCommitmentInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub time_commitment_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SummarizedAttackVector {
#[serde(rename = "VectorCounters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vector_counters: Option<Vec<SummarizedCounter>>,
#[serde(rename = "VectorType")]
pub vector_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SummarizedCounter {
#[serde(rename = "Average")]
#[serde(skip_serializing_if = "Option::is_none")]
pub average: Option<f64>,
#[serde(rename = "Max")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max: Option<f64>,
#[serde(rename = "N")]
#[serde(skip_serializing_if = "Option::is_none")]
pub n: Option<i64>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Sum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sum: Option<f64>,
#[serde(rename = "Unit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unit: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TimeRange {
#[serde(rename = "FromInclusive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub from_inclusive: Option<f64>,
#[serde(rename = "ToExclusive")]
#[serde(skip_serializing_if = "Option::is_none")]
pub to_exclusive: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateEmergencyContactSettingsRequest {
#[serde(rename = "EmergencyContactList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub emergency_contact_list: Option<Vec<EmergencyContact>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateEmergencyContactSettingsResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateSubscriptionRequest {
#[serde(rename = "AutoRenew")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_renew: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateSubscriptionResponse {}
#[derive(Debug, PartialEq)]
pub enum AssociateDRTLogBucketError {
AccessDeniedForDependency(String),
InternalError(String),
InvalidOperation(String),
InvalidParameter(String),
LimitsExceeded(String),
NoAssociatedRole(String),
OptimisticLock(String),
ResourceNotFound(String),
}
impl AssociateDRTLogBucketError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AssociateDRTLogBucketError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AccessDeniedForDependencyException" => {
return RusotoError::Service(
AssociateDRTLogBucketError::AccessDeniedForDependency(err.msg),
)
}
"InternalErrorException" => {
return RusotoError::Service(AssociateDRTLogBucketError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(AssociateDRTLogBucketError::InvalidOperation(
err.msg,
))
}
"InvalidParameterException" => {
return RusotoError::Service(AssociateDRTLogBucketError::InvalidParameter(
err.msg,
))
}
"LimitsExceededException" => {
return RusotoError::Service(AssociateDRTLogBucketError::LimitsExceeded(
err.msg,
))
}
"NoAssociatedRoleException" => {
return RusotoError::Service(AssociateDRTLogBucketError::NoAssociatedRole(
err.msg,
))
}
"OptimisticLockException" => {
return RusotoError::Service(AssociateDRTLogBucketError::OptimisticLock(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(AssociateDRTLogBucketError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for AssociateDRTLogBucketError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateDRTLogBucketError {
fn description(&self) -> &str {
match *self {
AssociateDRTLogBucketError::AccessDeniedForDependency(ref cause) => cause,
AssociateDRTLogBucketError::InternalError(ref cause) => cause,
AssociateDRTLogBucketError::InvalidOperation(ref cause) => cause,
AssociateDRTLogBucketError::InvalidParameter(ref cause) => cause,
AssociateDRTLogBucketError::LimitsExceeded(ref cause) => cause,
AssociateDRTLogBucketError::NoAssociatedRole(ref cause) => cause,
AssociateDRTLogBucketError::OptimisticLock(ref cause) => cause,
AssociateDRTLogBucketError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateDRTRoleError {
AccessDeniedForDependency(String),
InternalError(String),
InvalidOperation(String),
InvalidParameter(String),
OptimisticLock(String),
ResourceNotFound(String),
}
impl AssociateDRTRoleError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AssociateDRTRoleError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AccessDeniedForDependencyException" => {
return RusotoError::Service(AssociateDRTRoleError::AccessDeniedForDependency(
err.msg,
))
}
"InternalErrorException" => {
return RusotoError::Service(AssociateDRTRoleError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(AssociateDRTRoleError::InvalidOperation(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(AssociateDRTRoleError::InvalidParameter(err.msg))
}
"OptimisticLockException" => {
return RusotoError::Service(AssociateDRTRoleError::OptimisticLock(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(AssociateDRTRoleError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for AssociateDRTRoleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateDRTRoleError {
fn description(&self) -> &str {
match *self {
AssociateDRTRoleError::AccessDeniedForDependency(ref cause) => cause,
AssociateDRTRoleError::InternalError(ref cause) => cause,
AssociateDRTRoleError::InvalidOperation(ref cause) => cause,
AssociateDRTRoleError::InvalidParameter(ref cause) => cause,
AssociateDRTRoleError::OptimisticLock(ref cause) => cause,
AssociateDRTRoleError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateProtectionError {
InternalError(String),
InvalidOperation(String),
InvalidResource(String),
LimitsExceeded(String),
OptimisticLock(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
}
impl CreateProtectionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateProtectionError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(CreateProtectionError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(CreateProtectionError::InvalidOperation(err.msg))
}
"InvalidResourceException" => {
return RusotoError::Service(CreateProtectionError::InvalidResource(err.msg))
}
"LimitsExceededException" => {
return RusotoError::Service(CreateProtectionError::LimitsExceeded(err.msg))
}
"OptimisticLockException" => {
return RusotoError::Service(CreateProtectionError::OptimisticLock(err.msg))
}
"ResourceAlreadyExistsException" => {
return RusotoError::Service(CreateProtectionError::ResourceAlreadyExists(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(CreateProtectionError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreateProtectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateProtectionError {
fn description(&self) -> &str {
match *self {
CreateProtectionError::InternalError(ref cause) => cause,
CreateProtectionError::InvalidOperation(ref cause) => cause,
CreateProtectionError::InvalidResource(ref cause) => cause,
CreateProtectionError::LimitsExceeded(ref cause) => cause,
CreateProtectionError::OptimisticLock(ref cause) => cause,
CreateProtectionError::ResourceAlreadyExists(ref cause) => cause,
CreateProtectionError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSubscriptionError {
InternalError(String),
ResourceAlreadyExists(String),
}
impl CreateSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateSubscriptionError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(CreateSubscriptionError::InternalError(err.msg))
}
"ResourceAlreadyExistsException" => {
return RusotoError::Service(CreateSubscriptionError::ResourceAlreadyExists(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreateSubscriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSubscriptionError {
fn description(&self) -> &str {
match *self {
CreateSubscriptionError::InternalError(ref cause) => cause,
CreateSubscriptionError::ResourceAlreadyExists(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteProtectionError {
InternalError(String),
OptimisticLock(String),
ResourceNotFound(String),
}
impl DeleteProtectionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteProtectionError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeleteProtectionError::InternalError(err.msg))
}
"OptimisticLockException" => {
return RusotoError::Service(DeleteProtectionError::OptimisticLock(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteProtectionError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteProtectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteProtectionError {
fn description(&self) -> &str {
match *self {
DeleteProtectionError::InternalError(ref cause) => cause,
DeleteProtectionError::OptimisticLock(ref cause) => cause,
DeleteProtectionError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSubscriptionError {
InternalError(String),
LockedSubscription(String),
ResourceNotFound(String),
}
impl DeleteSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteSubscriptionError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeleteSubscriptionError::InternalError(err.msg))
}
"LockedSubscriptionException" => {
return RusotoError::Service(DeleteSubscriptionError::LockedSubscription(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteSubscriptionError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteSubscriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSubscriptionError {
fn description(&self) -> &str {
match *self {
DeleteSubscriptionError::InternalError(ref cause) => cause,
DeleteSubscriptionError::LockedSubscription(ref cause) => cause,
DeleteSubscriptionError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeAttackError {
AccessDenied(String),
InternalError(String),
}
impl DescribeAttackError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeAttackError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(DescribeAttackError::AccessDenied(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(DescribeAttackError::InternalError(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeAttackError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeAttackError {
fn description(&self) -> &str {
match *self {
DescribeAttackError::AccessDenied(ref cause) => cause,
DescribeAttackError::InternalError(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeDRTAccessError {
InternalError(String),
ResourceNotFound(String),
}
impl DescribeDRTAccessError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeDRTAccessError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DescribeDRTAccessError::InternalError(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeDRTAccessError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeDRTAccessError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeDRTAccessError {
fn description(&self) -> &str {
match *self {
DescribeDRTAccessError::InternalError(ref cause) => cause,
DescribeDRTAccessError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeEmergencyContactSettingsError {
InternalError(String),
ResourceNotFound(String),
}
impl DescribeEmergencyContactSettingsError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeEmergencyContactSettingsError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(
DescribeEmergencyContactSettingsError::InternalError(err.msg),
)
}
"ResourceNotFoundException" => {
return RusotoError::Service(
DescribeEmergencyContactSettingsError::ResourceNotFound(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeEmergencyContactSettingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeEmergencyContactSettingsError {
fn description(&self) -> &str {
match *self {
DescribeEmergencyContactSettingsError::InternalError(ref cause) => cause,
DescribeEmergencyContactSettingsError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeProtectionError {
InternalError(String),
InvalidParameter(String),
ResourceNotFound(String),
}
impl DescribeProtectionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeProtectionError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DescribeProtectionError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DescribeProtectionError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeProtectionError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeProtectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeProtectionError {
fn description(&self) -> &str {
match *self {
DescribeProtectionError::InternalError(ref cause) => cause,
DescribeProtectionError::InvalidParameter(ref cause) => cause,
DescribeProtectionError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeSubscriptionError {
InternalError(String),
ResourceNotFound(String),
}
impl DescribeSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeSubscriptionError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DescribeSubscriptionError::InternalError(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeSubscriptionError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeSubscriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeSubscriptionError {
fn description(&self) -> &str {
match *self {
DescribeSubscriptionError::InternalError(ref cause) => cause,
DescribeSubscriptionError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateDRTLogBucketError {
AccessDeniedForDependency(String),
InternalError(String),
InvalidOperation(String),
NoAssociatedRole(String),
OptimisticLock(String),
ResourceNotFound(String),
}
impl DisassociateDRTLogBucketError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DisassociateDRTLogBucketError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AccessDeniedForDependencyException" => {
return RusotoError::Service(
DisassociateDRTLogBucketError::AccessDeniedForDependency(err.msg),
)
}
"InternalErrorException" => {
return RusotoError::Service(DisassociateDRTLogBucketError::InternalError(
err.msg,
))
}
"InvalidOperationException" => {
return RusotoError::Service(DisassociateDRTLogBucketError::InvalidOperation(
err.msg,
))
}
"NoAssociatedRoleException" => {
return RusotoError::Service(DisassociateDRTLogBucketError::NoAssociatedRole(
err.msg,
))
}
"OptimisticLockException" => {
return RusotoError::Service(DisassociateDRTLogBucketError::OptimisticLock(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DisassociateDRTLogBucketError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DisassociateDRTLogBucketError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateDRTLogBucketError {
fn description(&self) -> &str {
match *self {
DisassociateDRTLogBucketError::AccessDeniedForDependency(ref cause) => cause,
DisassociateDRTLogBucketError::InternalError(ref cause) => cause,
DisassociateDRTLogBucketError::InvalidOperation(ref cause) => cause,
DisassociateDRTLogBucketError::NoAssociatedRole(ref cause) => cause,
DisassociateDRTLogBucketError::OptimisticLock(ref cause) => cause,
DisassociateDRTLogBucketError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateDRTRoleError {
InternalError(String),
InvalidOperation(String),
OptimisticLock(String),
ResourceNotFound(String),
}
impl DisassociateDRTRoleError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DisassociateDRTRoleError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DisassociateDRTRoleError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(DisassociateDRTRoleError::InvalidOperation(
err.msg,
))
}
"OptimisticLockException" => {
return RusotoError::Service(DisassociateDRTRoleError::OptimisticLock(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DisassociateDRTRoleError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DisassociateDRTRoleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateDRTRoleError {
fn description(&self) -> &str {
match *self {
DisassociateDRTRoleError::InternalError(ref cause) => cause,
DisassociateDRTRoleError::InvalidOperation(ref cause) => cause,
DisassociateDRTRoleError::OptimisticLock(ref cause) => cause,
DisassociateDRTRoleError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSubscriptionStateError {
InternalError(String),
}
impl GetSubscriptionStateError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetSubscriptionStateError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetSubscriptionStateError::InternalError(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for GetSubscriptionStateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSubscriptionStateError {
fn description(&self) -> &str {
match *self {
GetSubscriptionStateError::InternalError(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAttacksError {
InternalError(String),
InvalidOperation(String),
InvalidParameter(String),
}
impl ListAttacksError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListAttacksError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListAttacksError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(ListAttacksError::InvalidOperation(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(ListAttacksError::InvalidParameter(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListAttacksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAttacksError {
fn description(&self) -> &str {
match *self {
ListAttacksError::InternalError(ref cause) => cause,
ListAttacksError::InvalidOperation(ref cause) => cause,
ListAttacksError::InvalidParameter(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListProtectionsError {
InternalError(String),
InvalidPaginationToken(String),
ResourceNotFound(String),
}
impl ListProtectionsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListProtectionsError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListProtectionsError::InternalError(err.msg))
}
"InvalidPaginationTokenException" => {
return RusotoError::Service(ListProtectionsError::InvalidPaginationToken(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListProtectionsError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListProtectionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListProtectionsError {
fn description(&self) -> &str {
match *self {
ListProtectionsError::InternalError(ref cause) => cause,
ListProtectionsError::InvalidPaginationToken(ref cause) => cause,
ListProtectionsError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateEmergencyContactSettingsError {
InternalError(String),
InvalidParameter(String),
OptimisticLock(String),
ResourceNotFound(String),
}
impl UpdateEmergencyContactSettingsError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<UpdateEmergencyContactSettingsError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(
UpdateEmergencyContactSettingsError::InternalError(err.msg),
)
}
"InvalidParameterException" => {
return RusotoError::Service(
UpdateEmergencyContactSettingsError::InvalidParameter(err.msg),
)
}
"OptimisticLockException" => {
return RusotoError::Service(
UpdateEmergencyContactSettingsError::OptimisticLock(err.msg),
)
}
"ResourceNotFoundException" => {
return RusotoError::Service(
UpdateEmergencyContactSettingsError::ResourceNotFound(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateEmergencyContactSettingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateEmergencyContactSettingsError {
fn description(&self) -> &str {
match *self {
UpdateEmergencyContactSettingsError::InternalError(ref cause) => cause,
UpdateEmergencyContactSettingsError::InvalidParameter(ref cause) => cause,
UpdateEmergencyContactSettingsError::OptimisticLock(ref cause) => cause,
UpdateEmergencyContactSettingsError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateSubscriptionError {
InternalError(String),
InvalidParameter(String),
LockedSubscription(String),
OptimisticLock(String),
ResourceNotFound(String),
}
impl UpdateSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateSubscriptionError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(UpdateSubscriptionError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(UpdateSubscriptionError::InvalidParameter(err.msg))
}
"LockedSubscriptionException" => {
return RusotoError::Service(UpdateSubscriptionError::LockedSubscription(
err.msg,
))
}
"OptimisticLockException" => {
return RusotoError::Service(UpdateSubscriptionError::OptimisticLock(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateSubscriptionError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateSubscriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateSubscriptionError {
fn description(&self) -> &str {
match *self {
UpdateSubscriptionError::InternalError(ref cause) => cause,
UpdateSubscriptionError::InvalidParameter(ref cause) => cause,
UpdateSubscriptionError::LockedSubscription(ref cause) => cause,
UpdateSubscriptionError::OptimisticLock(ref cause) => cause,
UpdateSubscriptionError::ResourceNotFound(ref cause) => cause,
}
}
}
pub trait Shield {
fn associate_drt_log_bucket(
&self,
input: AssociateDRTLogBucketRequest,
) -> RusotoFuture<AssociateDRTLogBucketResponse, AssociateDRTLogBucketError>;
fn associate_drt_role(
&self,
input: AssociateDRTRoleRequest,
) -> RusotoFuture<AssociateDRTRoleResponse, AssociateDRTRoleError>;
fn create_protection(
&self,
input: CreateProtectionRequest,
) -> RusotoFuture<CreateProtectionResponse, CreateProtectionError>;
fn create_subscription(
&self,
) -> RusotoFuture<CreateSubscriptionResponse, CreateSubscriptionError>;
fn delete_protection(
&self,
input: DeleteProtectionRequest,
) -> RusotoFuture<DeleteProtectionResponse, DeleteProtectionError>;
fn delete_subscription(
&self,
) -> RusotoFuture<DeleteSubscriptionResponse, DeleteSubscriptionError>;
fn describe_attack(
&self,
input: DescribeAttackRequest,
) -> RusotoFuture<DescribeAttackResponse, DescribeAttackError>;
fn describe_drt_access(
&self,
) -> RusotoFuture<DescribeDRTAccessResponse, DescribeDRTAccessError>;
fn describe_emergency_contact_settings(
&self,
) -> RusotoFuture<DescribeEmergencyContactSettingsResponse, DescribeEmergencyContactSettingsError>;
fn describe_protection(
&self,
input: DescribeProtectionRequest,
) -> RusotoFuture<DescribeProtectionResponse, DescribeProtectionError>;
fn describe_subscription(
&self,
) -> RusotoFuture<DescribeSubscriptionResponse, DescribeSubscriptionError>;
fn disassociate_drt_log_bucket(
&self,
input: DisassociateDRTLogBucketRequest,
) -> RusotoFuture<DisassociateDRTLogBucketResponse, DisassociateDRTLogBucketError>;
fn disassociate_drt_role(
&self,
) -> RusotoFuture<DisassociateDRTRoleResponse, DisassociateDRTRoleError>;
fn get_subscription_state(
&self,
) -> RusotoFuture<GetSubscriptionStateResponse, GetSubscriptionStateError>;
fn list_attacks(
&self,
input: ListAttacksRequest,
) -> RusotoFuture<ListAttacksResponse, ListAttacksError>;
fn list_protections(
&self,
input: ListProtectionsRequest,
) -> RusotoFuture<ListProtectionsResponse, ListProtectionsError>;
fn update_emergency_contact_settings(
&self,
input: UpdateEmergencyContactSettingsRequest,
) -> RusotoFuture<UpdateEmergencyContactSettingsResponse, UpdateEmergencyContactSettingsError>;
fn update_subscription(
&self,
input: UpdateSubscriptionRequest,
) -> RusotoFuture<UpdateSubscriptionResponse, UpdateSubscriptionError>;
}
#[derive(Clone)]
pub struct ShieldClient {
client: Client,
region: region::Region,
}
impl ShieldClient {
pub fn new(region: region::Region) -> ShieldClient {
ShieldClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> ShieldClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
ShieldClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
}
impl Shield for ShieldClient {
fn associate_drt_log_bucket(
&self,
input: AssociateDRTLogBucketRequest,
) -> RusotoFuture<AssociateDRTLogBucketResponse, AssociateDRTLogBucketError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.AssociateDRTLogBucket");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<AssociateDRTLogBucketResponse, _>()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AssociateDRTLogBucketError::from_response(response))
}),
)
}
})
}
fn associate_drt_role(
&self,
input: AssociateDRTRoleRequest,
) -> RusotoFuture<AssociateDRTRoleResponse, AssociateDRTRoleError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.AssociateDRTRole");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<AssociateDRTRoleResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AssociateDRTRoleError::from_response(response))),
)
}
})
}
fn create_protection(
&self,
input: CreateProtectionRequest,
) -> RusotoFuture<CreateProtectionResponse, CreateProtectionError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.CreateProtection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<CreateProtectionResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateProtectionError::from_response(response))),
)
}
})
}
fn create_subscription(
&self,
) -> RusotoFuture<CreateSubscriptionResponse, CreateSubscriptionError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.CreateSubscription");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<CreateSubscriptionResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateSubscriptionError::from_response(response))),
)
}
})
}
fn delete_protection(
&self,
input: DeleteProtectionRequest,
) -> RusotoFuture<DeleteProtectionResponse, DeleteProtectionError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.DeleteProtection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteProtectionResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteProtectionError::from_response(response))),
)
}
})
}
fn delete_subscription(
&self,
) -> RusotoFuture<DeleteSubscriptionResponse, DeleteSubscriptionError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.DeleteSubscription");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteSubscriptionResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteSubscriptionError::from_response(response))),
)
}
})
}
fn describe_attack(
&self,
input: DescribeAttackRequest,
) -> RusotoFuture<DescribeAttackResponse, DescribeAttackError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.DescribeAttack");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeAttackResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeAttackError::from_response(response))),
)
}
})
}
fn describe_drt_access(
&self,
) -> RusotoFuture<DescribeDRTAccessResponse, DescribeDRTAccessError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.DescribeDRTAccess");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeDRTAccessResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeDRTAccessError::from_response(response))),
)
}
})
}
fn describe_emergency_contact_settings(
&self,
) -> RusotoFuture<DescribeEmergencyContactSettingsResponse, DescribeEmergencyContactSettingsError>
{
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSShield_20160616.DescribeEmergencyContactSettings",
);
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeEmergencyContactSettingsResponse, _>()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeEmergencyContactSettingsError::from_response(
response,
))
}))
}
})
}
fn describe_protection(
&self,
input: DescribeProtectionRequest,
) -> RusotoFuture<DescribeProtectionResponse, DescribeProtectionError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.DescribeProtection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeProtectionResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeProtectionError::from_response(response))),
)
}
})
}
fn describe_subscription(
&self,
) -> RusotoFuture<DescribeSubscriptionResponse, DescribeSubscriptionError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.DescribeSubscription");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeSubscriptionResponse, _>()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeSubscriptionError::from_response(response))
}),
)
}
})
}
fn disassociate_drt_log_bucket(
&self,
input: DisassociateDRTLogBucketRequest,
) -> RusotoFuture<DisassociateDRTLogBucketResponse, DisassociateDRTLogBucketError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSShield_20160616.DisassociateDRTLogBucket",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DisassociateDRTLogBucketResponse, _>()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DisassociateDRTLogBucketError::from_response(response))
}))
}
})
}
fn disassociate_drt_role(
&self,
) -> RusotoFuture<DisassociateDRTRoleResponse, DisassociateDRTRoleError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.DisassociateDRTRole");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DisassociateDRTRoleResponse, _>()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DisassociateDRTRoleError::from_response(response))
}),
)
}
})
}
fn get_subscription_state(
&self,
) -> RusotoFuture<GetSubscriptionStateResponse, GetSubscriptionStateError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.GetSubscriptionState");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<GetSubscriptionStateResponse, _>()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetSubscriptionStateError::from_response(response))
}),
)
}
})
}
fn list_attacks(
&self,
input: ListAttacksRequest,
) -> RusotoFuture<ListAttacksResponse, ListAttacksError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.ListAttacks");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<ListAttacksResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListAttacksError::from_response(response))),
)
}
})
}
fn list_protections(
&self,
input: ListProtectionsRequest,
) -> RusotoFuture<ListProtectionsResponse, ListProtectionsError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.ListProtections");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<ListProtectionsResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListProtectionsError::from_response(response))),
)
}
})
}
fn update_emergency_contact_settings(
&self,
input: UpdateEmergencyContactSettingsRequest,
) -> RusotoFuture<UpdateEmergencyContactSettingsResponse, UpdateEmergencyContactSettingsError>
{
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSShield_20160616.UpdateEmergencyContactSettings",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateEmergencyContactSettingsResponse, _>()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateEmergencyContactSettingsError::from_response(response))
}))
}
})
}
fn update_subscription(
&self,
input: UpdateSubscriptionRequest,
) -> RusotoFuture<UpdateSubscriptionResponse, UpdateSubscriptionError> {
let mut request = SignedRequest::new("POST", "shield", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSShield_20160616.UpdateSubscription");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateSubscriptionResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateSubscriptionError::from_response(response))),
)
}
})
}
}