aws_sdk_ec2/operation/create_snapshot/_create_snapshot_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 CreateSnapshotInput {
6 /// <p>A description for the snapshot.</p>
7 pub description: ::std::option::Option<::std::string::String>,
8 /// <note>
9 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
10 /// </note>
11 /// <ul>
12 /// <li>
13 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
14 /// <li>
15 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
16 /// </ul>
17 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
18 pub outpost_arn: ::std::option::Option<::std::string::String>,
19 /// <p>The ID of the Amazon EBS volume.</p>
20 pub volume_id: ::std::option::Option<::std::string::String>,
21 /// <p>The tags to apply to the snapshot during creation.</p>
22 pub tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
23 /// <note>
24 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
25 /// </note>
26 /// <ul>
27 /// <li>
28 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
29 /// <li>
30 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
31 /// </ul>
32 /// <p>Default value: <code>regional</code></p>
33 pub location: ::std::option::Option<crate::types::SnapshotLocationEnum>,
34 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
35 pub dry_run: ::std::option::Option<bool>,
36}
37impl CreateSnapshotInput {
38 /// <p>A description for the snapshot.</p>
39 pub fn description(&self) -> ::std::option::Option<&str> {
40 self.description.as_deref()
41 }
42 /// <note>
43 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
44 /// </note>
45 /// <ul>
46 /// <li>
47 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
48 /// <li>
49 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
50 /// </ul>
51 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
52 pub fn outpost_arn(&self) -> ::std::option::Option<&str> {
53 self.outpost_arn.as_deref()
54 }
55 /// <p>The ID of the Amazon EBS volume.</p>
56 pub fn volume_id(&self) -> ::std::option::Option<&str> {
57 self.volume_id.as_deref()
58 }
59 /// <p>The tags to apply to the snapshot during creation.</p>
60 ///
61 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tag_specifications.is_none()`.
62 pub fn tag_specifications(&self) -> &[crate::types::TagSpecification] {
63 self.tag_specifications.as_deref().unwrap_or_default()
64 }
65 /// <note>
66 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
67 /// </note>
68 /// <ul>
69 /// <li>
70 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
71 /// <li>
72 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
73 /// </ul>
74 /// <p>Default value: <code>regional</code></p>
75 pub fn location(&self) -> ::std::option::Option<&crate::types::SnapshotLocationEnum> {
76 self.location.as_ref()
77 }
78 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
79 pub fn dry_run(&self) -> ::std::option::Option<bool> {
80 self.dry_run
81 }
82}
83impl CreateSnapshotInput {
84 /// Creates a new builder-style object to manufacture [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
85 pub fn builder() -> crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder {
86 crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder::default()
87 }
88}
89
90/// A builder for [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
91#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
92#[non_exhaustive]
93pub struct CreateSnapshotInputBuilder {
94 pub(crate) description: ::std::option::Option<::std::string::String>,
95 pub(crate) outpost_arn: ::std::option::Option<::std::string::String>,
96 pub(crate) volume_id: ::std::option::Option<::std::string::String>,
97 pub(crate) tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
98 pub(crate) location: ::std::option::Option<crate::types::SnapshotLocationEnum>,
99 pub(crate) dry_run: ::std::option::Option<bool>,
100}
101impl CreateSnapshotInputBuilder {
102 /// <p>A description for the snapshot.</p>
103 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104 self.description = ::std::option::Option::Some(input.into());
105 self
106 }
107 /// <p>A description for the snapshot.</p>
108 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109 self.description = input;
110 self
111 }
112 /// <p>A description for the snapshot.</p>
113 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
114 &self.description
115 }
116 /// <note>
117 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
118 /// </note>
119 /// <ul>
120 /// <li>
121 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
122 /// <li>
123 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
124 /// </ul>
125 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
126 pub fn outpost_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127 self.outpost_arn = ::std::option::Option::Some(input.into());
128 self
129 }
130 /// <note>
131 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
132 /// </note>
133 /// <ul>
134 /// <li>
135 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
136 /// <li>
137 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
138 /// </ul>
139 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
140 pub fn set_outpost_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141 self.outpost_arn = input;
142 self
143 }
144 /// <note>
145 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
146 /// </note>
147 /// <ul>
148 /// <li>
149 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
150 /// <li>
151 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
152 /// </ul>
153 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
154 pub fn get_outpost_arn(&self) -> &::std::option::Option<::std::string::String> {
155 &self.outpost_arn
156 }
157 /// <p>The ID of the Amazon EBS volume.</p>
158 /// This field is required.
159 pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160 self.volume_id = ::std::option::Option::Some(input.into());
161 self
162 }
163 /// <p>The ID of the Amazon EBS volume.</p>
164 pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165 self.volume_id = input;
166 self
167 }
168 /// <p>The ID of the Amazon EBS volume.</p>
169 pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
170 &self.volume_id
171 }
172 /// Appends an item to `tag_specifications`.
173 ///
174 /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
175 ///
176 /// <p>The tags to apply to the snapshot during creation.</p>
177 pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
178 let mut v = self.tag_specifications.unwrap_or_default();
179 v.push(input);
180 self.tag_specifications = ::std::option::Option::Some(v);
181 self
182 }
183 /// <p>The tags to apply to the snapshot during creation.</p>
184 pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
185 self.tag_specifications = input;
186 self
187 }
188 /// <p>The tags to apply to the snapshot during creation.</p>
189 pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
190 &self.tag_specifications
191 }
192 /// <note>
193 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
194 /// </note>
195 /// <ul>
196 /// <li>
197 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
198 /// <li>
199 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
200 /// </ul>
201 /// <p>Default value: <code>regional</code></p>
202 pub fn location(mut self, input: crate::types::SnapshotLocationEnum) -> Self {
203 self.location = ::std::option::Option::Some(input);
204 self
205 }
206 /// <note>
207 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
208 /// </note>
209 /// <ul>
210 /// <li>
211 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
212 /// <li>
213 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
214 /// </ul>
215 /// <p>Default value: <code>regional</code></p>
216 pub fn set_location(mut self, input: ::std::option::Option<crate::types::SnapshotLocationEnum>) -> Self {
217 self.location = input;
218 self
219 }
220 /// <note>
221 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
222 /// </note>
223 /// <ul>
224 /// <li>
225 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
226 /// <li>
227 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
228 /// </ul>
229 /// <p>Default value: <code>regional</code></p>
230 pub fn get_location(&self) -> &::std::option::Option<crate::types::SnapshotLocationEnum> {
231 &self.location
232 }
233 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
234 pub fn dry_run(mut self, input: bool) -> Self {
235 self.dry_run = ::std::option::Option::Some(input);
236 self
237 }
238 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
239 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
240 self.dry_run = input;
241 self
242 }
243 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
244 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
245 &self.dry_run
246 }
247 /// Consumes the builder and constructs a [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
248 pub fn build(
249 self,
250 ) -> ::std::result::Result<crate::operation::create_snapshot::CreateSnapshotInput, ::aws_smithy_types::error::operation::BuildError> {
251 ::std::result::Result::Ok(crate::operation::create_snapshot::CreateSnapshotInput {
252 description: self.description,
253 outpost_arn: self.outpost_arn,
254 volume_id: self.volume_id,
255 tag_specifications: self.tag_specifications,
256 location: self.location,
257 dry_run: self.dry_run,
258 })
259 }
260}