aws_sdk_ec2/operation/deregister_image/_deregister_image_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the parameters for DeregisterImage.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DeregisterImageInput {
7    /// <p>The ID of the AMI.</p>
8    pub image_id: ::std::option::Option<::std::string::String>,
9    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
10    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
11    /// </note>
12    /// <p>Default: The snapshots are not deleted.</p>
13    pub delete_associated_snapshots: ::std::option::Option<bool>,
14    /// <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>
15    pub dry_run: ::std::option::Option<bool>,
16}
17impl DeregisterImageInput {
18    /// <p>The ID of the AMI.</p>
19    pub fn image_id(&self) -> ::std::option::Option<&str> {
20        self.image_id.as_deref()
21    }
22    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
23    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
24    /// </note>
25    /// <p>Default: The snapshots are not deleted.</p>
26    pub fn delete_associated_snapshots(&self) -> ::std::option::Option<bool> {
27        self.delete_associated_snapshots
28    }
29    /// <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>
30    pub fn dry_run(&self) -> ::std::option::Option<bool> {
31        self.dry_run
32    }
33}
34impl DeregisterImageInput {
35    /// Creates a new builder-style object to manufacture [`DeregisterImageInput`](crate::operation::deregister_image::DeregisterImageInput).
36    pub fn builder() -> crate::operation::deregister_image::builders::DeregisterImageInputBuilder {
37        crate::operation::deregister_image::builders::DeregisterImageInputBuilder::default()
38    }
39}
40
41/// A builder for [`DeregisterImageInput`](crate::operation::deregister_image::DeregisterImageInput).
42#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
43#[non_exhaustive]
44pub struct DeregisterImageInputBuilder {
45    pub(crate) image_id: ::std::option::Option<::std::string::String>,
46    pub(crate) delete_associated_snapshots: ::std::option::Option<bool>,
47    pub(crate) dry_run: ::std::option::Option<bool>,
48}
49impl DeregisterImageInputBuilder {
50    /// <p>The ID of the AMI.</p>
51    /// This field is required.
52    pub fn image_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
53        self.image_id = ::std::option::Option::Some(input.into());
54        self
55    }
56    /// <p>The ID of the AMI.</p>
57    pub fn set_image_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
58        self.image_id = input;
59        self
60    }
61    /// <p>The ID of the AMI.</p>
62    pub fn get_image_id(&self) -> &::std::option::Option<::std::string::String> {
63        &self.image_id
64    }
65    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
66    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
67    /// </note>
68    /// <p>Default: The snapshots are not deleted.</p>
69    pub fn delete_associated_snapshots(mut self, input: bool) -> Self {
70        self.delete_associated_snapshots = ::std::option::Option::Some(input);
71        self
72    }
73    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
74    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
75    /// </note>
76    /// <p>Default: The snapshots are not deleted.</p>
77    pub fn set_delete_associated_snapshots(mut self, input: ::std::option::Option<bool>) -> Self {
78        self.delete_associated_snapshots = input;
79        self
80    }
81    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
82    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
83    /// </note>
84    /// <p>Default: The snapshots are not deleted.</p>
85    pub fn get_delete_associated_snapshots(&self) -> &::std::option::Option<bool> {
86        &self.delete_associated_snapshots
87    }
88    /// <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>
89    pub fn dry_run(mut self, input: bool) -> Self {
90        self.dry_run = ::std::option::Option::Some(input);
91        self
92    }
93    /// <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>
94    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
95        self.dry_run = input;
96        self
97    }
98    /// <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>
99    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
100        &self.dry_run
101    }
102    /// Consumes the builder and constructs a [`DeregisterImageInput`](crate::operation::deregister_image::DeregisterImageInput).
103    pub fn build(
104        self,
105    ) -> ::std::result::Result<crate::operation::deregister_image::DeregisterImageInput, ::aws_smithy_types::error::operation::BuildError> {
106        ::std::result::Result::Ok(crate::operation::deregister_image::DeregisterImageInput {
107            image_id: self.image_id,
108            delete_associated_snapshots: self.delete_associated_snapshots,
109            dry_run: self.dry_run,
110        })
111    }
112}