aws_sdk_serverlessapplicationrepository/types/_application_policy_statement.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Policy statement applied to the application.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ApplicationPolicyStatement {
7 /// <p>For the list of actions supported for this operation, see <a href="https://docs.aws.amazon.com/serverlessrepo/latest/devguide/access-control-resource-based.html#application-permissions">Application Permissions</a>.</p>
8 pub actions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
9 /// <p>An array of PrinciplalOrgIDs, which corresponds to AWS IAM <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#principal-org-id">aws:PrincipalOrgID</a> global condition key.</p>
10 pub principal_org_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11 /// <p>An array of AWS account IDs, or * to make the application public.</p>
12 pub principals: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
13 /// <p>A unique ID for the statement.</p>
14 pub statement_id: ::std::option::Option<::std::string::String>,
15}
16impl ApplicationPolicyStatement {
17 /// <p>For the list of actions supported for this operation, see <a href="https://docs.aws.amazon.com/serverlessrepo/latest/devguide/access-control-resource-based.html#application-permissions">Application Permissions</a>.</p>
18 ///
19 /// 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()`.
20 pub fn actions(&self) -> &[::std::string::String] {
21 self.actions.as_deref().unwrap_or_default()
22 }
23 /// <p>An array of PrinciplalOrgIDs, which corresponds to AWS IAM <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#principal-org-id">aws:PrincipalOrgID</a> global condition key.</p>
24 ///
25 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.principal_org_ids.is_none()`.
26 pub fn principal_org_ids(&self) -> &[::std::string::String] {
27 self.principal_org_ids.as_deref().unwrap_or_default()
28 }
29 /// <p>An array of AWS account IDs, or * to make the application public.</p>
30 ///
31 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.principals.is_none()`.
32 pub fn principals(&self) -> &[::std::string::String] {
33 self.principals.as_deref().unwrap_or_default()
34 }
35 /// <p>A unique ID for the statement.</p>
36 pub fn statement_id(&self) -> ::std::option::Option<&str> {
37 self.statement_id.as_deref()
38 }
39}
40impl ApplicationPolicyStatement {
41 /// Creates a new builder-style object to manufacture [`ApplicationPolicyStatement`](crate::types::ApplicationPolicyStatement).
42 pub fn builder() -> crate::types::builders::ApplicationPolicyStatementBuilder {
43 crate::types::builders::ApplicationPolicyStatementBuilder::default()
44 }
45}
46
47/// A builder for [`ApplicationPolicyStatement`](crate::types::ApplicationPolicyStatement).
48#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
49#[non_exhaustive]
50pub struct ApplicationPolicyStatementBuilder {
51 pub(crate) actions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
52 pub(crate) principal_org_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
53 pub(crate) principals: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
54 pub(crate) statement_id: ::std::option::Option<::std::string::String>,
55}
56impl ApplicationPolicyStatementBuilder {
57 /// Appends an item to `actions`.
58 ///
59 /// To override the contents of this collection use [`set_actions`](Self::set_actions).
60 ///
61 /// <p>For the list of actions supported for this operation, see <a href="https://docs.aws.amazon.com/serverlessrepo/latest/devguide/access-control-resource-based.html#application-permissions">Application Permissions</a>.</p>
62 pub fn actions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63 let mut v = self.actions.unwrap_or_default();
64 v.push(input.into());
65 self.actions = ::std::option::Option::Some(v);
66 self
67 }
68 /// <p>For the list of actions supported for this operation, see <a href="https://docs.aws.amazon.com/serverlessrepo/latest/devguide/access-control-resource-based.html#application-permissions">Application Permissions</a>.</p>
69 pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
70 self.actions = input;
71 self
72 }
73 /// <p>For the list of actions supported for this operation, see <a href="https://docs.aws.amazon.com/serverlessrepo/latest/devguide/access-control-resource-based.html#application-permissions">Application Permissions</a>.</p>
74 pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
75 &self.actions
76 }
77 /// Appends an item to `principal_org_ids`.
78 ///
79 /// To override the contents of this collection use [`set_principal_org_ids`](Self::set_principal_org_ids).
80 ///
81 /// <p>An array of PrinciplalOrgIDs, which corresponds to AWS IAM <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#principal-org-id">aws:PrincipalOrgID</a> global condition key.</p>
82 pub fn principal_org_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83 let mut v = self.principal_org_ids.unwrap_or_default();
84 v.push(input.into());
85 self.principal_org_ids = ::std::option::Option::Some(v);
86 self
87 }
88 /// <p>An array of PrinciplalOrgIDs, which corresponds to AWS IAM <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#principal-org-id">aws:PrincipalOrgID</a> global condition key.</p>
89 pub fn set_principal_org_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
90 self.principal_org_ids = input;
91 self
92 }
93 /// <p>An array of PrinciplalOrgIDs, which corresponds to AWS IAM <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#principal-org-id">aws:PrincipalOrgID</a> global condition key.</p>
94 pub fn get_principal_org_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
95 &self.principal_org_ids
96 }
97 /// Appends an item to `principals`.
98 ///
99 /// To override the contents of this collection use [`set_principals`](Self::set_principals).
100 ///
101 /// <p>An array of AWS account IDs, or * to make the application public.</p>
102 pub fn principals(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103 let mut v = self.principals.unwrap_or_default();
104 v.push(input.into());
105 self.principals = ::std::option::Option::Some(v);
106 self
107 }
108 /// <p>An array of AWS account IDs, or * to make the application public.</p>
109 pub fn set_principals(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
110 self.principals = input;
111 self
112 }
113 /// <p>An array of AWS account IDs, or * to make the application public.</p>
114 pub fn get_principals(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
115 &self.principals
116 }
117 /// <p>A unique ID for the statement.</p>
118 pub fn statement_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119 self.statement_id = ::std::option::Option::Some(input.into());
120 self
121 }
122 /// <p>A unique ID for the statement.</p>
123 pub fn set_statement_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124 self.statement_id = input;
125 self
126 }
127 /// <p>A unique ID for the statement.</p>
128 pub fn get_statement_id(&self) -> &::std::option::Option<::std::string::String> {
129 &self.statement_id
130 }
131 /// Consumes the builder and constructs a [`ApplicationPolicyStatement`](crate::types::ApplicationPolicyStatement).
132 pub fn build(self) -> crate::types::ApplicationPolicyStatement {
133 crate::types::ApplicationPolicyStatement {
134 actions: self.actions,
135 principal_org_ids: self.principal_org_ids,
136 principals: self.principals,
137 statement_id: self.statement_id,
138 }
139 }
140}