Skip to main content

aws_sdk_lightsail/operation/create_bucket/
_create_bucket_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 CreateBucketInput {
6    /// <p>The name for the bucket.</p>
7    /// <p>For more information about bucket names, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/bucket-naming-rules-in-amazon-lightsail">Bucket naming rules in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
8    pub bucket_name: ::std::option::Option<::std::string::String>,
9    /// <p>The ID of the bundle to use for the bucket.</p>
10    /// <p>A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket.</p>
11    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetBucketBundles.html">GetBucketBundles</a> action to get a list of bundle IDs that you can specify.</p>
12    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_UpdateBucketBundle.html">UpdateBucketBundle</a> action to change the bundle after the bucket is created.</p>
13    pub bundle_id: ::std::option::Option<::std::string::String>,
14    /// <p>The tag keys and optional values to add to the bucket during creation.</p>
15    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_TagResource.html">TagResource</a> action to tag the bucket after it's created.</p>
16    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
17    /// <p>A Boolean value that indicates whether to enable versioning of objects in the bucket.</p>
18    /// <p>For more information about versioning, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-managing-bucket-object-versioning">Enabling and suspending object versioning in a bucket in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
19    pub enable_object_versioning: ::std::option::Option<bool>,
20}
21impl CreateBucketInput {
22    /// <p>The name for the bucket.</p>
23    /// <p>For more information about bucket names, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/bucket-naming-rules-in-amazon-lightsail">Bucket naming rules in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
24    pub fn bucket_name(&self) -> ::std::option::Option<&str> {
25        self.bucket_name.as_deref()
26    }
27    /// <p>The ID of the bundle to use for the bucket.</p>
28    /// <p>A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket.</p>
29    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetBucketBundles.html">GetBucketBundles</a> action to get a list of bundle IDs that you can specify.</p>
30    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_UpdateBucketBundle.html">UpdateBucketBundle</a> action to change the bundle after the bucket is created.</p>
31    pub fn bundle_id(&self) -> ::std::option::Option<&str> {
32        self.bundle_id.as_deref()
33    }
34    /// <p>The tag keys and optional values to add to the bucket during creation.</p>
35    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_TagResource.html">TagResource</a> action to tag the bucket after it's created.</p>
36    ///
37    /// 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()`.
38    pub fn tags(&self) -> &[crate::types::Tag] {
39        self.tags.as_deref().unwrap_or_default()
40    }
41    /// <p>A Boolean value that indicates whether to enable versioning of objects in the bucket.</p>
42    /// <p>For more information about versioning, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-managing-bucket-object-versioning">Enabling and suspending object versioning in a bucket in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
43    pub fn enable_object_versioning(&self) -> ::std::option::Option<bool> {
44        self.enable_object_versioning
45    }
46}
47impl CreateBucketInput {
48    /// Creates a new builder-style object to manufacture [`CreateBucketInput`](crate::operation::create_bucket::CreateBucketInput).
49    pub fn builder() -> crate::operation::create_bucket::builders::CreateBucketInputBuilder {
50        crate::operation::create_bucket::builders::CreateBucketInputBuilder::default()
51    }
52}
53
54/// A builder for [`CreateBucketInput`](crate::operation::create_bucket::CreateBucketInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct CreateBucketInputBuilder {
58    pub(crate) bucket_name: ::std::option::Option<::std::string::String>,
59    pub(crate) bundle_id: ::std::option::Option<::std::string::String>,
60    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
61    pub(crate) enable_object_versioning: ::std::option::Option<bool>,
62}
63impl CreateBucketInputBuilder {
64    /// <p>The name for the bucket.</p>
65    /// <p>For more information about bucket names, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/bucket-naming-rules-in-amazon-lightsail">Bucket naming rules in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
66    /// This field is required.
67    pub fn bucket_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.bucket_name = ::std::option::Option::Some(input.into());
69        self
70    }
71    /// <p>The name for the bucket.</p>
72    /// <p>For more information about bucket names, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/bucket-naming-rules-in-amazon-lightsail">Bucket naming rules in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
73    pub fn set_bucket_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.bucket_name = input;
75        self
76    }
77    /// <p>The name for the bucket.</p>
78    /// <p>For more information about bucket names, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/bucket-naming-rules-in-amazon-lightsail">Bucket naming rules in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
79    pub fn get_bucket_name(&self) -> &::std::option::Option<::std::string::String> {
80        &self.bucket_name
81    }
82    /// <p>The ID of the bundle to use for the bucket.</p>
83    /// <p>A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket.</p>
84    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetBucketBundles.html">GetBucketBundles</a> action to get a list of bundle IDs that you can specify.</p>
85    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_UpdateBucketBundle.html">UpdateBucketBundle</a> action to change the bundle after the bucket is created.</p>
86    /// This field is required.
87    pub fn bundle_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
88        self.bundle_id = ::std::option::Option::Some(input.into());
89        self
90    }
91    /// <p>The ID of the bundle to use for the bucket.</p>
92    /// <p>A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket.</p>
93    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetBucketBundles.html">GetBucketBundles</a> action to get a list of bundle IDs that you can specify.</p>
94    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_UpdateBucketBundle.html">UpdateBucketBundle</a> action to change the bundle after the bucket is created.</p>
95    pub fn set_bundle_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.bundle_id = input;
97        self
98    }
99    /// <p>The ID of the bundle to use for the bucket.</p>
100    /// <p>A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket.</p>
101    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetBucketBundles.html">GetBucketBundles</a> action to get a list of bundle IDs that you can specify.</p>
102    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_UpdateBucketBundle.html">UpdateBucketBundle</a> action to change the bundle after the bucket is created.</p>
103    pub fn get_bundle_id(&self) -> &::std::option::Option<::std::string::String> {
104        &self.bundle_id
105    }
106    /// Appends an item to `tags`.
107    ///
108    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
109    ///
110    /// <p>The tag keys and optional values to add to the bucket during creation.</p>
111    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_TagResource.html">TagResource</a> action to tag the bucket after it's created.</p>
112    pub fn tags(mut self, input: crate::types::Tag) -> Self {
113        let mut v = self.tags.unwrap_or_default();
114        v.push(input);
115        self.tags = ::std::option::Option::Some(v);
116        self
117    }
118    /// <p>The tag keys and optional values to add to the bucket during creation.</p>
119    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_TagResource.html">TagResource</a> action to tag the bucket after it's created.</p>
120    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
121        self.tags = input;
122        self
123    }
124    /// <p>The tag keys and optional values to add to the bucket during creation.</p>
125    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_TagResource.html">TagResource</a> action to tag the bucket after it's created.</p>
126    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
127        &self.tags
128    }
129    /// <p>A Boolean value that indicates whether to enable versioning of objects in the bucket.</p>
130    /// <p>For more information about versioning, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-managing-bucket-object-versioning">Enabling and suspending object versioning in a bucket in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
131    pub fn enable_object_versioning(mut self, input: bool) -> Self {
132        self.enable_object_versioning = ::std::option::Option::Some(input);
133        self
134    }
135    /// <p>A Boolean value that indicates whether to enable versioning of objects in the bucket.</p>
136    /// <p>For more information about versioning, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-managing-bucket-object-versioning">Enabling and suspending object versioning in a bucket in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
137    pub fn set_enable_object_versioning(mut self, input: ::std::option::Option<bool>) -> Self {
138        self.enable_object_versioning = input;
139        self
140    }
141    /// <p>A Boolean value that indicates whether to enable versioning of objects in the bucket.</p>
142    /// <p>For more information about versioning, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-managing-bucket-object-versioning">Enabling and suspending object versioning in a bucket in Amazon Lightsail</a> in the <i>Amazon Lightsail Developer Guide</i>.</p>
143    pub fn get_enable_object_versioning(&self) -> &::std::option::Option<bool> {
144        &self.enable_object_versioning
145    }
146    /// Consumes the builder and constructs a [`CreateBucketInput`](crate::operation::create_bucket::CreateBucketInput).
147    pub fn build(
148        self,
149    ) -> ::std::result::Result<crate::operation::create_bucket::CreateBucketInput, ::aws_smithy_types::error::operation::BuildError> {
150        ::std::result::Result::Ok(crate::operation::create_bucket::CreateBucketInput {
151            bucket_name: self.bucket_name,
152            bundle_id: self.bundle_id,
153            tags: self.tags,
154            enable_object_versioning: self.enable_object_versioning,
155        })
156    }
157}