aws_sdk_cloudfront/operation/update_distribution/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_distribution::_update_distribution_output::UpdateDistributionOutputBuilder;
3
4pub use crate::operation::update_distribution::_update_distribution_input::UpdateDistributionInputBuilder;
5
6impl crate::operation::update_distribution::builders::UpdateDistributionInputBuilder {
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::update_distribution::UpdateDistributionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_distribution::UpdateDistributionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_distribution();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateDistribution`.
24///
25/// <p>Updates the configuration for a CloudFront distribution.</p>
26/// <p>The update process includes getting the current distribution configuration, updating it to make your changes, and then submitting an <code>UpdateDistribution</code> request to make the updates.</p>
27/// <p><b>To update a web distribution using the CloudFront API</b></p>
28/// <ol>
29/// <li>
30/// <p>Use <code>GetDistributionConfig</code> to get the current configuration, including the version identifier (<code>ETag</code>).</p></li>
31/// <li>
32/// <p>Update the distribution configuration that was returned in the response. Note the following important requirements and restrictions:</p>
33/// <ul>
34/// <li>
35/// <p>You must copy the <code>ETag</code> field value from the response. (You'll use it for the <code>IfMatch</code> parameter in your request.) Then, remove the <code>ETag</code> field from the distribution configuration.</p></li>
36/// <li>
37/// <p>You can't change the value of <code>CallerReference</code>.</p></li>
38/// </ul></li>
39/// <li>
40/// <p>Submit an <code>UpdateDistribution</code> request, providing the updated distribution configuration. The new configuration replaces the existing configuration. The values that you specify in an <code>UpdateDistribution</code> request are not merged into your existing configuration. Make sure to include all fields: the ones that you modified and also the ones that you didn't.</p></li>
41/// </ol>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct UpdateDistributionFluentBuilder {
44    handle: ::std::sync::Arc<crate::client::Handle>,
45    inner: crate::operation::update_distribution::builders::UpdateDistributionInputBuilder,
46    config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49    crate::client::customize::internal::CustomizableSend<
50        crate::operation::update_distribution::UpdateDistributionOutput,
51        crate::operation::update_distribution::UpdateDistributionError,
52    > for UpdateDistributionFluentBuilder
53{
54    fn send(
55        self,
56        config_override: crate::config::Builder,
57    ) -> crate::client::customize::internal::BoxFuture<
58        crate::client::customize::internal::SendResult<
59            crate::operation::update_distribution::UpdateDistributionOutput,
60            crate::operation::update_distribution::UpdateDistributionError,
61        >,
62    > {
63        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64    }
65}
66impl UpdateDistributionFluentBuilder {
67    /// Creates a new `UpdateDistributionFluentBuilder`.
68    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
69        Self {
70            handle,
71            inner: ::std::default::Default::default(),
72            config_override: ::std::option::Option::None,
73        }
74    }
75    /// Access the UpdateDistribution as a reference.
76    pub fn as_input(&self) -> &crate::operation::update_distribution::builders::UpdateDistributionInputBuilder {
77        &self.inner
78    }
79    /// Sends the request and returns the response.
80    ///
81    /// If an error occurs, an `SdkError` will be returned with additional details that
82    /// can be matched against.
83    ///
84    /// By default, any retryable failures will be retried twice. Retry behavior
85    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
86    /// set when configuring the client.
87    pub async fn send(
88        self,
89    ) -> ::std::result::Result<
90        crate::operation::update_distribution::UpdateDistributionOutput,
91        ::aws_smithy_runtime_api::client::result::SdkError<
92            crate::operation::update_distribution::UpdateDistributionError,
93            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
94        >,
95    > {
96        let input = self
97            .inner
98            .build()
99            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
100        let runtime_plugins = crate::operation::update_distribution::UpdateDistribution::operation_runtime_plugins(
101            self.handle.runtime_plugins.clone(),
102            &self.handle.conf,
103            self.config_override,
104        );
105        crate::operation::update_distribution::UpdateDistribution::orchestrate(&runtime_plugins, input).await
106    }
107
108    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
109    pub fn customize(
110        self,
111    ) -> crate::client::customize::CustomizableOperation<
112        crate::operation::update_distribution::UpdateDistributionOutput,
113        crate::operation::update_distribution::UpdateDistributionError,
114        Self,
115    > {
116        crate::client::customize::CustomizableOperation::new(self)
117    }
118    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
119        self.set_config_override(::std::option::Option::Some(config_override.into()));
120        self
121    }
122
123    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
124        self.config_override = config_override;
125        self
126    }
127    /// <p>The distribution's configuration information.</p>
128    pub fn distribution_config(mut self, input: crate::types::DistributionConfig) -> Self {
129        self.inner = self.inner.distribution_config(input);
130        self
131    }
132    /// <p>The distribution's configuration information.</p>
133    pub fn set_distribution_config(mut self, input: ::std::option::Option<crate::types::DistributionConfig>) -> Self {
134        self.inner = self.inner.set_distribution_config(input);
135        self
136    }
137    /// <p>The distribution's configuration information.</p>
138    pub fn get_distribution_config(&self) -> &::std::option::Option<crate::types::DistributionConfig> {
139        self.inner.get_distribution_config()
140    }
141    /// <p>The distribution's id.</p>
142    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.inner = self.inner.id(input.into());
144        self
145    }
146    /// <p>The distribution's id.</p>
147    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.inner = self.inner.set_id(input);
149        self
150    }
151    /// <p>The distribution's id.</p>
152    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_id()
154    }
155    /// <p>The value of the <code>ETag</code> header that you received when retrieving the distribution's configuration. For example: <code>E2QWRUHAPOMQZL</code>.</p>
156    pub fn if_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157        self.inner = self.inner.if_match(input.into());
158        self
159    }
160    /// <p>The value of the <code>ETag</code> header that you received when retrieving the distribution's configuration. For example: <code>E2QWRUHAPOMQZL</code>.</p>
161    pub fn set_if_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162        self.inner = self.inner.set_if_match(input);
163        self
164    }
165    /// <p>The value of the <code>ETag</code> header that you received when retrieving the distribution's configuration. For example: <code>E2QWRUHAPOMQZL</code>.</p>
166    pub fn get_if_match(&self) -> &::std::option::Option<::std::string::String> {
167        self.inner.get_if_match()
168    }
169}