aws_sdk_lightsail/operation/create_disk/
_create_disk_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 CreateDiskInput {
6    /// <p>The unique Lightsail disk name (<code>my-disk</code>).</p>
7    pub disk_name: ::std::option::Option<::std::string::String>,
8    /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Use the same Availability Zone as the Lightsail instance to which you want to attach the disk.</p>
9    /// <p>Use the <code>get regions</code> operation to list the Availability Zones where Lightsail is currently available.</p>
10    pub availability_zone: ::std::option::Option<::std::string::String>,
11    /// <p>The size of the disk in GB (<code>32</code>).</p>
12    pub size_in_gb: ::std::option::Option<i32>,
13    /// <p>The tag keys and optional values to add to the resource during create.</p>
14    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
15    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
16    /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
17    pub add_ons: ::std::option::Option<::std::vec::Vec<crate::types::AddOnRequest>>,
18}
19impl CreateDiskInput {
20    /// <p>The unique Lightsail disk name (<code>my-disk</code>).</p>
21    pub fn disk_name(&self) -> ::std::option::Option<&str> {
22        self.disk_name.as_deref()
23    }
24    /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Use the same Availability Zone as the Lightsail instance to which you want to attach the disk.</p>
25    /// <p>Use the <code>get regions</code> operation to list the Availability Zones where Lightsail is currently available.</p>
26    pub fn availability_zone(&self) -> ::std::option::Option<&str> {
27        self.availability_zone.as_deref()
28    }
29    /// <p>The size of the disk in GB (<code>32</code>).</p>
30    pub fn size_in_gb(&self) -> ::std::option::Option<i32> {
31        self.size_in_gb
32    }
33    /// <p>The tag keys and optional values to add to the resource during create.</p>
34    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
35    ///
36    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
37    pub fn tags(&self) -> &[crate::types::Tag] {
38        self.tags.as_deref().unwrap_or_default()
39    }
40    /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
41    ///
42    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.add_ons.is_none()`.
43    pub fn add_ons(&self) -> &[crate::types::AddOnRequest] {
44        self.add_ons.as_deref().unwrap_or_default()
45    }
46}
47impl CreateDiskInput {
48    /// Creates a new builder-style object to manufacture [`CreateDiskInput`](crate::operation::create_disk::CreateDiskInput).
49    pub fn builder() -> crate::operation::create_disk::builders::CreateDiskInputBuilder {
50        crate::operation::create_disk::builders::CreateDiskInputBuilder::default()
51    }
52}
53
54/// A builder for [`CreateDiskInput`](crate::operation::create_disk::CreateDiskInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct CreateDiskInputBuilder {
58    pub(crate) disk_name: ::std::option::Option<::std::string::String>,
59    pub(crate) availability_zone: ::std::option::Option<::std::string::String>,
60    pub(crate) size_in_gb: ::std::option::Option<i32>,
61    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
62    pub(crate) add_ons: ::std::option::Option<::std::vec::Vec<crate::types::AddOnRequest>>,
63}
64impl CreateDiskInputBuilder {
65    /// <p>The unique Lightsail disk name (<code>my-disk</code>).</p>
66    /// This field is required.
67    pub fn disk_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.disk_name = ::std::option::Option::Some(input.into());
69        self
70    }
71    /// <p>The unique Lightsail disk name (<code>my-disk</code>).</p>
72    pub fn set_disk_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73        self.disk_name = input;
74        self
75    }
76    /// <p>The unique Lightsail disk name (<code>my-disk</code>).</p>
77    pub fn get_disk_name(&self) -> &::std::option::Option<::std::string::String> {
78        &self.disk_name
79    }
80    /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Use the same Availability Zone as the Lightsail instance to which you want to attach the disk.</p>
81    /// <p>Use the <code>get regions</code> operation to list the Availability Zones where Lightsail is currently available.</p>
82    /// This field is required.
83    pub fn availability_zone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.availability_zone = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Use the same Availability Zone as the Lightsail instance to which you want to attach the disk.</p>
88    /// <p>Use the <code>get regions</code> operation to list the Availability Zones where Lightsail is currently available.</p>
89    pub fn set_availability_zone(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90        self.availability_zone = input;
91        self
92    }
93    /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Use the same Availability Zone as the Lightsail instance to which you want to attach the disk.</p>
94    /// <p>Use the <code>get regions</code> operation to list the Availability Zones where Lightsail is currently available.</p>
95    pub fn get_availability_zone(&self) -> &::std::option::Option<::std::string::String> {
96        &self.availability_zone
97    }
98    /// <p>The size of the disk in GB (<code>32</code>).</p>
99    /// This field is required.
100    pub fn size_in_gb(mut self, input: i32) -> Self {
101        self.size_in_gb = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The size of the disk in GB (<code>32</code>).</p>
105    pub fn set_size_in_gb(mut self, input: ::std::option::Option<i32>) -> Self {
106        self.size_in_gb = input;
107        self
108    }
109    /// <p>The size of the disk in GB (<code>32</code>).</p>
110    pub fn get_size_in_gb(&self) -> &::std::option::Option<i32> {
111        &self.size_in_gb
112    }
113    /// Appends an item to `tags`.
114    ///
115    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
116    ///
117    /// <p>The tag keys and optional values to add to the resource during create.</p>
118    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
119    pub fn tags(mut self, input: crate::types::Tag) -> Self {
120        let mut v = self.tags.unwrap_or_default();
121        v.push(input);
122        self.tags = ::std::option::Option::Some(v);
123        self
124    }
125    /// <p>The tag keys and optional values to add to the resource during create.</p>
126    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
127    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
128        self.tags = input;
129        self
130    }
131    /// <p>The tag keys and optional values to add to the resource during create.</p>
132    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
133    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
134        &self.tags
135    }
136    /// Appends an item to `add_ons`.
137    ///
138    /// To override the contents of this collection use [`set_add_ons`](Self::set_add_ons).
139    ///
140    /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
141    pub fn add_ons(mut self, input: crate::types::AddOnRequest) -> Self {
142        let mut v = self.add_ons.unwrap_or_default();
143        v.push(input);
144        self.add_ons = ::std::option::Option::Some(v);
145        self
146    }
147    /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
148    pub fn set_add_ons(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AddOnRequest>>) -> Self {
149        self.add_ons = input;
150        self
151    }
152    /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
153    pub fn get_add_ons(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AddOnRequest>> {
154        &self.add_ons
155    }
156    /// Consumes the builder and constructs a [`CreateDiskInput`](crate::operation::create_disk::CreateDiskInput).
157    pub fn build(self) -> ::std::result::Result<crate::operation::create_disk::CreateDiskInput, ::aws_smithy_types::error::operation::BuildError> {
158        ::std::result::Result::Ok(crate::operation::create_disk::CreateDiskInput {
159            disk_name: self.disk_name,
160            availability_zone: self.availability_zone,
161            size_in_gb: self.size_in_gb,
162            tags: self.tags,
163            add_ons: self.add_ons,
164        })
165    }
166}