aws_sdk_networkmanager/types/
_core_network_policy.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CoreNetworkPolicy {
7 pub core_network_id: ::std::option::Option<::std::string::String>,
9 pub policy_version_id: ::std::option::Option<i32>,
11 pub alias: ::std::option::Option<crate::types::CoreNetworkPolicyAlias>,
13 pub description: ::std::option::Option<::std::string::String>,
15 pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
17 pub change_set_state: ::std::option::Option<crate::types::ChangeSetState>,
19 pub policy_errors: ::std::option::Option<::std::vec::Vec<crate::types::CoreNetworkPolicyError>>,
21 pub policy_document: ::std::option::Option<::std::string::String>,
23}
24impl CoreNetworkPolicy {
25 pub fn core_network_id(&self) -> ::std::option::Option<&str> {
27 self.core_network_id.as_deref()
28 }
29 pub fn policy_version_id(&self) -> ::std::option::Option<i32> {
31 self.policy_version_id
32 }
33 pub fn alias(&self) -> ::std::option::Option<&crate::types::CoreNetworkPolicyAlias> {
35 self.alias.as_ref()
36 }
37 pub fn description(&self) -> ::std::option::Option<&str> {
39 self.description.as_deref()
40 }
41 pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
43 self.created_at.as_ref()
44 }
45 pub fn change_set_state(&self) -> ::std::option::Option<&crate::types::ChangeSetState> {
47 self.change_set_state.as_ref()
48 }
49 pub fn policy_errors(&self) -> &[crate::types::CoreNetworkPolicyError] {
53 self.policy_errors.as_deref().unwrap_or_default()
54 }
55 pub fn policy_document(&self) -> ::std::option::Option<&str> {
57 self.policy_document.as_deref()
58 }
59}
60impl CoreNetworkPolicy {
61 pub fn builder() -> crate::types::builders::CoreNetworkPolicyBuilder {
63 crate::types::builders::CoreNetworkPolicyBuilder::default()
64 }
65}
66
67#[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 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 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 pub fn get_core_network_id(&self) -> &::std::option::Option<::std::string::String> {
93 &self.core_network_id
94 }
95 pub fn policy_version_id(mut self, input: i32) -> Self {
97 self.policy_version_id = ::std::option::Option::Some(input);
98 self
99 }
100 pub fn set_policy_version_id(mut self, input: ::std::option::Option<i32>) -> Self {
102 self.policy_version_id = input;
103 self
104 }
105 pub fn get_policy_version_id(&self) -> &::std::option::Option<i32> {
107 &self.policy_version_id
108 }
109 pub fn alias(mut self, input: crate::types::CoreNetworkPolicyAlias) -> Self {
111 self.alias = ::std::option::Option::Some(input);
112 self
113 }
114 pub fn set_alias(mut self, input: ::std::option::Option<crate::types::CoreNetworkPolicyAlias>) -> Self {
116 self.alias = input;
117 self
118 }
119 pub fn get_alias(&self) -> &::std::option::Option<crate::types::CoreNetworkPolicyAlias> {
121 &self.alias
122 }
123 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 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130 self.description = input;
131 self
132 }
133 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
135 &self.description
136 }
137 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 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 pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
149 &self.created_at
150 }
151 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 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 pub fn get_change_set_state(&self) -> &::std::option::Option<crate::types::ChangeSetState> {
163 &self.change_set_state
164 }
165 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 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 pub fn get_policy_errors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CoreNetworkPolicyError>> {
183 &self.policy_errors
184 }
185 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 pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
192 self.policy_document = input;
193 self
194 }
195 pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
197 &self.policy_document
198 }
199 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}