aws_sdk_shield/operation/create_protection/_create_protection_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 CreateProtectionInput {
6 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
7 pub name: ::std::option::Option<::std::string::String>,
8 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
9 /// <p>The ARN should be in one of the following formats:</p>
10 /// <ul>
11 /// <li>
12 /// <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>
13 /// <li>
14 /// <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>
15 /// <li>
16 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
17 /// <li>
18 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
19 /// <li>
20 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
21 /// <li>
22 /// <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>
23 /// </ul>
24 pub resource_arn: ::std::option::Option<::std::string::String>,
25 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
26 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
27}
28impl CreateProtectionInput {
29 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
30 pub fn name(&self) -> ::std::option::Option<&str> {
31 self.name.as_deref()
32 }
33 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
34 /// <p>The ARN should be in one of the following formats:</p>
35 /// <ul>
36 /// <li>
37 /// <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>
38 /// <li>
39 /// <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>
40 /// <li>
41 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
42 /// <li>
43 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
44 /// <li>
45 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
46 /// <li>
47 /// <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>
48 /// </ul>
49 pub fn resource_arn(&self) -> ::std::option::Option<&str> {
50 self.resource_arn.as_deref()
51 }
52 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
53 ///
54 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
55 pub fn tags(&self) -> &[crate::types::Tag] {
56 self.tags.as_deref().unwrap_or_default()
57 }
58}
59impl CreateProtectionInput {
60 /// Creates a new builder-style object to manufacture [`CreateProtectionInput`](crate::operation::create_protection::CreateProtectionInput).
61 pub fn builder() -> crate::operation::create_protection::builders::CreateProtectionInputBuilder {
62 crate::operation::create_protection::builders::CreateProtectionInputBuilder::default()
63 }
64}
65
66/// A builder for [`CreateProtectionInput`](crate::operation::create_protection::CreateProtectionInput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct CreateProtectionInputBuilder {
70 pub(crate) name: ::std::option::Option<::std::string::String>,
71 pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
72 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
73}
74impl CreateProtectionInputBuilder {
75 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
76 /// This field is required.
77 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78 self.name = ::std::option::Option::Some(input.into());
79 self
80 }
81 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
82 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83 self.name = input;
84 self
85 }
86 /// <p>Friendly name for the <code>Protection</code> you are creating.</p>
87 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
88 &self.name
89 }
90 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
91 /// <p>The ARN should be in one of the following formats:</p>
92 /// <ul>
93 /// <li>
94 /// <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>
95 /// <li>
96 /// <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>
97 /// <li>
98 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
99 /// <li>
100 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
101 /// <li>
102 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
103 /// <li>
104 /// <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>
105 /// </ul>
106 /// This field is required.
107 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108 self.resource_arn = ::std::option::Option::Some(input.into());
109 self
110 }
111 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
112 /// <p>The ARN should be in one of the following formats:</p>
113 /// <ul>
114 /// <li>
115 /// <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>
116 /// <li>
117 /// <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>
118 /// <li>
119 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
120 /// <li>
121 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
122 /// <li>
123 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
124 /// <li>
125 /// <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>
126 /// </ul>
127 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128 self.resource_arn = input;
129 self
130 }
131 /// <p>The ARN (Amazon Resource Name) of the resource to be protected.</p>
132 /// <p>The ARN should be in one of the following formats:</p>
133 /// <ul>
134 /// <li>
135 /// <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>
136 /// <li>
137 /// <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>
138 /// <li>
139 /// <p>For an Amazon CloudFront distribution: <code>arn:aws:cloudfront::<i>account-id</i>:distribution/<i>distribution-id</i> </code></p></li>
140 /// <li>
141 /// <p>For an Global Accelerator standard accelerator: <code>arn:aws:globalaccelerator::<i>account-id</i>:accelerator/<i>accelerator-id</i> </code></p></li>
142 /// <li>
143 /// <p>For Amazon Route 53: <code>arn:aws:route53:::hostedzone/<i>hosted-zone-id</i> </code></p></li>
144 /// <li>
145 /// <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>
146 /// </ul>
147 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
148 &self.resource_arn
149 }
150 /// Appends an item to `tags`.
151 ///
152 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
153 ///
154 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
155 pub fn tags(mut self, input: crate::types::Tag) -> Self {
156 let mut v = self.tags.unwrap_or_default();
157 v.push(input);
158 self.tags = ::std::option::Option::Some(v);
159 self
160 }
161 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
162 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
163 self.tags = input;
164 self
165 }
166 /// <p>One or more tag key-value pairs for the <code>Protection</code> object that is created.</p>
167 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
168 &self.tags
169 }
170 /// Consumes the builder and constructs a [`CreateProtectionInput`](crate::operation::create_protection::CreateProtectionInput).
171 pub fn build(
172 self,
173 ) -> ::std::result::Result<crate::operation::create_protection::CreateProtectionInput, ::aws_smithy_types::error::operation::BuildError> {
174 ::std::result::Result::Ok(crate::operation::create_protection::CreateProtectionInput {
175 name: self.name,
176 resource_arn: self.resource_arn,
177 tags: self.tags,
178 })
179 }
180}