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::param::{Params, ServiceParams};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct AnalyzedResource {
#[serde(rename = "actions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actions: Option<Vec<String>>,
#[serde(rename = "analyzedAt")]
pub analyzed_at: f64,
#[serde(rename = "createdAt")]
pub created_at: f64,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "isPublic")]
pub is_public: bool,
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "resourceOwnerAccount")]
pub resource_owner_account: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
#[serde(rename = "sharedVia")]
#[serde(skip_serializing_if = "Option::is_none")]
pub shared_via: Option<Vec<String>>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "updatedAt")]
pub updated_at: f64,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct AnalyzedResourceSummary {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "resourceOwnerAccount")]
pub resource_owner_account: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct AnalyzerSummary {
#[serde(rename = "arn")]
pub arn: String,
#[serde(rename = "createdAt")]
pub created_at: f64,
#[serde(rename = "lastResourceAnalyzed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_resource_analyzed: Option<String>,
#[serde(rename = "lastResourceAnalyzedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_resource_analyzed_at: Option<f64>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "statusReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_reason: Option<StatusReason>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ArchiveRuleSummary {
#[serde(rename = "createdAt")]
pub created_at: f64,
#[serde(rename = "filter")]
pub filter: ::std::collections::HashMap<String, Criterion>,
#[serde(rename = "ruleName")]
pub rule_name: String,
#[serde(rename = "updatedAt")]
pub updated_at: f64,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct CreateAnalyzerRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
#[serde(rename = "archiveRules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub archive_rules: Option<Vec<InlineArchiveRule>>,
#[serde(rename = "clientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct CreateAnalyzerResponse {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct CreateArchiveRuleRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
#[serde(rename = "clientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
#[serde(rename = "filter")]
pub filter: ::std::collections::HashMap<String, Criterion>,
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct Criterion {
#[serde(rename = "contains")]
#[serde(skip_serializing_if = "Option::is_none")]
pub contains: Option<Vec<String>>,
#[serde(rename = "eq")]
#[serde(skip_serializing_if = "Option::is_none")]
pub eq: Option<Vec<String>>,
#[serde(rename = "exists")]
#[serde(skip_serializing_if = "Option::is_none")]
pub exists: Option<bool>,
#[serde(rename = "neq")]
#[serde(skip_serializing_if = "Option::is_none")]
pub neq: Option<Vec<String>>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DeleteAnalyzerRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
#[serde(rename = "clientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DeleteArchiveRuleRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
#[serde(rename = "clientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct Finding {
#[serde(rename = "action")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action: Option<Vec<String>>,
#[serde(rename = "analyzedAt")]
pub analyzed_at: f64,
#[serde(rename = "condition")]
pub condition: ::std::collections::HashMap<String, String>,
#[serde(rename = "createdAt")]
pub created_at: f64,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "isPublic")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_public: Option<bool>,
#[serde(rename = "principal")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principal: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "resource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource: Option<String>,
#[serde(rename = "resourceOwnerAccount")]
pub resource_owner_account: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
#[serde(rename = "sources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sources: Option<Vec<FindingSource>>,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "updatedAt")]
pub updated_at: f64,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct FindingSource {
#[serde(rename = "detail")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<FindingSourceDetail>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct FindingSourceDetail {
#[serde(rename = "accessPointArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_point_arn: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct FindingSummary {
#[serde(rename = "action")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action: Option<Vec<String>>,
#[serde(rename = "analyzedAt")]
pub analyzed_at: f64,
#[serde(rename = "condition")]
pub condition: ::std::collections::HashMap<String, String>,
#[serde(rename = "createdAt")]
pub created_at: f64,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "isPublic")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_public: Option<bool>,
#[serde(rename = "principal")]
#[serde(skip_serializing_if = "Option::is_none")]
pub principal: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "resource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource: Option<String>,
#[serde(rename = "resourceOwnerAccount")]
pub resource_owner_account: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
#[serde(rename = "sources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sources: Option<Vec<FindingSource>>,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "updatedAt")]
pub updated_at: f64,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetAnalyzedResourceRequest {
#[serde(rename = "analyzerArn")]
pub analyzer_arn: String,
#[serde(rename = "resourceArn")]
pub resource_arn: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetAnalyzedResourceResponse {
#[serde(rename = "resource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource: Option<AnalyzedResource>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetAnalyzerRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetAnalyzerResponse {
#[serde(rename = "analyzer")]
pub analyzer: AnalyzerSummary,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetArchiveRuleRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetArchiveRuleResponse {
#[serde(rename = "archiveRule")]
pub archive_rule: ArchiveRuleSummary,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetFindingRequest {
#[serde(rename = "analyzerArn")]
pub analyzer_arn: String,
#[serde(rename = "id")]
pub id: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetFindingResponse {
#[serde(rename = "finding")]
#[serde(skip_serializing_if = "Option::is_none")]
pub finding: Option<Finding>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct InlineArchiveRule {
#[serde(rename = "filter")]
pub filter: ::std::collections::HashMap<String, Criterion>,
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListAnalyzedResourcesRequest {
#[serde(rename = "analyzerArn")]
pub analyzer_arn: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "resourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_type: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListAnalyzedResourcesResponse {
#[serde(rename = "analyzedResources")]
pub analyzed_resources: Vec<AnalyzedResourceSummary>,
#[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 ListAnalyzersRequest {
#[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 = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListAnalyzersResponse {
#[serde(rename = "analyzers")]
pub analyzers: Vec<AnalyzerSummary>,
#[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 ListArchiveRulesRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListArchiveRulesResponse {
#[serde(rename = "archiveRules")]
pub archive_rules: Vec<ArchiveRuleSummary>,
#[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 ListFindingsRequest {
#[serde(rename = "analyzerArn")]
pub analyzer_arn: String,
#[serde(rename = "filter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter: Option<::std::collections::HashMap<String, Criterion>>,
#[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 = "sort")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort: Option<SortCriteria>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListFindingsResponse {
#[serde(rename = "findings")]
pub findings: Vec<FindingSummary>,
#[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 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 = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct SortCriteria {
#[serde(rename = "attributeName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attribute_name: Option<String>,
#[serde(rename = "orderBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub order_by: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct StartResourceScanRequest {
#[serde(rename = "analyzerArn")]
pub analyzer_arn: String,
#[serde(rename = "resourceArn")]
pub resource_arn: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct StatusReason {
#[serde(rename = "code")]
pub code: 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 = "tags")]
pub tags: ::std::collections::HashMap<String, String>,
}
#[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(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct UpdateArchiveRuleRequest {
#[serde(rename = "analyzerName")]
pub analyzer_name: String,
#[serde(rename = "clientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
#[serde(rename = "filter")]
pub filter: ::std::collections::HashMap<String, Criterion>,
#[serde(rename = "ruleName")]
pub rule_name: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct UpdateFindingsRequest {
#[serde(rename = "analyzerArn")]
pub analyzer_arn: String,
#[serde(rename = "clientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
#[serde(rename = "ids")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ids: Option<Vec<String>>,
#[serde(rename = "resourceArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_arn: Option<String>,
#[serde(rename = "status")]
pub status: String,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ValidationExceptionField {
pub message: String,
pub name: String,
}
#[derive(Debug, PartialEq)]
pub enum CreateAnalyzerError {
AccessDenied(String),
Conflict(String),
InternalServer(String),
ServiceQuotaExceeded(String),
Throttling(String),
}
impl CreateAnalyzerError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateAnalyzerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(CreateAnalyzerError::AccessDenied(err.msg))
}
"ConflictException" => {
return RusotoError::Service(CreateAnalyzerError::Conflict(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(CreateAnalyzerError::InternalServer(err.msg))
}
"ServiceQuotaExceededException" => {
return RusotoError::Service(CreateAnalyzerError::ServiceQuotaExceeded(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(CreateAnalyzerError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for CreateAnalyzerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
CreateAnalyzerError::AccessDenied(ref cause) => write!(f, "{}", cause),
CreateAnalyzerError::Conflict(ref cause) => write!(f, "{}", cause),
CreateAnalyzerError::InternalServer(ref cause) => write!(f, "{}", cause),
CreateAnalyzerError::ServiceQuotaExceeded(ref cause) => write!(f, "{}", cause),
CreateAnalyzerError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for CreateAnalyzerError {}
#[derive(Debug, PartialEq)]
pub enum CreateArchiveRuleError {
AccessDenied(String),
Conflict(String),
InternalServer(String),
ResourceNotFound(String),
ServiceQuotaExceeded(String),
Throttling(String),
}
impl CreateArchiveRuleError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateArchiveRuleError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(CreateArchiveRuleError::AccessDenied(err.msg))
}
"ConflictException" => {
return RusotoError::Service(CreateArchiveRuleError::Conflict(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(CreateArchiveRuleError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(CreateArchiveRuleError::ResourceNotFound(err.msg))
}
"ServiceQuotaExceededException" => {
return RusotoError::Service(CreateArchiveRuleError::ServiceQuotaExceeded(
err.msg,
))
}
"ThrottlingException" => {
return RusotoError::Service(CreateArchiveRuleError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for CreateArchiveRuleError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
CreateArchiveRuleError::AccessDenied(ref cause) => write!(f, "{}", cause),
CreateArchiveRuleError::Conflict(ref cause) => write!(f, "{}", cause),
CreateArchiveRuleError::InternalServer(ref cause) => write!(f, "{}", cause),
CreateArchiveRuleError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
CreateArchiveRuleError::ServiceQuotaExceeded(ref cause) => write!(f, "{}", cause),
CreateArchiveRuleError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for CreateArchiveRuleError {}
#[derive(Debug, PartialEq)]
pub enum DeleteAnalyzerError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl DeleteAnalyzerError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteAnalyzerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(DeleteAnalyzerError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(DeleteAnalyzerError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteAnalyzerError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(DeleteAnalyzerError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DeleteAnalyzerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DeleteAnalyzerError::AccessDenied(ref cause) => write!(f, "{}", cause),
DeleteAnalyzerError::InternalServer(ref cause) => write!(f, "{}", cause),
DeleteAnalyzerError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
DeleteAnalyzerError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DeleteAnalyzerError {}
#[derive(Debug, PartialEq)]
pub enum DeleteArchiveRuleError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl DeleteArchiveRuleError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteArchiveRuleError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(DeleteArchiveRuleError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(DeleteArchiveRuleError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteArchiveRuleError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(DeleteArchiveRuleError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DeleteArchiveRuleError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DeleteArchiveRuleError::AccessDenied(ref cause) => write!(f, "{}", cause),
DeleteArchiveRuleError::InternalServer(ref cause) => write!(f, "{}", cause),
DeleteArchiveRuleError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
DeleteArchiveRuleError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DeleteArchiveRuleError {}
#[derive(Debug, PartialEq)]
pub enum GetAnalyzedResourceError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl GetAnalyzedResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetAnalyzedResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(GetAnalyzedResourceError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(GetAnalyzedResourceError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetAnalyzedResourceError::ResourceNotFound(
err.msg,
))
}
"ThrottlingException" => {
return RusotoError::Service(GetAnalyzedResourceError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetAnalyzedResourceError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetAnalyzedResourceError::AccessDenied(ref cause) => write!(f, "{}", cause),
GetAnalyzedResourceError::InternalServer(ref cause) => write!(f, "{}", cause),
GetAnalyzedResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
GetAnalyzedResourceError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetAnalyzedResourceError {}
#[derive(Debug, PartialEq)]
pub enum GetAnalyzerError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl GetAnalyzerError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetAnalyzerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(GetAnalyzerError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(GetAnalyzerError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetAnalyzerError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(GetAnalyzerError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetAnalyzerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetAnalyzerError::AccessDenied(ref cause) => write!(f, "{}", cause),
GetAnalyzerError::InternalServer(ref cause) => write!(f, "{}", cause),
GetAnalyzerError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
GetAnalyzerError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetAnalyzerError {}
#[derive(Debug, PartialEq)]
pub enum GetArchiveRuleError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl GetArchiveRuleError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetArchiveRuleError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(GetArchiveRuleError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(GetArchiveRuleError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetArchiveRuleError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(GetArchiveRuleError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetArchiveRuleError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetArchiveRuleError::AccessDenied(ref cause) => write!(f, "{}", cause),
GetArchiveRuleError::InternalServer(ref cause) => write!(f, "{}", cause),
GetArchiveRuleError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
GetArchiveRuleError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetArchiveRuleError {}
#[derive(Debug, PartialEq)]
pub enum GetFindingError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl GetFindingError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetFindingError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(GetFindingError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(GetFindingError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetFindingError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(GetFindingError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetFindingError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetFindingError::AccessDenied(ref cause) => write!(f, "{}", cause),
GetFindingError::InternalServer(ref cause) => write!(f, "{}", cause),
GetFindingError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
GetFindingError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetFindingError {}
#[derive(Debug, PartialEq)]
pub enum ListAnalyzedResourcesError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl ListAnalyzedResourcesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListAnalyzedResourcesError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(ListAnalyzedResourcesError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(ListAnalyzedResourcesError::InternalServer(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListAnalyzedResourcesError::ResourceNotFound(
err.msg,
))
}
"ThrottlingException" => {
return RusotoError::Service(ListAnalyzedResourcesError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListAnalyzedResourcesError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListAnalyzedResourcesError::AccessDenied(ref cause) => write!(f, "{}", cause),
ListAnalyzedResourcesError::InternalServer(ref cause) => write!(f, "{}", cause),
ListAnalyzedResourcesError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
ListAnalyzedResourcesError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListAnalyzedResourcesError {}
#[derive(Debug, PartialEq)]
pub enum ListAnalyzersError {
AccessDenied(String),
InternalServer(String),
Throttling(String),
}
impl ListAnalyzersError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListAnalyzersError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(ListAnalyzersError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(ListAnalyzersError::InternalServer(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(ListAnalyzersError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListAnalyzersError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListAnalyzersError::AccessDenied(ref cause) => write!(f, "{}", cause),
ListAnalyzersError::InternalServer(ref cause) => write!(f, "{}", cause),
ListAnalyzersError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListAnalyzersError {}
#[derive(Debug, PartialEq)]
pub enum ListArchiveRulesError {
AccessDenied(String),
InternalServer(String),
Throttling(String),
}
impl ListArchiveRulesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListArchiveRulesError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(ListArchiveRulesError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(ListArchiveRulesError::InternalServer(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(ListArchiveRulesError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListArchiveRulesError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListArchiveRulesError::AccessDenied(ref cause) => write!(f, "{}", cause),
ListArchiveRulesError::InternalServer(ref cause) => write!(f, "{}", cause),
ListArchiveRulesError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListArchiveRulesError {}
#[derive(Debug, PartialEq)]
pub enum ListFindingsError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl ListFindingsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListFindingsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(ListFindingsError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(ListFindingsError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListFindingsError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(ListFindingsError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListFindingsError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListFindingsError::AccessDenied(ref cause) => write!(f, "{}", cause),
ListFindingsError::InternalServer(ref cause) => write!(f, "{}", cause),
ListFindingsError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
ListFindingsError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListFindingsError {}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(ListTagsForResourceError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(ListTagsForResourceError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListTagsForResourceError::ResourceNotFound(
err.msg,
))
}
"ThrottlingException" => {
return RusotoError::Service(ListTagsForResourceError::Throttling(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::AccessDenied(ref cause) => write!(f, "{}", cause),
ListTagsForResourceError::InternalServer(ref cause) => write!(f, "{}", cause),
ListTagsForResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
ListTagsForResourceError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListTagsForResourceError {}
#[derive(Debug, PartialEq)]
pub enum StartResourceScanError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl StartResourceScanError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<StartResourceScanError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(StartResourceScanError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(StartResourceScanError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(StartResourceScanError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(StartResourceScanError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for StartResourceScanError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
StartResourceScanError::AccessDenied(ref cause) => write!(f, "{}", cause),
StartResourceScanError::InternalServer(ref cause) => write!(f, "{}", cause),
StartResourceScanError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
StartResourceScanError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for StartResourceScanError {}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(TagResourceError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(TagResourceError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(TagResourceError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(TagResourceError::Throttling(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::AccessDenied(ref cause) => write!(f, "{}", cause),
TagResourceError::InternalServer(ref cause) => write!(f, "{}", cause),
TagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
TagResourceError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for TagResourceError {}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(UntagResourceError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(UntagResourceError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UntagResourceError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(UntagResourceError::Throttling(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::AccessDenied(ref cause) => write!(f, "{}", cause),
UntagResourceError::InternalServer(ref cause) => write!(f, "{}", cause),
UntagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
UntagResourceError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for UntagResourceError {}
#[derive(Debug, PartialEq)]
pub enum UpdateArchiveRuleError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl UpdateArchiveRuleError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateArchiveRuleError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(UpdateArchiveRuleError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(UpdateArchiveRuleError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateArchiveRuleError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(UpdateArchiveRuleError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for UpdateArchiveRuleError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
UpdateArchiveRuleError::AccessDenied(ref cause) => write!(f, "{}", cause),
UpdateArchiveRuleError::InternalServer(ref cause) => write!(f, "{}", cause),
UpdateArchiveRuleError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
UpdateArchiveRuleError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for UpdateArchiveRuleError {}
#[derive(Debug, PartialEq)]
pub enum UpdateFindingsError {
AccessDenied(String),
InternalServer(String),
ResourceNotFound(String),
Throttling(String),
}
impl UpdateFindingsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateFindingsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccessDeniedException" => {
return RusotoError::Service(UpdateFindingsError::AccessDenied(err.msg))
}
"InternalServerException" => {
return RusotoError::Service(UpdateFindingsError::InternalServer(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateFindingsError::ResourceNotFound(err.msg))
}
"ThrottlingException" => {
return RusotoError::Service(UpdateFindingsError::Throttling(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for UpdateFindingsError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
UpdateFindingsError::AccessDenied(ref cause) => write!(f, "{}", cause),
UpdateFindingsError::InternalServer(ref cause) => write!(f, "{}", cause),
UpdateFindingsError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
UpdateFindingsError::Throttling(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for UpdateFindingsError {}
#[async_trait]
pub trait AccessAnalyzer {
async fn create_analyzer(
&self,
input: CreateAnalyzerRequest,
) -> Result<CreateAnalyzerResponse, RusotoError<CreateAnalyzerError>>;
async fn create_archive_rule(
&self,
input: CreateArchiveRuleRequest,
) -> Result<(), RusotoError<CreateArchiveRuleError>>;
async fn delete_analyzer(
&self,
input: DeleteAnalyzerRequest,
) -> Result<(), RusotoError<DeleteAnalyzerError>>;
async fn delete_archive_rule(
&self,
input: DeleteArchiveRuleRequest,
) -> Result<(), RusotoError<DeleteArchiveRuleError>>;
async fn get_analyzed_resource(
&self,
input: GetAnalyzedResourceRequest,
) -> Result<GetAnalyzedResourceResponse, RusotoError<GetAnalyzedResourceError>>;
async fn get_analyzer(
&self,
input: GetAnalyzerRequest,
) -> Result<GetAnalyzerResponse, RusotoError<GetAnalyzerError>>;
async fn get_archive_rule(
&self,
input: GetArchiveRuleRequest,
) -> Result<GetArchiveRuleResponse, RusotoError<GetArchiveRuleError>>;
async fn get_finding(
&self,
input: GetFindingRequest,
) -> Result<GetFindingResponse, RusotoError<GetFindingError>>;
async fn list_analyzed_resources(
&self,
input: ListAnalyzedResourcesRequest,
) -> Result<ListAnalyzedResourcesResponse, RusotoError<ListAnalyzedResourcesError>>;
async fn list_analyzers(
&self,
input: ListAnalyzersRequest,
) -> Result<ListAnalyzersResponse, RusotoError<ListAnalyzersError>>;
async fn list_archive_rules(
&self,
input: ListArchiveRulesRequest,
) -> Result<ListArchiveRulesResponse, RusotoError<ListArchiveRulesError>>;
async fn list_findings(
&self,
input: ListFindingsRequest,
) -> Result<ListFindingsResponse, RusotoError<ListFindingsError>>;
async fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>>;
async fn start_resource_scan(
&self,
input: StartResourceScanRequest,
) -> Result<(), RusotoError<StartResourceScanError>>;
async fn tag_resource(
&self,
input: TagResourceRequest,
) -> Result<TagResourceResponse, RusotoError<TagResourceError>>;
async fn untag_resource(
&self,
input: UntagResourceRequest,
) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>>;
async fn update_archive_rule(
&self,
input: UpdateArchiveRuleRequest,
) -> Result<(), RusotoError<UpdateArchiveRuleError>>;
async fn update_findings(
&self,
input: UpdateFindingsRequest,
) -> Result<(), RusotoError<UpdateFindingsError>>;
}
#[derive(Clone)]
pub struct AccessAnalyzerClient {
client: Client,
region: region::Region,
}
impl AccessAnalyzerClient {
pub fn new(region: region::Region) -> AccessAnalyzerClient {
AccessAnalyzerClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> AccessAnalyzerClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
D: DispatchSignedRequest + Send + Sync + 'static,
{
AccessAnalyzerClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
pub fn new_with_client(client: Client, region: region::Region) -> AccessAnalyzerClient {
AccessAnalyzerClient { client, region }
}
}
#[async_trait]
impl AccessAnalyzer for AccessAnalyzerClient {
#[allow(unused_mut)]
async fn create_analyzer(
&self,
input: CreateAnalyzerRequest,
) -> Result<CreateAnalyzerResponse, RusotoError<CreateAnalyzerError>> {
let request_uri = "/analyzer";
let mut request = SignedRequest::new("PUT", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<CreateAnalyzerResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(CreateAnalyzerError::from_response(response))
}
}
#[allow(unused_mut)]
async fn create_archive_rule(
&self,
input: CreateArchiveRuleRequest,
) -> Result<(), RusotoError<CreateArchiveRuleError>> {
let request_uri = format!(
"/analyzer/{analyzer_name}/archive-rule",
analyzer_name = input.analyzer_name
);
let mut request = SignedRequest::new("PUT", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = ::std::mem::drop(response);
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(CreateArchiveRuleError::from_response(response))
}
}
#[allow(unused_mut)]
async fn delete_analyzer(
&self,
input: DeleteAnalyzerRequest,
) -> Result<(), RusotoError<DeleteAnalyzerError>> {
let request_uri = format!(
"/analyzer/{analyzer_name}",
analyzer_name = input.analyzer_name
);
let mut request =
SignedRequest::new("DELETE", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.client_token {
params.put("clientToken", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = ::std::mem::drop(response);
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(DeleteAnalyzerError::from_response(response))
}
}
#[allow(unused_mut)]
async fn delete_archive_rule(
&self,
input: DeleteArchiveRuleRequest,
) -> Result<(), RusotoError<DeleteArchiveRuleError>> {
let request_uri = format!(
"/analyzer/{analyzer_name}/archive-rule/{rule_name}",
analyzer_name = input.analyzer_name,
rule_name = input.rule_name
);
let mut request =
SignedRequest::new("DELETE", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.client_token {
params.put("clientToken", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = ::std::mem::drop(response);
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(DeleteArchiveRuleError::from_response(response))
}
}
#[allow(unused_mut)]
async fn get_analyzed_resource(
&self,
input: GetAnalyzedResourceRequest,
) -> Result<GetAnalyzedResourceResponse, RusotoError<GetAnalyzedResourceError>> {
let request_uri = "/analyzed-resource";
let mut request = SignedRequest::new("GET", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
params.put("analyzerArn", &input.analyzer_arn);
params.put("resourceArn", &input.resource_arn);
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetAnalyzedResourceResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(GetAnalyzedResourceError::from_response(response))
}
}
#[allow(unused_mut)]
async fn get_analyzer(
&self,
input: GetAnalyzerRequest,
) -> Result<GetAnalyzerResponse, RusotoError<GetAnalyzerError>> {
let request_uri = format!(
"/analyzer/{analyzer_name}",
analyzer_name = input.analyzer_name
);
let mut request = SignedRequest::new("GET", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetAnalyzerResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(GetAnalyzerError::from_response(response))
}
}
#[allow(unused_mut)]
async fn get_archive_rule(
&self,
input: GetArchiveRuleRequest,
) -> Result<GetArchiveRuleResponse, RusotoError<GetArchiveRuleError>> {
let request_uri = format!(
"/analyzer/{analyzer_name}/archive-rule/{rule_name}",
analyzer_name = input.analyzer_name,
rule_name = input.rule_name
);
let mut request = SignedRequest::new("GET", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetArchiveRuleResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(GetArchiveRuleError::from_response(response))
}
}
#[allow(unused_mut)]
async fn get_finding(
&self,
input: GetFindingRequest,
) -> Result<GetFindingResponse, RusotoError<GetFindingError>> {
let request_uri = format!("/finding/{id}", id = input.id);
let mut request = SignedRequest::new("GET", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
params.put("analyzerArn", &input.analyzer_arn);
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetFindingResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(GetFindingError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_analyzed_resources(
&self,
input: ListAnalyzedResourcesRequest,
) -> Result<ListAnalyzedResourcesResponse, RusotoError<ListAnalyzedResourcesError>> {
let request_uri = "/analyzed-resource";
let mut request = SignedRequest::new("POST", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListAnalyzedResourcesResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListAnalyzedResourcesError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_analyzers(
&self,
input: ListAnalyzersRequest,
) -> Result<ListAnalyzersResponse, RusotoError<ListAnalyzersError>> {
let request_uri = "/analyzer";
let mut request = SignedRequest::new("GET", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
if let Some(ref x) = input.type_ {
params.put("type", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListAnalyzersResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListAnalyzersError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_archive_rules(
&self,
input: ListArchiveRulesRequest,
) -> Result<ListArchiveRulesResponse, RusotoError<ListArchiveRulesError>> {
let request_uri = format!(
"/analyzer/{analyzer_name}/archive-rule",
analyzer_name = input.analyzer_name
);
let mut request = SignedRequest::new("GET", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListArchiveRulesResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListArchiveRulesError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_findings(
&self,
input: ListFindingsRequest,
) -> Result<ListFindingsResponse, RusotoError<ListFindingsError>> {
let request_uri = "/finding";
let mut request = SignedRequest::new("POST", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListFindingsResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListFindingsError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("GET", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListTagsForResourceResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListTagsForResourceError::from_response(response))
}
}
#[allow(unused_mut)]
async fn start_resource_scan(
&self,
input: StartResourceScanRequest,
) -> Result<(), RusotoError<StartResourceScanError>> {
let request_uri = "/resource/scan";
let mut request = SignedRequest::new("POST", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = ::std::mem::drop(response);
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(StartResourceScanError::from_response(response))
}
}
#[allow(unused_mut)]
async fn tag_resource(
&self,
input: TagResourceRequest,
) -> Result<TagResourceResponse, RusotoError<TagResourceError>> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("POST", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<TagResourceResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(TagResourceError::from_response(response))
}
}
#[allow(unused_mut)]
async fn untag_resource(
&self,
input: UntagResourceRequest,
) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request =
SignedRequest::new("DELETE", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
for item in input.tag_keys.iter() {
params.put("tagKeys", item);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UntagResourceResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(UntagResourceError::from_response(response))
}
}
#[allow(unused_mut)]
async fn update_archive_rule(
&self,
input: UpdateArchiveRuleRequest,
) -> Result<(), RusotoError<UpdateArchiveRuleError>> {
let request_uri = format!(
"/analyzer/{analyzer_name}/archive-rule/{rule_name}",
analyzer_name = input.analyzer_name,
rule_name = input.rule_name
);
let mut request = SignedRequest::new("PUT", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = ::std::mem::drop(response);
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(UpdateArchiveRuleError::from_response(response))
}
}
#[allow(unused_mut)]
async fn update_findings(
&self,
input: UpdateFindingsRequest,
) -> Result<(), RusotoError<UpdateFindingsError>> {
let request_uri = "/finding";
let mut request = SignedRequest::new("PUT", "access-analyzer", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.as_u16() == 200 {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = ::std::mem::drop(response);
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(UpdateFindingsError::from_response(response))
}
}
}