aws_sdk_verifiedpermissions/operation/update_policy/
_update_policy_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 UpdatePolicyOutput {
6    /// <p>The ID of the policy store that contains the policy that was updated.</p>
7    pub policy_store_id: ::std::string::String,
8    /// <p>The ID of the policy that was updated.</p>
9    pub policy_id: ::std::string::String,
10    /// <p>The type of the policy that was updated.</p>
11    pub policy_type: crate::types::PolicyType,
12    /// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
13    pub principal: ::std::option::Option<crate::types::EntityIdentifier>,
14    /// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
15    pub resource: ::std::option::Option<crate::types::EntityIdentifier>,
16    /// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
17    pub actions: ::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>>,
18    /// <p>The date and time that the policy was originally created.</p>
19    pub created_date: ::aws_smithy_types::DateTime,
20    /// <p>The date and time that the policy was most recently updated.</p>
21    pub last_updated_date: ::aws_smithy_types::DateTime,
22    /// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
23    pub effect: ::std::option::Option<crate::types::PolicyEffect>,
24    _request_id: Option<String>,
25}
26impl UpdatePolicyOutput {
27    /// <p>The ID of the policy store that contains the policy that was updated.</p>
28    pub fn policy_store_id(&self) -> &str {
29        use std::ops::Deref;
30        self.policy_store_id.deref()
31    }
32    /// <p>The ID of the policy that was updated.</p>
33    pub fn policy_id(&self) -> &str {
34        use std::ops::Deref;
35        self.policy_id.deref()
36    }
37    /// <p>The type of the policy that was updated.</p>
38    pub fn policy_type(&self) -> &crate::types::PolicyType {
39        &self.policy_type
40    }
41    /// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
42    pub fn principal(&self) -> ::std::option::Option<&crate::types::EntityIdentifier> {
43        self.principal.as_ref()
44    }
45    /// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
46    pub fn resource(&self) -> ::std::option::Option<&crate::types::EntityIdentifier> {
47        self.resource.as_ref()
48    }
49    /// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</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 `.actions.is_none()`.
52    pub fn actions(&self) -> &[crate::types::ActionIdentifier] {
53        self.actions.as_deref().unwrap_or_default()
54    }
55    /// <p>The date and time that the policy was originally created.</p>
56    pub fn created_date(&self) -> &::aws_smithy_types::DateTime {
57        &self.created_date
58    }
59    /// <p>The date and time that the policy was most recently updated.</p>
60    pub fn last_updated_date(&self) -> &::aws_smithy_types::DateTime {
61        &self.last_updated_date
62    }
63    /// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
64    pub fn effect(&self) -> ::std::option::Option<&crate::types::PolicyEffect> {
65        self.effect.as_ref()
66    }
67}
68impl ::aws_types::request_id::RequestId for UpdatePolicyOutput {
69    fn request_id(&self) -> Option<&str> {
70        self._request_id.as_deref()
71    }
72}
73impl UpdatePolicyOutput {
74    /// Creates a new builder-style object to manufacture [`UpdatePolicyOutput`](crate::operation::update_policy::UpdatePolicyOutput).
75    pub fn builder() -> crate::operation::update_policy::builders::UpdatePolicyOutputBuilder {
76        crate::operation::update_policy::builders::UpdatePolicyOutputBuilder::default()
77    }
78}
79
80/// A builder for [`UpdatePolicyOutput`](crate::operation::update_policy::UpdatePolicyOutput).
81#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
82#[non_exhaustive]
83pub struct UpdatePolicyOutputBuilder {
84    pub(crate) policy_store_id: ::std::option::Option<::std::string::String>,
85    pub(crate) policy_id: ::std::option::Option<::std::string::String>,
86    pub(crate) policy_type: ::std::option::Option<crate::types::PolicyType>,
87    pub(crate) principal: ::std::option::Option<crate::types::EntityIdentifier>,
88    pub(crate) resource: ::std::option::Option<crate::types::EntityIdentifier>,
89    pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>>,
90    pub(crate) created_date: ::std::option::Option<::aws_smithy_types::DateTime>,
91    pub(crate) last_updated_date: ::std::option::Option<::aws_smithy_types::DateTime>,
92    pub(crate) effect: ::std::option::Option<crate::types::PolicyEffect>,
93    _request_id: Option<String>,
94}
95impl UpdatePolicyOutputBuilder {
96    /// <p>The ID of the policy store that contains the policy that was updated.</p>
97    /// This field is required.
98    pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.policy_store_id = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The ID of the policy store that contains the policy that was updated.</p>
103    pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.policy_store_id = input;
105        self
106    }
107    /// <p>The ID of the policy store that contains the policy that was updated.</p>
108    pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
109        &self.policy_store_id
110    }
111    /// <p>The ID of the policy that was updated.</p>
112    /// This field is required.
113    pub fn policy_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.policy_id = ::std::option::Option::Some(input.into());
115        self
116    }
117    /// <p>The ID of the policy that was updated.</p>
118    pub fn set_policy_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.policy_id = input;
120        self
121    }
122    /// <p>The ID of the policy that was updated.</p>
123    pub fn get_policy_id(&self) -> &::std::option::Option<::std::string::String> {
124        &self.policy_id
125    }
126    /// <p>The type of the policy that was updated.</p>
127    /// This field is required.
128    pub fn policy_type(mut self, input: crate::types::PolicyType) -> Self {
129        self.policy_type = ::std::option::Option::Some(input);
130        self
131    }
132    /// <p>The type of the policy that was updated.</p>
133    pub fn set_policy_type(mut self, input: ::std::option::Option<crate::types::PolicyType>) -> Self {
134        self.policy_type = input;
135        self
136    }
137    /// <p>The type of the policy that was updated.</p>
138    pub fn get_policy_type(&self) -> &::std::option::Option<crate::types::PolicyType> {
139        &self.policy_type
140    }
141    /// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
142    pub fn principal(mut self, input: crate::types::EntityIdentifier) -> Self {
143        self.principal = ::std::option::Option::Some(input);
144        self
145    }
146    /// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
147    pub fn set_principal(mut self, input: ::std::option::Option<crate::types::EntityIdentifier>) -> Self {
148        self.principal = input;
149        self
150    }
151    /// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
152    pub fn get_principal(&self) -> &::std::option::Option<crate::types::EntityIdentifier> {
153        &self.principal
154    }
155    /// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
156    pub fn resource(mut self, input: crate::types::EntityIdentifier) -> Self {
157        self.resource = ::std::option::Option::Some(input);
158        self
159    }
160    /// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
161    pub fn set_resource(mut self, input: ::std::option::Option<crate::types::EntityIdentifier>) -> Self {
162        self.resource = input;
163        self
164    }
165    /// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
166    pub fn get_resource(&self) -> &::std::option::Option<crate::types::EntityIdentifier> {
167        &self.resource
168    }
169    /// Appends an item to `actions`.
170    ///
171    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
172    ///
173    /// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
174    pub fn actions(mut self, input: crate::types::ActionIdentifier) -> Self {
175        let mut v = self.actions.unwrap_or_default();
176        v.push(input);
177        self.actions = ::std::option::Option::Some(v);
178        self
179    }
180    /// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
181    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>>) -> Self {
182        self.actions = input;
183        self
184    }
185    /// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
186    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>> {
187        &self.actions
188    }
189    /// <p>The date and time that the policy was originally created.</p>
190    /// This field is required.
191    pub fn created_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
192        self.created_date = ::std::option::Option::Some(input);
193        self
194    }
195    /// <p>The date and time that the policy was originally created.</p>
196    pub fn set_created_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
197        self.created_date = input;
198        self
199    }
200    /// <p>The date and time that the policy was originally created.</p>
201    pub fn get_created_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
202        &self.created_date
203    }
204    /// <p>The date and time that the policy was most recently updated.</p>
205    /// This field is required.
206    pub fn last_updated_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
207        self.last_updated_date = ::std::option::Option::Some(input);
208        self
209    }
210    /// <p>The date and time that the policy was most recently updated.</p>
211    pub fn set_last_updated_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
212        self.last_updated_date = input;
213        self
214    }
215    /// <p>The date and time that the policy was most recently updated.</p>
216    pub fn get_last_updated_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
217        &self.last_updated_date
218    }
219    /// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
220    pub fn effect(mut self, input: crate::types::PolicyEffect) -> Self {
221        self.effect = ::std::option::Option::Some(input);
222        self
223    }
224    /// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
225    pub fn set_effect(mut self, input: ::std::option::Option<crate::types::PolicyEffect>) -> Self {
226        self.effect = input;
227        self
228    }
229    /// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
230    pub fn get_effect(&self) -> &::std::option::Option<crate::types::PolicyEffect> {
231        &self.effect
232    }
233    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
234        self._request_id = Some(request_id.into());
235        self
236    }
237
238    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
239        self._request_id = request_id;
240        self
241    }
242    /// Consumes the builder and constructs a [`UpdatePolicyOutput`](crate::operation::update_policy::UpdatePolicyOutput).
243    /// This method will fail if any of the following fields are not set:
244    /// - [`policy_store_id`](crate::operation::update_policy::builders::UpdatePolicyOutputBuilder::policy_store_id)
245    /// - [`policy_id`](crate::operation::update_policy::builders::UpdatePolicyOutputBuilder::policy_id)
246    /// - [`policy_type`](crate::operation::update_policy::builders::UpdatePolicyOutputBuilder::policy_type)
247    /// - [`created_date`](crate::operation::update_policy::builders::UpdatePolicyOutputBuilder::created_date)
248    /// - [`last_updated_date`](crate::operation::update_policy::builders::UpdatePolicyOutputBuilder::last_updated_date)
249    pub fn build(
250        self,
251    ) -> ::std::result::Result<crate::operation::update_policy::UpdatePolicyOutput, ::aws_smithy_types::error::operation::BuildError> {
252        ::std::result::Result::Ok(crate::operation::update_policy::UpdatePolicyOutput {
253            policy_store_id: self.policy_store_id.ok_or_else(|| {
254                ::aws_smithy_types::error::operation::BuildError::missing_field(
255                    "policy_store_id",
256                    "policy_store_id was not specified but it is required when building UpdatePolicyOutput",
257                )
258            })?,
259            policy_id: self.policy_id.ok_or_else(|| {
260                ::aws_smithy_types::error::operation::BuildError::missing_field(
261                    "policy_id",
262                    "policy_id was not specified but it is required when building UpdatePolicyOutput",
263                )
264            })?,
265            policy_type: self.policy_type.ok_or_else(|| {
266                ::aws_smithy_types::error::operation::BuildError::missing_field(
267                    "policy_type",
268                    "policy_type was not specified but it is required when building UpdatePolicyOutput",
269                )
270            })?,
271            principal: self.principal,
272            resource: self.resource,
273            actions: self.actions,
274            created_date: self.created_date.ok_or_else(|| {
275                ::aws_smithy_types::error::operation::BuildError::missing_field(
276                    "created_date",
277                    "created_date was not specified but it is required when building UpdatePolicyOutput",
278                )
279            })?,
280            last_updated_date: self.last_updated_date.ok_or_else(|| {
281                ::aws_smithy_types::error::operation::BuildError::missing_field(
282                    "last_updated_date",
283                    "last_updated_date was not specified but it is required when building UpdatePolicyOutput",
284                )
285            })?,
286            effect: self.effect,
287            _request_id: self._request_id,
288        })
289    }
290}