Skip to main content

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