use std::error::Error;
use std::fmt;
use async_trait::async_trait;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct AddAttachmentsToSetRequest {
#[serde(rename = "attachmentSetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment_set_id: Option<String>,
#[serde(rename = "attachments")]
pub attachments: Vec<Attachment>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct AddAttachmentsToSetResponse {
#[serde(rename = "attachmentSetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment_set_id: Option<String>,
#[serde(rename = "expiryTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expiry_time: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct AddCommunicationToCaseRequest {
#[serde(rename = "attachmentSetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment_set_id: Option<String>,
#[serde(rename = "caseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub case_id: Option<String>,
#[serde(rename = "ccEmailAddresses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cc_email_addresses: Option<Vec<String>>,
#[serde(rename = "communicationBody")]
pub communication_body: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct AddCommunicationToCaseResponse {
#[serde(rename = "result")]
#[serde(skip_serializing_if = "Option::is_none")]
pub result: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Attachment {
#[serde(rename = "data")]
#[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 data: Option<bytes::Bytes>,
#[serde(rename = "fileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct AttachmentDetails {
#[serde(rename = "attachmentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment_id: Option<String>,
#[serde(rename = "fileName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct CaseDetails {
#[serde(rename = "caseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub case_id: Option<String>,
#[serde(rename = "categoryCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub category_code: Option<String>,
#[serde(rename = "ccEmailAddresses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cc_email_addresses: Option<Vec<String>>,
#[serde(rename = "displayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_id: Option<String>,
#[serde(rename = "language")]
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
#[serde(rename = "recentCommunications")]
#[serde(skip_serializing_if = "Option::is_none")]
pub recent_communications: Option<RecentCaseCommunications>,
#[serde(rename = "serviceCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_code: Option<String>,
#[serde(rename = "severityCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub severity_code: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "subject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<String>,
#[serde(rename = "submittedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub submitted_by: Option<String>,
#[serde(rename = "timeCreated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub time_created: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct Category {
#[serde(rename = "code")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct Communication {
#[serde(rename = "attachmentSet")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment_set: Option<Vec<AttachmentDetails>>,
#[serde(rename = "body")]
#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
#[serde(rename = "caseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub case_id: Option<String>,
#[serde(rename = "submittedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub submitted_by: Option<String>,
#[serde(rename = "timeCreated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub time_created: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct CreateCaseRequest {
#[serde(rename = "attachmentSetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment_set_id: Option<String>,
#[serde(rename = "categoryCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub category_code: Option<String>,
#[serde(rename = "ccEmailAddresses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cc_email_addresses: Option<Vec<String>>,
#[serde(rename = "communicationBody")]
pub communication_body: String,
#[serde(rename = "issueType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub issue_type: Option<String>,
#[serde(rename = "language")]
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
#[serde(rename = "serviceCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_code: Option<String>,
#[serde(rename = "severityCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub severity_code: Option<String>,
#[serde(rename = "subject")]
pub subject: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct CreateCaseResponse {
#[serde(rename = "caseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub case_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeAttachmentRequest {
#[serde(rename = "attachmentId")]
pub attachment_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeAttachmentResponse {
#[serde(rename = "attachment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment: Option<Attachment>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeCasesRequest {
#[serde(rename = "afterTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_time: Option<String>,
#[serde(rename = "beforeTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_time: Option<String>,
#[serde(rename = "caseIdList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub case_id_list: Option<Vec<String>>,
#[serde(rename = "displayId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_id: Option<String>,
#[serde(rename = "includeCommunications")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_communications: Option<bool>,
#[serde(rename = "includeResolvedCases")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_resolved_cases: Option<bool>,
#[serde(rename = "language")]
#[serde(skip_serializing_if = "Option::is_none")]
pub language: 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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeCasesResponse {
#[serde(rename = "cases")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cases: Option<Vec<CaseDetails>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeCommunicationsRequest {
#[serde(rename = "afterTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_time: Option<String>,
#[serde(rename = "beforeTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_time: Option<String>,
#[serde(rename = "caseId")]
pub case_id: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeCommunicationsResponse {
#[serde(rename = "communications")]
#[serde(skip_serializing_if = "Option::is_none")]
pub communications: Option<Vec<Communication>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeServicesRequest {
#[serde(rename = "language")]
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
#[serde(rename = "serviceCodeList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_code_list: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeServicesResponse {
#[serde(rename = "services")]
#[serde(skip_serializing_if = "Option::is_none")]
pub services: Option<Vec<Service>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeSeverityLevelsRequest {
#[serde(rename = "language")]
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeSeverityLevelsResponse {
#[serde(rename = "severityLevels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub severity_levels: Option<Vec<SeverityLevel>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeTrustedAdvisorCheckRefreshStatusesRequest {
#[serde(rename = "checkIds")]
pub check_ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeTrustedAdvisorCheckRefreshStatusesResponse {
#[serde(rename = "statuses")]
pub statuses: Vec<TrustedAdvisorCheckRefreshStatus>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeTrustedAdvisorCheckResultRequest {
#[serde(rename = "checkId")]
pub check_id: String,
#[serde(rename = "language")]
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeTrustedAdvisorCheckResultResponse {
#[serde(rename = "result")]
#[serde(skip_serializing_if = "Option::is_none")]
pub result: Option<TrustedAdvisorCheckResult>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeTrustedAdvisorCheckSummariesRequest {
#[serde(rename = "checkIds")]
pub check_ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeTrustedAdvisorCheckSummariesResponse {
#[serde(rename = "summaries")]
pub summaries: Vec<TrustedAdvisorCheckSummary>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeTrustedAdvisorChecksRequest {
#[serde(rename = "language")]
pub language: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeTrustedAdvisorChecksResponse {
#[serde(rename = "checks")]
pub checks: Vec<TrustedAdvisorCheckDescription>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct RecentCaseCommunications {
#[serde(rename = "communications")]
#[serde(skip_serializing_if = "Option::is_none")]
pub communications: Option<Vec<Communication>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct RefreshTrustedAdvisorCheckRequest {
#[serde(rename = "checkId")]
pub check_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct RefreshTrustedAdvisorCheckResponse {
#[serde(rename = "status")]
pub status: TrustedAdvisorCheckRefreshStatus,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ResolveCaseRequest {
#[serde(rename = "caseId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub case_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ResolveCaseResponse {
#[serde(rename = "finalCaseStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub final_case_status: Option<String>,
#[serde(rename = "initialCaseStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub initial_case_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct Service {
#[serde(rename = "categories")]
#[serde(skip_serializing_if = "Option::is_none")]
pub categories: Option<Vec<Category>>,
#[serde(rename = "code")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct SeverityLevel {
#[serde(rename = "code")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorCategorySpecificSummary {
#[serde(rename = "costOptimizing")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cost_optimizing: Option<TrustedAdvisorCostOptimizingSummary>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorCheckDescription {
#[serde(rename = "category")]
pub category: String,
#[serde(rename = "description")]
pub description: String,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "metadata")]
pub metadata: Vec<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorCheckRefreshStatus {
#[serde(rename = "checkId")]
pub check_id: String,
#[serde(rename = "millisUntilNextRefreshable")]
pub millis_until_next_refreshable: i64,
#[serde(rename = "status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorCheckResult {
#[serde(rename = "categorySpecificSummary")]
pub category_specific_summary: TrustedAdvisorCategorySpecificSummary,
#[serde(rename = "checkId")]
pub check_id: String,
#[serde(rename = "flaggedResources")]
pub flagged_resources: Vec<TrustedAdvisorResourceDetail>,
#[serde(rename = "resourcesSummary")]
pub resources_summary: TrustedAdvisorResourcesSummary,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "timestamp")]
pub timestamp: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorCheckSummary {
#[serde(rename = "categorySpecificSummary")]
pub category_specific_summary: TrustedAdvisorCategorySpecificSummary,
#[serde(rename = "checkId")]
pub check_id: String,
#[serde(rename = "hasFlaggedResources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub has_flagged_resources: Option<bool>,
#[serde(rename = "resourcesSummary")]
pub resources_summary: TrustedAdvisorResourcesSummary,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "timestamp")]
pub timestamp: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorCostOptimizingSummary {
#[serde(rename = "estimatedMonthlySavings")]
pub estimated_monthly_savings: f64,
#[serde(rename = "estimatedPercentMonthlySavings")]
pub estimated_percent_monthly_savings: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorResourceDetail {
#[serde(rename = "isSuppressed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_suppressed: Option<bool>,
#[serde(rename = "metadata")]
pub metadata: Vec<String>,
#[serde(rename = "region")]
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TrustedAdvisorResourcesSummary {
#[serde(rename = "resourcesFlagged")]
pub resources_flagged: i64,
#[serde(rename = "resourcesIgnored")]
pub resources_ignored: i64,
#[serde(rename = "resourcesProcessed")]
pub resources_processed: i64,
#[serde(rename = "resourcesSuppressed")]
pub resources_suppressed: i64,
}
#[derive(Debug, PartialEq)]
pub enum AddAttachmentsToSetError {
AttachmentLimitExceeded(String),
AttachmentSetExpired(String),
AttachmentSetIdNotFound(String),
AttachmentSetSizeLimitExceeded(String),
InternalServerError(String),
}
impl AddAttachmentsToSetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AddAttachmentsToSetError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AttachmentLimitExceeded" => {
return RusotoError::Service(AddAttachmentsToSetError::AttachmentLimitExceeded(
err.msg,
))
}
"AttachmentSetExpired" => {
return RusotoError::Service(AddAttachmentsToSetError::AttachmentSetExpired(
err.msg,
))
}
"AttachmentSetIdNotFound" => {
return RusotoError::Service(AddAttachmentsToSetError::AttachmentSetIdNotFound(
err.msg,
))
}
"AttachmentSetSizeLimitExceeded" => {
return RusotoError::Service(
AddAttachmentsToSetError::AttachmentSetSizeLimitExceeded(err.msg),
)
}
"InternalServerError" => {
return RusotoError::Service(AddAttachmentsToSetError::InternalServerError(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for AddAttachmentsToSetError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
AddAttachmentsToSetError::AttachmentLimitExceeded(ref cause) => write!(f, "{}", cause),
AddAttachmentsToSetError::AttachmentSetExpired(ref cause) => write!(f, "{}", cause),
AddAttachmentsToSetError::AttachmentSetIdNotFound(ref cause) => write!(f, "{}", cause),
AddAttachmentsToSetError::AttachmentSetSizeLimitExceeded(ref cause) => {
write!(f, "{}", cause)
}
AddAttachmentsToSetError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for AddAttachmentsToSetError {}
#[derive(Debug, PartialEq)]
pub enum AddCommunicationToCaseError {
AttachmentSetExpired(String),
AttachmentSetIdNotFound(String),
CaseIdNotFound(String),
InternalServerError(String),
}
impl AddCommunicationToCaseError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AddCommunicationToCaseError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AttachmentSetExpired" => {
return RusotoError::Service(AddCommunicationToCaseError::AttachmentSetExpired(
err.msg,
))
}
"AttachmentSetIdNotFound" => {
return RusotoError::Service(
AddCommunicationToCaseError::AttachmentSetIdNotFound(err.msg),
)
}
"CaseIdNotFound" => {
return RusotoError::Service(AddCommunicationToCaseError::CaseIdNotFound(
err.msg,
))
}
"InternalServerError" => {
return RusotoError::Service(AddCommunicationToCaseError::InternalServerError(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for AddCommunicationToCaseError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
AddCommunicationToCaseError::AttachmentSetExpired(ref cause) => write!(f, "{}", cause),
AddCommunicationToCaseError::AttachmentSetIdNotFound(ref cause) => {
write!(f, "{}", cause)
}
AddCommunicationToCaseError::CaseIdNotFound(ref cause) => write!(f, "{}", cause),
AddCommunicationToCaseError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for AddCommunicationToCaseError {}
#[derive(Debug, PartialEq)]
pub enum CreateCaseError {
AttachmentSetExpired(String),
AttachmentSetIdNotFound(String),
CaseCreationLimitExceeded(String),
InternalServerError(String),
}
impl CreateCaseError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateCaseError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AttachmentSetExpired" => {
return RusotoError::Service(CreateCaseError::AttachmentSetExpired(err.msg))
}
"AttachmentSetIdNotFound" => {
return RusotoError::Service(CreateCaseError::AttachmentSetIdNotFound(err.msg))
}
"CaseCreationLimitExceeded" => {
return RusotoError::Service(CreateCaseError::CaseCreationLimitExceeded(
err.msg,
))
}
"InternalServerError" => {
return RusotoError::Service(CreateCaseError::InternalServerError(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for CreateCaseError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
CreateCaseError::AttachmentSetExpired(ref cause) => write!(f, "{}", cause),
CreateCaseError::AttachmentSetIdNotFound(ref cause) => write!(f, "{}", cause),
CreateCaseError::CaseCreationLimitExceeded(ref cause) => write!(f, "{}", cause),
CreateCaseError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for CreateCaseError {}
#[derive(Debug, PartialEq)]
pub enum DescribeAttachmentError {
AttachmentIdNotFound(String),
DescribeAttachmentLimitExceeded(String),
InternalServerError(String),
}
impl DescribeAttachmentError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeAttachmentError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"AttachmentIdNotFound" => {
return RusotoError::Service(DescribeAttachmentError::AttachmentIdNotFound(
err.msg,
))
}
"DescribeAttachmentLimitExceeded" => {
return RusotoError::Service(
DescribeAttachmentError::DescribeAttachmentLimitExceeded(err.msg),
)
}
"InternalServerError" => {
return RusotoError::Service(DescribeAttachmentError::InternalServerError(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeAttachmentError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeAttachmentError::AttachmentIdNotFound(ref cause) => write!(f, "{}", cause),
DescribeAttachmentError::DescribeAttachmentLimitExceeded(ref cause) => {
write!(f, "{}", cause)
}
DescribeAttachmentError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DescribeAttachmentError {}
#[derive(Debug, PartialEq)]
pub enum DescribeCasesError {
CaseIdNotFound(String),
InternalServerError(String),
}
impl DescribeCasesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeCasesError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"CaseIdNotFound" => {
return RusotoError::Service(DescribeCasesError::CaseIdNotFound(err.msg))
}
"InternalServerError" => {
return RusotoError::Service(DescribeCasesError::InternalServerError(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeCasesError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeCasesError::CaseIdNotFound(ref cause) => write!(f, "{}", cause),
DescribeCasesError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DescribeCasesError {}
#[derive(Debug, PartialEq)]
pub enum DescribeCommunicationsError {
CaseIdNotFound(String),
InternalServerError(String),
}
impl DescribeCommunicationsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeCommunicationsError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"CaseIdNotFound" => {
return RusotoError::Service(DescribeCommunicationsError::CaseIdNotFound(
err.msg,
))
}
"InternalServerError" => {
return RusotoError::Service(DescribeCommunicationsError::InternalServerError(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeCommunicationsError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeCommunicationsError::CaseIdNotFound(ref cause) => write!(f, "{}", cause),
DescribeCommunicationsError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DescribeCommunicationsError {}
#[derive(Debug, PartialEq)]
pub enum DescribeServicesError {
InternalServerError(String),
}
impl DescribeServicesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeServicesError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalServerError" => {
return RusotoError::Service(DescribeServicesError::InternalServerError(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeServicesError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeServicesError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DescribeServicesError {}
#[derive(Debug, PartialEq)]
pub enum DescribeSeverityLevelsError {
InternalServerError(String),
}
impl DescribeSeverityLevelsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeSeverityLevelsError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalServerError" => {
return RusotoError::Service(DescribeSeverityLevelsError::InternalServerError(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeSeverityLevelsError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeSeverityLevelsError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DescribeSeverityLevelsError {}
#[derive(Debug, PartialEq)]
pub enum DescribeTrustedAdvisorCheckRefreshStatusesError {
InternalServerError(String),
}
impl DescribeTrustedAdvisorCheckRefreshStatusesError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeTrustedAdvisorCheckRefreshStatusesError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalServerError" => {
return RusotoError::Service(
DescribeTrustedAdvisorCheckRefreshStatusesError::InternalServerError(
err.msg,
),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeTrustedAdvisorCheckRefreshStatusesError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeTrustedAdvisorCheckRefreshStatusesError::InternalServerError(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for DescribeTrustedAdvisorCheckRefreshStatusesError {}
#[derive(Debug, PartialEq)]
pub enum DescribeTrustedAdvisorCheckResultError {
InternalServerError(String),
}
impl DescribeTrustedAdvisorCheckResultError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeTrustedAdvisorCheckResultError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalServerError" => {
return RusotoError::Service(
DescribeTrustedAdvisorCheckResultError::InternalServerError(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeTrustedAdvisorCheckResultError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeTrustedAdvisorCheckResultError::InternalServerError(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for DescribeTrustedAdvisorCheckResultError {}
#[derive(Debug, PartialEq)]
pub enum DescribeTrustedAdvisorCheckSummariesError {
InternalServerError(String),
}
impl DescribeTrustedAdvisorCheckSummariesError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeTrustedAdvisorCheckSummariesError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalServerError" => {
return RusotoError::Service(
DescribeTrustedAdvisorCheckSummariesError::InternalServerError(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeTrustedAdvisorCheckSummariesError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeTrustedAdvisorCheckSummariesError::InternalServerError(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for DescribeTrustedAdvisorCheckSummariesError {}
#[derive(Debug, PartialEq)]
pub enum DescribeTrustedAdvisorChecksError {
InternalServerError(String),
}
impl DescribeTrustedAdvisorChecksError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeTrustedAdvisorChecksError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalServerError" => {
return RusotoError::Service(
DescribeTrustedAdvisorChecksError::InternalServerError(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeTrustedAdvisorChecksError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeTrustedAdvisorChecksError::InternalServerError(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for DescribeTrustedAdvisorChecksError {}
#[derive(Debug, PartialEq)]
pub enum RefreshTrustedAdvisorCheckError {
InternalServerError(String),
}
impl RefreshTrustedAdvisorCheckError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<RefreshTrustedAdvisorCheckError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalServerError" => {
return RusotoError::Service(
RefreshTrustedAdvisorCheckError::InternalServerError(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for RefreshTrustedAdvisorCheckError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
RefreshTrustedAdvisorCheckError::InternalServerError(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for RefreshTrustedAdvisorCheckError {}
#[derive(Debug, PartialEq)]
pub enum ResolveCaseError {
CaseIdNotFound(String),
InternalServerError(String),
}
impl ResolveCaseError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ResolveCaseError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"CaseIdNotFound" => {
return RusotoError::Service(ResolveCaseError::CaseIdNotFound(err.msg))
}
"InternalServerError" => {
return RusotoError::Service(ResolveCaseError::InternalServerError(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ResolveCaseError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ResolveCaseError::CaseIdNotFound(ref cause) => write!(f, "{}", cause),
ResolveCaseError::InternalServerError(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ResolveCaseError {}
#[async_trait]
pub trait AWSSupport {
async fn add_attachments_to_set(
&self,
input: AddAttachmentsToSetRequest,
) -> Result<AddAttachmentsToSetResponse, RusotoError<AddAttachmentsToSetError>>;
async fn add_communication_to_case(
&self,
input: AddCommunicationToCaseRequest,
) -> Result<AddCommunicationToCaseResponse, RusotoError<AddCommunicationToCaseError>>;
async fn create_case(
&self,
input: CreateCaseRequest,
) -> Result<CreateCaseResponse, RusotoError<CreateCaseError>>;
async fn describe_attachment(
&self,
input: DescribeAttachmentRequest,
) -> Result<DescribeAttachmentResponse, RusotoError<DescribeAttachmentError>>;
async fn describe_cases(
&self,
input: DescribeCasesRequest,
) -> Result<DescribeCasesResponse, RusotoError<DescribeCasesError>>;
async fn describe_communications(
&self,
input: DescribeCommunicationsRequest,
) -> Result<DescribeCommunicationsResponse, RusotoError<DescribeCommunicationsError>>;
async fn describe_services(
&self,
input: DescribeServicesRequest,
) -> Result<DescribeServicesResponse, RusotoError<DescribeServicesError>>;
async fn describe_severity_levels(
&self,
input: DescribeSeverityLevelsRequest,
) -> Result<DescribeSeverityLevelsResponse, RusotoError<DescribeSeverityLevelsError>>;
async fn describe_trusted_advisor_check_refresh_statuses(
&self,
input: DescribeTrustedAdvisorCheckRefreshStatusesRequest,
) -> Result<
DescribeTrustedAdvisorCheckRefreshStatusesResponse,
RusotoError<DescribeTrustedAdvisorCheckRefreshStatusesError>,
>;
async fn describe_trusted_advisor_check_result(
&self,
input: DescribeTrustedAdvisorCheckResultRequest,
) -> Result<
DescribeTrustedAdvisorCheckResultResponse,
RusotoError<DescribeTrustedAdvisorCheckResultError>,
>;
async fn describe_trusted_advisor_check_summaries(
&self,
input: DescribeTrustedAdvisorCheckSummariesRequest,
) -> Result<
DescribeTrustedAdvisorCheckSummariesResponse,
RusotoError<DescribeTrustedAdvisorCheckSummariesError>,
>;
async fn describe_trusted_advisor_checks(
&self,
input: DescribeTrustedAdvisorChecksRequest,
) -> Result<DescribeTrustedAdvisorChecksResponse, RusotoError<DescribeTrustedAdvisorChecksError>>;
async fn refresh_trusted_advisor_check(
&self,
input: RefreshTrustedAdvisorCheckRequest,
) -> Result<RefreshTrustedAdvisorCheckResponse, RusotoError<RefreshTrustedAdvisorCheckError>>;
async fn resolve_case(
&self,
input: ResolveCaseRequest,
) -> Result<ResolveCaseResponse, RusotoError<ResolveCaseError>>;
}
#[derive(Clone)]
pub struct AWSSupportClient {
client: Client,
region: region::Region,
}
impl AWSSupportClient {
pub fn new(region: region::Region) -> AWSSupportClient {
AWSSupportClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> AWSSupportClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
D: DispatchSignedRequest + Send + Sync + 'static,
{
AWSSupportClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
pub fn new_with_client(client: Client, region: region::Region) -> AWSSupportClient {
AWSSupportClient { client, region }
}
}
#[async_trait]
impl AWSSupport for AWSSupportClient {
async fn add_attachments_to_set(
&self,
input: AddAttachmentsToSetRequest,
) -> Result<AddAttachmentsToSetResponse, RusotoError<AddAttachmentsToSetError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.AddAttachmentsToSet");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<AddAttachmentsToSetResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(AddAttachmentsToSetError::from_response(response))
}
}
async fn add_communication_to_case(
&self,
input: AddCommunicationToCaseRequest,
) -> Result<AddCommunicationToCaseResponse, RusotoError<AddCommunicationToCaseError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.AddCommunicationToCase");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<AddCommunicationToCaseResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(AddCommunicationToCaseError::from_response(response))
}
}
async fn create_case(
&self,
input: CreateCaseRequest,
) -> Result<CreateCaseResponse, RusotoError<CreateCaseError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.CreateCase");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<CreateCaseResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(CreateCaseError::from_response(response))
}
}
async fn describe_attachment(
&self,
input: DescribeAttachmentRequest,
) -> Result<DescribeAttachmentResponse, RusotoError<DescribeAttachmentError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.DescribeAttachment");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeAttachmentResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeAttachmentError::from_response(response))
}
}
async fn describe_cases(
&self,
input: DescribeCasesRequest,
) -> Result<DescribeCasesResponse, RusotoError<DescribeCasesError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.DescribeCases");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<DescribeCasesResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeCasesError::from_response(response))
}
}
async fn describe_communications(
&self,
input: DescribeCommunicationsRequest,
) -> Result<DescribeCommunicationsResponse, RusotoError<DescribeCommunicationsError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.DescribeCommunications");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeCommunicationsResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeCommunicationsError::from_response(response))
}
}
async fn describe_services(
&self,
input: DescribeServicesRequest,
) -> Result<DescribeServicesResponse, RusotoError<DescribeServicesError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.DescribeServices");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeServicesResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeServicesError::from_response(response))
}
}
async fn describe_severity_levels(
&self,
input: DescribeSeverityLevelsRequest,
) -> Result<DescribeSeverityLevelsResponse, RusotoError<DescribeSeverityLevelsError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.DescribeSeverityLevels");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeSeverityLevelsResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeSeverityLevelsError::from_response(response))
}
}
async fn describe_trusted_advisor_check_refresh_statuses(
&self,
input: DescribeTrustedAdvisorCheckRefreshStatusesRequest,
) -> Result<
DescribeTrustedAdvisorCheckRefreshStatusesResponse,
RusotoError<DescribeTrustedAdvisorCheckRefreshStatusesError>,
> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSSupport_20130415.DescribeTrustedAdvisorCheckRefreshStatuses",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeTrustedAdvisorCheckRefreshStatusesResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeTrustedAdvisorCheckRefreshStatusesError::from_response(response))
}
}
async fn describe_trusted_advisor_check_result(
&self,
input: DescribeTrustedAdvisorCheckResultRequest,
) -> Result<
DescribeTrustedAdvisorCheckResultResponse,
RusotoError<DescribeTrustedAdvisorCheckResultError>,
> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSSupport_20130415.DescribeTrustedAdvisorCheckResult",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeTrustedAdvisorCheckResultResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeTrustedAdvisorCheckResultError::from_response(
response,
))
}
}
async fn describe_trusted_advisor_check_summaries(
&self,
input: DescribeTrustedAdvisorCheckSummariesRequest,
) -> Result<
DescribeTrustedAdvisorCheckSummariesResponse,
RusotoError<DescribeTrustedAdvisorCheckSummariesError>,
> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSSupport_20130415.DescribeTrustedAdvisorCheckSummaries",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeTrustedAdvisorCheckSummariesResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeTrustedAdvisorCheckSummariesError::from_response(
response,
))
}
}
async fn describe_trusted_advisor_checks(
&self,
input: DescribeTrustedAdvisorChecksRequest,
) -> Result<DescribeTrustedAdvisorChecksResponse, RusotoError<DescribeTrustedAdvisorChecksError>>
{
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSSupport_20130415.DescribeTrustedAdvisorChecks",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeTrustedAdvisorChecksResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(DescribeTrustedAdvisorChecksError::from_response(response))
}
}
async fn refresh_trusted_advisor_check(
&self,
input: RefreshTrustedAdvisorCheckRequest,
) -> Result<RefreshTrustedAdvisorCheckResponse, RusotoError<RefreshTrustedAdvisorCheckError>>
{
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSSupport_20130415.RefreshTrustedAdvisorCheck",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<RefreshTrustedAdvisorCheckResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(RefreshTrustedAdvisorCheckError::from_response(response))
}
}
async fn resolve_case(
&self,
input: ResolveCaseRequest,
) -> Result<ResolveCaseResponse, RusotoError<ResolveCaseError>> {
let mut request = SignedRequest::new("POST", "support", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSSupport_20130415.ResolveCase");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<ResolveCaseResponse, _>()
} else {
let try_response = response.buffer().await;
let response = try_response.map_err(RusotoError::HttpDispatch)?;
Err(ResolveCaseError::from_response(response))
}
}
}