aws_sdk_inspector2/types/
_account.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An Amazon Web Services account within your environment that Amazon Inspector has been enabled for.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Account {
7    /// <p>The ID of the Amazon Web Services account.</p>
8    pub account_id: ::std::string::String,
9    /// <p>The status of Amazon Inspector for the account.</p>
10    pub status: crate::types::Status,
11    /// <p>Details of the status of Amazon Inspector scans by resource type.</p>
12    pub resource_status: ::std::option::Option<crate::types::ResourceStatus>,
13}
14impl Account {
15    /// <p>The ID of the Amazon Web Services account.</p>
16    pub fn account_id(&self) -> &str {
17        use std::ops::Deref;
18        self.account_id.deref()
19    }
20    /// <p>The status of Amazon Inspector for the account.</p>
21    pub fn status(&self) -> &crate::types::Status {
22        &self.status
23    }
24    /// <p>Details of the status of Amazon Inspector scans by resource type.</p>
25    pub fn resource_status(&self) -> ::std::option::Option<&crate::types::ResourceStatus> {
26        self.resource_status.as_ref()
27    }
28}
29impl Account {
30    /// Creates a new builder-style object to manufacture [`Account`](crate::types::Account).
31    pub fn builder() -> crate::types::builders::AccountBuilder {
32        crate::types::builders::AccountBuilder::default()
33    }
34}
35
36/// A builder for [`Account`](crate::types::Account).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct AccountBuilder {
40    pub(crate) account_id: ::std::option::Option<::std::string::String>,
41    pub(crate) status: ::std::option::Option<crate::types::Status>,
42    pub(crate) resource_status: ::std::option::Option<crate::types::ResourceStatus>,
43}
44impl AccountBuilder {
45    /// <p>The ID of the Amazon Web Services account.</p>
46    /// This field is required.
47    pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48        self.account_id = ::std::option::Option::Some(input.into());
49        self
50    }
51    /// <p>The ID of the Amazon Web Services account.</p>
52    pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53        self.account_id = input;
54        self
55    }
56    /// <p>The ID of the Amazon Web Services account.</p>
57    pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
58        &self.account_id
59    }
60    /// <p>The status of Amazon Inspector for the account.</p>
61    /// This field is required.
62    pub fn status(mut self, input: crate::types::Status) -> Self {
63        self.status = ::std::option::Option::Some(input);
64        self
65    }
66    /// <p>The status of Amazon Inspector for the account.</p>
67    pub fn set_status(mut self, input: ::std::option::Option<crate::types::Status>) -> Self {
68        self.status = input;
69        self
70    }
71    /// <p>The status of Amazon Inspector for the account.</p>
72    pub fn get_status(&self) -> &::std::option::Option<crate::types::Status> {
73        &self.status
74    }
75    /// <p>Details of the status of Amazon Inspector scans by resource type.</p>
76    /// This field is required.
77    pub fn resource_status(mut self, input: crate::types::ResourceStatus) -> Self {
78        self.resource_status = ::std::option::Option::Some(input);
79        self
80    }
81    /// <p>Details of the status of Amazon Inspector scans by resource type.</p>
82    pub fn set_resource_status(mut self, input: ::std::option::Option<crate::types::ResourceStatus>) -> Self {
83        self.resource_status = input;
84        self
85    }
86    /// <p>Details of the status of Amazon Inspector scans by resource type.</p>
87    pub fn get_resource_status(&self) -> &::std::option::Option<crate::types::ResourceStatus> {
88        &self.resource_status
89    }
90    /// Consumes the builder and constructs a [`Account`](crate::types::Account).
91    /// This method will fail if any of the following fields are not set:
92    /// - [`account_id`](crate::types::builders::AccountBuilder::account_id)
93    /// - [`status`](crate::types::builders::AccountBuilder::status)
94    pub fn build(self) -> ::std::result::Result<crate::types::Account, ::aws_smithy_types::error::operation::BuildError> {
95        ::std::result::Result::Ok(crate::types::Account {
96            account_id: self.account_id.ok_or_else(|| {
97                ::aws_smithy_types::error::operation::BuildError::missing_field(
98                    "account_id",
99                    "account_id was not specified but it is required when building Account",
100                )
101            })?,
102            status: self.status.ok_or_else(|| {
103                ::aws_smithy_types::error::operation::BuildError::missing_field(
104                    "status",
105                    "status was not specified but it is required when building Account",
106                )
107            })?,
108            resource_status: self.resource_status,
109        })
110    }
111}