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::request::HttpResponse;
use rusoto_core::signature::SignedRequest;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
impl FmsClient {
fn new_signed_request(&self, http_method: &str, request_uri: &str) -> SignedRequest {
let mut request = SignedRequest::new(http_method, "fms", &self.region, request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request
}
async fn sign_and_dispatch<E>(
&self,
request: SignedRequest,
from_response: fn(BufferedHttpResponse) -> RusotoError<E>,
) -> Result<HttpResponse, RusotoError<E>> {
let mut response = self.client.sign_and_dispatch(request).await?;
if !response.status.is_success() {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
return Err(from_response(response));
}
Ok(response)
}
}
use serde_json;
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct AssociateAdminAccountRequest {
#[serde(rename = "AdminAccount")]
pub admin_account: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ComplianceViolator {
#[serde(rename = "ResourceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_id: Option<String>,
#[serde(rename = "ResourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
#[serde(rename = "ViolationReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violation_reason: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DeleteNotificationChannelRequest {}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DeletePolicyRequest {
#[serde(rename = "DeleteAllPolicyResources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delete_all_policy_resources: Option<bool>,
#[serde(rename = "PolicyId")]
pub policy_id: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DisassociateAdminAccountRequest {}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct EvaluationResult {
#[serde(rename = "ComplianceStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub compliance_status: Option<String>,
#[serde(rename = "EvaluationLimitExceeded")]
#[serde(skip_serializing_if = "Option::is_none")]
pub evaluation_limit_exceeded: Option<bool>,
#[serde(rename = "ViolatorCount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violator_count: Option<i64>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetAdminAccountRequest {}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetAdminAccountResponse {
#[serde(rename = "AdminAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub admin_account: Option<String>,
#[serde(rename = "RoleStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_status: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetComplianceDetailRequest {
#[serde(rename = "MemberAccount")]
pub member_account: String,
#[serde(rename = "PolicyId")]
pub policy_id: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetComplianceDetailResponse {
#[serde(rename = "PolicyComplianceDetail")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_compliance_detail: Option<PolicyComplianceDetail>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetNotificationChannelRequest {}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetNotificationChannelResponse {
#[serde(rename = "SnsRoleName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sns_role_name: Option<String>,
#[serde(rename = "SnsTopicArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sns_topic_arn: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetPolicyRequest {
#[serde(rename = "PolicyId")]
pub policy_id: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetPolicyResponse {
#[serde(rename = "Policy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy: Option<Policy>,
#[serde(rename = "PolicyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetProtectionStatusRequest {
#[serde(rename = "EndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "MemberAccountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub member_account_id: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyId")]
pub policy_id: String,
#[serde(rename = "StartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetProtectionStatusResponse {
#[serde(rename = "AdminAccountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub admin_account_id: Option<String>,
#[serde(rename = "Data")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "ServiceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_type: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListComplianceStatusRequest {
#[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 = "PolicyId")]
pub policy_id: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListComplianceStatusResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyComplianceStatusList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_compliance_status_list: Option<Vec<PolicyComplianceStatus>>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListMemberAccountsRequest {
#[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(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListMemberAccountsResponse {
#[serde(rename = "MemberAccounts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub member_accounts: Option<Vec<String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListPoliciesRequest {
#[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(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListPoliciesResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_list: Option<Vec<PolicySummary>>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListTagsForResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListTagsForResourceResponse {
#[serde(rename = "TagList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_list: Option<Vec<Tag>>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct Policy {
#[serde(rename = "ExcludeMap")]
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_map: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "ExcludeResourceTags")]
pub exclude_resource_tags: bool,
#[serde(rename = "IncludeMap")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_map: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "PolicyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_id: Option<String>,
#[serde(rename = "PolicyName")]
pub policy_name: String,
#[serde(rename = "PolicyUpdateToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_update_token: Option<String>,
#[serde(rename = "RemediationEnabled")]
pub remediation_enabled: bool,
#[serde(rename = "ResourceTags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_tags: Option<Vec<ResourceTag>>,
#[serde(rename = "ResourceType")]
pub resource_type: String,
#[serde(rename = "ResourceTypeList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type_list: Option<Vec<String>>,
#[serde(rename = "SecurityServicePolicyData")]
pub security_service_policy_data: SecurityServicePolicyData,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct PolicyComplianceDetail {
#[serde(rename = "EvaluationLimitExceeded")]
#[serde(skip_serializing_if = "Option::is_none")]
pub evaluation_limit_exceeded: Option<bool>,
#[serde(rename = "ExpiredAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expired_at: Option<f64>,
#[serde(rename = "IssueInfoMap")]
#[serde(skip_serializing_if = "Option::is_none")]
pub issue_info_map: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "MemberAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub member_account: Option<String>,
#[serde(rename = "PolicyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_id: Option<String>,
#[serde(rename = "PolicyOwner")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_owner: Option<String>,
#[serde(rename = "Violators")]
#[serde(skip_serializing_if = "Option::is_none")]
pub violators: Option<Vec<ComplianceViolator>>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct PolicyComplianceStatus {
#[serde(rename = "EvaluationResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub evaluation_results: Option<Vec<EvaluationResult>>,
#[serde(rename = "IssueInfoMap")]
#[serde(skip_serializing_if = "Option::is_none")]
pub issue_info_map: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "LastUpdated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated: Option<f64>,
#[serde(rename = "MemberAccount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub member_account: Option<String>,
#[serde(rename = "PolicyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_id: Option<String>,
#[serde(rename = "PolicyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
#[serde(rename = "PolicyOwner")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_owner: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct PolicySummary {
#[serde(rename = "PolicyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
#[serde(rename = "PolicyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_id: Option<String>,
#[serde(rename = "PolicyName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_name: Option<String>,
#[serde(rename = "RemediationEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remediation_enabled: Option<bool>,
#[serde(rename = "ResourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
#[serde(rename = "SecurityServiceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_service_type: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct PutNotificationChannelRequest {
#[serde(rename = "SnsRoleName")]
pub sns_role_name: String,
#[serde(rename = "SnsTopicArn")]
pub sns_topic_arn: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct PutPolicyRequest {
#[serde(rename = "Policy")]
pub policy: Policy,
#[serde(rename = "TagList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_list: Option<Vec<Tag>>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct PutPolicyResponse {
#[serde(rename = "Policy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy: Option<Policy>,
#[serde(rename = "PolicyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_arn: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct ResourceTag {
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct SecurityServicePolicyData {
#[serde(rename = "ManagedServiceData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub managed_service_data: Option<String>,
#[serde(rename = "Type")]
pub type_: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct Tag {
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Value")]
pub value: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct TagResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "TagList")]
pub tag_list: Vec<Tag>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TagResourceResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct UntagResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "TagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct UntagResourceResponse {}
#[derive(Debug, PartialEq)]
pub enum AssociateAdminAccountError {
InternalError(String),
InvalidInput(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl AssociateAdminAccountError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AssociateAdminAccountError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(AssociateAdminAccountError::InternalError(err.msg))
}
"InvalidInputException" => {
return RusotoError::Service(AssociateAdminAccountError::InvalidInput(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(AssociateAdminAccountError::InvalidOperation(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(AssociateAdminAccountError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for AssociateAdminAccountError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
AssociateAdminAccountError::InternalError(ref cause) => write!(f, "{}", cause),
AssociateAdminAccountError::InvalidInput(ref cause) => write!(f, "{}", cause),
AssociateAdminAccountError::InvalidOperation(ref cause) => write!(f, "{}", cause),
AssociateAdminAccountError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for AssociateAdminAccountError {}
#[derive(Debug, PartialEq)]
pub enum DeleteNotificationChannelError {
InternalError(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl DeleteNotificationChannelError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteNotificationChannelError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeleteNotificationChannelError::InternalError(
err.msg,
))
}
"InvalidOperationException" => {
return RusotoError::Service(DeleteNotificationChannelError::InvalidOperation(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteNotificationChannelError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DeleteNotificationChannelError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DeleteNotificationChannelError::InternalError(ref cause) => write!(f, "{}", cause),
DeleteNotificationChannelError::InvalidOperation(ref cause) => write!(f, "{}", cause),
DeleteNotificationChannelError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DeleteNotificationChannelError {}
#[derive(Debug, PartialEq)]
pub enum DeletePolicyError {
InternalError(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl DeletePolicyError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeletePolicyError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeletePolicyError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(DeletePolicyError::InvalidOperation(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeletePolicyError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DeletePolicyError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DeletePolicyError::InternalError(ref cause) => write!(f, "{}", cause),
DeletePolicyError::InvalidOperation(ref cause) => write!(f, "{}", cause),
DeletePolicyError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DeletePolicyError {}
#[derive(Debug, PartialEq)]
pub enum DisassociateAdminAccountError {
InternalError(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl DisassociateAdminAccountError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DisassociateAdminAccountError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DisassociateAdminAccountError::InternalError(
err.msg,
))
}
"InvalidOperationException" => {
return RusotoError::Service(DisassociateAdminAccountError::InvalidOperation(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DisassociateAdminAccountError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DisassociateAdminAccountError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DisassociateAdminAccountError::InternalError(ref cause) => write!(f, "{}", cause),
DisassociateAdminAccountError::InvalidOperation(ref cause) => write!(f, "{}", cause),
DisassociateAdminAccountError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DisassociateAdminAccountError {}
#[derive(Debug, PartialEq)]
pub enum GetAdminAccountError {
InternalError(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl GetAdminAccountError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetAdminAccountError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetAdminAccountError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(GetAdminAccountError::InvalidOperation(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetAdminAccountError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetAdminAccountError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetAdminAccountError::InternalError(ref cause) => write!(f, "{}", cause),
GetAdminAccountError::InvalidOperation(ref cause) => write!(f, "{}", cause),
GetAdminAccountError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetAdminAccountError {}
#[derive(Debug, PartialEq)]
pub enum GetComplianceDetailError {
InternalError(String),
ResourceNotFound(String),
}
impl GetComplianceDetailError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetComplianceDetailError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetComplianceDetailError::InternalError(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetComplianceDetailError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetComplianceDetailError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetComplianceDetailError::InternalError(ref cause) => write!(f, "{}", cause),
GetComplianceDetailError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetComplianceDetailError {}
#[derive(Debug, PartialEq)]
pub enum GetNotificationChannelError {
InternalError(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl GetNotificationChannelError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetNotificationChannelError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetNotificationChannelError::InternalError(
err.msg,
))
}
"InvalidOperationException" => {
return RusotoError::Service(GetNotificationChannelError::InvalidOperation(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetNotificationChannelError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetNotificationChannelError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetNotificationChannelError::InternalError(ref cause) => write!(f, "{}", cause),
GetNotificationChannelError::InvalidOperation(ref cause) => write!(f, "{}", cause),
GetNotificationChannelError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetNotificationChannelError {}
#[derive(Debug, PartialEq)]
pub enum GetPolicyError {
InternalError(String),
InvalidOperation(String),
InvalidType(String),
ResourceNotFound(String),
}
impl GetPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetPolicyError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetPolicyError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(GetPolicyError::InvalidOperation(err.msg))
}
"InvalidTypeException" => {
return RusotoError::Service(GetPolicyError::InvalidType(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetPolicyError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetPolicyError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetPolicyError::InternalError(ref cause) => write!(f, "{}", cause),
GetPolicyError::InvalidOperation(ref cause) => write!(f, "{}", cause),
GetPolicyError::InvalidType(ref cause) => write!(f, "{}", cause),
GetPolicyError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetPolicyError {}
#[derive(Debug, PartialEq)]
pub enum GetProtectionStatusError {
InternalError(String),
InvalidInput(String),
ResourceNotFound(String),
}
impl GetProtectionStatusError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetProtectionStatusError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(GetProtectionStatusError::InternalError(err.msg))
}
"InvalidInputException" => {
return RusotoError::Service(GetProtectionStatusError::InvalidInput(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetProtectionStatusError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetProtectionStatusError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetProtectionStatusError::InternalError(ref cause) => write!(f, "{}", cause),
GetProtectionStatusError::InvalidInput(ref cause) => write!(f, "{}", cause),
GetProtectionStatusError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetProtectionStatusError {}
#[derive(Debug, PartialEq)]
pub enum ListComplianceStatusError {
InternalError(String),
ResourceNotFound(String),
}
impl ListComplianceStatusError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListComplianceStatusError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListComplianceStatusError::InternalError(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListComplianceStatusError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListComplianceStatusError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListComplianceStatusError::InternalError(ref cause) => write!(f, "{}", cause),
ListComplianceStatusError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListComplianceStatusError {}
#[derive(Debug, PartialEq)]
pub enum ListMemberAccountsError {
InternalError(String),
ResourceNotFound(String),
}
impl ListMemberAccountsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListMemberAccountsError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListMemberAccountsError::InternalError(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListMemberAccountsError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListMemberAccountsError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListMemberAccountsError::InternalError(ref cause) => write!(f, "{}", cause),
ListMemberAccountsError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListMemberAccountsError {}
#[derive(Debug, PartialEq)]
pub enum ListPoliciesError {
InternalError(String),
InvalidOperation(String),
LimitExceeded(String),
ResourceNotFound(String),
}
impl ListPoliciesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListPoliciesError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListPoliciesError::InternalError(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(ListPoliciesError::InvalidOperation(err.msg))
}
"LimitExceededException" => {
return RusotoError::Service(ListPoliciesError::LimitExceeded(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListPoliciesError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListPoliciesError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListPoliciesError::InternalError(ref cause) => write!(f, "{}", cause),
ListPoliciesError::InvalidOperation(ref cause) => write!(f, "{}", cause),
ListPoliciesError::LimitExceeded(ref cause) => write!(f, "{}", cause),
ListPoliciesError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListPoliciesError {}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
InternalError(String),
InvalidInput(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(ListTagsForResourceError::InternalError(err.msg))
}
"InvalidInputException" => {
return RusotoError::Service(ListTagsForResourceError::InvalidInput(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(ListTagsForResourceError::InvalidOperation(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListTagsForResourceError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListTagsForResourceError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListTagsForResourceError::InternalError(ref cause) => write!(f, "{}", cause),
ListTagsForResourceError::InvalidInput(ref cause) => write!(f, "{}", cause),
ListTagsForResourceError::InvalidOperation(ref cause) => write!(f, "{}", cause),
ListTagsForResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListTagsForResourceError {}
#[derive(Debug, PartialEq)]
pub enum PutNotificationChannelError {
InternalError(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl PutNotificationChannelError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutNotificationChannelError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(PutNotificationChannelError::InternalError(
err.msg,
))
}
"InvalidOperationException" => {
return RusotoError::Service(PutNotificationChannelError::InvalidOperation(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(PutNotificationChannelError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for PutNotificationChannelError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
PutNotificationChannelError::InternalError(ref cause) => write!(f, "{}", cause),
PutNotificationChannelError::InvalidOperation(ref cause) => write!(f, "{}", cause),
PutNotificationChannelError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for PutNotificationChannelError {}
#[derive(Debug, PartialEq)]
pub enum PutPolicyError {
InternalError(String),
InvalidInput(String),
InvalidOperation(String),
InvalidType(String),
LimitExceeded(String),
ResourceNotFound(String),
}
impl PutPolicyError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutPolicyError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(PutPolicyError::InternalError(err.msg))
}
"InvalidInputException" => {
return RusotoError::Service(PutPolicyError::InvalidInput(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(PutPolicyError::InvalidOperation(err.msg))
}
"InvalidTypeException" => {
return RusotoError::Service(PutPolicyError::InvalidType(err.msg))
}
"LimitExceededException" => {
return RusotoError::Service(PutPolicyError::LimitExceeded(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(PutPolicyError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for PutPolicyError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
PutPolicyError::InternalError(ref cause) => write!(f, "{}", cause),
PutPolicyError::InvalidInput(ref cause) => write!(f, "{}", cause),
PutPolicyError::InvalidOperation(ref cause) => write!(f, "{}", cause),
PutPolicyError::InvalidType(ref cause) => write!(f, "{}", cause),
PutPolicyError::LimitExceeded(ref cause) => write!(f, "{}", cause),
PutPolicyError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for PutPolicyError {}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
InternalError(String),
InvalidInput(String),
InvalidOperation(String),
LimitExceeded(String),
ResourceNotFound(String),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(TagResourceError::InternalError(err.msg))
}
"InvalidInputException" => {
return RusotoError::Service(TagResourceError::InvalidInput(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(TagResourceError::InvalidOperation(err.msg))
}
"LimitExceededException" => {
return RusotoError::Service(TagResourceError::LimitExceeded(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(TagResourceError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for TagResourceError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
TagResourceError::InternalError(ref cause) => write!(f, "{}", cause),
TagResourceError::InvalidInput(ref cause) => write!(f, "{}", cause),
TagResourceError::InvalidOperation(ref cause) => write!(f, "{}", cause),
TagResourceError::LimitExceeded(ref cause) => write!(f, "{}", cause),
TagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for TagResourceError {}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
InternalError(String),
InvalidInput(String),
InvalidOperation(String),
ResourceNotFound(String),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(UntagResourceError::InternalError(err.msg))
}
"InvalidInputException" => {
return RusotoError::Service(UntagResourceError::InvalidInput(err.msg))
}
"InvalidOperationException" => {
return RusotoError::Service(UntagResourceError::InvalidOperation(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UntagResourceError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for UntagResourceError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
UntagResourceError::InternalError(ref cause) => write!(f, "{}", cause),
UntagResourceError::InvalidInput(ref cause) => write!(f, "{}", cause),
UntagResourceError::InvalidOperation(ref cause) => write!(f, "{}", cause),
UntagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for UntagResourceError {}
#[async_trait]
pub trait Fms {
async fn associate_admin_account(
&self,
input: AssociateAdminAccountRequest,
) -> Result<(), RusotoError<AssociateAdminAccountError>>;
async fn delete_notification_channel(
&self,
) -> Result<(), RusotoError<DeleteNotificationChannelError>>;
async fn delete_policy(
&self,
input: DeletePolicyRequest,
) -> Result<(), RusotoError<DeletePolicyError>>;
async fn disassociate_admin_account(
&self,
) -> Result<(), RusotoError<DisassociateAdminAccountError>>;
async fn get_admin_account(
&self,
) -> Result<GetAdminAccountResponse, RusotoError<GetAdminAccountError>>;
async fn get_compliance_detail(
&self,
input: GetComplianceDetailRequest,
) -> Result<GetComplianceDetailResponse, RusotoError<GetComplianceDetailError>>;
async fn get_notification_channel(
&self,
) -> Result<GetNotificationChannelResponse, RusotoError<GetNotificationChannelError>>;
async fn get_policy(
&self,
input: GetPolicyRequest,
) -> Result<GetPolicyResponse, RusotoError<GetPolicyError>>;
async fn get_protection_status(
&self,
input: GetProtectionStatusRequest,
) -> Result<GetProtectionStatusResponse, RusotoError<GetProtectionStatusError>>;
async fn list_compliance_status(
&self,
input: ListComplianceStatusRequest,
) -> Result<ListComplianceStatusResponse, RusotoError<ListComplianceStatusError>>;
async fn list_member_accounts(
&self,
input: ListMemberAccountsRequest,
) -> Result<ListMemberAccountsResponse, RusotoError<ListMemberAccountsError>>;
async fn list_policies(
&self,
input: ListPoliciesRequest,
) -> Result<ListPoliciesResponse, RusotoError<ListPoliciesError>>;
async fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>>;
async fn put_notification_channel(
&self,
input: PutNotificationChannelRequest,
) -> Result<(), RusotoError<PutNotificationChannelError>>;
async fn put_policy(
&self,
input: PutPolicyRequest,
) -> Result<PutPolicyResponse, RusotoError<PutPolicyError>>;
async fn tag_resource(
&self,
input: TagResourceRequest,
) -> Result<TagResourceResponse, RusotoError<TagResourceError>>;
async fn untag_resource(
&self,
input: UntagResourceRequest,
) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>>;
}
#[derive(Clone)]
pub struct FmsClient {
client: Client,
region: region::Region,
}
impl FmsClient {
pub fn new(region: region::Region) -> FmsClient {
FmsClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> FmsClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
D: DispatchSignedRequest + Send + Sync + 'static,
{
FmsClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
pub fn new_with_client(client: Client, region: region::Region) -> FmsClient {
FmsClient { client, region }
}
}
#[async_trait]
impl Fms for FmsClient {
async fn associate_admin_account(
&self,
input: AssociateAdminAccountRequest,
) -> Result<(), RusotoError<AssociateAdminAccountError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.AssociateAdminAccount");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, AssociateAdminAccountError::from_response)
.await?;
std::mem::drop(response);
Ok(())
}
async fn delete_notification_channel(
&self,
) -> Result<(), RusotoError<DeleteNotificationChannelError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.DeleteNotificationChannel");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
let response = self
.sign_and_dispatch(request, DeleteNotificationChannelError::from_response)
.await?;
std::mem::drop(response);
Ok(())
}
async fn delete_policy(
&self,
input: DeletePolicyRequest,
) -> Result<(), RusotoError<DeletePolicyError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.DeletePolicy");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, DeletePolicyError::from_response)
.await?;
std::mem::drop(response);
Ok(())
}
async fn disassociate_admin_account(
&self,
) -> Result<(), RusotoError<DisassociateAdminAccountError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.DisassociateAdminAccount");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
let response = self
.sign_and_dispatch(request, DisassociateAdminAccountError::from_response)
.await?;
std::mem::drop(response);
Ok(())
}
async fn get_admin_account(
&self,
) -> Result<GetAdminAccountResponse, RusotoError<GetAdminAccountError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.GetAdminAccount");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
let response = self
.sign_and_dispatch(request, GetAdminAccountError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<GetAdminAccountResponse, _>()
}
async fn get_compliance_detail(
&self,
input: GetComplianceDetailRequest,
) -> Result<GetComplianceDetailResponse, RusotoError<GetComplianceDetailError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.GetComplianceDetail");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, GetComplianceDetailError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<GetComplianceDetailResponse, _>()
}
async fn get_notification_channel(
&self,
) -> Result<GetNotificationChannelResponse, RusotoError<GetNotificationChannelError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.GetNotificationChannel");
request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
let response = self
.sign_and_dispatch(request, GetNotificationChannelError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<GetNotificationChannelResponse, _>()
}
async fn get_policy(
&self,
input: GetPolicyRequest,
) -> Result<GetPolicyResponse, RusotoError<GetPolicyError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.GetPolicy");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, GetPolicyError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<GetPolicyResponse, _>()
}
async fn get_protection_status(
&self,
input: GetProtectionStatusRequest,
) -> Result<GetProtectionStatusResponse, RusotoError<GetProtectionStatusError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.GetProtectionStatus");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, GetProtectionStatusError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<GetProtectionStatusResponse, _>()
}
async fn list_compliance_status(
&self,
input: ListComplianceStatusRequest,
) -> Result<ListComplianceStatusResponse, RusotoError<ListComplianceStatusError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.ListComplianceStatus");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, ListComplianceStatusError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response)
.deserialize::<ListComplianceStatusResponse, _>()
}
async fn list_member_accounts(
&self,
input: ListMemberAccountsRequest,
) -> Result<ListMemberAccountsResponse, RusotoError<ListMemberAccountsError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.ListMemberAccounts");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, ListMemberAccountsError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<ListMemberAccountsResponse, _>()
}
async fn list_policies(
&self,
input: ListPoliciesRequest,
) -> Result<ListPoliciesResponse, RusotoError<ListPoliciesError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.ListPolicies");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, ListPoliciesError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<ListPoliciesResponse, _>()
}
async fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.ListTagsForResource");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, ListTagsForResourceError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<ListTagsForResourceResponse, _>()
}
async fn put_notification_channel(
&self,
input: PutNotificationChannelRequest,
) -> Result<(), RusotoError<PutNotificationChannelError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.PutNotificationChannel");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, PutNotificationChannelError::from_response)
.await?;
std::mem::drop(response);
Ok(())
}
async fn put_policy(
&self,
input: PutPolicyRequest,
) -> Result<PutPolicyResponse, RusotoError<PutPolicyError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.PutPolicy");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, PutPolicyError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<PutPolicyResponse, _>()
}
async fn tag_resource(
&self,
input: TagResourceRequest,
) -> Result<TagResourceResponse, RusotoError<TagResourceError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.TagResource");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, TagResourceError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<TagResourceResponse, _>()
}
async fn untag_resource(
&self,
input: UntagResourceRequest,
) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>> {
let mut request = self.new_signed_request("POST", "/");
request.add_header("x-amz-target", "AWSFMS_20180101.UntagResource");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
let response = self
.sign_and_dispatch(request, UntagResourceError::from_response)
.await?;
let mut response = response;
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
proto::json::ResponsePayload::new(&response).deserialize::<UntagResourceResponse, _>()
}
}