Skip to main content

aws_sdk_shield/operation/update_protection_group/
_update_protection_group_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct UpdateProtectionGroupInput {
6    /// <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>
7    pub protection_group_id: ::std::option::Option<::std::string::String>,
8    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
9    /// <ul>
10    /// <li>
11    /// <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>
12    /// <li>
13    /// <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>
14    /// <li>
15    /// <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>
16    /// </ul>
17    pub aggregation: ::std::option::Option<crate::types::ProtectionGroupAggregation>,
18    /// <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>
19    pub pattern: ::std::option::Option<crate::types::ProtectionGroupPattern>,
20    /// <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>
21    pub resource_type: ::std::option::Option<crate::types::ProtectedResourceType>,
22    /// <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>
23    pub members: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
24}
25impl UpdateProtectionGroupInput {
26    /// <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>
27    pub fn protection_group_id(&self) -> ::std::option::Option<&str> {
28        self.protection_group_id.as_deref()
29    }
30    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
31    /// <ul>
32    /// <li>
33    /// <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>
34    /// <li>
35    /// <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>
36    /// <li>
37    /// <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>
38    /// </ul>
39    pub fn aggregation(&self) -> ::std::option::Option<&crate::types::ProtectionGroupAggregation> {
40        self.aggregation.as_ref()
41    }
42    /// <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>
43    pub fn pattern(&self) -> ::std::option::Option<&crate::types::ProtectionGroupPattern> {
44        self.pattern.as_ref()
45    }
46    /// <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>
47    pub fn resource_type(&self) -> ::std::option::Option<&crate::types::ProtectedResourceType> {
48        self.resource_type.as_ref()
49    }
50    /// <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>
51    ///
52    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.members.is_none()`.
53    pub fn members(&self) -> &[::std::string::String] {
54        self.members.as_deref().unwrap_or_default()
55    }
56}
57impl UpdateProtectionGroupInput {
58    /// Creates a new builder-style object to manufacture [`UpdateProtectionGroupInput`](crate::operation::update_protection_group::UpdateProtectionGroupInput).
59    pub fn builder() -> crate::operation::update_protection_group::builders::UpdateProtectionGroupInputBuilder {
60        crate::operation::update_protection_group::builders::UpdateProtectionGroupInputBuilder::default()
61    }
62}
63
64/// A builder for [`UpdateProtectionGroupInput`](crate::operation::update_protection_group::UpdateProtectionGroupInput).
65#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
66#[non_exhaustive]
67pub struct UpdateProtectionGroupInputBuilder {
68    pub(crate) protection_group_id: ::std::option::Option<::std::string::String>,
69    pub(crate) aggregation: ::std::option::Option<crate::types::ProtectionGroupAggregation>,
70    pub(crate) pattern: ::std::option::Option<crate::types::ProtectionGroupPattern>,
71    pub(crate) resource_type: ::std::option::Option<crate::types::ProtectedResourceType>,
72    pub(crate) members: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
73}
74impl UpdateProtectionGroupInputBuilder {
75    /// <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>
76    /// This field is required.
77    pub fn protection_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.protection_group_id = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <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>
82    pub fn set_protection_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.protection_group_id = input;
84        self
85    }
86    /// <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>
87    pub fn get_protection_group_id(&self) -> &::std::option::Option<::std::string::String> {
88        &self.protection_group_id
89    }
90    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
91    /// <ul>
92    /// <li>
93    /// <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>
94    /// <li>
95    /// <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>
96    /// <li>
97    /// <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>
98    /// </ul>
99    /// This field is required.
100    pub fn aggregation(mut self, input: crate::types::ProtectionGroupAggregation) -> Self {
101        self.aggregation = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
105    /// <ul>
106    /// <li>
107    /// <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>
108    /// <li>
109    /// <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>
110    /// <li>
111    /// <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>
112    /// </ul>
113    pub fn set_aggregation(mut self, input: ::std::option::Option<crate::types::ProtectionGroupAggregation>) -> Self {
114        self.aggregation = input;
115        self
116    }
117    /// <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p>
118    /// <ul>
119    /// <li>
120    /// <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>
121    /// <li>
122    /// <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>
123    /// <li>
124    /// <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>
125    /// </ul>
126    pub fn get_aggregation(&self) -> &::std::option::Option<crate::types::ProtectionGroupAggregation> {
127        &self.aggregation
128    }
129    /// <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>
130    /// This field is required.
131    pub fn pattern(mut self, input: crate::types::ProtectionGroupPattern) -> Self {
132        self.pattern = ::std::option::Option::Some(input);
133        self
134    }
135    /// <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>
136    pub fn set_pattern(mut self, input: ::std::option::Option<crate::types::ProtectionGroupPattern>) -> Self {
137        self.pattern = input;
138        self
139    }
140    /// <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>
141    pub fn get_pattern(&self) -> &::std::option::Option<crate::types::ProtectionGroupPattern> {
142        &self.pattern
143    }
144    /// <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>
145    pub fn resource_type(mut self, input: crate::types::ProtectedResourceType) -> Self {
146        self.resource_type = ::std::option::Option::Some(input);
147        self
148    }
149    /// <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>
150    pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ProtectedResourceType>) -> Self {
151        self.resource_type = input;
152        self
153    }
154    /// <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>
155    pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ProtectedResourceType> {
156        &self.resource_type
157    }
158    /// Appends an item to `members`.
159    ///
160    /// To override the contents of this collection use [`set_members`](Self::set_members).
161    ///
162    /// <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>
163    pub fn members(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        let mut v = self.members.unwrap_or_default();
165        v.push(input.into());
166        self.members = ::std::option::Option::Some(v);
167        self
168    }
169    /// <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>
170    pub fn set_members(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
171        self.members = input;
172        self
173    }
174    /// <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>
175    pub fn get_members(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
176        &self.members
177    }
178    /// Consumes the builder and constructs a [`UpdateProtectionGroupInput`](crate::operation::update_protection_group::UpdateProtectionGroupInput).
179    pub fn build(
180        self,
181    ) -> ::std::result::Result<crate::operation::update_protection_group::UpdateProtectionGroupInput, ::aws_smithy_types::error::operation::BuildError>
182    {
183        ::std::result::Result::Ok(crate::operation::update_protection_group::UpdateProtectionGroupInput {
184            protection_group_id: self.protection_group_id,
185            aggregation: self.aggregation,
186            pattern: self.pattern,
187            resource_type: self.resource_type,
188            members: self.members,
189        })
190    }
191}