Skip to main content

aws_sdk_networkmanager/types/
_core_network_policy.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes a core network policy. You can have only one LIVE Core Policy.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CoreNetworkPolicy {
7    /// <p>The ID of a core network.</p>
8    pub core_network_id: ::std::option::Option<::std::string::String>,
9    /// <p>The ID of the policy version.</p>
10    pub policy_version_id: ::std::option::Option<i32>,
11    /// <p>Whether a core network policy is the current LIVE policy or the most recently submitted policy.</p>
12    pub alias: ::std::option::Option<crate::types::CoreNetworkPolicyAlias>,
13    /// <p>The description of a core network policy.</p>
14    pub description: ::std::option::Option<::std::string::String>,
15    /// <p>The timestamp when a core network policy was created.</p>
16    pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
17    /// <p>The state of a core network policy.</p>
18    pub change_set_state: ::std::option::Option<crate::types::ChangeSetState>,
19    /// <p>Describes any errors in a core network policy.</p>
20    pub policy_errors: ::std::option::Option<::std::vec::Vec<crate::types::CoreNetworkPolicyError>>,
21    /// <p>Describes a core network policy.</p>
22    pub policy_document: ::std::option::Option<::std::string::String>,
23}
24impl CoreNetworkPolicy {
25    /// <p>The ID of a core network.</p>
26    pub fn core_network_id(&self) -> ::std::option::Option<&str> {
27        self.core_network_id.as_deref()
28    }
29    /// <p>The ID of the policy version.</p>
30    pub fn policy_version_id(&self) -> ::std::option::Option<i32> {
31        self.policy_version_id
32    }
33    /// <p>Whether a core network policy is the current LIVE policy or the most recently submitted policy.</p>
34    pub fn alias(&self) -> ::std::option::Option<&crate::types::CoreNetworkPolicyAlias> {
35        self.alias.as_ref()
36    }
37    /// <p>The description of a core network policy.</p>
38    pub fn description(&self) -> ::std::option::Option<&str> {
39        self.description.as_deref()
40    }
41    /// <p>The timestamp when a core network policy was created.</p>
42    pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
43        self.created_at.as_ref()
44    }
45    /// <p>The state of a core network policy.</p>
46    pub fn change_set_state(&self) -> ::std::option::Option<&crate::types::ChangeSetState> {
47        self.change_set_state.as_ref()
48    }
49    /// <p>Describes any errors in a core network policy.</p>
50    ///
51    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.policy_errors.is_none()`.
52    pub fn policy_errors(&self) -> &[crate::types::CoreNetworkPolicyError] {
53        self.policy_errors.as_deref().unwrap_or_default()
54    }
55    /// <p>Describes a core network policy.</p>
56    pub fn policy_document(&self) -> ::std::option::Option<&str> {
57        self.policy_document.as_deref()
58    }
59}
60impl CoreNetworkPolicy {
61    /// Creates a new builder-style object to manufacture [`CoreNetworkPolicy`](crate::types::CoreNetworkPolicy).
62    pub fn builder() -> crate::types::builders::CoreNetworkPolicyBuilder {
63        crate::types::builders::CoreNetworkPolicyBuilder::default()
64    }
65}
66
67/// A builder for [`CoreNetworkPolicy`](crate::types::CoreNetworkPolicy).
68#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
69#[non_exhaustive]
70pub struct CoreNetworkPolicyBuilder {
71    pub(crate) core_network_id: ::std::option::Option<::std::string::String>,
72    pub(crate) policy_version_id: ::std::option::Option<i32>,
73    pub(crate) alias: ::std::option::Option<crate::types::CoreNetworkPolicyAlias>,
74    pub(crate) description: ::std::option::Option<::std::string::String>,
75    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
76    pub(crate) change_set_state: ::std::option::Option<crate::types::ChangeSetState>,
77    pub(crate) policy_errors: ::std::option::Option<::std::vec::Vec<crate::types::CoreNetworkPolicyError>>,
78    pub(crate) policy_document: ::std::option::Option<::std::string::String>,
79}
80impl CoreNetworkPolicyBuilder {
81    /// <p>The ID of a core network.</p>
82    pub fn core_network_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83        self.core_network_id = ::std::option::Option::Some(input.into());
84        self
85    }
86    /// <p>The ID of a core network.</p>
87    pub fn set_core_network_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.core_network_id = input;
89        self
90    }
91    /// <p>The ID of a core network.</p>
92    pub fn get_core_network_id(&self) -> &::std::option::Option<::std::string::String> {
93        &self.core_network_id
94    }
95    /// <p>The ID of the policy version.</p>
96    pub fn policy_version_id(mut self, input: i32) -> Self {
97        self.policy_version_id = ::std::option::Option::Some(input);
98        self
99    }
100    /// <p>The ID of the policy version.</p>
101    pub fn set_policy_version_id(mut self, input: ::std::option::Option<i32>) -> Self {
102        self.policy_version_id = input;
103        self
104    }
105    /// <p>The ID of the policy version.</p>
106    pub fn get_policy_version_id(&self) -> &::std::option::Option<i32> {
107        &self.policy_version_id
108    }
109    /// <p>Whether a core network policy is the current LIVE policy or the most recently submitted policy.</p>
110    pub fn alias(mut self, input: crate::types::CoreNetworkPolicyAlias) -> Self {
111        self.alias = ::std::option::Option::Some(input);
112        self
113    }
114    /// <p>Whether a core network policy is the current LIVE policy or the most recently submitted policy.</p>
115    pub fn set_alias(mut self, input: ::std::option::Option<crate::types::CoreNetworkPolicyAlias>) -> Self {
116        self.alias = input;
117        self
118    }
119    /// <p>Whether a core network policy is the current LIVE policy or the most recently submitted policy.</p>
120    pub fn get_alias(&self) -> &::std::option::Option<crate::types::CoreNetworkPolicyAlias> {
121        &self.alias
122    }
123    /// <p>The description of a core network policy.</p>
124    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.description = ::std::option::Option::Some(input.into());
126        self
127    }
128    /// <p>The description of a core network policy.</p>
129    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.description = input;
131        self
132    }
133    /// <p>The description of a core network policy.</p>
134    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
135        &self.description
136    }
137    /// <p>The timestamp when a core network policy was created.</p>
138    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
139        self.created_at = ::std::option::Option::Some(input);
140        self
141    }
142    /// <p>The timestamp when a core network policy was created.</p>
143    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
144        self.created_at = input;
145        self
146    }
147    /// <p>The timestamp when a core network policy was created.</p>
148    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
149        &self.created_at
150    }
151    /// <p>The state of a core network policy.</p>
152    pub fn change_set_state(mut self, input: crate::types::ChangeSetState) -> Self {
153        self.change_set_state = ::std::option::Option::Some(input);
154        self
155    }
156    /// <p>The state of a core network policy.</p>
157    pub fn set_change_set_state(mut self, input: ::std::option::Option<crate::types::ChangeSetState>) -> Self {
158        self.change_set_state = input;
159        self
160    }
161    /// <p>The state of a core network policy.</p>
162    pub fn get_change_set_state(&self) -> &::std::option::Option<crate::types::ChangeSetState> {
163        &self.change_set_state
164    }
165    /// Appends an item to `policy_errors`.
166    ///
167    /// To override the contents of this collection use [`set_policy_errors`](Self::set_policy_errors).
168    ///
169    /// <p>Describes any errors in a core network policy.</p>
170    pub fn policy_errors(mut self, input: crate::types::CoreNetworkPolicyError) -> Self {
171        let mut v = self.policy_errors.unwrap_or_default();
172        v.push(input);
173        self.policy_errors = ::std::option::Option::Some(v);
174        self
175    }
176    /// <p>Describes any errors in a core network policy.</p>
177    pub fn set_policy_errors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CoreNetworkPolicyError>>) -> Self {
178        self.policy_errors = input;
179        self
180    }
181    /// <p>Describes any errors in a core network policy.</p>
182    pub fn get_policy_errors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CoreNetworkPolicyError>> {
183        &self.policy_errors
184    }
185    /// <p>Describes a core network policy.</p>
186    pub fn policy_document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187        self.policy_document = ::std::option::Option::Some(input.into());
188        self
189    }
190    /// <p>Describes a core network policy.</p>
191    pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
192        self.policy_document = input;
193        self
194    }
195    /// <p>Describes a core network policy.</p>
196    pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
197        &self.policy_document
198    }
199    /// Consumes the builder and constructs a [`CoreNetworkPolicy`](crate::types::CoreNetworkPolicy).
200    pub fn build(self) -> crate::types::CoreNetworkPolicy {
201        crate::types::CoreNetworkPolicy {
202            core_network_id: self.core_network_id,
203            policy_version_id: self.policy_version_id,
204            alias: self.alias,
205            description: self.description,
206            created_at: self.created_at,
207            change_set_state: self.change_set_state,
208            policy_errors: self.policy_errors,
209            policy_document: self.policy_document,
210        }
211    }
212}