aws_sdk_verifiedpermissions/operation/create_policy/
_create_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 CreatePolicyInput {
6    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
7    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
8    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
9    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
10    pub client_token: ::std::option::Option<::std::string::String>,
11    /// <p>Specifies the <code>PolicyStoreId</code> of the policy store you want to store the policy in.</p>
12    pub policy_store_id: ::std::option::Option<::std::string::String>,
13    /// <p>A structure that specifies the policy type and content to use for the new policy. You must include either a static or a templateLinked element. The policy content must be written in the Cedar policy language.</p>
14    pub definition: ::std::option::Option<crate::types::PolicyDefinition>,
15}
16impl CreatePolicyInput {
17    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
18    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
19    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
20    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
21    pub fn client_token(&self) -> ::std::option::Option<&str> {
22        self.client_token.as_deref()
23    }
24    /// <p>Specifies the <code>PolicyStoreId</code> of the policy store you want to store the policy in.</p>
25    pub fn policy_store_id(&self) -> ::std::option::Option<&str> {
26        self.policy_store_id.as_deref()
27    }
28    /// <p>A structure that specifies the policy type and content to use for the new policy. You must include either a static or a templateLinked element. The policy content must be written in the Cedar policy language.</p>
29    pub fn definition(&self) -> ::std::option::Option<&crate::types::PolicyDefinition> {
30        self.definition.as_ref()
31    }
32}
33impl CreatePolicyInput {
34    /// Creates a new builder-style object to manufacture [`CreatePolicyInput`](crate::operation::create_policy::CreatePolicyInput).
35    pub fn builder() -> crate::operation::create_policy::builders::CreatePolicyInputBuilder {
36        crate::operation::create_policy::builders::CreatePolicyInputBuilder::default()
37    }
38}
39
40/// A builder for [`CreatePolicyInput`](crate::operation::create_policy::CreatePolicyInput).
41#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
42#[non_exhaustive]
43pub struct CreatePolicyInputBuilder {
44    pub(crate) client_token: ::std::option::Option<::std::string::String>,
45    pub(crate) policy_store_id: ::std::option::Option<::std::string::String>,
46    pub(crate) definition: ::std::option::Option<crate::types::PolicyDefinition>,
47}
48impl CreatePolicyInputBuilder {
49    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
50    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
51    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
52    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
53    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.client_token = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
58    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
59    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
60    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
61    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.client_token = input;
63        self
64    }
65    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
66    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
67    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
68    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
69    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
70        &self.client_token
71    }
72    /// <p>Specifies the <code>PolicyStoreId</code> of the policy store you want to store the policy in.</p>
73    /// This field is required.
74    pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75        self.policy_store_id = ::std::option::Option::Some(input.into());
76        self
77    }
78    /// <p>Specifies the <code>PolicyStoreId</code> of the policy store you want to store the policy in.</p>
79    pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.policy_store_id = input;
81        self
82    }
83    /// <p>Specifies the <code>PolicyStoreId</code> of the policy store you want to store the policy in.</p>
84    pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
85        &self.policy_store_id
86    }
87    /// <p>A structure that specifies the policy type and content to use for the new policy. You must include either a static or a templateLinked element. The policy content must be written in the Cedar policy language.</p>
88    /// This field is required.
89    pub fn definition(mut self, input: crate::types::PolicyDefinition) -> Self {
90        self.definition = ::std::option::Option::Some(input);
91        self
92    }
93    /// <p>A structure that specifies the policy type and content to use for the new policy. You must include either a static or a templateLinked element. The policy content must be written in the Cedar policy language.</p>
94    pub fn set_definition(mut self, input: ::std::option::Option<crate::types::PolicyDefinition>) -> Self {
95        self.definition = input;
96        self
97    }
98    /// <p>A structure that specifies the policy type and content to use for the new policy. You must include either a static or a templateLinked element. The policy content must be written in the Cedar policy language.</p>
99    pub fn get_definition(&self) -> &::std::option::Option<crate::types::PolicyDefinition> {
100        &self.definition
101    }
102    /// Consumes the builder and constructs a [`CreatePolicyInput`](crate::operation::create_policy::CreatePolicyInput).
103    pub fn build(
104        self,
105    ) -> ::std::result::Result<crate::operation::create_policy::CreatePolicyInput, ::aws_smithy_types::error::operation::BuildError> {
106        ::std::result::Result::Ok(crate::operation::create_policy::CreatePolicyInput {
107            client_token: self.client_token,
108            policy_store_id: self.policy_store_id,
109            definition: self.definition,
110        })
111    }
112}