aws_sdk_accessanalyzer/operation/validate_policy/
_validate_policy_input.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 ValidatePolicyInput {
6    /// <p>The locale to use for localizing the findings.</p>
7    pub locale: ::std::option::Option<crate::types::Locale>,
8    /// <p>The maximum number of results to return in the response.</p>
9    pub max_results: ::std::option::Option<i32>,
10    /// <p>A token used for pagination of results returned.</p>
11    pub next_token: ::std::option::Option<::std::string::String>,
12    /// <p>The JSON policy document to use as the content for the policy.</p>
13    pub policy_document: ::std::option::Option<::std::string::String>,
14    /// <p>The type of policy to validate. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.</p>
15    /// <p>Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.</p>
16    /// <p>Service control policies (SCPs) are a type of organization policy attached to an Amazon Web Services organization, organizational unit (OU), or an account.</p>
17    pub policy_type: ::std::option::Option<crate::types::PolicyType>,
18    /// <p>The type of resource to attach to your resource policy. Specify a value for the policy validation resource type only if the policy type is <code>RESOURCE_POLICY</code>. For example, to validate a resource policy to attach to an Amazon S3 bucket, you can choose <code>AWS::S3::Bucket</code> for the policy validation resource type.</p>
19    /// <p>For resource types not supported as valid values, IAM Access Analyzer runs policy checks that apply to all resource policies. For example, to validate a resource policy to attach to a KMS key, do not specify a value for the policy validation resource type and IAM Access Analyzer will run policy checks that apply to all resource policies.</p>
20    pub validate_policy_resource_type: ::std::option::Option<crate::types::ValidatePolicyResourceType>,
21}
22impl ValidatePolicyInput {
23    /// <p>The locale to use for localizing the findings.</p>
24    pub fn locale(&self) -> ::std::option::Option<&crate::types::Locale> {
25        self.locale.as_ref()
26    }
27    /// <p>The maximum number of results to return in the response.</p>
28    pub fn max_results(&self) -> ::std::option::Option<i32> {
29        self.max_results
30    }
31    /// <p>A token used for pagination of results returned.</p>
32    pub fn next_token(&self) -> ::std::option::Option<&str> {
33        self.next_token.as_deref()
34    }
35    /// <p>The JSON policy document to use as the content for the policy.</p>
36    pub fn policy_document(&self) -> ::std::option::Option<&str> {
37        self.policy_document.as_deref()
38    }
39    /// <p>The type of policy to validate. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.</p>
40    /// <p>Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.</p>
41    /// <p>Service control policies (SCPs) are a type of organization policy attached to an Amazon Web Services organization, organizational unit (OU), or an account.</p>
42    pub fn policy_type(&self) -> ::std::option::Option<&crate::types::PolicyType> {
43        self.policy_type.as_ref()
44    }
45    /// <p>The type of resource to attach to your resource policy. Specify a value for the policy validation resource type only if the policy type is <code>RESOURCE_POLICY</code>. For example, to validate a resource policy to attach to an Amazon S3 bucket, you can choose <code>AWS::S3::Bucket</code> for the policy validation resource type.</p>
46    /// <p>For resource types not supported as valid values, IAM Access Analyzer runs policy checks that apply to all resource policies. For example, to validate a resource policy to attach to a KMS key, do not specify a value for the policy validation resource type and IAM Access Analyzer will run policy checks that apply to all resource policies.</p>
47    pub fn validate_policy_resource_type(&self) -> ::std::option::Option<&crate::types::ValidatePolicyResourceType> {
48        self.validate_policy_resource_type.as_ref()
49    }
50}
51impl ValidatePolicyInput {
52    /// Creates a new builder-style object to manufacture [`ValidatePolicyInput`](crate::operation::validate_policy::ValidatePolicyInput).
53    pub fn builder() -> crate::operation::validate_policy::builders::ValidatePolicyInputBuilder {
54        crate::operation::validate_policy::builders::ValidatePolicyInputBuilder::default()
55    }
56}
57
58/// A builder for [`ValidatePolicyInput`](crate::operation::validate_policy::ValidatePolicyInput).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct ValidatePolicyInputBuilder {
62    pub(crate) locale: ::std::option::Option<crate::types::Locale>,
63    pub(crate) max_results: ::std::option::Option<i32>,
64    pub(crate) next_token: ::std::option::Option<::std::string::String>,
65    pub(crate) policy_document: ::std::option::Option<::std::string::String>,
66    pub(crate) policy_type: ::std::option::Option<crate::types::PolicyType>,
67    pub(crate) validate_policy_resource_type: ::std::option::Option<crate::types::ValidatePolicyResourceType>,
68}
69impl ValidatePolicyInputBuilder {
70    /// <p>The locale to use for localizing the findings.</p>
71    pub fn locale(mut self, input: crate::types::Locale) -> Self {
72        self.locale = ::std::option::Option::Some(input);
73        self
74    }
75    /// <p>The locale to use for localizing the findings.</p>
76    pub fn set_locale(mut self, input: ::std::option::Option<crate::types::Locale>) -> Self {
77        self.locale = input;
78        self
79    }
80    /// <p>The locale to use for localizing the findings.</p>
81    pub fn get_locale(&self) -> &::std::option::Option<crate::types::Locale> {
82        &self.locale
83    }
84    /// <p>The maximum number of results to return in the response.</p>
85    pub fn max_results(mut self, input: i32) -> Self {
86        self.max_results = ::std::option::Option::Some(input);
87        self
88    }
89    /// <p>The maximum number of results to return in the response.</p>
90    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
91        self.max_results = input;
92        self
93    }
94    /// <p>The maximum number of results to return in the response.</p>
95    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
96        &self.max_results
97    }
98    /// <p>A token used for pagination of results returned.</p>
99    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100        self.next_token = ::std::option::Option::Some(input.into());
101        self
102    }
103    /// <p>A token used for pagination of results returned.</p>
104    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105        self.next_token = input;
106        self
107    }
108    /// <p>A token used for pagination of results returned.</p>
109    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
110        &self.next_token
111    }
112    /// <p>The JSON policy document to use as the content for the policy.</p>
113    /// This field is required.
114    pub fn policy_document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.policy_document = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The JSON policy document to use as the content for the policy.</p>
119    pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.policy_document = input;
121        self
122    }
123    /// <p>The JSON policy document to use as the content for the policy.</p>
124    pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
125        &self.policy_document
126    }
127    /// <p>The type of policy to validate. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.</p>
128    /// <p>Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.</p>
129    /// <p>Service control policies (SCPs) are a type of organization policy attached to an Amazon Web Services organization, organizational unit (OU), or an account.</p>
130    /// This field is required.
131    pub fn policy_type(mut self, input: crate::types::PolicyType) -> Self {
132        self.policy_type = ::std::option::Option::Some(input);
133        self
134    }
135    /// <p>The type of policy to validate. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.</p>
136    /// <p>Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.</p>
137    /// <p>Service control policies (SCPs) are a type of organization policy attached to an Amazon Web Services organization, organizational unit (OU), or an account.</p>
138    pub fn set_policy_type(mut self, input: ::std::option::Option<crate::types::PolicyType>) -> Self {
139        self.policy_type = input;
140        self
141    }
142    /// <p>The type of policy to validate. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.</p>
143    /// <p>Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.</p>
144    /// <p>Service control policies (SCPs) are a type of organization policy attached to an Amazon Web Services organization, organizational unit (OU), or an account.</p>
145    pub fn get_policy_type(&self) -> &::std::option::Option<crate::types::PolicyType> {
146        &self.policy_type
147    }
148    /// <p>The type of resource to attach to your resource policy. Specify a value for the policy validation resource type only if the policy type is <code>RESOURCE_POLICY</code>. For example, to validate a resource policy to attach to an Amazon S3 bucket, you can choose <code>AWS::S3::Bucket</code> for the policy validation resource type.</p>
149    /// <p>For resource types not supported as valid values, IAM Access Analyzer runs policy checks that apply to all resource policies. For example, to validate a resource policy to attach to a KMS key, do not specify a value for the policy validation resource type and IAM Access Analyzer will run policy checks that apply to all resource policies.</p>
150    pub fn validate_policy_resource_type(mut self, input: crate::types::ValidatePolicyResourceType) -> Self {
151        self.validate_policy_resource_type = ::std::option::Option::Some(input);
152        self
153    }
154    /// <p>The type of resource to attach to your resource policy. Specify a value for the policy validation resource type only if the policy type is <code>RESOURCE_POLICY</code>. For example, to validate a resource policy to attach to an Amazon S3 bucket, you can choose <code>AWS::S3::Bucket</code> for the policy validation resource type.</p>
155    /// <p>For resource types not supported as valid values, IAM Access Analyzer runs policy checks that apply to all resource policies. For example, to validate a resource policy to attach to a KMS key, do not specify a value for the policy validation resource type and IAM Access Analyzer will run policy checks that apply to all resource policies.</p>
156    pub fn set_validate_policy_resource_type(mut self, input: ::std::option::Option<crate::types::ValidatePolicyResourceType>) -> Self {
157        self.validate_policy_resource_type = input;
158        self
159    }
160    /// <p>The type of resource to attach to your resource policy. Specify a value for the policy validation resource type only if the policy type is <code>RESOURCE_POLICY</code>. For example, to validate a resource policy to attach to an Amazon S3 bucket, you can choose <code>AWS::S3::Bucket</code> for the policy validation resource type.</p>
161    /// <p>For resource types not supported as valid values, IAM Access Analyzer runs policy checks that apply to all resource policies. For example, to validate a resource policy to attach to a KMS key, do not specify a value for the policy validation resource type and IAM Access Analyzer will run policy checks that apply to all resource policies.</p>
162    pub fn get_validate_policy_resource_type(&self) -> &::std::option::Option<crate::types::ValidatePolicyResourceType> {
163        &self.validate_policy_resource_type
164    }
165    /// Consumes the builder and constructs a [`ValidatePolicyInput`](crate::operation::validate_policy::ValidatePolicyInput).
166    pub fn build(
167        self,
168    ) -> ::std::result::Result<crate::operation::validate_policy::ValidatePolicyInput, ::aws_smithy_types::error::operation::BuildError> {
169        ::std::result::Result::Ok(crate::operation::validate_policy::ValidatePolicyInput {
170            locale: self.locale,
171            max_results: self.max_results,
172            next_token: self.next_token,
173            policy_document: self.policy_document,
174            policy_type: self.policy_type,
175            validate_policy_resource_type: self.validate_policy_resource_type,
176        })
177    }
178}