aws_sdk_ec2/operation/attach_volume/
_attach_volume_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes volume attachment details.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AttachVolumeOutput {
7    /// <p>Indicates whether the EBS volume is deleted on instance termination.</p>
8    pub delete_on_termination: ::std::option::Option<bool>,
9    /// <p>The ARN of the Amazon Web Services-managed resource to which the volume is attached.</p>
10    pub associated_resource: ::std::option::Option<::std::string::String>,
11    /// <p>The service principal of the Amazon Web Services service that owns the underlying resource to which the volume is attached.</p>
12    /// <p>This parameter is returned only for volumes that are attached to Amazon Web Services-managed resources.</p>
13    pub instance_owning_service: ::std::option::Option<::std::string::String>,
14    /// <p>The ID of the volume.</p>
15    pub volume_id: ::std::option::Option<::std::string::String>,
16    /// <p>The ID of the instance.</p>
17    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
18    pub instance_id: ::std::option::Option<::std::string::String>,
19    /// <p>The device name.</p>
20    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
21    pub device: ::std::option::Option<::std::string::String>,
22    /// <p>The attachment state of the volume.</p>
23    pub state: ::std::option::Option<crate::types::VolumeAttachmentState>,
24    /// <p>The time stamp when the attachment initiated.</p>
25    pub attach_time: ::std::option::Option<::aws_smithy_types::DateTime>,
26    _request_id: Option<String>,
27}
28impl AttachVolumeOutput {
29    /// <p>Indicates whether the EBS volume is deleted on instance termination.</p>
30    pub fn delete_on_termination(&self) -> ::std::option::Option<bool> {
31        self.delete_on_termination
32    }
33    /// <p>The ARN of the Amazon Web Services-managed resource to which the volume is attached.</p>
34    pub fn associated_resource(&self) -> ::std::option::Option<&str> {
35        self.associated_resource.as_deref()
36    }
37    /// <p>The service principal of the Amazon Web Services service that owns the underlying resource to which the volume is attached.</p>
38    /// <p>This parameter is returned only for volumes that are attached to Amazon Web Services-managed resources.</p>
39    pub fn instance_owning_service(&self) -> ::std::option::Option<&str> {
40        self.instance_owning_service.as_deref()
41    }
42    /// <p>The ID of the volume.</p>
43    pub fn volume_id(&self) -> ::std::option::Option<&str> {
44        self.volume_id.as_deref()
45    }
46    /// <p>The ID of the instance.</p>
47    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
48    pub fn instance_id(&self) -> ::std::option::Option<&str> {
49        self.instance_id.as_deref()
50    }
51    /// <p>The device name.</p>
52    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
53    pub fn device(&self) -> ::std::option::Option<&str> {
54        self.device.as_deref()
55    }
56    /// <p>The attachment state of the volume.</p>
57    pub fn state(&self) -> ::std::option::Option<&crate::types::VolumeAttachmentState> {
58        self.state.as_ref()
59    }
60    /// <p>The time stamp when the attachment initiated.</p>
61    pub fn attach_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
62        self.attach_time.as_ref()
63    }
64}
65impl ::aws_types::request_id::RequestId for AttachVolumeOutput {
66    fn request_id(&self) -> Option<&str> {
67        self._request_id.as_deref()
68    }
69}
70impl AttachVolumeOutput {
71    /// Creates a new builder-style object to manufacture [`AttachVolumeOutput`](crate::operation::attach_volume::AttachVolumeOutput).
72    pub fn builder() -> crate::operation::attach_volume::builders::AttachVolumeOutputBuilder {
73        crate::operation::attach_volume::builders::AttachVolumeOutputBuilder::default()
74    }
75}
76
77/// A builder for [`AttachVolumeOutput`](crate::operation::attach_volume::AttachVolumeOutput).
78#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
79#[non_exhaustive]
80pub struct AttachVolumeOutputBuilder {
81    pub(crate) delete_on_termination: ::std::option::Option<bool>,
82    pub(crate) associated_resource: ::std::option::Option<::std::string::String>,
83    pub(crate) instance_owning_service: ::std::option::Option<::std::string::String>,
84    pub(crate) volume_id: ::std::option::Option<::std::string::String>,
85    pub(crate) instance_id: ::std::option::Option<::std::string::String>,
86    pub(crate) device: ::std::option::Option<::std::string::String>,
87    pub(crate) state: ::std::option::Option<crate::types::VolumeAttachmentState>,
88    pub(crate) attach_time: ::std::option::Option<::aws_smithy_types::DateTime>,
89    _request_id: Option<String>,
90}
91impl AttachVolumeOutputBuilder {
92    /// <p>Indicates whether the EBS volume is deleted on instance termination.</p>
93    pub fn delete_on_termination(mut self, input: bool) -> Self {
94        self.delete_on_termination = ::std::option::Option::Some(input);
95        self
96    }
97    /// <p>Indicates whether the EBS volume is deleted on instance termination.</p>
98    pub fn set_delete_on_termination(mut self, input: ::std::option::Option<bool>) -> Self {
99        self.delete_on_termination = input;
100        self
101    }
102    /// <p>Indicates whether the EBS volume is deleted on instance termination.</p>
103    pub fn get_delete_on_termination(&self) -> &::std::option::Option<bool> {
104        &self.delete_on_termination
105    }
106    /// <p>The ARN of the Amazon Web Services-managed resource to which the volume is attached.</p>
107    pub fn associated_resource(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108        self.associated_resource = ::std::option::Option::Some(input.into());
109        self
110    }
111    /// <p>The ARN of the Amazon Web Services-managed resource to which the volume is attached.</p>
112    pub fn set_associated_resource(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
113        self.associated_resource = input;
114        self
115    }
116    /// <p>The ARN of the Amazon Web Services-managed resource to which the volume is attached.</p>
117    pub fn get_associated_resource(&self) -> &::std::option::Option<::std::string::String> {
118        &self.associated_resource
119    }
120    /// <p>The service principal of the Amazon Web Services service that owns the underlying resource to which the volume is attached.</p>
121    /// <p>This parameter is returned only for volumes that are attached to Amazon Web Services-managed resources.</p>
122    pub fn instance_owning_service(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.instance_owning_service = ::std::option::Option::Some(input.into());
124        self
125    }
126    /// <p>The service principal of the Amazon Web Services service that owns the underlying resource to which the volume is attached.</p>
127    /// <p>This parameter is returned only for volumes that are attached to Amazon Web Services-managed resources.</p>
128    pub fn set_instance_owning_service(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.instance_owning_service = input;
130        self
131    }
132    /// <p>The service principal of the Amazon Web Services service that owns the underlying resource to which the volume is attached.</p>
133    /// <p>This parameter is returned only for volumes that are attached to Amazon Web Services-managed resources.</p>
134    pub fn get_instance_owning_service(&self) -> &::std::option::Option<::std::string::String> {
135        &self.instance_owning_service
136    }
137    /// <p>The ID of the volume.</p>
138    pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.volume_id = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>The ID of the volume.</p>
143    pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.volume_id = input;
145        self
146    }
147    /// <p>The ID of the volume.</p>
148    pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
149        &self.volume_id
150    }
151    /// <p>The ID of the instance.</p>
152    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
153    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154        self.instance_id = ::std::option::Option::Some(input.into());
155        self
156    }
157    /// <p>The ID of the instance.</p>
158    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
159    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.instance_id = input;
161        self
162    }
163    /// <p>The ID of the instance.</p>
164    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
165    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
166        &self.instance_id
167    }
168    /// <p>The device name.</p>
169    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
170    pub fn device(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171        self.device = ::std::option::Option::Some(input.into());
172        self
173    }
174    /// <p>The device name.</p>
175    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
176    pub fn set_device(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
177        self.device = input;
178        self
179    }
180    /// <p>The device name.</p>
181    /// <p>If the volume is attached to an Amazon Web Services-managed resource, this parameter returns <code>null</code>.</p>
182    pub fn get_device(&self) -> &::std::option::Option<::std::string::String> {
183        &self.device
184    }
185    /// <p>The attachment state of the volume.</p>
186    pub fn state(mut self, input: crate::types::VolumeAttachmentState) -> Self {
187        self.state = ::std::option::Option::Some(input);
188        self
189    }
190    /// <p>The attachment state of the volume.</p>
191    pub fn set_state(mut self, input: ::std::option::Option<crate::types::VolumeAttachmentState>) -> Self {
192        self.state = input;
193        self
194    }
195    /// <p>The attachment state of the volume.</p>
196    pub fn get_state(&self) -> &::std::option::Option<crate::types::VolumeAttachmentState> {
197        &self.state
198    }
199    /// <p>The time stamp when the attachment initiated.</p>
200    pub fn attach_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
201        self.attach_time = ::std::option::Option::Some(input);
202        self
203    }
204    /// <p>The time stamp when the attachment initiated.</p>
205    pub fn set_attach_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
206        self.attach_time = input;
207        self
208    }
209    /// <p>The time stamp when the attachment initiated.</p>
210    pub fn get_attach_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
211        &self.attach_time
212    }
213    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
214        self._request_id = Some(request_id.into());
215        self
216    }
217
218    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
219        self._request_id = request_id;
220        self
221    }
222    /// Consumes the builder and constructs a [`AttachVolumeOutput`](crate::operation::attach_volume::AttachVolumeOutput).
223    pub fn build(self) -> crate::operation::attach_volume::AttachVolumeOutput {
224        crate::operation::attach_volume::AttachVolumeOutput {
225            delete_on_termination: self.delete_on_termination,
226            associated_resource: self.associated_resource,
227            instance_owning_service: self.instance_owning_service,
228            volume_id: self.volume_id,
229            instance_id: self.instance_id,
230            device: self.device,
231            state: self.state,
232            attach_time: self.attach_time,
233            _request_id: self._request_id,
234        }
235    }
236}