Skip to main content

aws_sdk_cloudwatchlogs/types/
_account_policy.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A structure that contains information about one CloudWatch Logs account policy.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AccountPolicy {
7    /// <p>The name of the account policy.</p>
8    pub policy_name: ::std::option::Option<::std::string::String>,
9    /// <p>The policy document for this account policy.</p>
10    /// <p>The JSON specified in <code>policyDocument</code> can be up to 30,720 characters.</p>
11    pub policy_document: ::std::option::Option<::std::string::String>,
12    /// <p>The date and time that this policy was most recently updated.</p>
13    pub last_updated_time: ::std::option::Option<i64>,
14    /// <p>The type of policy for this account policy.</p>
15    pub policy_type: ::std::option::Option<crate::types::PolicyType>,
16    /// <p>The scope of the account policy.</p>
17    pub scope: ::std::option::Option<crate::types::Scope>,
18    /// <p>The log group selection criteria that is used for this policy.</p>
19    pub selection_criteria: ::std::option::Option<::std::string::String>,
20    /// <p>The Amazon Web Services account ID that the policy applies to.</p>
21    pub account_id: ::std::option::Option<::std::string::String>,
22}
23impl AccountPolicy {
24    /// <p>The name of the account policy.</p>
25    pub fn policy_name(&self) -> ::std::option::Option<&str> {
26        self.policy_name.as_deref()
27    }
28    /// <p>The policy document for this account policy.</p>
29    /// <p>The JSON specified in <code>policyDocument</code> can be up to 30,720 characters.</p>
30    pub fn policy_document(&self) -> ::std::option::Option<&str> {
31        self.policy_document.as_deref()
32    }
33    /// <p>The date and time that this policy was most recently updated.</p>
34    pub fn last_updated_time(&self) -> ::std::option::Option<i64> {
35        self.last_updated_time
36    }
37    /// <p>The type of policy for this account policy.</p>
38    pub fn policy_type(&self) -> ::std::option::Option<&crate::types::PolicyType> {
39        self.policy_type.as_ref()
40    }
41    /// <p>The scope of the account policy.</p>
42    pub fn scope(&self) -> ::std::option::Option<&crate::types::Scope> {
43        self.scope.as_ref()
44    }
45    /// <p>The log group selection criteria that is used for this policy.</p>
46    pub fn selection_criteria(&self) -> ::std::option::Option<&str> {
47        self.selection_criteria.as_deref()
48    }
49    /// <p>The Amazon Web Services account ID that the policy applies to.</p>
50    pub fn account_id(&self) -> ::std::option::Option<&str> {
51        self.account_id.as_deref()
52    }
53}
54impl AccountPolicy {
55    /// Creates a new builder-style object to manufacture [`AccountPolicy`](crate::types::AccountPolicy).
56    pub fn builder() -> crate::types::builders::AccountPolicyBuilder {
57        crate::types::builders::AccountPolicyBuilder::default()
58    }
59}
60
61/// A builder for [`AccountPolicy`](crate::types::AccountPolicy).
62#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
63#[non_exhaustive]
64pub struct AccountPolicyBuilder {
65    pub(crate) policy_name: ::std::option::Option<::std::string::String>,
66    pub(crate) policy_document: ::std::option::Option<::std::string::String>,
67    pub(crate) last_updated_time: ::std::option::Option<i64>,
68    pub(crate) policy_type: ::std::option::Option<crate::types::PolicyType>,
69    pub(crate) scope: ::std::option::Option<crate::types::Scope>,
70    pub(crate) selection_criteria: ::std::option::Option<::std::string::String>,
71    pub(crate) account_id: ::std::option::Option<::std::string::String>,
72}
73impl AccountPolicyBuilder {
74    /// <p>The name of the account policy.</p>
75    pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.policy_name = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The name of the account policy.</p>
80    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.policy_name = input;
82        self
83    }
84    /// <p>The name of the account policy.</p>
85    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
86        &self.policy_name
87    }
88    /// <p>The policy document for this account policy.</p>
89    /// <p>The JSON specified in <code>policyDocument</code> can be up to 30,720 characters.</p>
90    pub fn policy_document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.policy_document = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>The policy document for this account policy.</p>
95    /// <p>The JSON specified in <code>policyDocument</code> can be up to 30,720 characters.</p>
96    pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
97        self.policy_document = input;
98        self
99    }
100    /// <p>The policy document for this account policy.</p>
101    /// <p>The JSON specified in <code>policyDocument</code> can be up to 30,720 characters.</p>
102    pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
103        &self.policy_document
104    }
105    /// <p>The date and time that this policy was most recently updated.</p>
106    pub fn last_updated_time(mut self, input: i64) -> Self {
107        self.last_updated_time = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>The date and time that this policy was most recently updated.</p>
111    pub fn set_last_updated_time(mut self, input: ::std::option::Option<i64>) -> Self {
112        self.last_updated_time = input;
113        self
114    }
115    /// <p>The date and time that this policy was most recently updated.</p>
116    pub fn get_last_updated_time(&self) -> &::std::option::Option<i64> {
117        &self.last_updated_time
118    }
119    /// <p>The type of policy for this account policy.</p>
120    pub fn policy_type(mut self, input: crate::types::PolicyType) -> Self {
121        self.policy_type = ::std::option::Option::Some(input);
122        self
123    }
124    /// <p>The type of policy for this account policy.</p>
125    pub fn set_policy_type(mut self, input: ::std::option::Option<crate::types::PolicyType>) -> Self {
126        self.policy_type = input;
127        self
128    }
129    /// <p>The type of policy for this account policy.</p>
130    pub fn get_policy_type(&self) -> &::std::option::Option<crate::types::PolicyType> {
131        &self.policy_type
132    }
133    /// <p>The scope of the account policy.</p>
134    pub fn scope(mut self, input: crate::types::Scope) -> Self {
135        self.scope = ::std::option::Option::Some(input);
136        self
137    }
138    /// <p>The scope of the account policy.</p>
139    pub fn set_scope(mut self, input: ::std::option::Option<crate::types::Scope>) -> Self {
140        self.scope = input;
141        self
142    }
143    /// <p>The scope of the account policy.</p>
144    pub fn get_scope(&self) -> &::std::option::Option<crate::types::Scope> {
145        &self.scope
146    }
147    /// <p>The log group selection criteria that is used for this policy.</p>
148    pub fn selection_criteria(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.selection_criteria = ::std::option::Option::Some(input.into());
150        self
151    }
152    /// <p>The log group selection criteria that is used for this policy.</p>
153    pub fn set_selection_criteria(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.selection_criteria = input;
155        self
156    }
157    /// <p>The log group selection criteria that is used for this policy.</p>
158    pub fn get_selection_criteria(&self) -> &::std::option::Option<::std::string::String> {
159        &self.selection_criteria
160    }
161    /// <p>The Amazon Web Services account ID that the policy applies to.</p>
162    pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.account_id = ::std::option::Option::Some(input.into());
164        self
165    }
166    /// <p>The Amazon Web Services account ID that the policy applies to.</p>
167    pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.account_id = input;
169        self
170    }
171    /// <p>The Amazon Web Services account ID that the policy applies to.</p>
172    pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
173        &self.account_id
174    }
175    /// Consumes the builder and constructs a [`AccountPolicy`](crate::types::AccountPolicy).
176    pub fn build(self) -> crate::types::AccountPolicy {
177        crate::types::AccountPolicy {
178            policy_name: self.policy_name,
179            policy_document: self.policy_document,
180            last_updated_time: self.last_updated_time,
181            policy_type: self.policy_type,
182            scope: self.scope,
183            selection_criteria: self.selection_criteria,
184            account_id: self.account_id,
185        }
186    }
187}