aws_sdk_ec2/client/
lock_snapshot.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`LockSnapshot`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder) operation.
4    ///
5    /// - The fluent builder is configurable:
6    ///   - [`snapshot_id(impl Into<String>)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::snapshot_id) / [`set_snapshot_id(Option<String>)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::set_snapshot_id):<br>required: **true**<br><p>The ID of the snapshot to lock.</p><br>
7    ///   - [`dry_run(bool)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::dry_run) / [`set_dry_run(Option<bool>)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::set_dry_run):<br>required: **false**<br><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><br>
8    ///   - [`lock_mode(LockMode)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::lock_mode) / [`set_lock_mode(Option<LockMode>)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::set_lock_mode):<br>required: **true**<br><p>The mode in which to lock the snapshot. Specify one of the following:</p> <ul>  <li>   <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>   <ul>    <li>     <p>The lock duration expires.</p></li>    <li>     <p>The snapshot is unlocked by a user with the appropriate permissions.</p></li>   </ul>   <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>   <p>If you lock a snapshot in <code>governance</code> mode, omit <b> CoolOffPeriod</b>.</p></li>  <li>   <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>   <p>If you lock a snapshot in <code>compliance</code> mode, you can optionally specify <b>CoolOffPeriod</b>.</p></li> </ul><br>
9    ///   - [`cool_off_period(i32)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::cool_off_period) / [`set_cool_off_period(Option<i32>)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::set_cool_off_period):<br>required: **false**<br><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> <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> <p>To lock the snapshot in compliance mode immediately without a cooling-off period, omit this parameter.</p> <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> <p>Allowed values: Min 1, max 72.</p><br>
10    ///   - [`lock_duration(i32)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::lock_duration) / [`set_lock_duration(Option<i32>)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::set_lock_duration):<br>required: **false**<br><p>The period of time for which to lock the snapshot, in days. The snapshot lock will automatically expire after this period lapses.</p> <p>You must specify either this parameter or <b>ExpirationDate</b>, but not both.</p> <p>Allowed values: Min: 1, max 36500</p><br>
11    ///   - [`expiration_date(DateTime)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::expiration_date) / [`set_expiration_date(Option<DateTime>)`](crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::set_expiration_date):<br>required: **false**<br><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> <p>You must specify either this parameter or <b>LockDuration</b>, but not both.</p><br>
12    /// - On success, responds with [`LockSnapshotOutput`](crate::operation::lock_snapshot::LockSnapshotOutput) with field(s):
13    ///   - [`snapshot_id(Option<String>)`](crate::operation::lock_snapshot::LockSnapshotOutput::snapshot_id): <p>The ID of the snapshot</p>
14    ///   - [`lock_state(Option<LockState>)`](crate::operation::lock_snapshot::LockSnapshotOutput::lock_state): <p>The state of the snapshot lock. Valid states include:</p> <ul>  <li>   <p><code>compliance-cooloff</code> - The snapshot has been locked in compliance mode but it is still within the cooling-off period. The snapshot can't be deleted, but it can be unlocked and the lock settings can be modified by users with appropriate permissions.</p></li>  <li>   <p><code>governance</code> - The snapshot is locked in governance mode. The snapshot can't be deleted, but it can be unlocked and the lock settings can be modified by users with appropriate permissions.</p></li>  <li>   <p><code>compliance</code> - The snapshot is locked in compliance mode and the cooling-off period has expired. The snapshot can't be unlocked or deleted. The lock duration can only be increased by users with appropriate permissions.</p></li>  <li>   <p><code>expired</code> - The snapshot was locked in compliance or governance mode but the lock duration has expired. The snapshot is not locked and can be deleted.</p></li> </ul>
15    ///   - [`lock_duration(Option<i32>)`](crate::operation::lock_snapshot::LockSnapshotOutput::lock_duration): <p>The period of time for which the snapshot is locked, in days.</p>
16    ///   - [`cool_off_period(Option<i32>)`](crate::operation::lock_snapshot::LockSnapshotOutput::cool_off_period): <p>The compliance mode cooling-off period, in hours.</p>
17    ///   - [`cool_off_period_expires_on(Option<DateTime>)`](crate::operation::lock_snapshot::LockSnapshotOutput::cool_off_period_expires_on): <p>The date and time at which the compliance mode cooling-off period expires, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
18    ///   - [`lock_created_on(Option<DateTime>)`](crate::operation::lock_snapshot::LockSnapshotOutput::lock_created_on): <p>The date and time at which the snapshot was locked, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
19    ///   - [`lock_expires_on(Option<DateTime>)`](crate::operation::lock_snapshot::LockSnapshotOutput::lock_expires_on): <p>The date and time at which the lock will expire, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
20    ///   - [`lock_duration_start_time(Option<DateTime>)`](crate::operation::lock_snapshot::LockSnapshotOutput::lock_duration_start_time): <p>The date and time at which the lock duration started, in the UTC time zone (<code>YYYY-MM-DDThh:mm:ss.sssZ</code>).</p>
21    /// - On failure, responds with [`SdkError<LockSnapshotError>`](crate::operation::lock_snapshot::LockSnapshotError)
22    pub fn lock_snapshot(&self) -> crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder {
23        crate::operation::lock_snapshot::builders::LockSnapshotFluentBuilder::new(self.handle.clone())
24    }
25}