aws_sdk_ec2/operation/lock_snapshot/
_lock_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 LockSnapshotInput {
6    /// <p>The ID of the snapshot to lock.</p>
7    pub snapshot_id: ::std::option::Option<::std::string::String>,
8    /// <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>
9    pub dry_run: ::std::option::Option<bool>,
10    /// <p>The mode in which to lock the snapshot. Specify one of the following:</p>
11    /// <ul>
12    /// <li>
13    /// <p><code>governance</code> - Locks the snapshot in governance mode. Snapshots locked in governance mode can't be deleted until one of the following conditions are met:</p>
14    /// <ul>
15    /// <li>
16    /// <p>The lock duration expires.</p></li>
17    /// <li>
18    /// <p>The snapshot is unlocked by a user with the appropriate permissions.</p></li>
19    /// </ul>
20    /// <p>Users with the appropriate IAM permissions can unlock the snapshot, increase or decrease the lock duration, and change the lock mode to <code>compliance</code> at any time.</p>
21    /// <p>If you lock a snapshot in <code>governance</code> mode, omit <b> CoolOffPeriod</b>.</p></li>
22    /// <li>
23    /// <p><code>compliance</code> - Locks the snapshot in compliance mode. Snapshots locked in compliance mode can't be unlocked by any user. They can be deleted only after the lock duration expires. Users can't decrease the lock duration or change the lock mode to <code>governance</code>. However, users with appropriate IAM permissions can increase the lock duration at any time.</p>
24    /// <p>If you lock a snapshot in <code>compliance</code> mode, you can optionally specify <b>CoolOffPeriod</b>.</p></li>
25    /// </ul>
26    pub lock_mode: ::std::option::Option<crate::types::LockMode>,
27    /// <p>The cooling-off period during which you can unlock the snapshot or modify the lock settings after locking the snapshot in compliance mode, in hours. After the cooling-off period expires, you can't unlock or delete the snapshot, decrease the lock duration, or change the lock mode. You can increase the lock duration after the cooling-off period expires.</p>
28    /// <p>The cooling-off period is optional when locking a snapshot in compliance mode. If you are locking the snapshot in governance mode, omit this parameter.</p>
29    /// <p>To lock the snapshot in compliance mode immediately without a cooling-off period, omit this parameter.</p>
30    /// <p>If you are extending the lock duration for a snapshot that is locked in compliance mode after the cooling-off period has expired, omit this parameter. If you specify a cooling-period in a such a request, the request fails.</p>
31    /// <p>Allowed values: Min 1, max 72.</p>
32    pub cool_off_period: ::std::option::Option<i32>,
33    /// <p>The period of time for which to lock the snapshot, in days. The snapshot lock will automatically expire after this period lapses.</p>
34    /// <p>You must specify either this parameter or <b>ExpirationDate</b>, but not both.</p>
35    /// <p>Allowed values: Min: 1, max 36500</p>
36    pub lock_duration: ::std::option::Option<i32>,
37    /// <p>The date and time at which the snapshot lock is to automatically expire, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
38    /// <p>You must specify either this parameter or <b>LockDuration</b>, but not both.</p>
39    pub expiration_date: ::std::option::Option<::aws_smithy_types::DateTime>,
40}
41impl LockSnapshotInput {
42    /// <p>The ID of the snapshot to lock.</p>
43    pub fn snapshot_id(&self) -> ::std::option::Option<&str> {
44        self.snapshot_id.as_deref()
45    }
46    /// <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>
47    pub fn dry_run(&self) -> ::std::option::Option<bool> {
48        self.dry_run
49    }
50    /// <p>The mode in which to lock the snapshot. Specify one of the following:</p>
51    /// <ul>
52    /// <li>
53    /// <p><code>governance</code> - Locks the snapshot in governance mode. Snapshots locked in governance mode can't be deleted until one of the following conditions are met:</p>
54    /// <ul>
55    /// <li>
56    /// <p>The lock duration expires.</p></li>
57    /// <li>
58    /// <p>The snapshot is unlocked by a user with the appropriate permissions.</p></li>
59    /// </ul>
60    /// <p>Users with the appropriate IAM permissions can unlock the snapshot, increase or decrease the lock duration, and change the lock mode to <code>compliance</code> at any time.</p>
61    /// <p>If you lock a snapshot in <code>governance</code> mode, omit <b> CoolOffPeriod</b>.</p></li>
62    /// <li>
63    /// <p><code>compliance</code> - Locks the snapshot in compliance mode. Snapshots locked in compliance mode can't be unlocked by any user. They can be deleted only after the lock duration expires. Users can't decrease the lock duration or change the lock mode to <code>governance</code>. However, users with appropriate IAM permissions can increase the lock duration at any time.</p>
64    /// <p>If you lock a snapshot in <code>compliance</code> mode, you can optionally specify <b>CoolOffPeriod</b>.</p></li>
65    /// </ul>
66    pub fn lock_mode(&self) -> ::std::option::Option<&crate::types::LockMode> {
67        self.lock_mode.as_ref()
68    }
69    /// <p>The cooling-off period during which you can unlock the snapshot or modify the lock settings after locking the snapshot in compliance mode, in hours. After the cooling-off period expires, you can't unlock or delete the snapshot, decrease the lock duration, or change the lock mode. You can increase the lock duration after the cooling-off period expires.</p>
70    /// <p>The cooling-off period is optional when locking a snapshot in compliance mode. If you are locking the snapshot in governance mode, omit this parameter.</p>
71    /// <p>To lock the snapshot in compliance mode immediately without a cooling-off period, omit this parameter.</p>
72    /// <p>If you are extending the lock duration for a snapshot that is locked in compliance mode after the cooling-off period has expired, omit this parameter. If you specify a cooling-period in a such a request, the request fails.</p>
73    /// <p>Allowed values: Min 1, max 72.</p>
74    pub fn cool_off_period(&self) -> ::std::option::Option<i32> {
75        self.cool_off_period
76    }
77    /// <p>The period of time for which to lock the snapshot, in days. The snapshot lock will automatically expire after this period lapses.</p>
78    /// <p>You must specify either this parameter or <b>ExpirationDate</b>, but not both.</p>
79    /// <p>Allowed values: Min: 1, max 36500</p>
80    pub fn lock_duration(&self) -> ::std::option::Option<i32> {
81        self.lock_duration
82    }
83    /// <p>The date and time at which the snapshot lock is to automatically expire, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
84    /// <p>You must specify either this parameter or <b>LockDuration</b>, but not both.</p>
85    pub fn expiration_date(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
86        self.expiration_date.as_ref()
87    }
88}
89impl LockSnapshotInput {
90    /// Creates a new builder-style object to manufacture [`LockSnapshotInput`](crate::operation::lock_snapshot::LockSnapshotInput).
91    pub fn builder() -> crate::operation::lock_snapshot::builders::LockSnapshotInputBuilder {
92        crate::operation::lock_snapshot::builders::LockSnapshotInputBuilder::default()
93    }
94}
95
96/// A builder for [`LockSnapshotInput`](crate::operation::lock_snapshot::LockSnapshotInput).
97#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
98#[non_exhaustive]
99pub struct LockSnapshotInputBuilder {
100    pub(crate) snapshot_id: ::std::option::Option<::std::string::String>,
101    pub(crate) dry_run: ::std::option::Option<bool>,
102    pub(crate) lock_mode: ::std::option::Option<crate::types::LockMode>,
103    pub(crate) cool_off_period: ::std::option::Option<i32>,
104    pub(crate) lock_duration: ::std::option::Option<i32>,
105    pub(crate) expiration_date: ::std::option::Option<::aws_smithy_types::DateTime>,
106}
107impl LockSnapshotInputBuilder {
108    /// <p>The ID of the snapshot to lock.</p>
109    /// This field is required.
110    pub fn snapshot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.snapshot_id = ::std::option::Option::Some(input.into());
112        self
113    }
114    /// <p>The ID of the snapshot to lock.</p>
115    pub fn set_snapshot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.snapshot_id = input;
117        self
118    }
119    /// <p>The ID of the snapshot to lock.</p>
120    pub fn get_snapshot_id(&self) -> &::std::option::Option<::std::string::String> {
121        &self.snapshot_id
122    }
123    /// <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>
124    pub fn dry_run(mut self, input: bool) -> Self {
125        self.dry_run = ::std::option::Option::Some(input);
126        self
127    }
128    /// <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>
129    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
130        self.dry_run = input;
131        self
132    }
133    /// <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>
134    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
135        &self.dry_run
136    }
137    /// <p>The mode in which to lock the snapshot. Specify one of the following:</p>
138    /// <ul>
139    /// <li>
140    /// <p><code>governance</code> - Locks the snapshot in governance mode. Snapshots locked in governance mode can't be deleted until one of the following conditions are met:</p>
141    /// <ul>
142    /// <li>
143    /// <p>The lock duration expires.</p></li>
144    /// <li>
145    /// <p>The snapshot is unlocked by a user with the appropriate permissions.</p></li>
146    /// </ul>
147    /// <p>Users with the appropriate IAM permissions can unlock the snapshot, increase or decrease the lock duration, and change the lock mode to <code>compliance</code> at any time.</p>
148    /// <p>If you lock a snapshot in <code>governance</code> mode, omit <b> CoolOffPeriod</b>.</p></li>
149    /// <li>
150    /// <p><code>compliance</code> - Locks the snapshot in compliance mode. Snapshots locked in compliance mode can't be unlocked by any user. They can be deleted only after the lock duration expires. Users can't decrease the lock duration or change the lock mode to <code>governance</code>. However, users with appropriate IAM permissions can increase the lock duration at any time.</p>
151    /// <p>If you lock a snapshot in <code>compliance</code> mode, you can optionally specify <b>CoolOffPeriod</b>.</p></li>
152    /// </ul>
153    /// This field is required.
154    pub fn lock_mode(mut self, input: crate::types::LockMode) -> Self {
155        self.lock_mode = ::std::option::Option::Some(input);
156        self
157    }
158    /// <p>The mode in which to lock the snapshot. Specify one of the following:</p>
159    /// <ul>
160    /// <li>
161    /// <p><code>governance</code> - Locks the snapshot in governance mode. Snapshots locked in governance mode can't be deleted until one of the following conditions are met:</p>
162    /// <ul>
163    /// <li>
164    /// <p>The lock duration expires.</p></li>
165    /// <li>
166    /// <p>The snapshot is unlocked by a user with the appropriate permissions.</p></li>
167    /// </ul>
168    /// <p>Users with the appropriate IAM permissions can unlock the snapshot, increase or decrease the lock duration, and change the lock mode to <code>compliance</code> at any time.</p>
169    /// <p>If you lock a snapshot in <code>governance</code> mode, omit <b> CoolOffPeriod</b>.</p></li>
170    /// <li>
171    /// <p><code>compliance</code> - Locks the snapshot in compliance mode. Snapshots locked in compliance mode can't be unlocked by any user. They can be deleted only after the lock duration expires. Users can't decrease the lock duration or change the lock mode to <code>governance</code>. However, users with appropriate IAM permissions can increase the lock duration at any time.</p>
172    /// <p>If you lock a snapshot in <code>compliance</code> mode, you can optionally specify <b>CoolOffPeriod</b>.</p></li>
173    /// </ul>
174    pub fn set_lock_mode(mut self, input: ::std::option::Option<crate::types::LockMode>) -> Self {
175        self.lock_mode = input;
176        self
177    }
178    /// <p>The mode in which to lock the snapshot. Specify one of the following:</p>
179    /// <ul>
180    /// <li>
181    /// <p><code>governance</code> - Locks the snapshot in governance mode. Snapshots locked in governance mode can't be deleted until one of the following conditions are met:</p>
182    /// <ul>
183    /// <li>
184    /// <p>The lock duration expires.</p></li>
185    /// <li>
186    /// <p>The snapshot is unlocked by a user with the appropriate permissions.</p></li>
187    /// </ul>
188    /// <p>Users with the appropriate IAM permissions can unlock the snapshot, increase or decrease the lock duration, and change the lock mode to <code>compliance</code> at any time.</p>
189    /// <p>If you lock a snapshot in <code>governance</code> mode, omit <b> CoolOffPeriod</b>.</p></li>
190    /// <li>
191    /// <p><code>compliance</code> - Locks the snapshot in compliance mode. Snapshots locked in compliance mode can't be unlocked by any user. They can be deleted only after the lock duration expires. Users can't decrease the lock duration or change the lock mode to <code>governance</code>. However, users with appropriate IAM permissions can increase the lock duration at any time.</p>
192    /// <p>If you lock a snapshot in <code>compliance</code> mode, you can optionally specify <b>CoolOffPeriod</b>.</p></li>
193    /// </ul>
194    pub fn get_lock_mode(&self) -> &::std::option::Option<crate::types::LockMode> {
195        &self.lock_mode
196    }
197    /// <p>The cooling-off period during which you can unlock the snapshot or modify the lock settings after locking the snapshot in compliance mode, in hours. After the cooling-off period expires, you can't unlock or delete the snapshot, decrease the lock duration, or change the lock mode. You can increase the lock duration after the cooling-off period expires.</p>
198    /// <p>The cooling-off period is optional when locking a snapshot in compliance mode. If you are locking the snapshot in governance mode, omit this parameter.</p>
199    /// <p>To lock the snapshot in compliance mode immediately without a cooling-off period, omit this parameter.</p>
200    /// <p>If you are extending the lock duration for a snapshot that is locked in compliance mode after the cooling-off period has expired, omit this parameter. If you specify a cooling-period in a such a request, the request fails.</p>
201    /// <p>Allowed values: Min 1, max 72.</p>
202    pub fn cool_off_period(mut self, input: i32) -> Self {
203        self.cool_off_period = ::std::option::Option::Some(input);
204        self
205    }
206    /// <p>The cooling-off period during which you can unlock the snapshot or modify the lock settings after locking the snapshot in compliance mode, in hours. After the cooling-off period expires, you can't unlock or delete the snapshot, decrease the lock duration, or change the lock mode. You can increase the lock duration after the cooling-off period expires.</p>
207    /// <p>The cooling-off period is optional when locking a snapshot in compliance mode. If you are locking the snapshot in governance mode, omit this parameter.</p>
208    /// <p>To lock the snapshot in compliance mode immediately without a cooling-off period, omit this parameter.</p>
209    /// <p>If you are extending the lock duration for a snapshot that is locked in compliance mode after the cooling-off period has expired, omit this parameter. If you specify a cooling-period in a such a request, the request fails.</p>
210    /// <p>Allowed values: Min 1, max 72.</p>
211    pub fn set_cool_off_period(mut self, input: ::std::option::Option<i32>) -> Self {
212        self.cool_off_period = input;
213        self
214    }
215    /// <p>The cooling-off period during which you can unlock the snapshot or modify the lock settings after locking the snapshot in compliance mode, in hours. After the cooling-off period expires, you can't unlock or delete the snapshot, decrease the lock duration, or change the lock mode. You can increase the lock duration after the cooling-off period expires.</p>
216    /// <p>The cooling-off period is optional when locking a snapshot in compliance mode. If you are locking the snapshot in governance mode, omit this parameter.</p>
217    /// <p>To lock the snapshot in compliance mode immediately without a cooling-off period, omit this parameter.</p>
218    /// <p>If you are extending the lock duration for a snapshot that is locked in compliance mode after the cooling-off period has expired, omit this parameter. If you specify a cooling-period in a such a request, the request fails.</p>
219    /// <p>Allowed values: Min 1, max 72.</p>
220    pub fn get_cool_off_period(&self) -> &::std::option::Option<i32> {
221        &self.cool_off_period
222    }
223    /// <p>The period of time for which to lock the snapshot, in days. The snapshot lock will automatically expire after this period lapses.</p>
224    /// <p>You must specify either this parameter or <b>ExpirationDate</b>, but not both.</p>
225    /// <p>Allowed values: Min: 1, max 36500</p>
226    pub fn lock_duration(mut self, input: i32) -> Self {
227        self.lock_duration = ::std::option::Option::Some(input);
228        self
229    }
230    /// <p>The period of time for which to lock the snapshot, in days. The snapshot lock will automatically expire after this period lapses.</p>
231    /// <p>You must specify either this parameter or <b>ExpirationDate</b>, but not both.</p>
232    /// <p>Allowed values: Min: 1, max 36500</p>
233    pub fn set_lock_duration(mut self, input: ::std::option::Option<i32>) -> Self {
234        self.lock_duration = input;
235        self
236    }
237    /// <p>The period of time for which to lock the snapshot, in days. The snapshot lock will automatically expire after this period lapses.</p>
238    /// <p>You must specify either this parameter or <b>ExpirationDate</b>, but not both.</p>
239    /// <p>Allowed values: Min: 1, max 36500</p>
240    pub fn get_lock_duration(&self) -> &::std::option::Option<i32> {
241        &self.lock_duration
242    }
243    /// <p>The date and time at which the snapshot lock is to automatically expire, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
244    /// <p>You must specify either this parameter or <b>LockDuration</b>, but not both.</p>
245    pub fn expiration_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
246        self.expiration_date = ::std::option::Option::Some(input);
247        self
248    }
249    /// <p>The date and time at which the snapshot lock is to automatically expire, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
250    /// <p>You must specify either this parameter or <b>LockDuration</b>, but not both.</p>
251    pub fn set_expiration_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
252        self.expiration_date = input;
253        self
254    }
255    /// <p>The date and time at which the snapshot lock is to automatically expire, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
256    /// <p>You must specify either this parameter or <b>LockDuration</b>, but not both.</p>
257    pub fn get_expiration_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
258        &self.expiration_date
259    }
260    /// Consumes the builder and constructs a [`LockSnapshotInput`](crate::operation::lock_snapshot::LockSnapshotInput).
261    pub fn build(
262        self,
263    ) -> ::std::result::Result<crate::operation::lock_snapshot::LockSnapshotInput, ::aws_smithy_types::error::operation::BuildError> {
264        ::std::result::Result::Ok(crate::operation::lock_snapshot::LockSnapshotInput {
265            snapshot_id: self.snapshot_id,
266            dry_run: self.dry_run,
267            lock_mode: self.lock_mode,
268            cool_off_period: self.cool_off_period,
269            lock_duration: self.lock_duration,
270            expiration_date: self.expiration_date,
271        })
272    }
273}