aws_sdk_inspector2/operation/enable/
_enable_output.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct EnableOutput {
6 pub accounts: ::std::vec::Vec<crate::types::Account>,
8 pub failed_accounts: ::std::option::Option<::std::vec::Vec<crate::types::FailedAccount>>,
10 _request_id: Option<String>,
11}
12impl EnableOutput {
13 pub fn accounts(&self) -> &[crate::types::Account] {
15 use std::ops::Deref;
16 self.accounts.deref()
17 }
18 pub fn failed_accounts(&self) -> &[crate::types::FailedAccount] {
22 self.failed_accounts.as_deref().unwrap_or_default()
23 }
24}
25impl ::aws_types::request_id::RequestId for EnableOutput {
26 fn request_id(&self) -> Option<&str> {
27 self._request_id.as_deref()
28 }
29}
30impl EnableOutput {
31 pub fn builder() -> crate::operation::enable::builders::EnableOutputBuilder {
33 crate::operation::enable::builders::EnableOutputBuilder::default()
34 }
35}
36
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct EnableOutputBuilder {
41 pub(crate) accounts: ::std::option::Option<::std::vec::Vec<crate::types::Account>>,
42 pub(crate) failed_accounts: ::std::option::Option<::std::vec::Vec<crate::types::FailedAccount>>,
43 _request_id: Option<String>,
44}
45impl EnableOutputBuilder {
46 pub fn accounts(mut self, input: crate::types::Account) -> Self {
52 let mut v = self.accounts.unwrap_or_default();
53 v.push(input);
54 self.accounts = ::std::option::Option::Some(v);
55 self
56 }
57 pub fn set_accounts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Account>>) -> Self {
59 self.accounts = input;
60 self
61 }
62 pub fn get_accounts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Account>> {
64 &self.accounts
65 }
66 pub fn failed_accounts(mut self, input: crate::types::FailedAccount) -> Self {
72 let mut v = self.failed_accounts.unwrap_or_default();
73 v.push(input);
74 self.failed_accounts = ::std::option::Option::Some(v);
75 self
76 }
77 pub fn set_failed_accounts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FailedAccount>>) -> Self {
79 self.failed_accounts = input;
80 self
81 }
82 pub fn get_failed_accounts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FailedAccount>> {
84 &self.failed_accounts
85 }
86 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
87 self._request_id = Some(request_id.into());
88 self
89 }
90
91 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
92 self._request_id = request_id;
93 self
94 }
95 pub fn build(self) -> ::std::result::Result<crate::operation::enable::EnableOutput, ::aws_smithy_types::error::operation::BuildError> {
99 ::std::result::Result::Ok(crate::operation::enable::EnableOutput {
100 accounts: self.accounts.ok_or_else(|| {
101 ::aws_smithy_types::error::operation::BuildError::missing_field(
102 "accounts",
103 "accounts was not specified but it is required when building EnableOutput",
104 )
105 })?,
106 failed_accounts: self.failed_accounts,
107 _request_id: self._request_id,
108 })
109 }
110}