1use std::error::Error;
14use std::fmt;
15
16use async_trait::async_trait;
17use rusoto_core::credential::ProvideAwsCredentials;
18use rusoto_core::region;
19use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
20use rusoto_core::{Client, RusotoError};
21
22use rusoto_core::proto;
23use rusoto_core::request::HttpResponse;
24use rusoto_core::signature::SignedRequest;
25#[allow(unused_imports)]
26use serde::{Deserialize, Serialize};
27
28impl FmsClient {
29 fn new_signed_request(&self, http_method: &str, request_uri: &str) -> SignedRequest {
30 let mut request = SignedRequest::new(http_method, "fms", &self.region, request_uri);
31
32 request.set_content_type("application/x-amz-json-1.1".to_owned());
33
34 request
35 }
36
37 async fn sign_and_dispatch<E>(
38 &self,
39 request: SignedRequest,
40 from_response: fn(BufferedHttpResponse) -> RusotoError<E>,
41 ) -> Result<HttpResponse, RusotoError<E>> {
42 let mut response = self.client.sign_and_dispatch(request).await?;
43 if !response.status.is_success() {
44 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
45 return Err(from_response(response));
46 }
47
48 Ok(response)
49 }
50}
51
52use serde_json;
53#[derive(Clone, Debug, Default, PartialEq, Serialize)]
54#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
55pub struct AssociateAdminAccountRequest {
56 #[serde(rename = "AdminAccount")]
58 pub admin_account: String,
59}
60
61#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
63#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
64pub struct ComplianceViolator {
65 #[serde(rename = "ResourceId")]
67 #[serde(skip_serializing_if = "Option::is_none")]
68 pub resource_id: Option<String>,
69 #[serde(rename = "ResourceType")]
71 #[serde(skip_serializing_if = "Option::is_none")]
72 pub resource_type: Option<String>,
73 #[serde(rename = "ViolationReason")]
75 #[serde(skip_serializing_if = "Option::is_none")]
76 pub violation_reason: Option<String>,
77}
78
79#[derive(Clone, Debug, Default, PartialEq, Serialize)]
80#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
81pub struct DeleteNotificationChannelRequest {}
82
83#[derive(Clone, Debug, Default, PartialEq, Serialize)]
84#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
85pub struct DeletePolicyRequest {
86 #[serde(rename = "DeleteAllPolicyResources")]
88 #[serde(skip_serializing_if = "Option::is_none")]
89 pub delete_all_policy_resources: Option<bool>,
90 #[serde(rename = "PolicyId")]
92 pub policy_id: String,
93}
94
95#[derive(Clone, Debug, Default, PartialEq, Serialize)]
96#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
97pub struct DisassociateAdminAccountRequest {}
98
99#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
101#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
102pub struct EvaluationResult {
103 #[serde(rename = "ComplianceStatus")]
105 #[serde(skip_serializing_if = "Option::is_none")]
106 pub compliance_status: Option<String>,
107 #[serde(rename = "EvaluationLimitExceeded")]
109 #[serde(skip_serializing_if = "Option::is_none")]
110 pub evaluation_limit_exceeded: Option<bool>,
111 #[serde(rename = "ViolatorCount")]
113 #[serde(skip_serializing_if = "Option::is_none")]
114 pub violator_count: Option<i64>,
115}
116
117#[derive(Clone, Debug, Default, PartialEq, Serialize)]
118#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
119pub struct GetAdminAccountRequest {}
120
121#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
122#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
123pub struct GetAdminAccountResponse {
124 #[serde(rename = "AdminAccount")]
126 #[serde(skip_serializing_if = "Option::is_none")]
127 pub admin_account: Option<String>,
128 #[serde(rename = "RoleStatus")]
130 #[serde(skip_serializing_if = "Option::is_none")]
131 pub role_status: Option<String>,
132}
133
134#[derive(Clone, Debug, Default, PartialEq, Serialize)]
135#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
136pub struct GetComplianceDetailRequest {
137 #[serde(rename = "MemberAccount")]
139 pub member_account: String,
140 #[serde(rename = "PolicyId")]
142 pub policy_id: String,
143}
144
145#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
146#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
147pub struct GetComplianceDetailResponse {
148 #[serde(rename = "PolicyComplianceDetail")]
150 #[serde(skip_serializing_if = "Option::is_none")]
151 pub policy_compliance_detail: Option<PolicyComplianceDetail>,
152}
153
154#[derive(Clone, Debug, Default, PartialEq, Serialize)]
155#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
156pub struct GetNotificationChannelRequest {}
157
158#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
159#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
160pub struct GetNotificationChannelResponse {
161 #[serde(rename = "SnsRoleName")]
163 #[serde(skip_serializing_if = "Option::is_none")]
164 pub sns_role_name: Option<String>,
165 #[serde(rename = "SnsTopicArn")]
167 #[serde(skip_serializing_if = "Option::is_none")]
168 pub sns_topic_arn: Option<String>,
169}
170
171#[derive(Clone, Debug, Default, PartialEq, Serialize)]
172#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
173pub struct GetPolicyRequest {
174 #[serde(rename = "PolicyId")]
176 pub policy_id: String,
177}
178
179#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
180#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
181pub struct GetPolicyResponse {
182 #[serde(rename = "Policy")]
184 #[serde(skip_serializing_if = "Option::is_none")]
185 pub policy: Option<Policy>,
186 #[serde(rename = "PolicyArn")]
188 #[serde(skip_serializing_if = "Option::is_none")]
189 pub policy_arn: Option<String>,
190}
191
192#[derive(Clone, Debug, Default, PartialEq, Serialize)]
193#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
194pub struct GetProtectionStatusRequest {
195 #[serde(rename = "EndTime")]
197 #[serde(skip_serializing_if = "Option::is_none")]
198 pub end_time: Option<f64>,
199 #[serde(rename = "MaxResults")]
201 #[serde(skip_serializing_if = "Option::is_none")]
202 pub max_results: Option<i64>,
203 #[serde(rename = "MemberAccountId")]
205 #[serde(skip_serializing_if = "Option::is_none")]
206 pub member_account_id: Option<String>,
207 #[serde(rename = "NextToken")]
209 #[serde(skip_serializing_if = "Option::is_none")]
210 pub next_token: Option<String>,
211 #[serde(rename = "PolicyId")]
213 pub policy_id: String,
214 #[serde(rename = "StartTime")]
216 #[serde(skip_serializing_if = "Option::is_none")]
217 pub start_time: Option<f64>,
218}
219
220#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
221#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
222pub struct GetProtectionStatusResponse {
223 #[serde(rename = "AdminAccountId")]
225 #[serde(skip_serializing_if = "Option::is_none")]
226 pub admin_account_id: Option<String>,
227 #[serde(rename = "Data")]
229 #[serde(skip_serializing_if = "Option::is_none")]
230 pub data: Option<String>,
231 #[serde(rename = "NextToken")]
233 #[serde(skip_serializing_if = "Option::is_none")]
234 pub next_token: Option<String>,
235 #[serde(rename = "ServiceType")]
237 #[serde(skip_serializing_if = "Option::is_none")]
238 pub service_type: Option<String>,
239}
240
241#[derive(Clone, Debug, Default, PartialEq, Serialize)]
242#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
243pub struct ListComplianceStatusRequest {
244 #[serde(rename = "MaxResults")]
246 #[serde(skip_serializing_if = "Option::is_none")]
247 pub max_results: Option<i64>,
248 #[serde(rename = "NextToken")]
250 #[serde(skip_serializing_if = "Option::is_none")]
251 pub next_token: Option<String>,
252 #[serde(rename = "PolicyId")]
254 pub policy_id: String,
255}
256
257#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
258#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
259pub struct ListComplianceStatusResponse {
260 #[serde(rename = "NextToken")]
262 #[serde(skip_serializing_if = "Option::is_none")]
263 pub next_token: Option<String>,
264 #[serde(rename = "PolicyComplianceStatusList")]
266 #[serde(skip_serializing_if = "Option::is_none")]
267 pub policy_compliance_status_list: Option<Vec<PolicyComplianceStatus>>,
268}
269
270#[derive(Clone, Debug, Default, PartialEq, Serialize)]
271#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
272pub struct ListMemberAccountsRequest {
273 #[serde(rename = "MaxResults")]
275 #[serde(skip_serializing_if = "Option::is_none")]
276 pub max_results: Option<i64>,
277 #[serde(rename = "NextToken")]
279 #[serde(skip_serializing_if = "Option::is_none")]
280 pub next_token: Option<String>,
281}
282
283#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
284#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
285pub struct ListMemberAccountsResponse {
286 #[serde(rename = "MemberAccounts")]
288 #[serde(skip_serializing_if = "Option::is_none")]
289 pub member_accounts: Option<Vec<String>>,
290 #[serde(rename = "NextToken")]
292 #[serde(skip_serializing_if = "Option::is_none")]
293 pub next_token: Option<String>,
294}
295
296#[derive(Clone, Debug, Default, PartialEq, Serialize)]
297#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
298pub struct ListPoliciesRequest {
299 #[serde(rename = "MaxResults")]
301 #[serde(skip_serializing_if = "Option::is_none")]
302 pub max_results: Option<i64>,
303 #[serde(rename = "NextToken")]
305 #[serde(skip_serializing_if = "Option::is_none")]
306 pub next_token: Option<String>,
307}
308
309#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
310#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
311pub struct ListPoliciesResponse {
312 #[serde(rename = "NextToken")]
314 #[serde(skip_serializing_if = "Option::is_none")]
315 pub next_token: Option<String>,
316 #[serde(rename = "PolicyList")]
318 #[serde(skip_serializing_if = "Option::is_none")]
319 pub policy_list: Option<Vec<PolicySummary>>,
320}
321
322#[derive(Clone, Debug, Default, PartialEq, Serialize)]
323#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
324pub struct ListTagsForResourceRequest {
325 #[serde(rename = "ResourceArn")]
327 pub resource_arn: String,
328}
329
330#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
331#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
332pub struct ListTagsForResourceResponse {
333 #[serde(rename = "TagList")]
335 #[serde(skip_serializing_if = "Option::is_none")]
336 pub tag_list: Option<Vec<Tag>>,
337}
338
339#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
341pub struct Policy {
342 #[serde(rename = "ExcludeMap")]
344 #[serde(skip_serializing_if = "Option::is_none")]
345 pub exclude_map: Option<::std::collections::HashMap<String, Vec<String>>>,
346 #[serde(rename = "ExcludeResourceTags")]
348 pub exclude_resource_tags: bool,
349 #[serde(rename = "IncludeMap")]
351 #[serde(skip_serializing_if = "Option::is_none")]
352 pub include_map: Option<::std::collections::HashMap<String, Vec<String>>>,
353 #[serde(rename = "PolicyId")]
355 #[serde(skip_serializing_if = "Option::is_none")]
356 pub policy_id: Option<String>,
357 #[serde(rename = "PolicyName")]
359 pub policy_name: String,
360 #[serde(rename = "PolicyUpdateToken")]
362 #[serde(skip_serializing_if = "Option::is_none")]
363 pub policy_update_token: Option<String>,
364 #[serde(rename = "RemediationEnabled")]
366 pub remediation_enabled: bool,
367 #[serde(rename = "ResourceTags")]
369 #[serde(skip_serializing_if = "Option::is_none")]
370 pub resource_tags: Option<Vec<ResourceTag>>,
371 #[serde(rename = "ResourceType")]
373 pub resource_type: String,
374 #[serde(rename = "ResourceTypeList")]
376 #[serde(skip_serializing_if = "Option::is_none")]
377 pub resource_type_list: Option<Vec<String>>,
378 #[serde(rename = "SecurityServicePolicyData")]
380 pub security_service_policy_data: SecurityServicePolicyData,
381}
382
383#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
385#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
386pub struct PolicyComplianceDetail {
387 #[serde(rename = "EvaluationLimitExceeded")]
389 #[serde(skip_serializing_if = "Option::is_none")]
390 pub evaluation_limit_exceeded: Option<bool>,
391 #[serde(rename = "ExpiredAt")]
393 #[serde(skip_serializing_if = "Option::is_none")]
394 pub expired_at: Option<f64>,
395 #[serde(rename = "IssueInfoMap")]
397 #[serde(skip_serializing_if = "Option::is_none")]
398 pub issue_info_map: Option<::std::collections::HashMap<String, String>>,
399 #[serde(rename = "MemberAccount")]
401 #[serde(skip_serializing_if = "Option::is_none")]
402 pub member_account: Option<String>,
403 #[serde(rename = "PolicyId")]
405 #[serde(skip_serializing_if = "Option::is_none")]
406 pub policy_id: Option<String>,
407 #[serde(rename = "PolicyOwner")]
409 #[serde(skip_serializing_if = "Option::is_none")]
410 pub policy_owner: Option<String>,
411 #[serde(rename = "Violators")]
413 #[serde(skip_serializing_if = "Option::is_none")]
414 pub violators: Option<Vec<ComplianceViolator>>,
415}
416
417#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
419#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
420pub struct PolicyComplianceStatus {
421 #[serde(rename = "EvaluationResults")]
423 #[serde(skip_serializing_if = "Option::is_none")]
424 pub evaluation_results: Option<Vec<EvaluationResult>>,
425 #[serde(rename = "IssueInfoMap")]
427 #[serde(skip_serializing_if = "Option::is_none")]
428 pub issue_info_map: Option<::std::collections::HashMap<String, String>>,
429 #[serde(rename = "LastUpdated")]
431 #[serde(skip_serializing_if = "Option::is_none")]
432 pub last_updated: Option<f64>,
433 #[serde(rename = "MemberAccount")]
435 #[serde(skip_serializing_if = "Option::is_none")]
436 pub member_account: Option<String>,
437 #[serde(rename = "PolicyId")]
439 #[serde(skip_serializing_if = "Option::is_none")]
440 pub policy_id: Option<String>,
441 #[serde(rename = "PolicyName")]
443 #[serde(skip_serializing_if = "Option::is_none")]
444 pub policy_name: Option<String>,
445 #[serde(rename = "PolicyOwner")]
447 #[serde(skip_serializing_if = "Option::is_none")]
448 pub policy_owner: Option<String>,
449}
450
451#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
453#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
454pub struct PolicySummary {
455 #[serde(rename = "PolicyArn")]
457 #[serde(skip_serializing_if = "Option::is_none")]
458 pub policy_arn: Option<String>,
459 #[serde(rename = "PolicyId")]
461 #[serde(skip_serializing_if = "Option::is_none")]
462 pub policy_id: Option<String>,
463 #[serde(rename = "PolicyName")]
465 #[serde(skip_serializing_if = "Option::is_none")]
466 pub policy_name: Option<String>,
467 #[serde(rename = "RemediationEnabled")]
469 #[serde(skip_serializing_if = "Option::is_none")]
470 pub remediation_enabled: Option<bool>,
471 #[serde(rename = "ResourceType")]
473 #[serde(skip_serializing_if = "Option::is_none")]
474 pub resource_type: Option<String>,
475 #[serde(rename = "SecurityServiceType")]
477 #[serde(skip_serializing_if = "Option::is_none")]
478 pub security_service_type: Option<String>,
479}
480
481#[derive(Clone, Debug, Default, PartialEq, Serialize)]
482#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
483pub struct PutNotificationChannelRequest {
484 #[serde(rename = "SnsRoleName")]
486 pub sns_role_name: String,
487 #[serde(rename = "SnsTopicArn")]
489 pub sns_topic_arn: String,
490}
491
492#[derive(Clone, Debug, Default, PartialEq, Serialize)]
493#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
494pub struct PutPolicyRequest {
495 #[serde(rename = "Policy")]
497 pub policy: Policy,
498 #[serde(rename = "TagList")]
500 #[serde(skip_serializing_if = "Option::is_none")]
501 pub tag_list: Option<Vec<Tag>>,
502}
503
504#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
505#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
506pub struct PutPolicyResponse {
507 #[serde(rename = "Policy")]
509 #[serde(skip_serializing_if = "Option::is_none")]
510 pub policy: Option<Policy>,
511 #[serde(rename = "PolicyArn")]
513 #[serde(skip_serializing_if = "Option::is_none")]
514 pub policy_arn: Option<String>,
515}
516
517#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
519pub struct ResourceTag {
520 #[serde(rename = "Key")]
522 pub key: String,
523 #[serde(rename = "Value")]
525 #[serde(skip_serializing_if = "Option::is_none")]
526 pub value: Option<String>,
527}
528
529#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
531pub struct SecurityServicePolicyData {
532 #[serde(rename = "ManagedServiceData")]
534 #[serde(skip_serializing_if = "Option::is_none")]
535 pub managed_service_data: Option<String>,
536 #[serde(rename = "Type")]
538 pub type_: String,
539}
540
541#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
543pub struct Tag {
544 #[serde(rename = "Key")]
546 pub key: String,
547 #[serde(rename = "Value")]
549 pub value: String,
550}
551
552#[derive(Clone, Debug, Default, PartialEq, Serialize)]
553#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
554pub struct TagResourceRequest {
555 #[serde(rename = "ResourceArn")]
557 pub resource_arn: String,
558 #[serde(rename = "TagList")]
560 pub tag_list: Vec<Tag>,
561}
562
563#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
564#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
565pub struct TagResourceResponse {}
566
567#[derive(Clone, Debug, Default, PartialEq, Serialize)]
568#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
569pub struct UntagResourceRequest {
570 #[serde(rename = "ResourceArn")]
572 pub resource_arn: String,
573 #[serde(rename = "TagKeys")]
575 pub tag_keys: Vec<String>,
576}
577
578#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
579#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
580pub struct UntagResourceResponse {}
581
582#[derive(Debug, PartialEq)]
584pub enum AssociateAdminAccountError {
585 InternalError(String),
587 InvalidInput(String),
589 InvalidOperation(String),
591 ResourceNotFound(String),
593}
594
595impl AssociateAdminAccountError {
596 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AssociateAdminAccountError> {
597 if let Some(err) = proto::json::Error::parse(&res) {
598 match err.typ.as_str() {
599 "InternalErrorException" => {
600 return RusotoError::Service(AssociateAdminAccountError::InternalError(err.msg))
601 }
602 "InvalidInputException" => {
603 return RusotoError::Service(AssociateAdminAccountError::InvalidInput(err.msg))
604 }
605 "InvalidOperationException" => {
606 return RusotoError::Service(AssociateAdminAccountError::InvalidOperation(
607 err.msg,
608 ))
609 }
610 "ResourceNotFoundException" => {
611 return RusotoError::Service(AssociateAdminAccountError::ResourceNotFound(
612 err.msg,
613 ))
614 }
615 "ValidationException" => return RusotoError::Validation(err.msg),
616 _ => {}
617 }
618 }
619 RusotoError::Unknown(res)
620 }
621}
622impl fmt::Display for AssociateAdminAccountError {
623 #[allow(unused_variables)]
624 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
625 match *self {
626 AssociateAdminAccountError::InternalError(ref cause) => write!(f, "{}", cause),
627 AssociateAdminAccountError::InvalidInput(ref cause) => write!(f, "{}", cause),
628 AssociateAdminAccountError::InvalidOperation(ref cause) => write!(f, "{}", cause),
629 AssociateAdminAccountError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
630 }
631 }
632}
633impl Error for AssociateAdminAccountError {}
634#[derive(Debug, PartialEq)]
636pub enum DeleteNotificationChannelError {
637 InternalError(String),
639 InvalidOperation(String),
641 ResourceNotFound(String),
643}
644
645impl DeleteNotificationChannelError {
646 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteNotificationChannelError> {
647 if let Some(err) = proto::json::Error::parse(&res) {
648 match err.typ.as_str() {
649 "InternalErrorException" => {
650 return RusotoError::Service(DeleteNotificationChannelError::InternalError(
651 err.msg,
652 ))
653 }
654 "InvalidOperationException" => {
655 return RusotoError::Service(DeleteNotificationChannelError::InvalidOperation(
656 err.msg,
657 ))
658 }
659 "ResourceNotFoundException" => {
660 return RusotoError::Service(DeleteNotificationChannelError::ResourceNotFound(
661 err.msg,
662 ))
663 }
664 "ValidationException" => return RusotoError::Validation(err.msg),
665 _ => {}
666 }
667 }
668 RusotoError::Unknown(res)
669 }
670}
671impl fmt::Display for DeleteNotificationChannelError {
672 #[allow(unused_variables)]
673 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
674 match *self {
675 DeleteNotificationChannelError::InternalError(ref cause) => write!(f, "{}", cause),
676 DeleteNotificationChannelError::InvalidOperation(ref cause) => write!(f, "{}", cause),
677 DeleteNotificationChannelError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
678 }
679 }
680}
681impl Error for DeleteNotificationChannelError {}
682#[derive(Debug, PartialEq)]
684pub enum DeletePolicyError {
685 InternalError(String),
687 InvalidOperation(String),
689 ResourceNotFound(String),
691}
692
693impl DeletePolicyError {
694 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeletePolicyError> {
695 if let Some(err) = proto::json::Error::parse(&res) {
696 match err.typ.as_str() {
697 "InternalErrorException" => {
698 return RusotoError::Service(DeletePolicyError::InternalError(err.msg))
699 }
700 "InvalidOperationException" => {
701 return RusotoError::Service(DeletePolicyError::InvalidOperation(err.msg))
702 }
703 "ResourceNotFoundException" => {
704 return RusotoError::Service(DeletePolicyError::ResourceNotFound(err.msg))
705 }
706 "ValidationException" => return RusotoError::Validation(err.msg),
707 _ => {}
708 }
709 }
710 RusotoError::Unknown(res)
711 }
712}
713impl fmt::Display for DeletePolicyError {
714 #[allow(unused_variables)]
715 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
716 match *self {
717 DeletePolicyError::InternalError(ref cause) => write!(f, "{}", cause),
718 DeletePolicyError::InvalidOperation(ref cause) => write!(f, "{}", cause),
719 DeletePolicyError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
720 }
721 }
722}
723impl Error for DeletePolicyError {}
724#[derive(Debug, PartialEq)]
726pub enum DisassociateAdminAccountError {
727 InternalError(String),
729 InvalidOperation(String),
731 ResourceNotFound(String),
733}
734
735impl DisassociateAdminAccountError {
736 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DisassociateAdminAccountError> {
737 if let Some(err) = proto::json::Error::parse(&res) {
738 match err.typ.as_str() {
739 "InternalErrorException" => {
740 return RusotoError::Service(DisassociateAdminAccountError::InternalError(
741 err.msg,
742 ))
743 }
744 "InvalidOperationException" => {
745 return RusotoError::Service(DisassociateAdminAccountError::InvalidOperation(
746 err.msg,
747 ))
748 }
749 "ResourceNotFoundException" => {
750 return RusotoError::Service(DisassociateAdminAccountError::ResourceNotFound(
751 err.msg,
752 ))
753 }
754 "ValidationException" => return RusotoError::Validation(err.msg),
755 _ => {}
756 }
757 }
758 RusotoError::Unknown(res)
759 }
760}
761impl fmt::Display for DisassociateAdminAccountError {
762 #[allow(unused_variables)]
763 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
764 match *self {
765 DisassociateAdminAccountError::InternalError(ref cause) => write!(f, "{}", cause),
766 DisassociateAdminAccountError::InvalidOperation(ref cause) => write!(f, "{}", cause),
767 DisassociateAdminAccountError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
768 }
769 }
770}
771impl Error for DisassociateAdminAccountError {}
772#[derive(Debug, PartialEq)]
774pub enum GetAdminAccountError {
775 InternalError(String),
777 InvalidOperation(String),
779 ResourceNotFound(String),
781}
782
783impl GetAdminAccountError {
784 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetAdminAccountError> {
785 if let Some(err) = proto::json::Error::parse(&res) {
786 match err.typ.as_str() {
787 "InternalErrorException" => {
788 return RusotoError::Service(GetAdminAccountError::InternalError(err.msg))
789 }
790 "InvalidOperationException" => {
791 return RusotoError::Service(GetAdminAccountError::InvalidOperation(err.msg))
792 }
793 "ResourceNotFoundException" => {
794 return RusotoError::Service(GetAdminAccountError::ResourceNotFound(err.msg))
795 }
796 "ValidationException" => return RusotoError::Validation(err.msg),
797 _ => {}
798 }
799 }
800 RusotoError::Unknown(res)
801 }
802}
803impl fmt::Display for GetAdminAccountError {
804 #[allow(unused_variables)]
805 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
806 match *self {
807 GetAdminAccountError::InternalError(ref cause) => write!(f, "{}", cause),
808 GetAdminAccountError::InvalidOperation(ref cause) => write!(f, "{}", cause),
809 GetAdminAccountError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
810 }
811 }
812}
813impl Error for GetAdminAccountError {}
814#[derive(Debug, PartialEq)]
816pub enum GetComplianceDetailError {
817 InternalError(String),
819 ResourceNotFound(String),
821}
822
823impl GetComplianceDetailError {
824 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetComplianceDetailError> {
825 if let Some(err) = proto::json::Error::parse(&res) {
826 match err.typ.as_str() {
827 "InternalErrorException" => {
828 return RusotoError::Service(GetComplianceDetailError::InternalError(err.msg))
829 }
830 "ResourceNotFoundException" => {
831 return RusotoError::Service(GetComplianceDetailError::ResourceNotFound(
832 err.msg,
833 ))
834 }
835 "ValidationException" => return RusotoError::Validation(err.msg),
836 _ => {}
837 }
838 }
839 RusotoError::Unknown(res)
840 }
841}
842impl fmt::Display for GetComplianceDetailError {
843 #[allow(unused_variables)]
844 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
845 match *self {
846 GetComplianceDetailError::InternalError(ref cause) => write!(f, "{}", cause),
847 GetComplianceDetailError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
848 }
849 }
850}
851impl Error for GetComplianceDetailError {}
852#[derive(Debug, PartialEq)]
854pub enum GetNotificationChannelError {
855 InternalError(String),
857 InvalidOperation(String),
859 ResourceNotFound(String),
861}
862
863impl GetNotificationChannelError {
864 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetNotificationChannelError> {
865 if let Some(err) = proto::json::Error::parse(&res) {
866 match err.typ.as_str() {
867 "InternalErrorException" => {
868 return RusotoError::Service(GetNotificationChannelError::InternalError(
869 err.msg,
870 ))
871 }
872 "InvalidOperationException" => {
873 return RusotoError::Service(GetNotificationChannelError::InvalidOperation(
874 err.msg,
875 ))
876 }
877 "ResourceNotFoundException" => {
878 return RusotoError::Service(GetNotificationChannelError::ResourceNotFound(
879 err.msg,
880 ))
881 }
882 "ValidationException" => return RusotoError::Validation(err.msg),
883 _ => {}
884 }
885 }
886 RusotoError::Unknown(res)
887 }
888}
889impl fmt::Display for GetNotificationChannelError {
890 #[allow(unused_variables)]
891 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
892 match *self {
893 GetNotificationChannelError::InternalError(ref cause) => write!(f, "{}", cause),
894 GetNotificationChannelError::InvalidOperation(ref cause) => write!(f, "{}", cause),
895 GetNotificationChannelError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
896 }
897 }
898}
899impl Error for GetNotificationChannelError {}
900#[derive(Debug, PartialEq)]
902pub enum GetPolicyError {
903 InternalError(String),
905 InvalidOperation(String),
907 InvalidType(String),
909 ResourceNotFound(String),
911}
912
913impl GetPolicyError {
914 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetPolicyError> {
915 if let Some(err) = proto::json::Error::parse(&res) {
916 match err.typ.as_str() {
917 "InternalErrorException" => {
918 return RusotoError::Service(GetPolicyError::InternalError(err.msg))
919 }
920 "InvalidOperationException" => {
921 return RusotoError::Service(GetPolicyError::InvalidOperation(err.msg))
922 }
923 "InvalidTypeException" => {
924 return RusotoError::Service(GetPolicyError::InvalidType(err.msg))
925 }
926 "ResourceNotFoundException" => {
927 return RusotoError::Service(GetPolicyError::ResourceNotFound(err.msg))
928 }
929 "ValidationException" => return RusotoError::Validation(err.msg),
930 _ => {}
931 }
932 }
933 RusotoError::Unknown(res)
934 }
935}
936impl fmt::Display for GetPolicyError {
937 #[allow(unused_variables)]
938 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
939 match *self {
940 GetPolicyError::InternalError(ref cause) => write!(f, "{}", cause),
941 GetPolicyError::InvalidOperation(ref cause) => write!(f, "{}", cause),
942 GetPolicyError::InvalidType(ref cause) => write!(f, "{}", cause),
943 GetPolicyError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
944 }
945 }
946}
947impl Error for GetPolicyError {}
948#[derive(Debug, PartialEq)]
950pub enum GetProtectionStatusError {
951 InternalError(String),
953 InvalidInput(String),
955 ResourceNotFound(String),
957}
958
959impl GetProtectionStatusError {
960 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetProtectionStatusError> {
961 if let Some(err) = proto::json::Error::parse(&res) {
962 match err.typ.as_str() {
963 "InternalErrorException" => {
964 return RusotoError::Service(GetProtectionStatusError::InternalError(err.msg))
965 }
966 "InvalidInputException" => {
967 return RusotoError::Service(GetProtectionStatusError::InvalidInput(err.msg))
968 }
969 "ResourceNotFoundException" => {
970 return RusotoError::Service(GetProtectionStatusError::ResourceNotFound(
971 err.msg,
972 ))
973 }
974 "ValidationException" => return RusotoError::Validation(err.msg),
975 _ => {}
976 }
977 }
978 RusotoError::Unknown(res)
979 }
980}
981impl fmt::Display for GetProtectionStatusError {
982 #[allow(unused_variables)]
983 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
984 match *self {
985 GetProtectionStatusError::InternalError(ref cause) => write!(f, "{}", cause),
986 GetProtectionStatusError::InvalidInput(ref cause) => write!(f, "{}", cause),
987 GetProtectionStatusError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
988 }
989 }
990}
991impl Error for GetProtectionStatusError {}
992#[derive(Debug, PartialEq)]
994pub enum ListComplianceStatusError {
995 InternalError(String),
997 ResourceNotFound(String),
999}
1000
1001impl ListComplianceStatusError {
1002 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListComplianceStatusError> {
1003 if let Some(err) = proto::json::Error::parse(&res) {
1004 match err.typ.as_str() {
1005 "InternalErrorException" => {
1006 return RusotoError::Service(ListComplianceStatusError::InternalError(err.msg))
1007 }
1008 "ResourceNotFoundException" => {
1009 return RusotoError::Service(ListComplianceStatusError::ResourceNotFound(
1010 err.msg,
1011 ))
1012 }
1013 "ValidationException" => return RusotoError::Validation(err.msg),
1014 _ => {}
1015 }
1016 }
1017 RusotoError::Unknown(res)
1018 }
1019}
1020impl fmt::Display for ListComplianceStatusError {
1021 #[allow(unused_variables)]
1022 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1023 match *self {
1024 ListComplianceStatusError::InternalError(ref cause) => write!(f, "{}", cause),
1025 ListComplianceStatusError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1026 }
1027 }
1028}
1029impl Error for ListComplianceStatusError {}
1030#[derive(Debug, PartialEq)]
1032pub enum ListMemberAccountsError {
1033 InternalError(String),
1035 ResourceNotFound(String),
1037}
1038
1039impl ListMemberAccountsError {
1040 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListMemberAccountsError> {
1041 if let Some(err) = proto::json::Error::parse(&res) {
1042 match err.typ.as_str() {
1043 "InternalErrorException" => {
1044 return RusotoError::Service(ListMemberAccountsError::InternalError(err.msg))
1045 }
1046 "ResourceNotFoundException" => {
1047 return RusotoError::Service(ListMemberAccountsError::ResourceNotFound(err.msg))
1048 }
1049 "ValidationException" => return RusotoError::Validation(err.msg),
1050 _ => {}
1051 }
1052 }
1053 RusotoError::Unknown(res)
1054 }
1055}
1056impl fmt::Display for ListMemberAccountsError {
1057 #[allow(unused_variables)]
1058 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1059 match *self {
1060 ListMemberAccountsError::InternalError(ref cause) => write!(f, "{}", cause),
1061 ListMemberAccountsError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1062 }
1063 }
1064}
1065impl Error for ListMemberAccountsError {}
1066#[derive(Debug, PartialEq)]
1068pub enum ListPoliciesError {
1069 InternalError(String),
1071 InvalidOperation(String),
1073 LimitExceeded(String),
1075 ResourceNotFound(String),
1077}
1078
1079impl ListPoliciesError {
1080 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListPoliciesError> {
1081 if let Some(err) = proto::json::Error::parse(&res) {
1082 match err.typ.as_str() {
1083 "InternalErrorException" => {
1084 return RusotoError::Service(ListPoliciesError::InternalError(err.msg))
1085 }
1086 "InvalidOperationException" => {
1087 return RusotoError::Service(ListPoliciesError::InvalidOperation(err.msg))
1088 }
1089 "LimitExceededException" => {
1090 return RusotoError::Service(ListPoliciesError::LimitExceeded(err.msg))
1091 }
1092 "ResourceNotFoundException" => {
1093 return RusotoError::Service(ListPoliciesError::ResourceNotFound(err.msg))
1094 }
1095 "ValidationException" => return RusotoError::Validation(err.msg),
1096 _ => {}
1097 }
1098 }
1099 RusotoError::Unknown(res)
1100 }
1101}
1102impl fmt::Display for ListPoliciesError {
1103 #[allow(unused_variables)]
1104 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1105 match *self {
1106 ListPoliciesError::InternalError(ref cause) => write!(f, "{}", cause),
1107 ListPoliciesError::InvalidOperation(ref cause) => write!(f, "{}", cause),
1108 ListPoliciesError::LimitExceeded(ref cause) => write!(f, "{}", cause),
1109 ListPoliciesError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1110 }
1111 }
1112}
1113impl Error for ListPoliciesError {}
1114#[derive(Debug, PartialEq)]
1116pub enum ListTagsForResourceError {
1117 InternalError(String),
1119 InvalidInput(String),
1121 InvalidOperation(String),
1123 ResourceNotFound(String),
1125}
1126
1127impl ListTagsForResourceError {
1128 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
1129 if let Some(err) = proto::json::Error::parse(&res) {
1130 match err.typ.as_str() {
1131 "InternalErrorException" => {
1132 return RusotoError::Service(ListTagsForResourceError::InternalError(err.msg))
1133 }
1134 "InvalidInputException" => {
1135 return RusotoError::Service(ListTagsForResourceError::InvalidInput(err.msg))
1136 }
1137 "InvalidOperationException" => {
1138 return RusotoError::Service(ListTagsForResourceError::InvalidOperation(
1139 err.msg,
1140 ))
1141 }
1142 "ResourceNotFoundException" => {
1143 return RusotoError::Service(ListTagsForResourceError::ResourceNotFound(
1144 err.msg,
1145 ))
1146 }
1147 "ValidationException" => return RusotoError::Validation(err.msg),
1148 _ => {}
1149 }
1150 }
1151 RusotoError::Unknown(res)
1152 }
1153}
1154impl fmt::Display for ListTagsForResourceError {
1155 #[allow(unused_variables)]
1156 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1157 match *self {
1158 ListTagsForResourceError::InternalError(ref cause) => write!(f, "{}", cause),
1159 ListTagsForResourceError::InvalidInput(ref cause) => write!(f, "{}", cause),
1160 ListTagsForResourceError::InvalidOperation(ref cause) => write!(f, "{}", cause),
1161 ListTagsForResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1162 }
1163 }
1164}
1165impl Error for ListTagsForResourceError {}
1166#[derive(Debug, PartialEq)]
1168pub enum PutNotificationChannelError {
1169 InternalError(String),
1171 InvalidOperation(String),
1173 ResourceNotFound(String),
1175}
1176
1177impl PutNotificationChannelError {
1178 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutNotificationChannelError> {
1179 if let Some(err) = proto::json::Error::parse(&res) {
1180 match err.typ.as_str() {
1181 "InternalErrorException" => {
1182 return RusotoError::Service(PutNotificationChannelError::InternalError(
1183 err.msg,
1184 ))
1185 }
1186 "InvalidOperationException" => {
1187 return RusotoError::Service(PutNotificationChannelError::InvalidOperation(
1188 err.msg,
1189 ))
1190 }
1191 "ResourceNotFoundException" => {
1192 return RusotoError::Service(PutNotificationChannelError::ResourceNotFound(
1193 err.msg,
1194 ))
1195 }
1196 "ValidationException" => return RusotoError::Validation(err.msg),
1197 _ => {}
1198 }
1199 }
1200 RusotoError::Unknown(res)
1201 }
1202}
1203impl fmt::Display for PutNotificationChannelError {
1204 #[allow(unused_variables)]
1205 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1206 match *self {
1207 PutNotificationChannelError::InternalError(ref cause) => write!(f, "{}", cause),
1208 PutNotificationChannelError::InvalidOperation(ref cause) => write!(f, "{}", cause),
1209 PutNotificationChannelError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1210 }
1211 }
1212}
1213impl Error for PutNotificationChannelError {}
1214#[derive(Debug, PartialEq)]
1216pub enum PutPolicyError {
1217 InternalError(String),
1219 InvalidInput(String),
1221 InvalidOperation(String),
1223 InvalidType(String),
1225 LimitExceeded(String),
1227 ResourceNotFound(String),
1229}
1230
1231impl PutPolicyError {
1232 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutPolicyError> {
1233 if let Some(err) = proto::json::Error::parse(&res) {
1234 match err.typ.as_str() {
1235 "InternalErrorException" => {
1236 return RusotoError::Service(PutPolicyError::InternalError(err.msg))
1237 }
1238 "InvalidInputException" => {
1239 return RusotoError::Service(PutPolicyError::InvalidInput(err.msg))
1240 }
1241 "InvalidOperationException" => {
1242 return RusotoError::Service(PutPolicyError::InvalidOperation(err.msg))
1243 }
1244 "InvalidTypeException" => {
1245 return RusotoError::Service(PutPolicyError::InvalidType(err.msg))
1246 }
1247 "LimitExceededException" => {
1248 return RusotoError::Service(PutPolicyError::LimitExceeded(err.msg))
1249 }
1250 "ResourceNotFoundException" => {
1251 return RusotoError::Service(PutPolicyError::ResourceNotFound(err.msg))
1252 }
1253 "ValidationException" => return RusotoError::Validation(err.msg),
1254 _ => {}
1255 }
1256 }
1257 RusotoError::Unknown(res)
1258 }
1259}
1260impl fmt::Display for PutPolicyError {
1261 #[allow(unused_variables)]
1262 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1263 match *self {
1264 PutPolicyError::InternalError(ref cause) => write!(f, "{}", cause),
1265 PutPolicyError::InvalidInput(ref cause) => write!(f, "{}", cause),
1266 PutPolicyError::InvalidOperation(ref cause) => write!(f, "{}", cause),
1267 PutPolicyError::InvalidType(ref cause) => write!(f, "{}", cause),
1268 PutPolicyError::LimitExceeded(ref cause) => write!(f, "{}", cause),
1269 PutPolicyError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1270 }
1271 }
1272}
1273impl Error for PutPolicyError {}
1274#[derive(Debug, PartialEq)]
1276pub enum TagResourceError {
1277 InternalError(String),
1279 InvalidInput(String),
1281 InvalidOperation(String),
1283 LimitExceeded(String),
1285 ResourceNotFound(String),
1287}
1288
1289impl TagResourceError {
1290 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
1291 if let Some(err) = proto::json::Error::parse(&res) {
1292 match err.typ.as_str() {
1293 "InternalErrorException" => {
1294 return RusotoError::Service(TagResourceError::InternalError(err.msg))
1295 }
1296 "InvalidInputException" => {
1297 return RusotoError::Service(TagResourceError::InvalidInput(err.msg))
1298 }
1299 "InvalidOperationException" => {
1300 return RusotoError::Service(TagResourceError::InvalidOperation(err.msg))
1301 }
1302 "LimitExceededException" => {
1303 return RusotoError::Service(TagResourceError::LimitExceeded(err.msg))
1304 }
1305 "ResourceNotFoundException" => {
1306 return RusotoError::Service(TagResourceError::ResourceNotFound(err.msg))
1307 }
1308 "ValidationException" => return RusotoError::Validation(err.msg),
1309 _ => {}
1310 }
1311 }
1312 RusotoError::Unknown(res)
1313 }
1314}
1315impl fmt::Display for TagResourceError {
1316 #[allow(unused_variables)]
1317 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1318 match *self {
1319 TagResourceError::InternalError(ref cause) => write!(f, "{}", cause),
1320 TagResourceError::InvalidInput(ref cause) => write!(f, "{}", cause),
1321 TagResourceError::InvalidOperation(ref cause) => write!(f, "{}", cause),
1322 TagResourceError::LimitExceeded(ref cause) => write!(f, "{}", cause),
1323 TagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1324 }
1325 }
1326}
1327impl Error for TagResourceError {}
1328#[derive(Debug, PartialEq)]
1330pub enum UntagResourceError {
1331 InternalError(String),
1333 InvalidInput(String),
1335 InvalidOperation(String),
1337 ResourceNotFound(String),
1339}
1340
1341impl UntagResourceError {
1342 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
1343 if let Some(err) = proto::json::Error::parse(&res) {
1344 match err.typ.as_str() {
1345 "InternalErrorException" => {
1346 return RusotoError::Service(UntagResourceError::InternalError(err.msg))
1347 }
1348 "InvalidInputException" => {
1349 return RusotoError::Service(UntagResourceError::InvalidInput(err.msg))
1350 }
1351 "InvalidOperationException" => {
1352 return RusotoError::Service(UntagResourceError::InvalidOperation(err.msg))
1353 }
1354 "ResourceNotFoundException" => {
1355 return RusotoError::Service(UntagResourceError::ResourceNotFound(err.msg))
1356 }
1357 "ValidationException" => return RusotoError::Validation(err.msg),
1358 _ => {}
1359 }
1360 }
1361 RusotoError::Unknown(res)
1362 }
1363}
1364impl fmt::Display for UntagResourceError {
1365 #[allow(unused_variables)]
1366 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1367 match *self {
1368 UntagResourceError::InternalError(ref cause) => write!(f, "{}", cause),
1369 UntagResourceError::InvalidInput(ref cause) => write!(f, "{}", cause),
1370 UntagResourceError::InvalidOperation(ref cause) => write!(f, "{}", cause),
1371 UntagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
1372 }
1373 }
1374}
1375impl Error for UntagResourceError {}
1376#[async_trait]
1378pub trait Fms {
1379 async fn associate_admin_account(
1381 &self,
1382 input: AssociateAdminAccountRequest,
1383 ) -> Result<(), RusotoError<AssociateAdminAccountError>>;
1384
1385 async fn delete_notification_channel(
1387 &self,
1388 ) -> Result<(), RusotoError<DeleteNotificationChannelError>>;
1389
1390 async fn delete_policy(
1392 &self,
1393 input: DeletePolicyRequest,
1394 ) -> Result<(), RusotoError<DeletePolicyError>>;
1395
1396 async fn disassociate_admin_account(
1398 &self,
1399 ) -> Result<(), RusotoError<DisassociateAdminAccountError>>;
1400
1401 async fn get_admin_account(
1403 &self,
1404 ) -> Result<GetAdminAccountResponse, RusotoError<GetAdminAccountError>>;
1405
1406 async fn get_compliance_detail(
1408 &self,
1409 input: GetComplianceDetailRequest,
1410 ) -> Result<GetComplianceDetailResponse, RusotoError<GetComplianceDetailError>>;
1411
1412 async fn get_notification_channel(
1414 &self,
1415 ) -> Result<GetNotificationChannelResponse, RusotoError<GetNotificationChannelError>>;
1416
1417 async fn get_policy(
1419 &self,
1420 input: GetPolicyRequest,
1421 ) -> Result<GetPolicyResponse, RusotoError<GetPolicyError>>;
1422
1423 async fn get_protection_status(
1425 &self,
1426 input: GetProtectionStatusRequest,
1427 ) -> Result<GetProtectionStatusResponse, RusotoError<GetProtectionStatusError>>;
1428
1429 async fn list_compliance_status(
1431 &self,
1432 input: ListComplianceStatusRequest,
1433 ) -> Result<ListComplianceStatusResponse, RusotoError<ListComplianceStatusError>>;
1434
1435 async fn list_member_accounts(
1437 &self,
1438 input: ListMemberAccountsRequest,
1439 ) -> Result<ListMemberAccountsResponse, RusotoError<ListMemberAccountsError>>;
1440
1441 async fn list_policies(
1443 &self,
1444 input: ListPoliciesRequest,
1445 ) -> Result<ListPoliciesResponse, RusotoError<ListPoliciesError>>;
1446
1447 async fn list_tags_for_resource(
1449 &self,
1450 input: ListTagsForResourceRequest,
1451 ) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>>;
1452
1453 async fn put_notification_channel(
1455 &self,
1456 input: PutNotificationChannelRequest,
1457 ) -> Result<(), RusotoError<PutNotificationChannelError>>;
1458
1459 async fn put_policy(
1461 &self,
1462 input: PutPolicyRequest,
1463 ) -> Result<PutPolicyResponse, RusotoError<PutPolicyError>>;
1464
1465 async fn tag_resource(
1467 &self,
1468 input: TagResourceRequest,
1469 ) -> Result<TagResourceResponse, RusotoError<TagResourceError>>;
1470
1471 async fn untag_resource(
1473 &self,
1474 input: UntagResourceRequest,
1475 ) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>>;
1476}
1477#[derive(Clone)]
1479pub struct FmsClient {
1480 client: Client,
1481 region: region::Region,
1482}
1483
1484impl FmsClient {
1485 pub fn new(region: region::Region) -> FmsClient {
1489 FmsClient {
1490 client: Client::shared(),
1491 region,
1492 }
1493 }
1494
1495 pub fn new_with<P, D>(
1496 request_dispatcher: D,
1497 credentials_provider: P,
1498 region: region::Region,
1499 ) -> FmsClient
1500 where
1501 P: ProvideAwsCredentials + Send + Sync + 'static,
1502 D: DispatchSignedRequest + Send + Sync + 'static,
1503 {
1504 FmsClient {
1505 client: Client::new_with(credentials_provider, request_dispatcher),
1506 region,
1507 }
1508 }
1509
1510 pub fn new_with_client(client: Client, region: region::Region) -> FmsClient {
1511 FmsClient { client, region }
1512 }
1513}
1514
1515#[async_trait]
1516impl Fms for FmsClient {
1517 async fn associate_admin_account(
1519 &self,
1520 input: AssociateAdminAccountRequest,
1521 ) -> Result<(), RusotoError<AssociateAdminAccountError>> {
1522 let mut request = self.new_signed_request("POST", "/");
1523 request.add_header("x-amz-target", "AWSFMS_20180101.AssociateAdminAccount");
1524 let encoded = serde_json::to_string(&input).unwrap();
1525 request.set_payload(Some(encoded));
1526
1527 let response = self
1528 .sign_and_dispatch(request, AssociateAdminAccountError::from_response)
1529 .await?;
1530 std::mem::drop(response);
1531 Ok(())
1532 }
1533
1534 async fn delete_notification_channel(
1536 &self,
1537 ) -> Result<(), RusotoError<DeleteNotificationChannelError>> {
1538 let mut request = self.new_signed_request("POST", "/");
1539 request.add_header("x-amz-target", "AWSFMS_20180101.DeleteNotificationChannel");
1540 request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
1541
1542 let response = self
1543 .sign_and_dispatch(request, DeleteNotificationChannelError::from_response)
1544 .await?;
1545 std::mem::drop(response);
1546 Ok(())
1547 }
1548
1549 async fn delete_policy(
1551 &self,
1552 input: DeletePolicyRequest,
1553 ) -> Result<(), RusotoError<DeletePolicyError>> {
1554 let mut request = self.new_signed_request("POST", "/");
1555 request.add_header("x-amz-target", "AWSFMS_20180101.DeletePolicy");
1556 let encoded = serde_json::to_string(&input).unwrap();
1557 request.set_payload(Some(encoded));
1558
1559 let response = self
1560 .sign_and_dispatch(request, DeletePolicyError::from_response)
1561 .await?;
1562 std::mem::drop(response);
1563 Ok(())
1564 }
1565
1566 async fn disassociate_admin_account(
1568 &self,
1569 ) -> Result<(), RusotoError<DisassociateAdminAccountError>> {
1570 let mut request = self.new_signed_request("POST", "/");
1571 request.add_header("x-amz-target", "AWSFMS_20180101.DisassociateAdminAccount");
1572 request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
1573
1574 let response = self
1575 .sign_and_dispatch(request, DisassociateAdminAccountError::from_response)
1576 .await?;
1577 std::mem::drop(response);
1578 Ok(())
1579 }
1580
1581 async fn get_admin_account(
1583 &self,
1584 ) -> Result<GetAdminAccountResponse, RusotoError<GetAdminAccountError>> {
1585 let mut request = self.new_signed_request("POST", "/");
1586 request.add_header("x-amz-target", "AWSFMS_20180101.GetAdminAccount");
1587 request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
1588
1589 let response = self
1590 .sign_and_dispatch(request, GetAdminAccountError::from_response)
1591 .await?;
1592 let mut response = response;
1593 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1594 proto::json::ResponsePayload::new(&response).deserialize::<GetAdminAccountResponse, _>()
1595 }
1596
1597 async fn get_compliance_detail(
1599 &self,
1600 input: GetComplianceDetailRequest,
1601 ) -> Result<GetComplianceDetailResponse, RusotoError<GetComplianceDetailError>> {
1602 let mut request = self.new_signed_request("POST", "/");
1603 request.add_header("x-amz-target", "AWSFMS_20180101.GetComplianceDetail");
1604 let encoded = serde_json::to_string(&input).unwrap();
1605 request.set_payload(Some(encoded));
1606
1607 let response = self
1608 .sign_and_dispatch(request, GetComplianceDetailError::from_response)
1609 .await?;
1610 let mut response = response;
1611 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1612 proto::json::ResponsePayload::new(&response).deserialize::<GetComplianceDetailResponse, _>()
1613 }
1614
1615 async fn get_notification_channel(
1617 &self,
1618 ) -> Result<GetNotificationChannelResponse, RusotoError<GetNotificationChannelError>> {
1619 let mut request = self.new_signed_request("POST", "/");
1620 request.add_header("x-amz-target", "AWSFMS_20180101.GetNotificationChannel");
1621 request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
1622
1623 let response = self
1624 .sign_and_dispatch(request, GetNotificationChannelError::from_response)
1625 .await?;
1626 let mut response = response;
1627 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1628 proto::json::ResponsePayload::new(&response)
1629 .deserialize::<GetNotificationChannelResponse, _>()
1630 }
1631
1632 async fn get_policy(
1634 &self,
1635 input: GetPolicyRequest,
1636 ) -> Result<GetPolicyResponse, RusotoError<GetPolicyError>> {
1637 let mut request = self.new_signed_request("POST", "/");
1638 request.add_header("x-amz-target", "AWSFMS_20180101.GetPolicy");
1639 let encoded = serde_json::to_string(&input).unwrap();
1640 request.set_payload(Some(encoded));
1641
1642 let response = self
1643 .sign_and_dispatch(request, GetPolicyError::from_response)
1644 .await?;
1645 let mut response = response;
1646 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1647 proto::json::ResponsePayload::new(&response).deserialize::<GetPolicyResponse, _>()
1648 }
1649
1650 async fn get_protection_status(
1652 &self,
1653 input: GetProtectionStatusRequest,
1654 ) -> Result<GetProtectionStatusResponse, RusotoError<GetProtectionStatusError>> {
1655 let mut request = self.new_signed_request("POST", "/");
1656 request.add_header("x-amz-target", "AWSFMS_20180101.GetProtectionStatus");
1657 let encoded = serde_json::to_string(&input).unwrap();
1658 request.set_payload(Some(encoded));
1659
1660 let response = self
1661 .sign_and_dispatch(request, GetProtectionStatusError::from_response)
1662 .await?;
1663 let mut response = response;
1664 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1665 proto::json::ResponsePayload::new(&response).deserialize::<GetProtectionStatusResponse, _>()
1666 }
1667
1668 async fn list_compliance_status(
1670 &self,
1671 input: ListComplianceStatusRequest,
1672 ) -> Result<ListComplianceStatusResponse, RusotoError<ListComplianceStatusError>> {
1673 let mut request = self.new_signed_request("POST", "/");
1674 request.add_header("x-amz-target", "AWSFMS_20180101.ListComplianceStatus");
1675 let encoded = serde_json::to_string(&input).unwrap();
1676 request.set_payload(Some(encoded));
1677
1678 let response = self
1679 .sign_and_dispatch(request, ListComplianceStatusError::from_response)
1680 .await?;
1681 let mut response = response;
1682 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1683 proto::json::ResponsePayload::new(&response)
1684 .deserialize::<ListComplianceStatusResponse, _>()
1685 }
1686
1687 async fn list_member_accounts(
1689 &self,
1690 input: ListMemberAccountsRequest,
1691 ) -> Result<ListMemberAccountsResponse, RusotoError<ListMemberAccountsError>> {
1692 let mut request = self.new_signed_request("POST", "/");
1693 request.add_header("x-amz-target", "AWSFMS_20180101.ListMemberAccounts");
1694 let encoded = serde_json::to_string(&input).unwrap();
1695 request.set_payload(Some(encoded));
1696
1697 let response = self
1698 .sign_and_dispatch(request, ListMemberAccountsError::from_response)
1699 .await?;
1700 let mut response = response;
1701 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1702 proto::json::ResponsePayload::new(&response).deserialize::<ListMemberAccountsResponse, _>()
1703 }
1704
1705 async fn list_policies(
1707 &self,
1708 input: ListPoliciesRequest,
1709 ) -> Result<ListPoliciesResponse, RusotoError<ListPoliciesError>> {
1710 let mut request = self.new_signed_request("POST", "/");
1711 request.add_header("x-amz-target", "AWSFMS_20180101.ListPolicies");
1712 let encoded = serde_json::to_string(&input).unwrap();
1713 request.set_payload(Some(encoded));
1714
1715 let response = self
1716 .sign_and_dispatch(request, ListPoliciesError::from_response)
1717 .await?;
1718 let mut response = response;
1719 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1720 proto::json::ResponsePayload::new(&response).deserialize::<ListPoliciesResponse, _>()
1721 }
1722
1723 async fn list_tags_for_resource(
1725 &self,
1726 input: ListTagsForResourceRequest,
1727 ) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>> {
1728 let mut request = self.new_signed_request("POST", "/");
1729 request.add_header("x-amz-target", "AWSFMS_20180101.ListTagsForResource");
1730 let encoded = serde_json::to_string(&input).unwrap();
1731 request.set_payload(Some(encoded));
1732
1733 let response = self
1734 .sign_and_dispatch(request, ListTagsForResourceError::from_response)
1735 .await?;
1736 let mut response = response;
1737 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1738 proto::json::ResponsePayload::new(&response).deserialize::<ListTagsForResourceResponse, _>()
1739 }
1740
1741 async fn put_notification_channel(
1743 &self,
1744 input: PutNotificationChannelRequest,
1745 ) -> Result<(), RusotoError<PutNotificationChannelError>> {
1746 let mut request = self.new_signed_request("POST", "/");
1747 request.add_header("x-amz-target", "AWSFMS_20180101.PutNotificationChannel");
1748 let encoded = serde_json::to_string(&input).unwrap();
1749 request.set_payload(Some(encoded));
1750
1751 let response = self
1752 .sign_and_dispatch(request, PutNotificationChannelError::from_response)
1753 .await?;
1754 std::mem::drop(response);
1755 Ok(())
1756 }
1757
1758 async fn put_policy(
1760 &self,
1761 input: PutPolicyRequest,
1762 ) -> Result<PutPolicyResponse, RusotoError<PutPolicyError>> {
1763 let mut request = self.new_signed_request("POST", "/");
1764 request.add_header("x-amz-target", "AWSFMS_20180101.PutPolicy");
1765 let encoded = serde_json::to_string(&input).unwrap();
1766 request.set_payload(Some(encoded));
1767
1768 let response = self
1769 .sign_and_dispatch(request, PutPolicyError::from_response)
1770 .await?;
1771 let mut response = response;
1772 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1773 proto::json::ResponsePayload::new(&response).deserialize::<PutPolicyResponse, _>()
1774 }
1775
1776 async fn tag_resource(
1778 &self,
1779 input: TagResourceRequest,
1780 ) -> Result<TagResourceResponse, RusotoError<TagResourceError>> {
1781 let mut request = self.new_signed_request("POST", "/");
1782 request.add_header("x-amz-target", "AWSFMS_20180101.TagResource");
1783 let encoded = serde_json::to_string(&input).unwrap();
1784 request.set_payload(Some(encoded));
1785
1786 let response = self
1787 .sign_and_dispatch(request, TagResourceError::from_response)
1788 .await?;
1789 let mut response = response;
1790 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1791 proto::json::ResponsePayload::new(&response).deserialize::<TagResourceResponse, _>()
1792 }
1793
1794 async fn untag_resource(
1796 &self,
1797 input: UntagResourceRequest,
1798 ) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>> {
1799 let mut request = self.new_signed_request("POST", "/");
1800 request.add_header("x-amz-target", "AWSFMS_20180101.UntagResource");
1801 let encoded = serde_json::to_string(&input).unwrap();
1802 request.set_payload(Some(encoded));
1803
1804 let response = self
1805 .sign_and_dispatch(request, UntagResourceError::from_response)
1806 .await?;
1807 let mut response = response;
1808 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1809 proto::json::ResponsePayload::new(&response).deserialize::<UntagResourceResponse, _>()
1810 }
1811}