aws_sdk_verifiedpermissions/operation/create_policy_store/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_policy_store::_create_policy_store_output::CreatePolicyStoreOutputBuilder;
3
4pub use crate::operation::create_policy_store::_create_policy_store_input::CreatePolicyStoreInputBuilder;
5
6impl crate::operation::create_policy_store::builders::CreatePolicyStoreInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::create_policy_store::CreatePolicyStoreOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_policy_store::CreatePolicyStoreError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_policy_store();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreatePolicyStore`.
24///
25/// <p>Creates a policy store. A policy store is a container for policy resources.</p><note>
26/// <p>Although <a href="https://docs.cedarpolicy.com/schema/schema.html#namespace">Cedar supports multiple namespaces</a>, Verified Permissions currently supports only one namespace per policy store.</p>
27/// </note> <note>
28/// <p>Verified Permissions is <i> <a href="https://wikipedia.org/wiki/Eventual_consistency">eventually consistent</a> </i>. It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.</p>
29/// </note>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreatePolicyStoreFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::create_policy_store::builders::CreatePolicyStoreInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::create_policy_store::CreatePolicyStoreOutput,
39 crate::operation::create_policy_store::CreatePolicyStoreError,
40 > for CreatePolicyStoreFluentBuilder
41{
42 fn send(
43 self,
44 config_override: crate::config::Builder,
45 ) -> crate::client::customize::internal::BoxFuture<
46 crate::client::customize::internal::SendResult<
47 crate::operation::create_policy_store::CreatePolicyStoreOutput,
48 crate::operation::create_policy_store::CreatePolicyStoreError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl CreatePolicyStoreFluentBuilder {
55 /// Creates a new `CreatePolicyStoreFluentBuilder`.
56 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57 Self {
58 handle,
59 inner: ::std::default::Default::default(),
60 config_override: ::std::option::Option::None,
61 }
62 }
63 /// Access the CreatePolicyStore as a reference.
64 pub fn as_input(&self) -> &crate::operation::create_policy_store::builders::CreatePolicyStoreInputBuilder {
65 &self.inner
66 }
67 /// Sends the request and returns the response.
68 ///
69 /// If an error occurs, an `SdkError` will be returned with additional details that
70 /// can be matched against.
71 ///
72 /// By default, any retryable failures will be retried twice. Retry behavior
73 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74 /// set when configuring the client.
75 pub async fn send(
76 self,
77 ) -> ::std::result::Result<
78 crate::operation::create_policy_store::CreatePolicyStoreOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::create_policy_store::CreatePolicyStoreError,
81 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82 >,
83 > {
84 let input = self
85 .inner
86 .build()
87 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88 let runtime_plugins = crate::operation::create_policy_store::CreatePolicyStore::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::create_policy_store::CreatePolicyStore::orchestrate(&runtime_plugins, input).await
94 }
95
96 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97 pub fn customize(
98 self,
99 ) -> crate::client::customize::CustomizableOperation<
100 crate::operation::create_policy_store::CreatePolicyStoreOutput,
101 crate::operation::create_policy_store::CreatePolicyStoreError,
102 Self,
103 > {
104 crate::client::customize::CustomizableOperation::new(self)
105 }
106 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107 self.set_config_override(::std::option::Option::Some(config_override.into()));
108 self
109 }
110
111 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112 self.config_override = config_override;
113 self
114 }
115 /// <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>
116 /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
117 /// <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>
118 /// <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>
119 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.inner = self.inner.client_token(input.into());
121 self
122 }
123 /// <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>
124 /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
125 /// <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>
126 /// <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>
127 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128 self.inner = self.inner.set_client_token(input);
129 self
130 }
131 /// <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>
132 /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
133 /// <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>
134 /// <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>
135 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
136 self.inner.get_client_token()
137 }
138 /// <p>Specifies the validation setting for this policy store.</p>
139 /// <p>Currently, the only valid and required value is <code>Mode</code>.</p><important>
140 /// <p>We recommend that you turn on <code>STRICT</code> mode only after you define a schema. If a schema doesn't exist, then <code>STRICT</code> mode causes any policy to fail validation, and Verified Permissions rejects the policy. You can turn off validation by using the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a>. Then, when you have a schema defined, use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a> again to turn validation back on.</p>
141 /// </important>
142 pub fn validation_settings(mut self, input: crate::types::ValidationSettings) -> Self {
143 self.inner = self.inner.validation_settings(input);
144 self
145 }
146 /// <p>Specifies the validation setting for this policy store.</p>
147 /// <p>Currently, the only valid and required value is <code>Mode</code>.</p><important>
148 /// <p>We recommend that you turn on <code>STRICT</code> mode only after you define a schema. If a schema doesn't exist, then <code>STRICT</code> mode causes any policy to fail validation, and Verified Permissions rejects the policy. You can turn off validation by using the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a>. Then, when you have a schema defined, use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a> again to turn validation back on.</p>
149 /// </important>
150 pub fn set_validation_settings(mut self, input: ::std::option::Option<crate::types::ValidationSettings>) -> Self {
151 self.inner = self.inner.set_validation_settings(input);
152 self
153 }
154 /// <p>Specifies the validation setting for this policy store.</p>
155 /// <p>Currently, the only valid and required value is <code>Mode</code>.</p><important>
156 /// <p>We recommend that you turn on <code>STRICT</code> mode only after you define a schema. If a schema doesn't exist, then <code>STRICT</code> mode causes any policy to fail validation, and Verified Permissions rejects the policy. You can turn off validation by using the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a>. Then, when you have a schema defined, use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a> again to turn validation back on.</p>
157 /// </important>
158 pub fn get_validation_settings(&self) -> &::std::option::Option<crate::types::ValidationSettings> {
159 self.inner.get_validation_settings()
160 }
161 /// <p>Descriptive text that you can provide to help with identification of the current policy store.</p>
162 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163 self.inner = self.inner.description(input.into());
164 self
165 }
166 /// <p>Descriptive text that you can provide to help with identification of the current policy store.</p>
167 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168 self.inner = self.inner.set_description(input);
169 self
170 }
171 /// <p>Descriptive text that you can provide to help with identification of the current policy store.</p>
172 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
173 self.inner.get_description()
174 }
175 /// <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>
176 /// <p>The default state is <code>DISABLED</code>.</p>
177 pub fn deletion_protection(mut self, input: crate::types::DeletionProtection) -> Self {
178 self.inner = self.inner.deletion_protection(input);
179 self
180 }
181 /// <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>
182 /// <p>The default state is <code>DISABLED</code>.</p>
183 pub fn set_deletion_protection(mut self, input: ::std::option::Option<crate::types::DeletionProtection>) -> Self {
184 self.inner = self.inner.set_deletion_protection(input);
185 self
186 }
187 /// <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>
188 /// <p>The default state is <code>DISABLED</code>.</p>
189 pub fn get_deletion_protection(&self) -> &::std::option::Option<crate::types::DeletionProtection> {
190 self.inner.get_deletion_protection()
191 }
192 ///
193 /// Adds a key-value pair to `tags`.
194 ///
195 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
196 ///
197 /// <p>The list of key-value pairs to associate with the policy store.</p>
198 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
199 self.inner = self.inner.tags(k.into(), v.into());
200 self
201 }
202 /// <p>The list of key-value pairs to associate with the policy store.</p>
203 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
204 self.inner = self.inner.set_tags(input);
205 self
206 }
207 /// <p>The list of key-value pairs to associate with the policy store.</p>
208 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
209 self.inner.get_tags()
210 }
211}