aws_sdk_cloudfront/operation/update_response_headers_policy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_response_headers_policy::_update_response_headers_policy_output::UpdateResponseHeadersPolicyOutputBuilder;
3
4pub use crate::operation::update_response_headers_policy::_update_response_headers_policy_input::UpdateResponseHeadersPolicyInputBuilder;
5
6impl crate::operation::update_response_headers_policy::builders::UpdateResponseHeadersPolicyInputBuilder {
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_response_headers_policy::UpdateResponseHeadersPolicyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_response_headers_policy();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateResponseHeadersPolicy`.
24///
25/// <p>Updates a response headers policy.</p>
26/// <p>When you update a response headers policy, the entire policy is replaced. You cannot update some policy fields independent of others. To update a response headers policy configuration:</p>
27/// <ol>
28/// <li>
29/// <p>Use <code>GetResponseHeadersPolicyConfig</code> to get the current policy's configuration.</p></li>
30/// <li>
31/// <p>Modify the fields in the response headers policy configuration that you want to update.</p></li>
32/// <li>
33/// <p>Call <code>UpdateResponseHeadersPolicy</code>, providing the entire response headers policy configuration, including the fields that you modified and those that you didn't.</p></li>
34/// </ol>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct UpdateResponseHeadersPolicyFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::update_response_headers_policy::builders::UpdateResponseHeadersPolicyInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyOutput,
44        crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyError,
45    > for UpdateResponseHeadersPolicyFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyOutput,
53            crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl UpdateResponseHeadersPolicyFluentBuilder {
60    /// Creates a new `UpdateResponseHeadersPolicyFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the UpdateResponseHeadersPolicy as a reference.
69    pub fn as_input(&self) -> &crate::operation::update_response_headers_policy::builders::UpdateResponseHeadersPolicyInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicy::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicy::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyOutput,
106        crate::operation::update_response_headers_policy::UpdateResponseHeadersPolicyError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>A response headers policy configuration.</p>
121    pub fn response_headers_policy_config(mut self, input: crate::types::ResponseHeadersPolicyConfig) -> Self {
122        self.inner = self.inner.response_headers_policy_config(input);
123        self
124    }
125    /// <p>A response headers policy configuration.</p>
126    pub fn set_response_headers_policy_config(mut self, input: ::std::option::Option<crate::types::ResponseHeadersPolicyConfig>) -> Self {
127        self.inner = self.inner.set_response_headers_policy_config(input);
128        self
129    }
130    /// <p>A response headers policy configuration.</p>
131    pub fn get_response_headers_policy_config(&self) -> &::std::option::Option<crate::types::ResponseHeadersPolicyConfig> {
132        self.inner.get_response_headers_policy_config()
133    }
134    /// <p>The identifier for the response headers policy that you are updating.</p>
135    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.id(input.into());
137        self
138    }
139    /// <p>The identifier for the response headers policy that you are updating.</p>
140    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_id(input);
142        self
143    }
144    /// <p>The identifier for the response headers policy that you are updating.</p>
145    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_id()
147    }
148    /// <p>The version of the response headers policy that you are updating.</p>
149    /// <p>The version is returned in the cache policy's <code>ETag</code> field in the response to <code>GetResponseHeadersPolicyConfig</code>.</p>
150    pub fn if_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.inner = self.inner.if_match(input.into());
152        self
153    }
154    /// <p>The version of the response headers policy that you are updating.</p>
155    /// <p>The version is returned in the cache policy's <code>ETag</code> field in the response to <code>GetResponseHeadersPolicyConfig</code>.</p>
156    pub fn set_if_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.inner = self.inner.set_if_match(input);
158        self
159    }
160    /// <p>The version of the response headers policy that you are updating.</p>
161    /// <p>The version is returned in the cache policy's <code>ETag</code> field in the response to <code>GetResponseHeadersPolicyConfig</code>.</p>
162    pub fn get_if_match(&self) -> &::std::option::Option<::std::string::String> {
163        self.inner.get_if_match()
164    }
165}