aws_sdk_shield/operation/update_protection_group/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_protection_group::_update_protection_group_output::UpdateProtectionGroupOutputBuilder;
3
4pub use crate::operation::update_protection_group::_update_protection_group_input::UpdateProtectionGroupInputBuilder;
5
6impl crate::operation::update_protection_group::builders::UpdateProtectionGroupInputBuilder {
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_protection_group::UpdateProtectionGroupOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_protection_group::UpdateProtectionGroupError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_protection_group();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateProtectionGroup`.
24///
25/// <p>Updates an existing protection group. A protection group is a grouping of protected resources so they can be handled as a collective. This resource grouping improves the accuracy of detection and reduces false positives.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct UpdateProtectionGroupFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::update_protection_group::builders::UpdateProtectionGroupInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::update_protection_group::UpdateProtectionGroupOutput,
35        crate::operation::update_protection_group::UpdateProtectionGroupError,
36    > for UpdateProtectionGroupFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::update_protection_group::UpdateProtectionGroupOutput,
44            crate::operation::update_protection_group::UpdateProtectionGroupError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl UpdateProtectionGroupFluentBuilder {
51    /// Creates a new `UpdateProtectionGroupFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the UpdateProtectionGroup as a reference.
60    pub fn as_input(&self) -> &crate::operation::update_protection_group::builders::UpdateProtectionGroupInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::update_protection_group::UpdateProtectionGroupOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::update_protection_group::UpdateProtectionGroupError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::update_protection_group::UpdateProtectionGroup::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::update_protection_group::UpdateProtectionGroup::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::update_protection_group::UpdateProtectionGroupOutput,
97        crate::operation::update_protection_group::UpdateProtectionGroupError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.</p>
112    pub fn protection_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.protection_group_id(input.into());
114        self
115    }
116    /// <p>The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.</p>
117    pub fn set_protection_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_protection_group_id(input);
119        self
120    }
121    /// <p>The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.</p>
122    pub fn get_protection_group_id(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_protection_group_id()
124    }
125    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
126    /// <ul>
127    /// <li>
128    /// <p>Sum - Use the total traffic across the group. This is a good choice for most cases. Examples include Elastic IP addresses for EC2 instances that scale manually or automatically.</p></li>
129    /// <li>
130    /// <p>Mean - Use the average of the traffic across the group. This is a good choice for resources that share traffic uniformly. Examples include accelerators and load balancers.</p></li>
131    /// <li>
132    /// <p>Max - Use the highest traffic from each resource. This is useful for resources that don't share traffic and for resources that share that traffic in a non-uniform way. Examples include Amazon CloudFront distributions and origin resources for CloudFront distributions.</p></li>
133    /// </ul>
134    pub fn aggregation(mut self, input: crate::types::ProtectionGroupAggregation) -> Self {
135        self.inner = self.inner.aggregation(input);
136        self
137    }
138    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
139    /// <ul>
140    /// <li>
141    /// <p>Sum - Use the total traffic across the group. This is a good choice for most cases. Examples include Elastic IP addresses for EC2 instances that scale manually or automatically.</p></li>
142    /// <li>
143    /// <p>Mean - Use the average of the traffic across the group. This is a good choice for resources that share traffic uniformly. Examples include accelerators and load balancers.</p></li>
144    /// <li>
145    /// <p>Max - Use the highest traffic from each resource. This is useful for resources that don't share traffic and for resources that share that traffic in a non-uniform way. Examples include Amazon CloudFront distributions and origin resources for CloudFront distributions.</p></li>
146    /// </ul>
147    pub fn set_aggregation(mut self, input: ::std::option::Option<crate::types::ProtectionGroupAggregation>) -> Self {
148        self.inner = self.inner.set_aggregation(input);
149        self
150    }
151    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
152    /// <ul>
153    /// <li>
154    /// <p>Sum - Use the total traffic across the group. This is a good choice for most cases. Examples include Elastic IP addresses for EC2 instances that scale manually or automatically.</p></li>
155    /// <li>
156    /// <p>Mean - Use the average of the traffic across the group. This is a good choice for resources that share traffic uniformly. Examples include accelerators and load balancers.</p></li>
157    /// <li>
158    /// <p>Max - Use the highest traffic from each resource. This is useful for resources that don't share traffic and for resources that share that traffic in a non-uniform way. Examples include Amazon CloudFront distributions and origin resources for CloudFront distributions.</p></li>
159    /// </ul>
160    pub fn get_aggregation(&self) -> &::std::option::Option<crate::types::ProtectionGroupAggregation> {
161        self.inner.get_aggregation()
162    }
163    /// <p>The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.</p>
164    pub fn pattern(mut self, input: crate::types::ProtectionGroupPattern) -> Self {
165        self.inner = self.inner.pattern(input);
166        self
167    }
168    /// <p>The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.</p>
169    pub fn set_pattern(mut self, input: ::std::option::Option<crate::types::ProtectionGroupPattern>) -> Self {
170        self.inner = self.inner.set_pattern(input);
171        self
172    }
173    /// <p>The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.</p>
174    pub fn get_pattern(&self) -> &::std::option::Option<crate::types::ProtectionGroupPattern> {
175        self.inner.get_pattern()
176    }
177    /// <p>The resource type to include in the protection group. All protected resources of this type are included in the protection group. You must set this when you set <code>Pattern</code> to <code>BY_RESOURCE_TYPE</code> and you must not set it for any other <code>Pattern</code> setting.</p>
178    pub fn resource_type(mut self, input: crate::types::ProtectedResourceType) -> Self {
179        self.inner = self.inner.resource_type(input);
180        self
181    }
182    /// <p>The resource type to include in the protection group. All protected resources of this type are included in the protection group. You must set this when you set <code>Pattern</code> to <code>BY_RESOURCE_TYPE</code> and you must not set it for any other <code>Pattern</code> setting.</p>
183    pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ProtectedResourceType>) -> Self {
184        self.inner = self.inner.set_resource_type(input);
185        self
186    }
187    /// <p>The resource type to include in the protection group. All protected resources of this type are included in the protection group. You must set this when you set <code>Pattern</code> to <code>BY_RESOURCE_TYPE</code> and you must not set it for any other <code>Pattern</code> setting.</p>
188    pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ProtectedResourceType> {
189        self.inner.get_resource_type()
190    }
191    ///
192    /// Appends an item to `Members`.
193    ///
194    /// To override the contents of this collection use [`set_members`](Self::set_members).
195    ///
196    /// <p>The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set <code>Pattern</code> to <code>ARBITRARY</code> and you must not set it for any other <code>Pattern</code> setting.</p>
197    pub fn members(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.inner = self.inner.members(input.into());
199        self
200    }
201    /// <p>The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set <code>Pattern</code> to <code>ARBITRARY</code> and you must not set it for any other <code>Pattern</code> setting.</p>
202    pub fn set_members(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
203        self.inner = self.inner.set_members(input);
204        self
205    }
206    /// <p>The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set <code>Pattern</code> to <code>ARBITRARY</code> and you must not set it for any other <code>Pattern</code> setting.</p>
207    pub fn get_members(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
208        self.inner.get_members()
209    }
210}