aws_sdk_verifiedpermissions/operation/put_schema/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_schema::_put_schema_output::PutSchemaOutputBuilder;
3
4pub use crate::operation::put_schema::_put_schema_input::PutSchemaInputBuilder;
5
6impl crate::operation::put_schema::builders::PutSchemaInputBuilder {
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::put_schema::PutSchemaOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_schema::PutSchemaError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_schema();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutSchema`.
24///
25/// <p>Creates or updates the policy schema in the specified policy store. The schema is used to validate any Cedar policies and policy templates submitted to the policy store. Any changes to the schema validate only policies and templates submitted after the schema change. Existing policies and templates are not re-evaluated against the changed schema. If you later update a policy, then it is evaluated against the new schema at that time.</p><note>
26/// <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>
27/// </note>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct PutSchemaFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::put_schema::builders::PutSchemaInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl crate::client::customize::internal::CustomizableSend<crate::operation::put_schema::PutSchemaOutput, crate::operation::put_schema::PutSchemaError>
35    for PutSchemaFluentBuilder
36{
37    fn send(
38        self,
39        config_override: crate::config::Builder,
40    ) -> crate::client::customize::internal::BoxFuture<
41        crate::client::customize::internal::SendResult<crate::operation::put_schema::PutSchemaOutput, crate::operation::put_schema::PutSchemaError>,
42    > {
43        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
44    }
45}
46impl PutSchemaFluentBuilder {
47    /// Creates a new `PutSchemaFluentBuilder`.
48    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
49        Self {
50            handle,
51            inner: ::std::default::Default::default(),
52            config_override: ::std::option::Option::None,
53        }
54    }
55    /// Access the PutSchema as a reference.
56    pub fn as_input(&self) -> &crate::operation::put_schema::builders::PutSchemaInputBuilder {
57        &self.inner
58    }
59    /// Sends the request and returns the response.
60    ///
61    /// If an error occurs, an `SdkError` will be returned with additional details that
62    /// can be matched against.
63    ///
64    /// By default, any retryable failures will be retried twice. Retry behavior
65    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
66    /// set when configuring the client.
67    pub async fn send(
68        self,
69    ) -> ::std::result::Result<
70        crate::operation::put_schema::PutSchemaOutput,
71        ::aws_smithy_runtime_api::client::result::SdkError<
72            crate::operation::put_schema::PutSchemaError,
73            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
74        >,
75    > {
76        let input = self
77            .inner
78            .build()
79            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
80        let runtime_plugins = crate::operation::put_schema::PutSchema::operation_runtime_plugins(
81            self.handle.runtime_plugins.clone(),
82            &self.handle.conf,
83            self.config_override,
84        );
85        crate::operation::put_schema::PutSchema::orchestrate(&runtime_plugins, input).await
86    }
87
88    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
89    pub fn customize(
90        self,
91    ) -> crate::client::customize::CustomizableOperation<
92        crate::operation::put_schema::PutSchemaOutput,
93        crate::operation::put_schema::PutSchemaError,
94        Self,
95    > {
96        crate::client::customize::CustomizableOperation::new(self)
97    }
98    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
99        self.set_config_override(::std::option::Option::Some(config_override.into()));
100        self
101    }
102
103    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
104        self.config_override = config_override;
105        self
106    }
107    /// <p>Specifies the ID of the policy store in which to place the schema.</p>
108    pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        self.inner = self.inner.policy_store_id(input.into());
110        self
111    }
112    /// <p>Specifies the ID of the policy store in which to place the schema.</p>
113    pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114        self.inner = self.inner.set_policy_store_id(input);
115        self
116    }
117    /// <p>Specifies the ID of the policy store in which to place the schema.</p>
118    pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
119        self.inner.get_policy_store_id()
120    }
121    /// <p>Specifies the definition of the schema to be stored. The schema definition must be written in Cedar schema JSON.</p>
122    pub fn definition(mut self, input: crate::types::SchemaDefinition) -> Self {
123        self.inner = self.inner.definition(input);
124        self
125    }
126    /// <p>Specifies the definition of the schema to be stored. The schema definition must be written in Cedar schema JSON.</p>
127    pub fn set_definition(mut self, input: ::std::option::Option<crate::types::SchemaDefinition>) -> Self {
128        self.inner = self.inner.set_definition(input);
129        self
130    }
131    /// <p>Specifies the definition of the schema to be stored. The schema definition must be written in Cedar schema JSON.</p>
132    pub fn get_definition(&self) -> &::std::option::Option<crate::types::SchemaDefinition> {
133        self.inner.get_definition()
134    }
135}