aws_sdk_shield/operation/create_protection/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_protection::_create_protection_output::CreateProtectionOutputBuilder;
3
4pub use crate::operation::create_protection::_create_protection_input::CreateProtectionInputBuilder;
5
6impl crate::operation::create_protection::builders::CreateProtectionInputBuilder {
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_protection::CreateProtectionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_protection::CreateProtectionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_protection();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateProtection`.
24///
25/// <p>Enables Shield Advanced for a specific Amazon Web Services resource. The resource can be an Amazon CloudFront distribution, Amazon Route 53 hosted zone, Global Accelerator standard accelerator, Elastic IP Address, Application Load Balancer, or a Classic Load Balancer. You can protect Amazon EC2 instances and Network Load Balancers by association with protected Amazon EC2 Elastic IP addresses.</p>
26/// <p>You can add protection to only a single resource with each <code>CreateProtection</code> request. You can add protection to multiple resources at once through the Shield Advanced console at <a href="https://console.aws.amazon.com/wafv2/shieldv2#/">https://console.aws.amazon.com/wafv2/shieldv2#/</a>. For more information see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/getting-started-ddos.html">Getting Started with Shield Advanced</a> and <a href="https://docs.aws.amazon.com/waf/latest/developerguide/configure-new-protection.html">Adding Shield Advanced protection to Amazon Web Services resources</a>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateProtectionFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::create_protection::builders::CreateProtectionInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34 crate::client::customize::internal::CustomizableSend<
35 crate::operation::create_protection::CreateProtectionOutput,
36 crate::operation::create_protection::CreateProtectionError,
37 > for CreateProtectionFluentBuilder
38{
39 fn send(
40 self,
41 config_override: crate::config::Builder,
42 ) -> crate::client::customize::internal::BoxFuture<
43 crate::client::customize::internal::SendResult<
44 crate::operation::create_protection::CreateProtectionOutput,
45 crate::operation::create_protection::CreateProtectionError,
46 >,
47 > {
48 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49 }
50}
51impl CreateProtectionFluentBuilder {
52 /// Creates a new `CreateProtectionFluentBuilder`.
53 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54 Self {
55 handle,
56 inner: ::std::default::Default::default(),
57 config_override: ::std::option::Option::None,
58 }
59 }
60 /// Access the CreateProtection as a reference.
61 pub fn as_input(&self) -> &crate::operation::create_protection::builders::CreateProtectionInputBuilder {
62 &self.inner
63 }
64 /// Sends the request and returns the response.
65 ///
66 /// If an error occurs, an `SdkError` will be returned with additional details that
67 /// can be matched against.
68 ///
69 /// By default, any retryable failures will be retried twice. Retry behavior
70 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71 /// set when configuring the client.
72 pub async fn send(
73 self,
74 ) -> ::std::result::Result<
75 crate::operation::create_protection::CreateProtectionOutput,
76 ::aws_smithy_runtime_api::client::result::SdkError<
77 crate::operation::create_protection::CreateProtectionError,
78 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79 >,
80 > {
81 let input = self
82 .inner
83 .build()
84 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85 let runtime_plugins = crate::operation::create_protection::CreateProtection::operation_runtime_plugins(
86 self.handle.runtime_plugins.clone(),
87 &self.handle.conf,
88 self.config_override,
89 );
90 crate::operation::create_protection::CreateProtection::orchestrate(&runtime_plugins, input).await
91 }
92
93 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94 pub fn customize(
95 self,
96 ) -> crate::client::customize::CustomizableOperation<
97 crate::operation::create_protection::CreateProtectionOutput,
98 crate::operation::create_protection::CreateProtectionError,
99 Self,
100 > {
101 crate::client::customize::CustomizableOperation::new(self)
102 }
103 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104 self.set_config_override(::std::option::Option::Some(config_override.into()));
105 self
106 }
107
108 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109 self.config_override = config_override;
110 self
111 }
112 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
113 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114 self.inner = self.inner.name(input.into());
115 self
116 }
117 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
118 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119 self.inner = self.inner.set_name(input);
120 self
121 }
122 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
123 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
124 self.inner.get_name()
125 }
126 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
127 /// <p>The ARN should be in one of the following formats:</p>
128 /// <ul>
129 /// <li>
130 /// <p>For an Application Load Balancer: <code>arn:aws:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/app/<i>load-balancer-name</i>/<i>load-balancer-id</i> </code></p></li>
131 /// <li>
132 /// <p>For an Elastic Load Balancer (Classic Load Balancer): <code>arn:aws:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/<i>load-balancer-name</i> </code></p></li>
133 /// <li>
134 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
135 /// <li>
136 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
137 /// <li>
138 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
139 /// <li>
140 /// <p>For an Elastic IP address: <code>arn:aws:ec2:<i>region</i>:<i>account-id</i>:eip-allocation/<i>allocation-id</i> </code></p></li>
141 /// </ul>
142 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143 self.inner = self.inner.resource_arn(input.into());
144 self
145 }
146 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
147 /// <p>The ARN should be in one of the following formats:</p>
148 /// <ul>
149 /// <li>
150 /// <p>For an Application Load Balancer: <code>arn:aws:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/app/<i>load-balancer-name</i>/<i>load-balancer-id</i> </code></p></li>
151 /// <li>
152 /// <p>For an Elastic Load Balancer (Classic Load Balancer): <code>arn:aws:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/<i>load-balancer-name</i> </code></p></li>
153 /// <li>
154 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
155 /// <li>
156 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
157 /// <li>
158 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
159 /// <li>
160 /// <p>For an Elastic IP address: <code>arn:aws:ec2:<i>region</i>:<i>account-id</i>:eip-allocation/<i>allocation-id</i> </code></p></li>
161 /// </ul>
162 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163 self.inner = self.inner.set_resource_arn(input);
164 self
165 }
166 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
167 /// <p>The ARN should be in one of the following formats:</p>
168 /// <ul>
169 /// <li>
170 /// <p>For an Application Load Balancer: <code>arn:aws:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/app/<i>load-balancer-name</i>/<i>load-balancer-id</i> </code></p></li>
171 /// <li>
172 /// <p>For an Elastic Load Balancer (Classic Load Balancer): <code>arn:aws:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/<i>load-balancer-name</i> </code></p></li>
173 /// <li>
174 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
175 /// <li>
176 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
177 /// <li>
178 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
179 /// <li>
180 /// <p>For an Elastic IP address: <code>arn:aws:ec2:<i>region</i>:<i>account-id</i>:eip-allocation/<i>allocation-id</i> </code></p></li>
181 /// </ul>
182 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
183 self.inner.get_resource_arn()
184 }
185 ///
186 /// Appends an item to `Tags`.
187 ///
188 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
189 ///
190 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
191 pub fn tags(mut self, input: crate::types::Tag) -> Self {
192 self.inner = self.inner.tags(input);
193 self
194 }
195 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
196 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
197 self.inner = self.inner.set_tags(input);
198 self
199 }
200 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
201 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
202 self.inner.get_tags()
203 }
204}