aws_sdk_inspector2/operation/enable/
_enable_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct EnableOutput {
6    /// <p>Information on the accounts that have had Amazon Inspector scans successfully enabled. Details are provided for each account.</p>
7    pub accounts: ::std::vec::Vec<crate::types::Account>,
8    /// <p>Information on any accounts for which Amazon Inspector scans could not be enabled. Details are provided for each account.</p>
9    pub failed_accounts: ::std::option::Option<::std::vec::Vec<crate::types::FailedAccount>>,
10    _request_id: Option<String>,
11}
12impl EnableOutput {
13    /// <p>Information on the accounts that have had Amazon Inspector scans successfully enabled. Details are provided for each account.</p>
14    pub fn accounts(&self) -> &[crate::types::Account] {
15        use std::ops::Deref;
16        self.accounts.deref()
17    }
18    /// <p>Information on any accounts for which Amazon Inspector scans could not be enabled. Details are provided for each account.</p>
19    ///
20    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.failed_accounts.is_none()`.
21    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    /// Creates a new builder-style object to manufacture [`EnableOutput`](crate::operation::enable::EnableOutput).
32    pub fn builder() -> crate::operation::enable::builders::EnableOutputBuilder {
33        crate::operation::enable::builders::EnableOutputBuilder::default()
34    }
35}
36
37/// A builder for [`EnableOutput`](crate::operation::enable::EnableOutput).
38#[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    /// Appends an item to `accounts`.
47    ///
48    /// To override the contents of this collection use [`set_accounts`](Self::set_accounts).
49    ///
50    /// <p>Information on the accounts that have had Amazon Inspector scans successfully enabled. Details are provided for each account.</p>
51    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    /// <p>Information on the accounts that have had Amazon Inspector scans successfully enabled. Details are provided for each account.</p>
58    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    /// <p>Information on the accounts that have had Amazon Inspector scans successfully enabled. Details are provided for each account.</p>
63    pub fn get_accounts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Account>> {
64        &self.accounts
65    }
66    /// Appends an item to `failed_accounts`.
67    ///
68    /// To override the contents of this collection use [`set_failed_accounts`](Self::set_failed_accounts).
69    ///
70    /// <p>Information on any accounts for which Amazon Inspector scans could not be enabled. Details are provided for each account.</p>
71    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    /// <p>Information on any accounts for which Amazon Inspector scans could not be enabled. Details are provided for each account.</p>
78    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    /// <p>Information on any accounts for which Amazon Inspector scans could not be enabled. Details are provided for each account.</p>
83    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    /// Consumes the builder and constructs a [`EnableOutput`](crate::operation::enable::EnableOutput).
96    /// This method will fail if any of the following fields are not set:
97    /// - [`accounts`](crate::operation::enable::builders::EnableOutputBuilder::accounts)
98    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}