aws_sdk_ec2/operation/detach_volume/_detach_volume_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 DetachVolumeInput {
6 /// <p>The device name.</p>
7 pub device: ::std::option::Option<::std::string::String>,
8 /// <p>Forces detachment if the previous detachment attempt did not occur cleanly (for example, logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance won't have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.</p>
9 pub force: ::std::option::Option<bool>,
10 /// <p>The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.</p>
11 pub instance_id: ::std::option::Option<::std::string::String>,
12 /// <p>The ID of the volume.</p>
13 pub volume_id: ::std::option::Option<::std::string::String>,
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 DetachVolumeInput {
18 /// <p>The device name.</p>
19 pub fn device(&self) -> ::std::option::Option<&str> {
20 self.device.as_deref()
21 }
22 /// <p>Forces detachment if the previous detachment attempt did not occur cleanly (for example, logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance won't have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.</p>
23 pub fn force(&self) -> ::std::option::Option<bool> {
24 self.force
25 }
26 /// <p>The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.</p>
27 pub fn instance_id(&self) -> ::std::option::Option<&str> {
28 self.instance_id.as_deref()
29 }
30 /// <p>The ID of the volume.</p>
31 pub fn volume_id(&self) -> ::std::option::Option<&str> {
32 self.volume_id.as_deref()
33 }
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 fn dry_run(&self) -> ::std::option::Option<bool> {
36 self.dry_run
37 }
38}
39impl DetachVolumeInput {
40 /// Creates a new builder-style object to manufacture [`DetachVolumeInput`](crate::operation::detach_volume::DetachVolumeInput).
41 pub fn builder() -> crate::operation::detach_volume::builders::DetachVolumeInputBuilder {
42 crate::operation::detach_volume::builders::DetachVolumeInputBuilder::default()
43 }
44}
45
46/// A builder for [`DetachVolumeInput`](crate::operation::detach_volume::DetachVolumeInput).
47#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
48#[non_exhaustive]
49pub struct DetachVolumeInputBuilder {
50 pub(crate) device: ::std::option::Option<::std::string::String>,
51 pub(crate) force: ::std::option::Option<bool>,
52 pub(crate) instance_id: ::std::option::Option<::std::string::String>,
53 pub(crate) volume_id: ::std::option::Option<::std::string::String>,
54 pub(crate) dry_run: ::std::option::Option<bool>,
55}
56impl DetachVolumeInputBuilder {
57 /// <p>The device name.</p>
58 pub fn device(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
59 self.device = ::std::option::Option::Some(input.into());
60 self
61 }
62 /// <p>The device name.</p>
63 pub fn set_device(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
64 self.device = input;
65 self
66 }
67 /// <p>The device name.</p>
68 pub fn get_device(&self) -> &::std::option::Option<::std::string::String> {
69 &self.device
70 }
71 /// <p>Forces detachment if the previous detachment attempt did not occur cleanly (for example, logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance won't have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.</p>
72 pub fn force(mut self, input: bool) -> Self {
73 self.force = ::std::option::Option::Some(input);
74 self
75 }
76 /// <p>Forces detachment if the previous detachment attempt did not occur cleanly (for example, logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance won't have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.</p>
77 pub fn set_force(mut self, input: ::std::option::Option<bool>) -> Self {
78 self.force = input;
79 self
80 }
81 /// <p>Forces detachment if the previous detachment attempt did not occur cleanly (for example, logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance won't have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.</p>
82 pub fn get_force(&self) -> &::std::option::Option<bool> {
83 &self.force
84 }
85 /// <p>The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.</p>
86 pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87 self.instance_id = ::std::option::Option::Some(input.into());
88 self
89 }
90 /// <p>The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.</p>
91 pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
92 self.instance_id = input;
93 self
94 }
95 /// <p>The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.</p>
96 pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
97 &self.instance_id
98 }
99 /// <p>The ID of the volume.</p>
100 /// This field is required.
101 pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102 self.volume_id = ::std::option::Option::Some(input.into());
103 self
104 }
105 /// <p>The ID of the volume.</p>
106 pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107 self.volume_id = input;
108 self
109 }
110 /// <p>The ID of the volume.</p>
111 pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
112 &self.volume_id
113 }
114 /// <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>
115 pub fn dry_run(mut self, input: bool) -> Self {
116 self.dry_run = ::std::option::Option::Some(input);
117 self
118 }
119 /// <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>
120 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
121 self.dry_run = input;
122 self
123 }
124 /// <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>
125 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
126 &self.dry_run
127 }
128 /// Consumes the builder and constructs a [`DetachVolumeInput`](crate::operation::detach_volume::DetachVolumeInput).
129 pub fn build(
130 self,
131 ) -> ::std::result::Result<crate::operation::detach_volume::DetachVolumeInput, ::aws_smithy_types::error::operation::BuildError> {
132 ::std::result::Result::Ok(crate::operation::detach_volume::DetachVolumeInput {
133 device: self.device,
134 force: self.force,
135 instance_id: self.instance_id,
136 volume_id: self.volume_id,
137 dry_run: self.dry_run,
138 })
139 }
140}